/* The Practice Room — Reno Voice Lessons
   purple #8F3985 · teal #00F0B5 · dark stage · Roboto */

:root {
  --purple: #8F3985;
  --purple-bright: #c05fb4;
  --purple-deep: #6d2b66;
  --teal: #00F0B5;
  --teal-dim: #00b98c;
  --bg: #060609;
  --panel: #101018;
  --panel-2: #16161f;
  --line: #23232e;
  --text: #f2f2f6;
  --muted: #9a9aa8;
  --gold: #ffd166;
  --red: #ff4d6a;
  --radius: 16px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 28px);
  -webkit-tap-highlight-color: transparent;
}

/* Stage lighting pinned to the viewport, so it doesn't scroll away with
   the page (background-attachment: fixed is unreliable on iOS). */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(143, 57, 133, 0.22), transparent 65%),
    radial-gradient(600px 420px at 90% 8%, rgba(0, 240, 181, 0.10), transparent 65%),
    radial-gradient(700px 500px at 50% 110%, rgba(143, 57, 133, 0.14), transparent 70%);
}

.app { width: 100%; max-width: 660px; }

.screen { display: none; animation: fadeIn 0.25s ease; }
.screen.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Hub ---------- */

.hub-header { display: flex; align-items: center; gap: 14px; }

.logo { width: 58px; height: 58px; flex: none; filter: drop-shadow(0 4px 14px rgba(143, 57, 133, 0.45)); }

.hub-titles { flex: 1; min-width: 0; }

h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 900; letter-spacing: 0.3px; line-height: 1.1; }

.hub-tagline { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--teal);
  font-size: 1.3rem;
  line-height: 1;
  transition: border-color 0.15s, transform 0.1s, opacity 0.15s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-pressed="false"] { color: var(--muted); opacity: 0.6; text-decoration: line-through; }

.hub-progress {
  margin: 18px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
#totalStars { font-size: 1.15rem; font-weight: 900; color: var(--gold); }
.hub-progress-label { color: var(--muted); font-size: 0.85rem; }

/* ---------- Coach Josie — RPG cutscene layer ---------- */

.jhero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--purple);
  box-shadow: 0 10px 34px rgba(143, 57, 133, 0.35);
  animation: josiePop 0.4s cubic-bezier(0.3, 1.3, 0.6, 1);
}

.jhero img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.jhero-banner img { aspect-ratio: 21 / 9; }

.jhero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(6, 6, 9, 0.88) 100%);
  pointer-events: none;
}

.jhero-banner .jhero-scrim { background: linear-gradient(180deg, transparent 55%, rgba(6, 6, 9, 0.8) 100%); }

.jhero-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 18px 12px;
  pointer-events: none;
}

.jhero-title {
  font-size: clamp(1.35rem, 5vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.jhero-sub { font-size: 0.85rem; color: rgba(242, 242, 246, 0.85); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }

@keyframes josiePop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Mobile: taller crops — more Josie, full width */
@media (max-width: 520px) {
  .jhero img { aspect-ratio: 1 / 1; }
  .jhero-banner img { aspect-ratio: 5 / 4; }
  .jhero-result img { aspect-ratio: 4 / 3; }
}

/* RPG dialogue box */

.jdialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px 14px;
  margin-top: 12px;
}

#josieHome .jdialog { margin-bottom: 16px; }

.jdialog-name {
  display: inline-block;
  background: var(--purple);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 7px;
  padding: 3px 10px;
  margin-bottom: 8px;
}

.jdialog-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  min-height: 1.6em;
  cursor: pointer;
}

.jdialog-body b { color: var(--teal); }

.jdialog-body:not(.typed)::after {
  content: '▌';
  color: var(--teal);
  animation: caretBlink 0.8s steps(1) infinite;
}

@keyframes caretBlink { 50% { opacity: 0; } }

/* Champion text reuses the results body */
.champion-text { font-size: 0.95rem; color: var(--text); line-height: 1.6; }
.champion-text b { color: var(--gold); }
.results-card.champion { border-color: var(--gold); }
.results-card.champion .jhero { border-color: var(--gold); border-radius: 0; box-shadow: none; }

/* Path of game cards */

.path { display: flex; flex-direction: column; gap: 12px; }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.card:not(.locked):active { transform: scale(0.985); }

.card.locked { opacity: 0.45; cursor: default; }

