/* Rainbow Keys Play-Along APP */
:root {
  --bg: #fff7ec;
  --card: #ffffff;
  --ink: #2b2440;
  --soft: #6b6380;
  --line: #eadfce;
  --gold: #ffb300;
  --u: 38px;            /* size of one 1-beat circle in the song */
  --kbh: clamp(190px, 36dvh, 330px);
  --gut: 16px;
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 17px; cursor: pointer; touch-action: manipulation; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 58px; font-size: 19px; padding: 0 28px; }
.btn.small { min-height: 42px; font-size: 15px; padding: 0 14px; }
.btn.round { width: 48px; height: 48px; padding: 0; border-radius: 50%; flex: none; }
.btn.toggle[aria-pressed="true"] { background: #e8f6fe; border-color: #29B6F6; }
.btn:focus-visible, a:focus-visible, .mode:focus-visible { outline: 3px solid #29B6F6; outline-offset: 2px; }

.logo { width: 56px; height: 56px; flex: none; border-radius: 16px; background: url(../icons/icon.svg) center / cover no-repeat; box-shadow: 0 3px 0 rgba(43, 36, 64, .12); }
.app-tag { font-weight: 800; color: var(--soft); font-size: 14px; letter-spacing: .02em; }

/* ---------- Gate ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: var(--gut); }
.gate-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 28px; padding: 32px 24px; text-align: center; box-shadow: 0 10px 30px rgba(43, 36, 64, .08); }
.gate-card .logo { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 22px; }
.gate-card h1 { font-size: 32px; font-weight: 900; }
.gate-txt { margin: 18px 0 14px; color: var(--soft); font-size: 17px; line-height: 1.4; }
#gate-form { display: grid; gap: 12px; }
#gate-code { width: 100%; min-height: 58px; border-radius: 16px; border: 2px solid var(--line); padding: 0 16px; font: inherit; font-size: 20px; font-weight: 800; text-align: center; letter-spacing: .04em; color: var(--ink); background: #fffdf9; }
#gate-code:focus { outline: none; border-color: #29B6F6; }
.gate-msg { min-height: 24px; margin-top: 12px; color: #8a5a00; font-weight: 700; }

/* ---------- Home ---------- */
.home { min-height: 100dvh; padding: 0 var(--gut) 32px; }
.home-head { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 18px 0 8px; }
.home-head > div:not(.logo) { flex: 1; }
.home-head h1 { font-size: 26px; font-weight: 900; line-height: 1.05; }
.home-main { max-width: 960px; margin: 0 auto; }
.sec-title { font-size: 20px; font-weight: 900; margin: 18px 0 10px; }
.levels { display: grid; gap: 12px; }
.level-card, .extra-card { display: flex; align-items: center; gap: 14px; min-height: 88px; padding: 14px 16px; border-radius: 22px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.level-card:active, .extra-card:active, .free-card:active, .song-card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.level-card.empty { opacity: .5; pointer-events: none; }
.lv-num { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 900; color: #fff; }
.lv1 .lv-num { background: #E53935; } .lv2 .lv-num { background: #FB8C00; } .lv3 .lv-num { background: #43A047; } .lv4 .lv-num { background: #3949AB; }
.lv-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-txt b { font-size: 21px; font-weight: 900; }
.lv-txt small { font-size: 15px; color: var(--soft); font-weight: 700; }
.lv-stars { flex: none; font-weight: 900; font-size: 17px; background: #fff4d6; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.st { color: var(--gold); }
.free-card { margin-top: 14px; display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 14px 16px; border-radius: 22px; background: var(--ink); color: #fff; box-shadow: 0 4px 0 #17122a; }
.free-card b { display: block; font-size: 21px; font-weight: 900; }
.free-card small { font-size: 15px; opacity: .8; font-weight: 700; }
.free-keys { display: flex; gap: 3px; flex: none; }
.free-keys i { width: 12px; height: 40px; border-radius: 0 0 5px 5px; }
.free-keys i:nth-child(1) { background: #E53935; } .free-keys i:nth-child(2) { background: #FB8C00; } .free-keys i:nth-child(3) { background: #FDD835; }
.free-keys i:nth-child(4) { background: #43A047; } .free-keys i:nth-child(5) { background: #29B6F6; } .free-keys i:nth-child(6) { background: #3949AB; } .free-keys i:nth-child(7) { background: #8E24AA; }
.extras { display: grid; gap: 12px; }
.extra-card { border-style: dashed; }
.empty-msg { margin: 24px 0; color: var(--soft); font-weight: 700; text-align: center; }
@media (min-width: 640px) {
  .levels, .extras { grid-template-columns: 1fr 1fr; }
}

/* ---------- Top bar ---------- */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px var(--gut); padding-top: max(10px, env(safe-area-inset-top)); }
.bar-title { flex: 1; min-width: 0; }
.bar-title h1 { font-size: 21px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title p { font-size: 14px; color: var(--soft); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star-pill { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff4d6; color: var(--gold); font-size: 26px; }

/* ---------- Song list ---------- */
.list { min-height: 100dvh; }
.songs { max-width: 960px; margin: 0 auto; padding: 4px var(--gut) 32px; display: grid; gap: 10px; }
@media (min-width: 640px) { .songs { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .songs { grid-template-columns: 1fr 1fr 1fr; } }
.song-card { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px; border-radius: 20px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.sc-num { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-weight: 900; color: var(--soft); }
.sc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-txt b { font-size: 17px; font-weight: 900; line-height: 1.2; }
.sc-dots { display: flex; gap: 4px; }
.sc-dots i { width: 13px; height: 13px; border-radius: 50%; }
.sc-star { font-size: 28px; color: #e6dccb; flex: none; }
.has-star .sc-star { color: var(--gold); }

/* ---------- Play ---------- */
.play, .free { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.modes { max-width: 620px; align-self: center; width: calc(100% - 2 * var(--gut)); display: flex; gap: 6px; margin: 0 0 6px; padding: 5px; background: #f3e8d6; border-radius: 18px; }
.mode { flex: 1; min-height: 46px; border: 0; border-radius: 14px; background: transparent; font: inherit; font-weight: 900; font-size: 16px; color: var(--soft); cursor: pointer; touch-action: manipulation; }
.mode[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 0 rgba(43, 36, 64, .1); }

.sheet { flex: 1; min-height: 0; overflow-y: auto; padding: 8px var(--gut) 18px; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.sline { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 4px 2px; padding: 10px 0 6px; border-bottom: 2px dashed var(--line); }
.sline:last-child { border-bottom: 0; }
.nt { display: flex; flex-direction: column; align-items: center; min-width: calc(var(--u) + 4px); padding: 4px 2px 0; transition: opacity .25s; }
.bub { position: relative; height: var(--u); width: var(--u); border-radius: 999px; background: var(--c); color: var(--ink); display: grid; place-items: center; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14); transition: transform .18s ease, box-shadow .18s; }
.bub b { color: var(--ink); font-size: calc(var(--u) * .46); font-weight: 900; line-height: 1; }
.d0_5 .bub { width: calc(var(--u) * .72); height: calc(var(--u) * .72); margin-top: calc(var(--u) * .14); }
.d0_5 .bub b { font-size: calc(var(--u) * .36); }
.d1_5 .bub { width: calc(var(--u) * 1.35); }
.d2 .bub { width: calc(var(--u) * 1.7); }
.d3 .bub { width: calc(var(--u) * 2.2); }
.d4 .bub { width: calc(var(--u) * 2.7); }
.oct-high .bub::before { content: ""; position: absolute; top: 3px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .18); }
.oct-high .bub b { padding-top: 9px; font-size: calc(var(--u) * .4); }
.oct-low .bub::after { content: ""; position: absolute; bottom: -10px; left: 22%; right: 22%; height: 4px; border-radius: 2px; background: #2b2440; }
.oct-low .lyr { margin-top: 16px; }
.rest .bub { background: transparent; box-shadow: none; }
.rest .dash { width: 60%; height: 6px; border-radius: 3px; background: #c9c1d3; }
.lyr { margin-top: 10px; min-height: 18px; font-size: 14px; font-weight: 800; color: #4a4060; text-align: center; white-space: nowrap; }
.nt.done { opacity: .38; }
.nt.cur .bub, .nt.sounding .bub { transform: scale(1.08); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14), 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.nt.cur .bub { animation: breathe 1.6s ease-in-out infinite; }
.nt.cur .lyr, .nt.sounding .lyr { color: var(--ink); text-decoration: underline 3px var(--gold); text-underline-offset: 4px; }
.nt.nudge .bub { animation: wiggle .5s ease; }
@keyframes breathe { 50% { transform: scale(1.16); } }
@keyframes wiggle { 25% { transform: scale(1.2) rotate(-6deg); } 75% { transform: scale(1.2) rotate(6deg); } }

.controls { flex: none; padding: 6px var(--gut); }
.ctl-follow, .ctl-listen { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.ctl-follow { justify-content: space-between; }
.ctl-listen .btn.primary { flex: 1; max-width: 260px; }
.next-chip { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; min-width: 0; }
.next-chip b { text-transform: capitalize; }
.dot { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 17px; }

/* ---------- Keyboard ---------- */
.kbd { flex: none; height: var(--kbh); padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
.kb { display: flex; flex-direction: column; }
.kb-nav { flex: none; display: flex; align-items: center; gap: 10px; height: 46px; padding-bottom: 6px; }
.kb-arrow { width: 64px; height: 40px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.kb-arrow:disabled { opacity: .3; }
.kb-mini { flex: 1; display: flex; justify-content: center; gap: 2px; }
.kb-mini span { width: 10px; height: 16px; border-radius: 0 0 3px 3px; opacity: .25; }
.kb-mini span.on { opacity: 1; }
.kb-view { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.kb-track { position: absolute; top: 0; bottom: 0; left: 0; display: flex; transition: transform .28s ease; padding-top: 6px; background: #2b2440; border-radius: 14px; }
.key.white { position: relative; flex: 0 0 var(--kw); height: 100%; border-radius: 0 0 14px 14px; background: var(--c); background: linear-gradient(to bottom, color-mix(in srgb, var(--c) 45%, #fff) 0%, var(--c) 40%, var(--c) 100%); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18), inset 0 -8px 0 rgba(0, 0, 0, .12); transition: filter .2s, transform .06s; cursor: pointer; }
.key.white + .key.white, .key.black + .key.white { margin-left: 0; }
.key-cap { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); pointer-events: none; }
.key-cap b { font-size: clamp(16px, calc(var(--kw) * .42), 34px); font-weight: 900; line-height: 1; }
.key-cap i { display: none; }
.key.oct-high .key-cap i { display: block; order: -1; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .25); }
.key.oct-low .key-cap i { display: block; width: 46%; max-width: 30px; height: 4px; border-radius: 2px; background: #2b2440; }
.key.black { position: absolute; top: 6px; height: 56%; z-index: 3; border-radius: 0 0 8px 8px; background: linear-gradient(to bottom, #75727e, #4b4853); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .25); }
.key.down { transform: translateY(3px); filter: brightness(.9) !important; }
.key.white::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
.kb.guiding .key.white:not(.next)::after { opacity: .38; }
.key.next { z-index: 2; box-shadow: inset 0 0 0 4px #fff, 0 0 18px 6px var(--c), inset 0 -8px 0 rgba(0, 0, 0, .12); }
.key-next { display: none; position: absolute; bottom: calc(26px + clamp(16px, calc(var(--kw) * .42), 34px) + clamp(18px, calc(var(--kw) * .34), 30px)); left: 50%; width: clamp(18px, calc(var(--kw) * .34), 30px); height: clamp(18px, calc(var(--kw) * .34), 30px); margin-left: calc(clamp(18px, calc(var(--kw) * .34), 30px) / -2); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .45); animation: hop 1s ease-in-out infinite; pointer-events: none; }
.key.next .key-next { display: block; }
.key.soft { animation: soft .5s ease; }
.key.nudge { animation: nudge .9s ease; }
.key.yay { filter: brightness(1.18) !important; }
@keyframes hop { 50% { transform: translateY(-10px); } }
@keyframes soft { 0% { box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18), 0 0 0 0 rgba(255,255,255,.9); } 40% { box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18), 0 0 14px 6px rgba(255,255,255,.85); } }
@keyframes nudge { 30% { box-shadow: inset 0 0 0 5px #fff, 0 0 30px 12px var(--c); } }

/* Listen mode: keys lit by the app */
.play.listening .key.white:not(.down)::after { opacity: .38; }

/* ---------- Free play ---------- */
.free { --kbh: clamp(230px, 56dvh, 460px); }
.free-last { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 30px; font-weight: 900; text-transform: capitalize; color: var(--c, var(--soft)); }
.free-last .dot { width: 72px; height: 72px; font-size: 36px; }

/* ---------- Celebration ---------- */
.party { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--gut); background: rgba(255, 247, 236, .82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); overflow: hidden; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -24px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
.confetti i.round { width: 12px; height: 12px; border-radius: 50%; }
@keyframes fall { to { transform: translate(var(--x), 112vh) rotate(var(--r)); } }
.party-card { position: relative; width: 100%; max-width: 420px; background: var(--card); border-radius: 28px; padding: 28px 22px 22px; text-align: center; box-shadow: 0 16px 40px rgba(43, 36, 64, .18); animation: pop .45s cubic-bezier(.2, 1.6, .5, 1); }
.big-star { font-size: 92px; line-height: 1; color: var(--gold); text-shadow: 0 4px 0 #e09400; animation: spin 1.2s ease; }
.party-card h2 { font-size: 32px; font-weight: 900; margin-top: 6px; }
.party-card p { color: var(--soft); font-weight: 700; font-size: 17px; margin: 6px 0 18px; }
.party-btns { display: grid; gap: 10px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes spin { from { transform: rotate(-200deg) scale(.3); } }

/* ---------- Grown-ups ---------- */
.sheet-modal { position: fixed; inset: 0; z-index: 60; background: rgba(43, 36, 64, .45); display: grid; place-items: center; padding: var(--gut); }
.help-card { width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto; background: var(--card); border-radius: 24px; padding: 22px 22px 18px; -webkit-user-select: text; user-select: text; }
.help-card h2 { font-size: 26px; font-weight: 900; }
.help-card h3 { font-size: 17px; font-weight: 900; margin: 16px 0 6px; }
.help-card p, .help-card li { font-size: 16px; line-height: 1.45; color: #3d3552; }
.help-card ol { margin: 0; padding-left: 22px; }
.help-btns { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

/* ---------- Sizes ---------- */
@media (min-width: 700px) {
  :root { --u: 56px; --gut: 24px; }
  .lyr { font-size: 16px; }
}
/* Landscape: wider keyboard, a bit more height for it */
@media (orientation: landscape) {
  :root { --kbh: clamp(170px, 40dvh, 340px); }
  .free { --kbh: clamp(200px, 58dvh, 460px); }
}
/* Short landscape phones */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --u: 34px; --kbh: 150px; }
  .free { --kbh: 200px; }
  .bar { padding-top: 4px; padding-bottom: 2px; }
  .bar .btn.round { width: 40px; height: 40px; }
  .bar-title h1 { font-size: 18px; }
  .bar-title p { display: none; }
  .star-pill { width: 36px; height: 36px; font-size: 20px; }
  .modes { margin-bottom: 2px; padding: 3px; }
  .mode { min-height: 34px; font-size: 15px; }
  .controls { padding-top: 0; padding-bottom: 2px; }
  .ctl-follow, .ctl-listen { min-height: 40px; }
  .controls .btn.small, .controls .btn { min-height: 36px; }
  .dot { width: 28px; height: 28px; font-size: 14px; }
  .lyr { margin-top: 6px; font-size: 13px; }
  .sline { padding: 6px 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- Add a book code ---------- */
.add-book { margin-top: 12px; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border-radius: 22px; border: 2px dashed #cdbfa8; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.add-book .plus { width: 38px; height: 38px; flex: none; border-radius: 50%; background: #f3e8d6; display: grid; place-items: center; font-size: 28px; font-weight: 900; }
.add-book b { display: block; font-size: 16px; font-weight: 800; color: var(--soft); }
.add-book small { display: block; font-size: 14px; color: var(--soft); font-weight: 700; line-height: 1.3; }
.book-txt { margin: 10px 0 14px; font-size: 16px; line-height: 1.45; color: #3d3552; }
#book-code { width: 100%; min-height: 56px; border-radius: 16px; border: 2px solid var(--line); padding: 0 16px; font: inherit; font-size: 20px; font-weight: 800; text-align: center; letter-spacing: .04em; color: var(--ink); background: #fffdf9; }
#book-code:focus { outline: none; border-color: #29B6F6; }
#book-form .help-btns { margin-top: 12px; }

.book-owned { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #eef8ee; color: #23602a; font-weight: 800; font-size: 15px; }
.extra-card.waiting { opacity: .75; }

/* ---------- Today's practice card (home) ---------- */
.today-card { margin-top: 10px; display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px; border-radius: 22px; color: #3a2a00; background: linear-gradient(100deg, #fff1c2, #ffe08a); border: 2px solid #f5c84c; box-shadow: 0 4px 0 #e8b53a; }
.today-card:active { transform: translateY(2px); box-shadow: 0 2px 0 #e8b53a; }
.today-star { width: 56px; height: 56px; flex: none; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 34px; color: var(--gold); box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); }
.today-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.today-txt b { font-size: 21px; font-weight: 900; }
.today-txt small { font-size: 15px; font-weight: 800; color: #6a5200; }
.today-go { flex: none; color: #6a5200; }

/* ---------- Games card (home) ---------- */
.games-card { margin-top: 12px; display: flex; align-items: center; gap: 16px; min-height: 80px; padding: 14px 16px; border-radius: 22px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.games-card b { display: block; font-size: 20px; font-weight: 900; }
.games-card small { font-size: 14px; color: var(--soft); font-weight: 700; }
.games-ico, .g-ico { display: flex; gap: 4px; flex: none; align-items: flex-end; }
.games-ico i, .g-ico i { width: 14px; border-radius: 7px; }
.games-ico i:nth-child(1), .g-ico i:nth-child(1) { height: 22px; background: #E53935; }
.games-ico i:nth-child(2), .g-ico i:nth-child(2) { height: 34px; background: #29B6F6; }
.games-ico i:nth-child(3), .g-ico i:nth-child(3) { height: 46px; background: #43A047; }

/* ---------- Generic sub screens ---------- */
.sub { min-height: 100dvh; }
.sub-main { max-width: 760px; margin: 0 auto; padding: 4px var(--gut) 32px; }
.small-note { margin: 14px 0 0; color: var(--soft); font-weight: 700; font-size: 14px; line-height: 1.4; }

/* Practice */
.day-card { background: var(--card); border: 2px solid var(--line); border-radius: 24px; padding: 18px; box-shadow: 0 4px 0 var(--line); }
.day-week { font-size: 14px; font-weight: 900; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.day-title { font-size: 30px; font-weight: 900; margin: 2px 0 8px; }
.day-task { font-size: 19px; font-weight: 700; line-height: 1.4; color: #3d3552; }
.day-actions { display: grid; gap: 10px; margin: 16px 0 12px; }
@media (min-width: 640px) { .day-actions { grid-template-columns: 1fr 1fr; } }
.act { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 60px; padding: 10px 14px; border-radius: 16px; background: #f8f2e8; border: 2px solid var(--line); }
.act b { font-size: 17px; font-weight: 900; flex: 1; min-width: 0; }
.act-k { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; background: var(--ink); color: #fff; border-radius: 999px; padding: 3px 9px; }
.act-game .act-k { background: #29B6F6; color: #06324a; }
.act-free .act-k { background: #43A047; }
.act .sc-dots { flex-basis: 100%; }
.day-note { min-height: 0; margin: 4px 0 12px; font-weight: 800; color: #23602a; }
.day-note a { text-decoration: underline; }
#day-done { width: 100%; }
#day-done.is-done { background: #43A047; border-color: #43A047; }
.board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.bstar { position: relative; aspect-ratio: 1; border-radius: 16px; background: var(--card); border: 2px solid var(--line); display: grid; place-items: center; }
.bs-star { font-size: clamp(26px, 8vw, 44px); line-height: 1; color: #eee3d2; }
.bs-n { position: absolute; bottom: 3px; right: 7px; font-size: 12px; font-weight: 900; color: var(--soft); }
.bstar.on .bs-star { color: var(--c); }
.bstar.cur { border-color: var(--ink); }
.bstar.pop .bs-star { animation: pop .5s cubic-bezier(.2, 1.6, .5, 1); }

/* Certificates */
.name-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.name-row label { font-weight: 900; }
#cert-name, #name-input { width: 100%; min-height: 54px; border-radius: 16px; border: 2px solid var(--line); padding: 0 16px; font: inherit; font-size: 20px; font-weight: 800; color: var(--ink); background: #fffdf9; }
#cert-name:focus, #name-input:focus { outline: none; border-color: #29B6F6; }
.cert-list { display: grid; gap: 10px; }
.cert-card { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 14px; border-radius: 20px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.cert-card.cur { border-color: var(--ink); }
.cert-badge { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #fff; background: var(--c); }
.cert-card .sc-star { color: #e6dccb; }
.cert-card.earned .sc-star { color: var(--gold); }
.cert-view { margin-top: 18px; scroll-margin-top: 10px; }
#cert-canvas { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 8px 24px rgba(43, 36, 64, .15); background: #fff; }
.cert-btns { display: flex; gap: 10px; margin-top: 12px; }
.cert-btns .btn { flex: 1; }
#print-area { display: none; }
.party .cert-btn { text-decoration: none; }

/* Games */
.games-list { display: grid; gap: 12px; }
.game-card { display: flex; align-items: center; gap: 16px; min-height: 92px; padding: 14px 16px; border-radius: 22px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.game-card b { display: block; font-size: 21px; font-weight: 900; }
.game-card small { font-size: 15px; color: var(--soft); font-weight: 700; }
.g-color .g-ico i:nth-child(1) { background: #FB8C00; } .g-color .g-ico i:nth-child(2) { background: #8E24AA; }
.g-beat .g-ico i { width: 38px; height: 38px !important; border-radius: 50%; background: #FDD835 !important; }
.game { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.game-score { flex: none; font-weight: 900; font-size: 20px; background: #fff4d6; border-radius: 999px; padding: 6px 12px; }
.game-score:empty { display: none; }
.game-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 8px var(--gut); text-align: center; }
.game-status { font-size: clamp(20px, 5.4vw, 30px); font-weight: 900; line-height: 1.25; max-width: 640px; }
.game-show { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 56px; align-items: center; }
.slot { width: 48px; height: 48px; border-radius: 50%; border: 4px dashed #d6cab6; }
.slot.on { border: 0; background: var(--c); animation: pop .3s ease; }
.chip { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--ink); font-weight: 900; font-size: 22px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.chip.hit { outline: 4px solid var(--ink); outline-offset: 3px; animation: pop .35s ease; }
.game-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.game-btns .btn { min-width: 170px; }
.key.white.off::after { opacity: .62 !important; }
.beat-area { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.beat-lights { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bl { width: 30px; height: 30px; border-radius: 50%; background: #eadfce; transition: transform .08s, background .08s; }
.bl.lit { background: var(--c); transform: scale(1.35); box-shadow: 0 0 16px 4px var(--c); }
.bl.hit { background: var(--c); }
.drum { width: min(56vw, 240px); aspect-ratio: 1; border-radius: 50%; border: 0; background: radial-gradient(circle at 50% 40%, #fff7e0 0 45%, #ffd66b 46% 62%, #e53935 63% 100%); box-shadow: 0 10px 0 #a3241f; font: inherit; font-weight: 900; font-size: 26px; color: #7a4b00; cursor: pointer; touch-action: manipulation; }
.drum.hit { animation: thump .15s ease; }
@keyframes thump { 50% { transform: scale(.94) translateY(4px); box-shadow: 0 5px 0 #a3241f; } }
.big-stars { font-size: 54px; color: var(--gold); letter-spacing: 6px; }
.big-stars .dim { color: #eadfce; }
.game .kbd { --kbh: clamp(170px, 34dvh, 300px); }
@media (orientation: landscape) and (max-height: 500px) {
  .game .kbd { --kbh: 150px; }
  .drum { width: 150px; }
  .game-status { font-size: 20px; }
}

/* Print: only the certificate */
@media print {
  @page { size: landscape; margin: 0; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { width: 100%; height: auto; display: block; }
}

/* ---------- More games ---------- */
.games-list { grid-template-columns: 1fr; }
@media (min-width: 560px) { .games-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .sub-main.games-list { max-width: 1000px; grid-template-columns: 1fr 1fr 1fr; } }
.game-card { min-height: 88px; }
.game-card small { display: block; line-height: 1.3; }
.g-badge { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 24px; font-weight: 900; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.game-card[style*="#FDD835"] .g-badge, .game-card[style*="#29B6F6"] .g-badge { color: #2b2440; }
.game-adult { max-width: 560px; font-size: 14px; font-weight: 700; color: var(--soft); line-height: 1.35; }
.game-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; max-width: 640px; }
.choice { flex: 1 1 150px; min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; border-radius: 22px; border: 3px solid var(--c, var(--line)); background: var(--card); color: var(--ink); font: inherit; font-weight: 900; font-size: 19px; cursor: pointer; box-shadow: 0 4px 0 var(--c, var(--line)); touch-action: manipulation; }
.choice svg { width: 30px; height: 30px; color: var(--c); stroke-width: 3.5; }
.choice .sym { font-size: 30px; color: var(--c); line-height: 1; }
.choice:disabled { opacity: .45; }
.choice:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--c, var(--line)); }
.choice.right { background: var(--c); color: #fff; }
.choice.right svg, .choice.right .sym { color: #fff; }
.choice.soft { animation: soft .5s ease; }
#game[data-game="tune"] .choice { flex-basis: 100%; min-height: 62px; font-size: 18px; }
.mbub { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--ink); font-weight: 900; font-size: 28px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.mbub.q { border: 3px dashed #c4b69f; background: #f3ead9; }
.tune-tag { padding: 8px 16px; border-radius: 999px; background: #f3e8d6; font-weight: 900; color: var(--soft); transition: background .15s; }
.tune-tag.on { background: var(--ink); color: #fff; }
.note-rain { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 320px; }
.note-rain i { width: 18px; height: 18px; border-radius: 50%; opacity: .35; }
.tempo-icons { display: flex; gap: 14px; font-weight: 900; color: var(--soft); }
.len-demo { display: flex; gap: 10px; align-items: center; }
.len-demo i { height: 18px; border-radius: 9px; background: #d9cdb8; }
.len-demo .l { width: 90px; } .len-demo .s { width: 22px; }
.hunt-blob { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--ink); font-size: 48px; font-weight: 900; box-shadow: inset 0 -6px 0 rgba(0,0,0,.14); }
.hunt-word { flex-basis: 100%; font-size: 34px; font-weight: 900; letter-spacing: .06em; }
.scale-row { display: flex; gap: 5px; align-items: flex-end; flex-wrap: nowrap; }
.scale-row i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); opacity: .25; }
.scale-row i.on { opacity: 1; }
.scale-row i.cur { opacity: 1; outline: 3px solid var(--ink); outline-offset: 2px; }
.scale-row i.top { width: 24px; height: 24px; }
.stairs { display: flex; gap: 8px; align-items: flex-end; height: 100px; }
.stairs i { width: 36px; height: var(--h); border-radius: 8px 8px 4px 4px; background: var(--c); transition: background .2s; }
.game-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; max-width: 420px; }
.game-cards[data-n="6"], .game-cards[data-n="8"] { grid-template-columns: repeat(3, 1fr); max-width: 480px; }
.game-cards[data-n="8"] { grid-template-columns: repeat(4, 1fr); max-width: 560px; }
.mcard { aspect-ratio: 3 / 4; border-radius: 18px; border: 0; background: linear-gradient(160deg, #3949AB, #8E24AA); color: #fff; font: inherit; font-weight: 900; font-size: 34px; cursor: pointer; box-shadow: 0 5px 0 #2b2440; touch-action: manipulation; }
.mcard.open { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line), inset 0 0 0 3px #b9aed0; }
.mcard.done { background: var(--c); color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.2); animation: pop .35s ease; }
#game[data-ui="choice"] .game-stage, #game[data-ui="cards"] .game-stage { justify-content: center; }
