/* Page 3 · Onboarding (/welcome). Mobile-first: one step per screen, the main button stays within thumb reach. */

/* Top bar: back · progress · language */
.ob-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(250, 247, 242, 0.94); backdrop-filter: blur(10px); }
.ob-top-row { display: flex; align-items: center; gap: 10px; height: 56px; }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: none; border-radius: 12px; background: transparent; margin-left: -10px; }
.icon-btn:active { background: var(--paper-2); }
.icon-btn[hidden] { display: grid !important; visibility: hidden; } /* keep the bar from shifting on step 1 */
.ob-progress { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ob-progress span { display: block; height: 100%; width: 25%; border-radius: inherit; background: var(--accent); transition: width 0.3s; }
.ob-count { font-size: 0.85rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: right; }
@media (max-width: 419px) {
  .ob-top .lang-switch button { min-width: 32px; padding: 4px 7px; }
}

.ob { max-width: 560px; padding-top: 12px; }
.ob h1 { font-size: 1.7rem; margin-top: 6px; }
.ob .lead { margin-top: 8px; color: var(--ink-2); }
.field-label { font-weight: 700; font-size: 0.92rem; padding: 0; }
.field-hint { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* Shared "selected" look: dark border + tint + check mark (never colour alone) */
.tile, .choice, .goal { position: relative; display: block; }
.tile input, .choice input, .goal input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tile-box, .choice-box, .goal-box { display: block; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink-2); }
:is(.tile, .choice, .goal) input:checked + span { border-color: var(--ink); background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
:is(.tile, .choice, .goal) input:checked + span::after { content: "✓"; position: absolute; top: 8px; right: 10px; font-size: 0.85rem; font-weight: 800; color: var(--ink); }
:is(.tile, .choice, .goal) input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Step 1: instruments */
.tiles { margin-top: 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile-box { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 92px; padding: 12px 6px; text-align: center; font-weight: 700; font-size: 0.92rem; }
.tile-box svg { width: 32px; height: 32px; }
.clef-pick { border: 0; padding: 0; margin: 24px 0 0; min-width: 0; }
.seg { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 44px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; color: var(--muted); text-align: center; padding: 0 6px; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Step 2: note names */
.choices { margin-top: 20px; display: grid; gap: 12px; }
.choice-box { display: grid; gap: 6px; padding: 18px 18px 16px; }
.choice-box strong { font-size: 1.3rem; color: var(--ink); }
.sample { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.02em; word-spacing: 0.25em; color: var(--accent-ink); }
.choice-hint { font-size: 0.85rem; color: var(--muted); }

/* Step 3: placement check */
.intro-art { margin: 20px 0 8px; padding: 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
[data-phase] > .btn { margin-top: 10px; }
.test-head { display: flex; align-items: center; gap: 12px; }
.timer { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--teal); }
.score { font-weight: 800; font-size: 0.9rem; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.test { margin-top: 12px; padding: 12px; }
.test-staff { color: var(--ink); }
.test-note { transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1), color 0.15s; }
.test-staff.correct .test-note { color: var(--ok); }
.test-staff.wrong .test-note { color: var(--bad); }
.test-staff.wrong svg { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.test-feedback { min-height: 1.5em; margin-top: 2px; text-align: center; font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.keys { margin-top: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.keys button { min-height: 52px; padding: 0; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); font-size: 1.1rem; font-weight: 800; box-shadow: 0 2px 0 var(--line); touch-action: manipulation; }
.keys.solfege button { font-size: 0.95rem; letter-spacing: -0.02em; }
.keys button:active { transform: translateY(1px); box-shadow: none; }
.keys button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.keys button.no { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (max-width: 419px) { .keys.solfege button { font-size: 0.86rem; letter-spacing: -0.03em; } }

.state-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.state-icon.ok { background: #e5f4e4; color: var(--ok); }
.level-name { margin-top: 6px; font-weight: 700; color: var(--teal); }

/* Step 4: goal */
.goals { margin-top: 20px; display: grid; gap: 10px; }
.goal-box { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 40px 10px 16px; }
.goal-min { min-width: 4.2em; font-size: 1.25rem; color: var(--ink); }
.goal-name { display: block; font-weight: 700; color: var(--ink); }
.goal-sprints { display: block; font-size: 0.85rem; color: var(--muted); }
:is(.goal) input:checked + span::after { top: 50%; transform: translateY(-50%); right: 16px; }
.toggle { margin-top: 18px; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.2s; margin-top: 1px; }
.toggle-track span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.toggle input:checked + .toggle-track { background: var(--ok); }
.toggle input:checked + .toggle-track span { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--accent); outline-offset: 2px; }
.toggle-label { display: block; font-weight: 700; }

/* Done: summary */
.summary { margin: 20px 0 16px; padding: 4px 16px; }
.summary div { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "dt btn" "dd btn"; align-items: center; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary div:last-child { border-bottom: 0; }
.summary dt { grid-area: dt; font-size: 0.82rem; color: var(--muted); }
.summary dd { grid-area: dd; margin: 0; font-weight: 700; }
.summary button { grid-area: btn; min-height: 40px; padding: 6px 12px; border: none; border-radius: 999px; background: transparent; color: var(--accent-ink); font-weight: 700; font-size: 0.88rem; }
.summary button:active { background: var(--accent-soft); }

/* Bottom action bar: sticky on phones so the main button is under the thumb */
.ob-actions { position: sticky; bottom: 0; margin-top: 24px; padding: 14px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(250, 247, 242, 0), var(--paper) 30%); }
.ob { padding-bottom: 8px; }
section[data-step] { padding-bottom: 8px; }
section[data-step="done"] { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .ob { padding-top: 32px; }
  .ob h1 { font-size: 2.1rem; }
  .btn-block { width: 100%; }
  .ob-actions { position: static; background: none; }
}
