@font-face { font-family: 'Slab'; src: url('fonts/alfaslab.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Baloo'; src: url('fonts/baloo.woff') format('woff'); font-weight: 700; font-display: swap; }
:root { --terra: #c8643f; --terra-d: #8e3b26; --sand: #f2c48d; --cream: #fff3e2; --violet: #4b2e63; --dusk: #24142f; --gold: #ffcf5a; --turq: #39d0bd; --rose: #ff8a6b; --ink: #3a1d22; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1838; color: var(--ink); font-family: 'Baloo', system-ui, sans-serif; font-weight: 700; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; background: linear-gradient(#3b2254 0%, #9b4a6b 45%, #f08a5d 75%, #ffc27a 100%); }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; font-weight: 700; cursor: pointer; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--cream); font-family: 'Slab', serif; font-size: 28px; z-index: 50; background: linear-gradient(#3b2254, #c4605a 70%, #f6a462); transition: opacity .5s; }
.loading.hide { opacity: 0; pointer-events: none; }
.spin { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6e8 0 30%, #7b4aa8 31% 52%, #fff6e8 53%); animation: roll 1s linear infinite; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
@keyframes roll { to { transform: rotate(360deg); } }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.chip { background: rgba(255, 243, 226, .94); border: 3px solid var(--terra-d); border-radius: 14px; padding: 3px 10px; font-size: 17px; line-height: 1.2; box-shadow: 0 3px 0 rgba(58, 29, 34, .35); white-space: nowrap; }
.lvl-chip { font-family: 'Slab', serif; font-weight: 400; color: var(--terra-d); font-size: 15px; }
.time-chip b { font-size: 20px; font-variant-numeric: tabular-nums; min-width: 3.2ch; display: inline-block; text-align: right; }
.time-chip .u { font-size: 13px; margin-left: 2px; opacity: .7; }
.time-chip .target { font-size: 12px; margin-left: 6px; color: #b07a12; }
.time-chip .target.late { color: #a33; text-decoration: line-through; }
.gem-chip b { color: #11796c; }
.gem-chip.pop { animation: pop .35s; }
@keyframes pop { 50% { transform: scale(1.25); } }
.hud-btns { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--terra-d); background: var(--cream); color: var(--terra-d); font-size: 18px; box-shadow: 0 3px 0 rgba(58,29,34,.35); padding: 0; }
.round-btn.off { opacity: .5; text-decoration: line-through; }
.coach { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 560px); text-align: center; background: rgba(36, 20, 47, .88); color: var(--cream); border: 3px solid var(--gold); border-radius: 16px; padding: 10px 14px; font-size: 18px; margin: 0; transition: opacity .35s, transform .35s; }
.coach.fade { opacity: 0; transform: translateX(-50%) translateY(10px); }
@media (max-width: 480px) { .chip { font-size: 15px; padding: 2px 7px; border-radius: 12px; } .lvl-chip { font-size: 12px; } .time-chip b { font-size: 17px; } .round-btn { width: 36px; height: 36px; font-size: 16px; } .hud-top { gap: 4px; left: 6px; right: 6px; } .coach { font-size: 16px; } .time-chip .target { display: block; margin: 0; font-size: 11px; line-height: 1; } }

/* floats + stick + hand */
#floats { position: absolute; inset: 0; pointer-events: none; z-index: 12; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -50%); font-family: 'Slab', serif; font-size: 22px; color: var(--cream); text-shadow: 0 2px 0 var(--terra-d), 0 0 6px rgba(0,0,0,.4); animation: up 1.1s ease-out forwards; white-space: nowrap; }
.float.big { font-size: 34px; color: var(--gold); }
@keyframes up { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px dashed rgba(255, 243, 226, .7); background: rgba(36, 20, 47, .18); pointer-events: none; z-index: 11; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 207, 90, .85); border: 3px solid var(--cream); }
.hand { position: absolute; left: 50%; top: 58%; font-size: 54px; z-index: 13; pointer-events: none; animation: drag 1.6s ease-in-out infinite; filter: drop-shadow(0 4px 2px rgba(0,0,0,.35)); }
@keyframes drag { 0% { transform: translate(-50%, -40px); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(-50%, 50px); opacity: 1; } 100% { transform: translate(-50%, 50px); opacity: 0; } }

/* screens */
.screen, .overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20; padding: 12px; background: radial-gradient(ellipse at center, rgba(36,20,47,.35), rgba(36,20,47,.7)); }
.screen.active, .overlay.active { display: flex; }
.panel { position: relative; background: var(--cream); border: 4px solid var(--terra-d); border-radius: 22px; box-shadow: 0 8px 0 rgba(58,29,34,.45), 0 18px 40px rgba(0,0,0,.35); padding: 18px 20px 14px; width: min(94vw, 420px); max-height: 94vh; overflow-y: auto; text-align: center; touch-action: pan-y; }
.panel.small { width: min(90vw, 320px); }
.panel.wide { width: min(96vw, 640px); }
h1 { font-family: 'Slab', serif; font-weight: 400; font-size: 50px; line-height: 1; margin: 6px 0 4px; letter-spacing: 1px; }
h1 .t1 { color: var(--terra); text-shadow: 0 4px 0 var(--terra-d); } h1 .t2 { color: var(--violet); text-shadow: 0 4px 0 #2a1838; }
h2 { font-family: 'Slab', serif; font-weight: 400; color: var(--terra-d); margin: 4px 0 8px; font-size: 30px; }
.badge { display: inline-block; background: var(--violet); color: var(--gold); border-radius: 99px; padding: 3px 12px; font-size: 13px; letter-spacing: 1px; margin: 4px 0; }
.tagline { margin: 4px 0; font-size: 18px; color: var(--violet); }
.ver { margin: 0; font-size: 12px; opacity: .55; }
.howto { text-align: left; margin: 8px 0 10px; padding-left: 22px; font-size: 15px; line-height: 1.35; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 12px; font-size: 20px; margin: 7px 0; text-decoration: none; text-align: center; box-shadow: 0 4px 0 rgba(58,29,34,.4); transition: transform .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(58,29,34,.4); }
.btn-play { background: linear-gradient(#f07a4a, #c8643f); color: #fff; font-size: 24px; text-shadow: 0 2px 0 var(--terra-d); }
.btn-ghost { background: #f4dcc0; color: var(--terra-d); font-size: 16px; }
.btn-sun { background: linear-gradient(#ffd56b, #f0a33a); color: #5a2e0c; font-size: 16px; }
.btn-tip { background: var(--violet); color: var(--gold); font-size: 15px; }
.row2 { display: flex; gap: 8px; } .row2 > * { flex: 1; }
.hint { margin: 8px 0 2px; font-size: 15px; }
.keys { font-size: 12px; opacity: .65; margin: 4px 0; }
.studio { font-family: 'Slab', serif; font-weight: 400; color: var(--terra); font-size: 13px; margin: 6px 0 0; letter-spacing: 1px; }
.lang-picker { position: absolute; top: 10px; right: 12px; display: flex; gap: 4px; }
.lang-btn { border: 2px solid var(--terra-d); background: #fff; color: var(--terra-d); border-radius: 8px; padding: 2px 6px; font-size: 12px; }
.lang-btn.active { background: var(--terra-d); color: #fff; }
.muted { color: #7a5a55; } .small { font-size: 14px; }
.stars { font-size: 50px; letter-spacing: 6px; margin: 2px 0; }
.stars span { color: #e3cdb5; display: inline-block; text-shadow: 0 3px 0 rgba(58,29,34,.25); }
.stars span.on { color: var(--gold); text-shadow: 0 3px 0 #b5741a; animation: starpop .45s cubic-bezier(.3,1.8,.5,1) both; }
@keyframes starpop { 0% { transform: scale(0) rotate(-60deg); } 100% { transform: scale(1) rotate(0); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 6px 0; font-size: 16px; }
.stats p { margin: 0; background: #f6e4cf; border-radius: 10px; padding: 4px 8px; display: flex; justify-content: space-between; }
.new-record { color: #c23b6a; font-family: 'Slab', serif; font-weight: 400; font-size: 22px; margin: 4px 0; animation: pop .6s infinite alternate; }
.level-grid { text-align: left; }
.lg-group h3 { font-family: 'Slab', serif; font-weight: 400; color: var(--violet); margin: 10px 0 6px; font-size: 18px; }
.lg-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lv { border: 3px solid var(--terra-d); background: #fff; border-radius: 12px; padding: 6px 2px 4px; font-size: 20px; color: var(--terra-d); box-shadow: 0 3px 0 rgba(58,29,34,.3); line-height: 1.1; }
.lv small { display: block; font-size: 11px; color: #b07a12; letter-spacing: 1px; min-height: 12px; }
.lv.locked { opacity: .45; background: #eadbc9; }
.lv.cur { background: #ffe9b0; }
@media (max-width: 420px) { h1 { font-size: 42px; } .lg-row { grid-template-columns: repeat(6, 1fr); gap: 4px; } .lv { font-size: 16px; } .btn { padding: 10px; } }
@media (max-height: 640px) { .howto { display: none; } h1 { font-size: 38px; } }
body.clean .hud, body.clean #floats, body.clean .stick, body.clean .hand { display: none !important; }
#screen-start .badge { margin-top: 26px; }
body.touch .keys { display: none; }
