/* ============================================================
   LOCKEDIN Skill Games — Typing Race
   Extends the dark studio theme (styles.css) with game-specific UI.
   ============================================================ */

.game-panel {
  max-width: 880px; margin: 0 auto; padding: 34px;
  background: radial-gradient(130% 90% at 0% 0%, rgba(204,23,51,0.08), transparent 55%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.game-view { display: none; }
.game-view.is-active { display: block; }

/* ---------- setup view ---------- */
.setup__label { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.setup__diffs { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.diff-btn {
  flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; align-items: center;
  padding: 16px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  cursor: pointer; font-family: inherit; color: var(--text); text-align: center;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}
.diff-btn:hover { transform: translateY(-2px); border-color: var(--line-hover); }
.diff-btn__name { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.diff-btn__meta { font-size: 0.8rem; color: var(--muted); }
.diff-btn.is-active {
  border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -8px rgba(204,23,51,0.6);
}
.diff-btn.is-active .diff-btn__meta { color: rgba(255,255,255,0.85); }

.setup__bests { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.best-chip {
  flex: 1 1 140px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.02); text-align: center;
}
.best-chip__num { font-family: var(--display); font-weight: 800; font-size: 1.3rem; color: var(--accent); }
.best-chip__label { font-size: 0.76rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

/* ---------- race view ---------- */
.track {
  position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 24px;
  background: linear-gradient(180deg, #17181d, #0d0e12); border: 1px solid rgba(255,255,255,0.08);
}
.lane { position: relative; height: 68px; display: flex; align-items: center;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.16) 0 22px, transparent 22px 46px);
  background-position-x: 0;
}
.lane + .lane { border-top: 1px dashed rgba(255,255,255,0.08); }
.track.is-racing .lane { animation: road-scroll 0.7s linear infinite; }
@keyframes road-scroll { to { background-position-x: -46px; } }
.lane__label {
  position: absolute; left: 10px; top: 8px; z-index: 2; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.08em; color: rgba(255,255,255,0.6); background: rgba(0,0,0,0.35);
  padding: 3px 8px; border-radius: 100px;
}
.finish-flag {
  position: absolute; top: 0; bottom: 0; right: 0; width: 14px; z-index: 1;
  background-image: repeating-conic-gradient(#0d0e12 0% 25%, #f4f3f1 0% 50%);
  background-size: 7px 7px; opacity: 0.9;
}
.car {
  position: absolute; top: 50%; left: 0; width: 52px; height: 24px;
  transform: translate(0, -50%); transition: left 0.25s linear;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5));
}
.car--player { color: var(--accent); }
.car--ai { color: #9aa0ab; }
.car.is-moving { animation: car-bob 0.3s ease-in-out infinite; }
@keyframes car-bob { 50% { transform: translate(0, -56%); } }

.hud { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { flex: 1 1 100px; text-align: center; padding: 12px 10px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.stat__num { font-family: var(--display); font-weight: 800; font-size: 1.4rem; }
.stat__label { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }

.passage {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 1.15rem; line-height: 1.9; letter-spacing: 0.01em;
  padding: 20px 22px; border-radius: 14px; background: rgba(0,0,0,0.25); border: 1px solid var(--line);
  margin-bottom: 16px; color: rgba(255,255,255,0.35);
}
.passage span.correct { color: #f4f3f1; }
.passage span.incorrect { color: #fff; background: rgba(204,23,51,0.55); border-radius: 2px; }
.passage span.current { position: relative; }
.passage span.current::before {
  content: ""; position: absolute; left: -1px; top: -2px; bottom: -2px; width: 2px;
  background: var(--accent); animation: caret-blink 1s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.type-input {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--text);
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.02);
  outline: none; transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.type-input:focus { border-color: var(--line-hover); box-shadow: 0 0 0 3px rgba(204,23,51,0.18); }
.type-input.is-shake { animation: shake 0.25s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.countdown {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,10,0.75); backdrop-filter: blur(3px);
  font-family: var(--display); font-weight: 800; font-size: 4rem; color: #fff;
}
.countdown.is-hidden { display: none; }

/* ---------- results view ---------- */
.results { text-align: center; }
.results__banner { font-family: var(--display); font-weight: 800; font-size: 1.6rem; margin-bottom: 6px; }
.results__banner.is-win { color: #3ddc84; }
.results__banner.is-lose { color: var(--accent); }
.results__sub { color: var(--muted); margin-bottom: 26px; }
.results__grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 30px; }
.results__grid .stat { flex: 1 1 130px; max-width: 160px; }
.results__pb {
  display: inline-block; margin-bottom: 24px; font-size: 0.85rem; font-weight: 700; color: #3ddc84;
  padding: 6px 14px; border-radius: 100px; background: rgba(61,220,132,0.12); border: 1px solid rgba(61,220,132,0.3);
}
.results__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 640px) {
  .game-panel { padding: 24px 18px; }
  .passage { font-size: 1rem; padding: 16px; }
  .car { width: 40px; height: 20px; }
}
