/* light-theme: manual
   Type Racer neon arcade redesign (typeracer.html, after typeracer.css).
   CRT arena with synthwave floor and scanlines, neon word plates with per-letter
   typed highlight, burst/points/combo effects (spawned by assets/js/typeracer.js),
   arcade start + game-over screens. Light variant at the end. */

:root .tr-page { max-width: 820px; }

:root .tr-title {
  font-family: "Bungee", sans-serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: 0.02em;
}

:root .tr-title span {
  background: none;
  -webkit-text-fill-color: #e0f7ff;
  color: #e0f7ff;
  text-shadow: 0 0 6px #fff, 0 0 18px #22d3ee, 0 0 42px #22d3ee;
}

:root .tr-title i { color: #ff3ea5; filter: drop-shadow(0 0 10px #ff3ea5); }

/* --- HUD as arcade score panel --- */
:root .tr-hud {
  gap: 0.6rem;
  padding: 0.7rem;
  border-radius: 16px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  background: rgba(8, 8, 22, 0.8);
}

:root .tr-hud-item {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.06);
}

:root .tr-hud-label { font-family: "Press Start 2P", monospace; font-size: 0.5rem; color: #22d3ee; letter-spacing: 0.08em; }

:root .tr-hud-value {
  font-family: "Press Start 2P", monospace;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
}

/* --- arena: CRT screen --- */
:root .tr-arena {
  height: 460px;
  border-radius: 18px;
  border: 2px solid #22d3ee;
  background:
    linear-gradient(90deg, rgba(255, 62, 165, 0.28) 1px, transparent 1px) 50% 100% / 56px 100%,
    linear-gradient(0deg, rgba(34, 211, 238, 0.28) 1px, transparent 1px) 0 100% / 100% 28px,
    radial-gradient(ellipse at 50% 120%, rgba(255, 62, 165, 0.35), transparent 60%),
    #07071a;
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.25), inset 0 0 80px rgba(0, 0, 0, 0.7);
}

/* fade the grid out towards the top (horizon) + scanlines on top of everything */
:root .tr-arena::before,
:root .tr-arena::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

