/* Page 6 · Game (/play). Phone-first, full screen, no tab bar: one note, answer area under the thumb. */

body { min-height: 100vh; }
.game-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(250, 247, 242, 0.95); backdrop-filter: blur(10px); }
.game-row { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 var(--pad); max-width: 620px; margin: 0 auto; }
.icon-btn { width: 44px; height: 44px; margin-left: -10px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.3s; }
.practice .bar span { background: var(--teal); }
.count { font-size: 0.82rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 419px) { .game-top .lang-switch button { min-width: 30px; padding: 4px 6px; } }

.game { max-width: 620px; margin: 0 auto; padding: 6px var(--pad) calc(24px + env(safe-area-inset-bottom)); }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.mode-pill { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; background: var(--ink); color: #fff; }
.practice .mode-pill { background: var(--teal-soft); color: var(--teal); }
.score-wrap { display: inline-flex; align-items: center; gap: 8px; }
.score { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.streak { padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: 0.8rem; }
.practice-info { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

.staff-card { margin-top: 10px; padding: 8px 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.staff svg { display: block; width: 100%; height: auto; color: var(--ink); }
.staff .target { transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1); }
.staff.correct .target { color: var(--ok); }
.staff.wrong .target { color: var(--bad); }
.staff.wrong svg { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.speed { height: 6px; margin: 4px 10px 0; border-radius: 999px; background: var(--line); overflow: hidden; }
.speed span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--teal); }
.speed-label { text-align: center; font-size: 0.75rem; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.practice .speed, .practice .speed-label { display: none; }

.feedback { min-height: 1.5em; margin-top: 10px; text-align: center; font-weight: 800; }
.feedback.ok { color: var(--ok); }
.feedback.no { color: var(--bad); }
.hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); font-size: 0.88rem; font-weight: 700; }
.hint svg { flex: none; margin-top: 1px; }
.hint-btn { display: block; margin: 6px auto 0; min-height: 36px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 0.82rem; font-weight: 700; color: var(--teal); }

/* Answer methods */
.methods { margin-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.methods button { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; border: 0; border-radius: 999px; background: transparent; font-size: 0.78rem; font-weight: 700; color: var(--muted); padding: 0 4px; }
.methods svg { width: 16px; height: 16px; flex: none; }
.methods button[aria-selected="true"] { background: var(--ink); color: #fff; }
.methods .lock { position: absolute; top: -7px; right: -2px; font-style: normal; font-size: 0.6rem; font-weight: 800; padding: 1px 5px; border-radius: 999px; background: var(--accent); color: #fff; }
@media (max-width: 380px) { .methods svg { display: none; } }

.device { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 0.85rem; }
.device-row { display: flex; gap: 8px; align-items: flex-start; }
.device-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--muted); }
.device-dot.ready { background: var(--ok); }
.device-dot.bad { background: var(--bad); }
.meter { height: 8px; margin-top: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.1s; }
.heard { margin-top: 6px; font-weight: 800; }
.octave { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 36px; color: var(--ink-2); }
.octave input { width: 20px; height: 20px; }
.device-check { display: inline-block; margin-top: 4px; min-height: 36px; line-height: 36px; font-weight: 800; font-size: 0.85rem; color: var(--accent-ink); text-decoration: none; }
.plus-lock { margin-top: 10px; padding: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: grid; gap: 6px; }
.plus-lock p { color: var(--ink-2); font-size: 0.88rem; margin-bottom: 4px; }

/* Note names */
.names { margin-top: 12px; }
.acc-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.acc-row button { min-width: 52px; min-height: 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 1.1rem; font-weight: 800; }
.acc-row button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.name-keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.name-keys button { min-height: 56px; padding: 0; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1.05rem; font-weight: 800; box-shadow: 0 2px 0 var(--line); touch-action: manipulation; }
.name-keys.solfege button { font-size: 0.92rem; letter-spacing: -0.02em; }
@media (max-width: 419px) { .name-keys.solfege button { font-size: 0.84rem; } }

/* Piano: only the keys the level needs; scrolls sideways when the range is wide (grand staff) */
.piano-scroll { margin-top: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.piano { position: relative; display: flex; height: 140px; min-width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.piano button { padding: 0; min-width: 0; border: 0; -webkit-tap-highlight-color: transparent; }
.piano .white { flex: 1 0 34px; height: 100%; background: #fff; border: 1px solid var(--line); border-left-width: 0; border-radius: 0 0 8px 8px; box-shadow: inset 0 -5px 0 var(--paper-2); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; font-size: 0.65rem; font-weight: 700; color: #9a9fb8; }
.piano .white:first-child { border-left-width: 1px; }
.piano .black { position: absolute; top: 0; z-index: 1; height: 60%; transform: translateX(-50%); background: var(--ink); border-radius: 0 0 5px 5px; box-shadow: inset 0 -4px 0 #3a4066; }
.piano .white:active { background: var(--paper-2); }
.piano .black:active { background: #3a4066; }

/* Marks shared by piano keys and name buttons */
.ok { background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; box-shadow: none !important; }
.no { background: var(--bad) !important; border-color: var(--bad) !important; color: #fff !important; box-shadow: none !important; }
.hint-mark { outline: 3px solid var(--ok); outline-offset: -3px; color: var(--ok) !important; }
.reveal-note { margin-top: 6px; text-align: center; font-size: 0.78rem; color: var(--muted); }

.proto-states { margin-top: 24px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.82rem; color: var(--muted); }
.proto-states button { min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 0.82rem; font-weight: 600; }
.proto-states button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
