:root {
  color-scheme: dark;
  --primary: #0066cc;
  --primary-hover: #0071e3;
  --bg: #000000;
  --panel: #111113;
  --bar-bg: #1c1c1e;
  --line: #2c2c2e;
  --text: #f5f5f7;
  --text-soft: #d1d1d6;
  --text-dim: #8e8e93;
  --selection-text: #ffffff;
  --link: #2997ff;
  --surface: #1c1c1e;
  --surface-soft: #2c2c2e;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --ease: 180ms ease-out;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Theme commands still work, but the interactive accent remains Action Blue. */
body[data-theme="bright"] {
  --bg: #09090b;
  --panel: #161618;
  --bar-bg: #232326;
  --line: #3a3a3c;
  --text: #ffffff;
  --text-soft: #e5e5ea;
  --text-dim: #98989d;
}

body[data-theme="amber"] {
  --bg: #0d0b08;
  --panel: #171410;
  --bar-bg: #211d17;
  --line: #383229;
  --text: #f5f1e8;
  --text-soft: #ddd6c8;
  --text-dim: #948b7b;
}

body[data-theme="cyan"] {
  --bg: #070b0e;
  --panel: #10161a;
  --bar-bg: #182126;
  --line: #2a3941;
  --text: #f3f8fa;
  --text-soft: #d3e0e5;
  --text-dim: #8799a1;
}

body[data-theme="paper"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --bar-bg: #f5f5f7;
  --line: #e0e0e0;
  --text: #1d1d1f;
  --text-soft: #3a3a3c;
  --text-dim: #6e6e73;
  --selection-text: #ffffff;
  --link: #0066cc;
  --surface: #f5f5f7;
  --surface-soft: #e8e8ed;
}

body[data-theme="hotline"] {
  --bg: #0c090d;
  --panel: #171318;
  --bar-bg: #211c22;
  --line: #39313a;
  --text: #f8f5f8;
  --text-soft: #ddd6de;
  --text-dim: #978d99;
}

body[data-theme="windows"] {
  --bg: #0c0c0c;
  --panel: #151515;
  --bar-bg: #202020;
  --line: #333333;
  --text: #f2f2f2;
  --text-soft: #d4d4d4;
  --text-dim: #8f8f8f;
}

body[data-shell="windows"] { font-family: Consolas, "Lucida Console", var(--mono); }
body[data-shell="windows"] .terminal-window { border-radius: var(--radius-sm); }
body[data-shell="windows"] .terminal-led { border-radius: 2px; }

button,
input,
textarea { font: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.terminal-shell {
  min-height: 100vh;
  padding: clamp(12px, 3vw, 28px);
  background: var(--bg);
}

.terminal-window {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(1080px, 100%);
  height: calc(100vh - clamp(24px, 6vw, 56px));
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.terminal-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--bar-bg);
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
}

.terminal-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #30d158;
}

.terminal-title,
.terminal-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-status {
  color: var(--text-dim);
  font-size: .7rem;
  letter-spacing: .04em;
}

.hub-return {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: .45rem .85rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: .76rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--ease), transform var(--ease);
  white-space: nowrap;
}

.hub-return:hover { background: var(--primary-hover); }
.hub-return:active { transform: scale(.97); }

.terminal-screen {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(18px, 4vw, 32px);
  scrollbar-color: var(--surface-soft) transparent;
}

.site-logo {
  width: 100%;
  margin: 0 0 22px;
  overflow-x: auto;
  color: var(--text);
  font-size: clamp(9px, 1.75vw, 14px);
  font-weight: 400;
  line-height: 1.08;
  white-space: pre;
}

.terminal-output {
  min-height: 12rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line {
  min-height: 1.5em;
  color: var(--text-soft);
}

.line + .line { margin-top: 3px; }
.dim { color: var(--text-dim); }
.bright { color: var(--text); font-weight: 600; }

.command-button,
.terminal-link {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.command-button:hover,
.terminal-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.command-button:active,
.terminal-link:active { opacity: .72; }

.prompt-line {
  display: flex;
  gap: .55ch;
  align-items: center;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color var(--ease), background var(--ease);
}

.prompt-line:focus-within {
  border-color: var(--primary);
  background: var(--panel);
}

.prompt-label {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-weight: 600;
}

.command-input {
  min-width: 4ch;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--primary);
  font-weight: 400;
}

.command-input:focus-visible { outline: 0; }

.command-input::selection,
.line::selection,
.site-logo::selection,
.nano-textarea::selection {
  background: var(--primary);
  color: var(--selection-text);
}

.terminal-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.noscript-link {
  position: fixed;
  inset: auto 16px 16px;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
}

.noscript-link a { color: var(--link); }

.nano-editor {
  position: fixed;
  inset: clamp(10px, 3vw, 28px);
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
}

.nano-title,
.nano-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bar-bg);
  color: var(--text-soft);
  font-family: var(--font);
  font-weight: 600;
}

.nano-textarea {
  width: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  outline: 0;
  padding: 16px;
  background: var(--panel);
  color: var(--text);
  caret-color: var(--primary);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.nano-bar {
  justify-content: flex-start;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.nano-bar button {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  padding: .45rem .85rem;
  background: var(--surface-soft);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}

.nano-bar button:hover { background: var(--primary); color: #fff; }
.nano-bar button:active { transform: scale(.97); }

@media (max-width: 640px) {
  body { font-size: 14px; }

  .terminal-shell { padding: 0; }

  .terminal-window {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .terminal-status { display: none; }

  .terminal-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 50px;
    padding: 0 12px;
  }

  .hub-return { min-height: 34px; padding-inline: .7rem; }

  .terminal-screen { padding: 16px; }

  .prompt-line {
    align-items: flex-start;
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