.card-icon {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

.card.done .card-icon { border-color: var(--teal-dim); }

.card-info { flex: 1; min-width: 0; }

.card-num { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.card-title { font-size: 1.05rem; font-weight: 900; margin: 1px 0 2px; }

.card-tag { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

.card-lock { font-size: 0.78rem; color: var(--purple-bright); margin-top: 3px; }

.card-side { flex: none; text-align: right; }

.card-stars { font-size: 1rem; letter-spacing: 2px; color: var(--gold); }
.card-stars .off { color: #3a3a46; }

.card-best { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

.hub-footer {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}
.hub-footer a { color: var(--teal-dim); text-decoration: none; }
.heart { color: var(--purple-bright); }

.link-btn { background: none; border: none; color: var(--muted); font-size: 0.8rem; text-decoration: underline; }

/* ---------- Game screens ---------- */

.gbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-btn {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1.2rem;
  transition: border-color 0.15s, transform 0.1s;
}
.back-btn:active { transform: scale(0.94); }

.gtitle { flex: 1; min-width: 0; }
.gtitle b { display: block; font-size: 1.1rem; font-weight: 900; }
.gtitle span { display: block; font-size: 0.78rem; color: var(--muted); }

.gstat {
  flex: none;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--teal);
  min-width: 70px;
  line-height: 1.35;
}
.gstat small { display: block; font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.gbody { position: relative; }

/* Shared game panel */

.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.staff-wrap { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px; }

svg.staff { display: block; width: 100%; height: auto; }

.staff-line { stroke: #4a4a58; stroke-width: 1.6; }
.staff-clef { fill: #b9b9c6; font-family: 'Segoe UI Symbol', 'Noto Music', 'Noto Sans Symbols2', serif; user-select: none; }

.note-head { fill: var(--text); }
.note-stem { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.note-ledger { stroke: #4a4a58; stroke-width: 1.8; }
.note-flag { fill: var(--text); }

g.note.teal .note-head, g.note.teal .note-flag { fill: var(--teal); }
g.note.teal .note-stem { stroke: var(--teal); }
g.note.purple .note-head, g.note.purple .note-flag { fill: var(--purple-bright); }
g.note.purple .note-stem { stroke: var(--purple-bright); }
g.note.gold .note-head, g.note.gold .note-flag { fill: var(--gold); }
g.note.gold .note-stem { stroke: var(--gold); }
g.note.red .note-head, g.note.red .note-flag { fill: var(--red); }
g.note.red .note-stem { stroke: var(--red); }
g.note.dim { opacity: 0.35; }

.note-label { font-size: 12px; font-weight: 700; fill: var(--muted); text-anchor: middle; }

/* Prompt + status text inside games */

.prompt { text-align: center; font-size: 1rem; font-weight: 500; margin: 14px 0; min-height: 1.5em; }
.prompt.teal { color: var(--teal); }
.prompt.purple { color: var(--purple-bright); }
.prompt.muted { color: var(--muted); }

/* Answer button grids */

.answers { display: grid; gap: 10px; margin-top: 14px; }
.answers.cols2 { grid-template-columns: 1fr 1fr; }
.answers.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.answers.cols4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.ans-btn {
  padding: 14px 10px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 700;
  font-size: 0.95rem;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.ans-btn:active { transform: scale(0.96); }
.ans-btn.good { border-color: var(--teal); background: rgba(0, 240, 181, 0.12); color: var(--teal); }
.ans-btn.bad { border-color: var(--red); background: rgba(255, 77, 106, 0.12); color: var(--red); animation: shake 0.3s; }
.ans-btn:disabled { cursor: default; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Meter (question progress / countdown) */

.meter { height: 6px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-top: 14px; }
.meter-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple), var(--teal)); transition: width 0.25s linear; }
.meter-fill.time { transition: none; }

/* Feedback flash line under answers */

.fact {
  margin-top: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  min-height: 2.6em;
}
.fact b { color: var(--teal); }

/* Big primary buttons */

.btn {
  display: inline-block;
  font-weight: 900;
  font-size: 0.98rem;
  padding: 13px 26px;
  border-radius: 13px;
  border: none;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 4px 18px rgba(143, 57, 133, 0.45); }
.btn-primary:active { transform: scale(0.96); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* Intro overlay (how to play / study deck) */

.intro { text-align: center; padding: 6px 4px 2px; }
.intro h2 { font-size: 1.3rem; font-weight: 900; margin-bottom: 8px; }
.intro p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; max-width: 46ch; margin: 0 auto 6px; }
.intro p b { color: var(--teal); font-weight: 700; }

/* Study deck (symbols) */

.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.deck-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px 9px;
  text-align: center;
}
.deck-card svg { width: 74px; height: 54px; display: block; margin: 0 auto; }
.deck-card b { display: block; font-size: 0.83rem; margin-top: 4px; }
.deck-card span { display: block; font-size: 0.7rem; color: var(--muted); line-height: 1.35; margin-top: 3px; }
.deck-sym { fill: var(--text); }
.deck-line { stroke: #4a4a58; stroke-width: 1.4; }
.deck-glyph { fill: var(--text); font-family: 'Segoe UI Symbol', 'Noto Music', 'Noto Sans Symbols2', serif; }

/* Symbol quiz display box */

.big-symbol {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.big-symbol svg { width: 200px; height: 120px; }

/* Landmarks legend chips */

.legend { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.chip {
  font-size: 0.78rem; font-weight: 700;
  border-radius: 999px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
}
.chip.teal { color: var(--teal); border-color: var(--teal-dim); }
.chip.purple { color: var(--purple-bright); border-color: var(--purple); }
.chip.gold { color: var(--gold); border-color: #8a6d2f; }

/* Note Storm */

.storm-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lives { font-size: 1.05rem; letter-spacing: 3px; }
.lives .on { color: var(--purple-bright); }
.lives .off { color: #33333e; }
.storm-combo { font-size: 0.8rem; font-weight: 700; color: var(--gold); min-height: 1.2em; }

.letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 14px; }
.letter-btn {
  padding: 15px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 1.05rem;
  font-weight: 900;
  transition: border-color 0.1s, transform 0.07s, background 0.1s;
}
.letter-btn:active { transform: scale(0.93); }
.letter-btn.bad { border-color: var(--red); background: rgba(255, 77, 106, 0.12); animation: shake 0.25s; }

.target-ring { fill: none; stroke: var(--teal); stroke-width: 2; opacity: 0.85; }

/* Melody Medic column hit zones */

.col-zone { fill: transparent; cursor: pointer; }
.ghost-note { pointer-events: none; opacity: 0.55; }

/* Results overlay */

.results {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 9, 0.88);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
  z-index: 50;
  padding: 12px;
}

.results-card {
  background: linear-gradient(135deg, rgba(143, 57, 133, 0.30), rgba(0, 240, 181, 0.08)), var(--panel);
  border: 1px solid var(--purple);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  text-align: center;
  max-width: 430px;
  width: 94%;
  max-height: 92%;
  overflow-y: auto;
}

.results-card .jhero {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.results-body { padding: 16px 24px 24px; }

.results-stars { font-size: 2rem; letter-spacing: 6px; color: var(--gold); margin-bottom: 6px; }
.results-stars .off { color: #3a3a46; }
.results-stars .pop { display: inline-block; animation: starPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; }
.results-stars .pop:nth-child(2) { animation-delay: 0.18s; }
.results-stars .pop:nth-child(3) { animation-delay: 0.36s; }

@keyframes starPop { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

.results-title { font-size: 1.25rem; font-weight: 900; margin-bottom: 4px; }
.results-score { font-size: 0.95rem; color: var(--teal); font-weight: 700; }
.results-best { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.results-tip { font-size: 0.85rem; color: var(--muted); line-height: 1.55; margin-top: 12px; }
.results-tip b { color: var(--purple-bright); }

/* Hover effects — mouse/trackpad devices only.
   Touch screens (iOS especially) apply :hover on tap and it sticks,
   so freshly rendered buttons inherit a ghost outline. */

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { border-color: var(--teal-dim); }
  .card:not(.locked):hover { border-color: var(--purple); box-shadow: 0 4px 22px rgba(143, 57, 133, 0.25); }
  .hub-footer a:hover { color: var(--teal); }
  .link-btn:hover { color: var(--red); }
  .back-btn:hover { border-color: var(--teal-dim); color: var(--teal); }
  .ans-btn:hover { border-color: var(--purple); }
  .btn-primary:hover { background: var(--purple-bright); }
  .btn-ghost:hover { color: var(--teal); border-color: var(--teal-dim); }
  .letter-btn:hover { border-color: var(--purple); }
  .col-zone:hover { fill: rgba(0, 240, 181, 0.05); }
}

/* Focus: visible ring for keyboard users only, nothing after a tap/click */

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Small screens */

@media (max-width: 420px) {
  .answers.cols4 { grid-template-columns: 1fr 1fr; }
  .deck { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .letters { gap: 5px; }
  .letter-btn { padding: 13px 0; }
}
