:root {
  color-scheme: dark;
  font-family: 'Ubuntu', system-ui, sans-serif;
  --desktop-plum: #2d0922;
  --desktop-violet: #5e2750;
  --desktop-orange: #e95420;
  --desktop-amber: #ff9f43;
  --panel-bg: rgba(18, 10, 23, 0.58);
  --window-bg: rgba(29, 20, 34, 0.9);
  --window-border: rgba(255, 255, 255, 0.1);
  --window-shadow: 0 26px 80px rgba(4, 2, 6, 0.48);
  --terminal-bg: rgba(11, 11, 13, 0.9);
  --terminal-text: #f2ecfb;
  --terminal-muted: #b8afc4;
  --terminal-green: #8ae234;
  --terminal-red: #ff8f8f;
  --terminal-cyan: #9be7ff;
  --terminal-orange: #ffb077;
}

[data-theme="light"] {
  --panel-bg: rgba(220, 213, 228, 0.80);
  --window-bg: rgba(250, 248, 246, 0.95);
  --window-border: rgba(0, 0, 0, 0.12);
  --window-shadow: 0 26px 80px rgba(0, 0, 0, 0.15);
  --terminal-bg: #faf8f6;
  --terminal-text: #2d1f3d;
  --terminal-muted: #6b7280;
  --terminal-green: #15803d;
  --terminal-red: #b91c1c;
  --terminal-cyan: #0e7490;
  --terminal-orange: #c2410c;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 176, 84, 0.28), transparent 24%),
    radial-gradient(circle at 82% 16%, rgba(255, 119, 64, 0.18), transparent 22%),
    radial-gradient(circle at 80% 76%, rgba(255, 102, 0, 0.14), transparent 18%),
    linear-gradient(135deg, #21061d 0%, #44103d 35%, #6b1b6d 62%, #e95420 100%);
  color: var(--terminal-text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(140deg, transparent 0 22%, rgba(255, 255, 255, 0.06) 22.2%, transparent 23%),
    linear-gradient(320deg, transparent 0 42%, rgba(255, 255, 255, 0.05) 42.2%, transparent 43%),
    linear-gradient(210deg, transparent 0 64%, rgba(255, 255, 255, 0.035) 64.2%, transparent 65%);
  mix-blend-mode: screen;
  opacity: 0.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.desktop-shell {
  position: relative;
  min-height: 100vh;
  padding-top: 44px;
  overflow: hidden;
}

.desktop-shell__wallpaper {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 72%, rgba(255, 232, 187, 0.12), transparent 18%),
    radial-gradient(circle at 68% 28%, rgba(255, 207, 143, 0.08), transparent 14%);
}

.desktop-shell__topbar {
  position: absolute;
  inset: 0 0 auto;
  height: 38px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  backdrop-filter: blur(14px);
  background: var(--panel-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.desktop-shell__cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
}

.desktop-shell__cluster--status {
  justify-self: end;
}

.desktop-shell__brand {
  font-weight: 700;
}

.desktop-shell__pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.92);
}

.desktop-shell__clock {
  justify-self: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.desktop-shell__dock {
  position: absolute;
  left: 16px;
  top: 54px;
  bottom: 18px;
  width: 68px;
  padding: 12px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border-radius: 24px;
  background: rgba(16, 10, 20, 0.26);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 5;
}

.desktop-shell__icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: 'Ubuntu Mono', monospace;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.desktop-shell__icon--active {
  position: relative;
}

.desktop-shell__icon--active::before {
  content: '';
  position: absolute;
  left: -10px;
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: white;
}

.window-frame {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--window-border);
  background: linear-gradient(180deg, rgba(46, 31, 52, 0.96), var(--window-bg));
  box-shadow: var(--window-shadow);
  backdrop-filter: blur(16px);
  animation: window-enter 0.45s cubic-bezier(0.2, 1, 0.3, 1);
}

.window-frame__titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 16px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: linear-gradient(180deg, rgba(92, 73, 96, 0.6), rgba(48, 33, 52, 0.4));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.window-frame__titlebar:active {
  cursor: grabbing;
}

.window-frame__traffic {
  display: flex;
  gap: 8px;
}

.window-frame__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.window-frame__dot--close {
  background: #ff5f57;
}

.window-frame__dot--minimize {
  background: #febc2e;
  cursor: pointer;
}

.window-frame__dot--maximize {
  background: #28c840;
  cursor: pointer;
}

.window-frame__titlegroup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.window-frame__title {
  font-size: 0.92rem;
  font-weight: 700;
}

.window-frame__accessory {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
}

.window-frame__body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--terminal-bg);
}

.window-frame__resize {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
}

.window-frame__resize::before {
  content: '';
  position: absolute;
  inset: 0;
  border-right: 2px solid rgba(255, 255, 255, 0.34);
  border-bottom: 2px solid rgba(255, 255, 255, 0.34);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.terminal {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 20px 18px;
  font-family: 'Ubuntu Mono', 'Cascadia Mono', monospace;
  font-size: 1.04rem;
}

.terminal__transcript {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 8px;
  padding-bottom: 8px;
}

.terminal__transcript::-webkit-scrollbar {
  width: 10px;
}

.terminal__transcript::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.terminal__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 1.5rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.terminal__row + .terminal__row {
  margin-top: 6px;
}

.terminal__row--muted {
  color: var(--terminal-muted);
}

.terminal__row--error {
  color: var(--terminal-red);
}

.terminal__row--success {
  color: var(--terminal-green);
}

.terminal__row--accent {
  color: var(--terminal-cyan);
}

.terminal__row--command {
  color: var(--terminal-text);
}

.terminal__row--input {
  align-items: center;
}

.terminal__prompt {
  flex: none;
  color: var(--terminal-green);
}

.terminal__command {
  color: var(--terminal-text);
}

.terminal__input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--terminal-text);
  caret-color: var(--terminal-orange);
  outline: none;
  animation: blink-caret 1s step-end infinite;
}

.terminal__crash {
  margin: 0;
  padding: 20px;
  color: var(--terminal-red);
  font-family: 'Ubuntu Mono', 'Cascadia Mono', monospace;
}

.terminal__link {
  color: var(--terminal-orange);
  text-decoration: none;
}

.terminal__link:hover {
  text-decoration: underline;
}

@keyframes window-enter {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes blink-caret {
  0%, 100% { caret-color: var(--terminal-orange); }
  50%       { caret-color: transparent; }
}

.is-dragging {
  user-select: none;
}

@media (max-width: 900px) {
  .desktop-shell__dock {
    display: none;
  }
}

@media (max-width: 720px) {
  .desktop-shell {
    padding-top: 38px;
  }

  .desktop-shell__topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .desktop-shell__cluster:first-child {
    display: none;
  }

  .window-frame {
    border-radius: 18px;
  }

  .terminal {
    padding: 16px;
    font-size: 0.98rem;
  }
}
