:root {
  /* ── starwars (asciimation): scoped CRT palette ────────────────────
   * Page chrome (body, title bar, controls, attribution) lives on
   * the brand paper-cream surface — the asciimation viewer sits in a
   * showroom rather than a darkened theater. The CRT screen INSIDE
   * the bezel (`#screen-container`) keeps its canonical pure-black-
   * with-white-pixels identity, with the amber Lucasfilm title and
   * green phosphor HUD readouts unchanged. That dark rectangle is
   * the show — flipping it would mean rendering the animation as
   * black-on-cream which loses the entire CRT-terminal vibe.
   */
  --sw-crt-bg: var(--pure-black);
  --sw-crt-ink: var(--pure-white);
  --sw-crt-title: #ffcc00; /* Lucasfilm yellow */
  --sw-crt-frame: #333333; /* CRT bezel */
  --sw-crt-status: var(--success); /* HUD readouts in brand green */
  --sw-crt-dim: var(--text-3); /* dimmed label text on the cream chrome */
  --sw-crt-mute: var(--text-2); /* tertiary status */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--surface-0);
  color: var(--text-1);
  font-family: 'Courier New', Courier, monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#app-wrapper {
  width: 100%;
  max-width: 760px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#title-bar {
  text-align: center;
  padding: 8px 0 4px;
}

#title-bar h1 {
  font-size: 1.25rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#screen-container {
  width: 100%;
  background: var(--sw-crt-bg, #000000);
  border: 2px solid var(--sw-crt-frame, #333333);
  border-radius: 4px;
  padding: 8px 12px;
  overflow: hidden;
}

#screen {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.2;
  color: var(--sw-crt-ink, #ffffff);
  white-space: pre;
  display: block;
  min-height: calc(13 * 1.2 * 14px);
  overflow: hidden;
  /* prevent text selection jitter during animation */
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 600px) {
  #app-wrapper {
    padding-top: 55px;
  }
  #screen {
    font-size: 8px;
    line-height: 1.1;
    min-height: calc(13 * 1.1 * 8px);
  }
}

#controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.ctrl-btn {
  background: var(--surface-1);
  color: var(--text-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-family: var(--font-mono), 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ctrl-btn:hover {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ctrl-btn:active {
  transform: scale(0.95);
}

.ctrl-btn.active {
  background: var(--accent-primary-bg);
  color: var(--text-on-accent);
  border-color: var(--accent-primary-bg);
}

.ctrl-divider {
  color: var(--hairline-strong);
}
.ctrl-status-label {
  color: var(--text-2);
  font-size: 12px;
  font-family: var(--font-mono), 'Courier New', monospace;
}

#speed-label {
  color: var(--text-2);
  font-size: 12px;
  font-family: var(--font-mono), 'Courier New', monospace;
  min-width: 60px;
  text-align: center;
}

#speed-range {
  accent-color: var(--accent-primary);
  width: 100px;
}

#frame-counter {
  color: var(--text-3);
  font-size: 12px;
  font-family: var(--font-mono), 'Courier New', monospace;
  text-align: center;
}

#attribution {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

#attribution a {
  color: var(--accent-primary);
  text-decoration: underline;
}

#attribution a:hover {
  color: var(--accent-primary-hover);
}

#progress-bar-container {
  width: 100%;
  height: 3px;
  background: var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}

#progress-bar {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius);
  transition: width 0.1s linear;
  pointer-events: none;
}