:root .tr-arena::before { background: linear-gradient(180deg, #07071a 30%, transparent 85%); }

:root .tr-arena::after {
  z-index: 9;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
}

/* danger zone at the bottom */
:root .tr-ground {
  height: 54px;
  opacity: 1;
  background: linear-gradient(0deg, rgba(239, 68, 68, 0.35), transparent);
  border-top: 2px solid rgba(239, 68, 68, 0.8);
  box-shadow: 0 -6px 24px rgba(239, 68, 68, 0.35);
}

/* shake the whole screen when a word hits the ground */
:root .tr-arena.tr-hit { animation: tr-screen-hit 0.45s ease; }

@keyframes tr-screen-hit {
  0%, 100% { translate: 0 0; box-shadow: 0 0 40px rgba(34, 211, 238, 0.25), inset 0 0 80px rgba(0, 0, 0, 0.7); }
  20% { translate: -8px 2px; box-shadow: 0 0 50px rgba(239, 68, 68, 0.6), inset 0 0 120px rgba(239, 68, 68, 0.35); }
  40% { translate: 7px -2px; }
  60% { translate: -5px 1px; }
  80% { translate: 3px 0; }
}

/* --- falling words as neon plates --- */
:root .tr-word {
  z-index: 2;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 0.78rem;
  font-weight: 400;
  color: #e0f7ff;
  letter-spacing: 0.04em;
  border: 1.5px solid rgba(34, 211, 238, 0.6);
  background: rgba(7, 7, 26, 0.85);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

:root .tr-word.tr-matched {
  color: #e0f7ff;
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.55);
}

/* letters already typed */
.tr-typed { color: #facc15; text-shadow: 0 0 10px #facc15; }

:root .tr-word.tr-danger {
  color: #fecaca;
  border-color: #ef4444;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.7);
  text-shadow: 0 0 8px #ef4444;
}

:root .tr-word.tr-cleared {
  border-color: #4ade80;
  animation: tr-neon-pop 0.4s ease-out forwards;
}

@keyframes tr-neon-pop {
  0% { transform: scale(1); opacity: 1; filter: brightness(1); }
  40% { transform: scale(1.25); opacity: 1; filter: brightness(2); }
  100% { transform: scale(0.4); opacity: 0; filter: brightness(3); }
}

/* --- effects spawned by the script --- */
.tr-fx-spark {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 1px;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  pointer-events: none;
  animation: tr-spark 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tr-fx-spark:nth-child(3n) { background: #22d3ee; box-shadow: 0 0 8px #22d3ee; }
.tr-fx-spark:nth-child(3n + 1) { background: #facc15; box-shadow: 0 0 8px #facc15; }

@keyframes tr-spark {
  to { translate: var(--dx) var(--dy); opacity: 0; scale: 0.3; }
}

.tr-fx-points,
.tr-fx-combo {
  position: absolute;
  z-index: 4;
  translate: -50% -50%;
  pointer-events: none;
  white-space: nowrap;
  font-family: "Press Start 2P", monospace;
  animation: tr-float 0.9s ease-out forwards;
}

.tr-fx-points { font-size: 0.8rem; color: #4ade80; text-shadow: 0 0 10px #4ade80; }

.tr-fx-combo {
  font-size: 0.7rem;
  color: #ff3ea5;
  text-shadow: 0 0 10px #ff3ea5;
  animation-name: tr-float-combo;
}

@keyframes tr-float { to { translate: -50% -160%; opacity: 0; } }
@keyframes tr-float-combo {
  0% { scale: 0.6; opacity: 0; }
  20% { scale: 1.2; opacity: 1; }
  100% { translate: -50% -200%; scale: 1; opacity: 0; }
}

/* --- start / game-over screens --- */
:root .tr-overlay {
  z-index: 10;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(34, 211, 238, 0.12), transparent 60%),
    rgba(4, 4, 16, 0.9);
  backdrop-filter: none;
}

:root .tr-overlay-content h2 {
  font-family: "Bungee", sans-serif;
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3rem);
  color: #fff0fa;
  text-shadow: 0 0 6px #fff, 0 0 20px #ff3ea5, 0 0 46px #ff3ea5;
  animation: tr-flicker 5s infinite;
}

@keyframes tr-flicker {
  0%, 17%, 21%, 60%, 62%, 64%, 100% { opacity: 1; }
  19%, 61%, 63% { opacity: 0.5; }
}

:root .tr-overlay-content p { color: #c4c4e8; }
:root .tr-overlay-content strong { color: #facc15; }

:root .tr-play-btn {
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  padding: 1rem 1.6rem;
  border-radius: 6px;
  border: 2px solid #facc15;
  background: #facc15;
  color: #1a1400;
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.55);
  animation: tr-blink 1.1s steps(1) infinite;
}

:root .tr-play-btn:hover { transform: translateY(-2px); background: #fde047; border-color: #fde047; animation: none; }

@keyframes tr-blink { 50% { box-shadow: 0 0 6px rgba(250, 204, 21, 0.2); } }

/* --- input as command line --- */
:root .tr-input {
  font-family: "Press Start 2P", monospace;
  font-size: 0.85rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  border: 2px solid rgba(34, 211, 238, 0.4);
  background: #07071a;
  color: #facc15;
  caret-color: #ff3ea5;
}

:root .tr-input:focus { border-color: #22d3ee; box-shadow: 0 0 20px rgba(34, 211, 238, 0.35); }
:root .tr-input::placeholder { color: rgba(196, 196, 232, 0.45); }

@media (max-width: 600px) {
  :root .tr-word { font-size: 0.62rem; padding: 0.25rem 0.5rem; }
  :root .tr-hud-value { font-size: 0.75rem; }
  :root .tr-input { font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  :root .tr-overlay-content h2,
  :root .tr-play-btn,
  :root .tr-arena.tr-hit { animation: none; }
}

/* --- light theme: the arena stays a dark screen (it's a "monitor"), the page around it goes light --- */
html[data-theme="light"] .tr-title span { -webkit-text-fill-color: #0e7490; color: #0e7490; text-shadow: 3px 3px 0 rgba(219, 39, 119, 0.3); }
html[data-theme="light"] .tr-hud { background: #ffffff; border-color: rgba(14, 116, 144, 0.25); }
html[data-theme="light"] .tr-hud-item { background: rgba(14, 116, 144, 0.06); }
html[data-theme="light"] .tr-hud-label { color: #0e7490; }
html[data-theme="light"] .tr-hud-value { color: #0f172a; text-shadow: none; }
