:root {
  --bg: #0a0a0b;
  --text: #e6e6e8;
  --muted: #5a5a62;
  --faint: #2e2e34;
  --orp: #c45c6a;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.screen {
  position: fixed;
  inset: 0;
}

/* ── Input ─────────────────────────────────────────────── */

.input-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  overflow: auto;
}

.input-shell {
  width: 100%;
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brand {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: var(--muted);
  text-align: center;
}

#text-input {
  width: 100%;
  min-height: 40vh;
  max-height: 60vh;
  resize: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--faint);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.7;
  padding: 0.5rem 0 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#text-input::placeholder {
  color: var(--muted);
  font-weight: 300;
}

#text-input:focus {
  border-bottom-color: var(--muted);
}

.input-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: 2rem;
}

.input-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.btn-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem 0;
  opacity: 0.9;
  transition: opacity 0.15s;
}

.btn-text:hover:not(:disabled) {
  opacity: 1;
}

.btn-text:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-text.muted {
  color: var(--muted);
}

.ctrl-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  cursor: pointer;
  user-select: none;
}

.ctrl-label {
  opacity: 0.7;
  min-width: 1.4rem;
}

.ctrl-inline input[type="range"] {
  width: 72px;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--faint);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.ctrl-inline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: none;
  cursor: pointer;
}

.ctrl-inline input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: none;
  cursor: pointer;
}

/* ── Player (full frame) ───────────────────────────────── */

.player-screen {
  background: var(--bg);
  cursor: default;
}

.player-screen.playing {
  cursor: none;
}

.player-screen.playing:hover .chrome,
.player-screen.paused .chrome {
  opacity: 1;
  pointer-events: auto;
}

.player-screen.playing:hover {
  cursor: default;
}

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  overflow: hidden;
}

.orp-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.guide-tick {
  position: absolute;
  left: 50%;
  top: -2.6em;
  width: 1px;
  height: 0.55em;
  background: var(--faint);
  transform: translateX(-50%);
}

.guide-tick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 3.9em);
  width: 1px;
  height: 0.55em;
  background: var(--faint);
  transform: translateX(-50%);
}

.word-display {
  --word-size: 4rem;
  font-family: var(--mono);
  font-size: var(--word-size);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: pre;
  z-index: 1;
}

.word-prefix,
.word-suffix {
  color: var(--text);
}

.word-orp {
  color: var(--orp);
}

.word-display.no-orp .word-orp {
  color: var(--text);
}

/* Progress: hairline at bottom */
.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: transparent;
  z-index: 2;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--faint);
  transition: width 0.08s linear;
}

.progress-input {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

/* Chrome overlay */
.chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.75rem;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background: linear-gradient(to top, rgba(10, 10, 11, 0.92) 0%, transparent 100%);
}

.chrome-left,
.chrome-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.chrome-right {
  justify-content: flex-end;
}

.chrome-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.ghost {
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.55rem;
  transition: color 0.15s;
}

.ghost:hover {
  color: var(--text);
}

.ghost.play {
  font-size: 0.75rem;
  letter-spacing: 0;
  min-width: 2.25rem;
  color: var(--text);
  opacity: 0.7;
}

.ghost.play:hover {
  opacity: 1;
}

.chrome-ctrl {
  margin-left: 0.35rem;
}

/* ── Done ──────────────────────────────────────────────── */

.done-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-shell {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.done-actions {
  display: flex;
  gap: 1.75rem;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 560px) {
  .chrome {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
  }

  .chrome-left,
  .chrome-right {
    justify-content: center;
  }

  .chrome-right {
    order: 3;
  }

  .input-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .input-bar-right {
    margin-left: 0;
    justify-content: space-between;
  }
}
