:root {
  --night: #0d0a2b;
  --ink: #1c1448;
  --ink-2: #2a1f6b;
  --gold: #ffcc4d;
  --gold-deep: #e0a21b;
  --candy: #ff6fae;
  --mint: #6ee7b7;
  --sky: #7cc7ff;
  --lilac: #c9a0ff;
  --parchment: #fff4d6;
  --parchment-2: #f3dfae;
  --parchment-ink: #4a2f12;
  --danger: #ff5c5c;
  --f-pinky: #ff6fae;
  --f-ring: #ffcc4d;
  --f-middle: #6ee7b7;
  --f-index: #7cc7ff;
  --f-thumb: #c9a0ff;
  --display: 'Fredoka', 'Nunito', sans-serif;
  --body: 'Nunito', sans-serif;
  --mono: 'Atkinson Hyperlegible', 'Nunito', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body);
  color: var(--parchment);
  background: var(--night);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- sky ---------- */
#sky {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 70% 10%, #3b2a8a 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 15% 35%, #1f3b7a 0%, transparent 60%),
    linear-gradient(180deg, #0b0825 0%, #1c1448 45%, #2c2a6e 75%, #1b3c69 100%);
}
.moon {
  position: absolute; top: 7vh; right: 10vw; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8d9, #ffe49a 55%, #f3c54f);
  box-shadow: 0 0 60px 20px rgba(255, 220, 130, .35), 0 0 140px 60px rgba(255, 204, 77, .12);
  animation: moonbob 9s ease-in-out infinite;
}
@keyframes moonbob { 50% { transform: translateY(-10px); } }
#stars span {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  animation: twinkle var(--d, 3s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.3); } }
#fireflies span {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #d9ff6a;
  box-shadow: 0 0 12px 4px rgba(217, 255, 106, .6);
  animation: drift var(--d, 12s) ease-in-out var(--delay, 0s) infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0, 0); opacity: .2; }
  30% { opacity: 1; }
  100% { transform: translate(var(--dx, 80px), var(--dy, -120px)); opacity: .1; }
}
.hills { position: absolute; bottom: 0; left: 0; width: 100%; height: 38vh; }
.hill.far { fill: #141a4a; }
.hill.near { fill: #0b0f33; }
.castle-silhouette {
  position: absolute; bottom: 12vh; left: 6vw; font-size: 120px; filter: brightness(.35) saturate(.6);
  opacity: .8;
}
#fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 10; display: none; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px;
}
.screen.active { display: flex; animation: screenIn .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes screenIn { from { opacity: 0; transform: scale(.94) translateY(16px); } }
body.shake .screen.active, body.shake #sky { animation: shake .35s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 3px); }
  40%, 60% { transform: translate(6px, -3px); }
}

/* ---------- title ---------- */
.title-wrap { text-align: center; max-width: 980px; width: 100%; }
.crown { font-size: 54px; animation: float 3s ease-in-out infinite; display: inline-block; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-6deg); } }
.logo {
  font-family: var(--display); font-weight: 700; font-size: clamp(40px, 8vw, 86px); margin: 0; line-height: 1;
  background: linear-gradient(180deg, #fff6c8 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #7a4b00) drop-shadow(0 10px 24px rgba(255, 204, 77, .35));
  letter-spacing: .5px;
}
.tagline { margin: 8px 0 22px; font-size: 18px; color: var(--lilac); font-weight: 700; }
.name-field { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--gold); font-size: 16px; }
.name-field input {
  font-family: var(--display); font-size: 22px; padding: 8px 16px; border-radius: 999px; border: 3px solid var(--gold);
  background: rgba(255, 244, 214, .12); color: #fff; width: 190px; text-align: center; outline: none;
}
.name-field input:focus { background: rgba(255, 244, 214, .22); box-shadow: 0 0 0 4px rgba(255, 204, 77, .3); }
.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 26px 0 20px;
}
.mode-card {
  position: relative; border: 0; border-radius: 22px; padding: 22px 16px 18px; text-align: center;
  background: linear-gradient(170deg, var(--parchment), var(--parchment-2));
  color: var(--parchment-ink); box-shadow: 0 8px 0 #b08a3e, 0 18px 30px rgba(0, 0, 0, .35);
  transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 6px; align-items: center;
  animation: cardIn .6s cubic-bezier(.2, .9, .3, 1.3) both;
}
.mode-card:nth-child(1) { animation-delay: .05s; } .mode-card:nth-child(2) { animation-delay: .15s; }
.mode-card:nth-child(3) { animation-delay: .25s; } .mode-card:nth-child(4) { animation-delay: .35s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) rotate(-3deg); } }
.mode-card:hover { transform: translateY(-6px) rotate(-1.5deg); box-shadow: 0 14px 0 #b08a3e, 0 28px 40px rgba(0, 0, 0, .4); }
.mode-card:active { transform: translateY(2px); box-shadow: 0 4px 0 #b08a3e; }
.mode-emoji { font-size: 52px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.mode-name { font-family: var(--display); font-weight: 700; font-size: 24px; }
.mode-desc { font-size: 14px; font-weight: 700; opacity: .75; }
.title-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--display); font-weight: 600; font-size: 18px; padding: 12px 22px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, #fff2c2, var(--gold)); color: #5a3a00;
  box-shadow: 0 5px 0 var(--gold-deep), 0 10px 20px rgba(0, 0, 0, .3); transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-deep); }
.btn.primary { background: linear-gradient(180deg, #ffb3d4, var(--candy)); color: #fff; box-shadow: 0 5px 0 #c23a7a, 0 10px 20px rgba(0, 0, 0, .3); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn.primary:active { box-shadow: 0 2px 0 #c23a7a; }
.btn.ghost { background: rgba(255, 244, 214, .12); color: var(--parchment); box-shadow: inset 0 0 0 2px rgba(255, 244, 214, .4); }
.btn.ghost:active { box-shadow: inset 0 0 0 2px rgba(255, 244, 214, .4); }
.btn.tiny { padding: 6px 12px; font-size: 16px; background: rgba(255, 92, 92, .25); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(170deg, var(--parchment), var(--parchment-2));
  color: var(--parchment-ink); border-radius: 28px; padding: 28px 32px; width: min(640px, 100%);
  box-shadow: 0 10px 0 #b08a3e, 0 30px 60px rgba(0, 0, 0, .5); text-align: center; position: relative;
  max-height: 92vh; overflow: auto;
}
.panel h2 { font-family: var(--display); font-weight: 700; font-size: 34px; margin: 0 0 16px; }
.panel .back { margin-top: 18px; background: rgba(74, 47, 18, .12); color: var(--parchment-ink); box-shadow: inset 0 0 0 2px rgba(74, 47, 18, .3); }
.level-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.level-btn {
  border: 3px solid #d9b36a; border-radius: 18px; padding: 14px 10px; background: #fffaf0; color: var(--parchment-ink);
  font-family: var(--display); font-weight: 600; font-size: 17px; display: flex; flex-direction: column; gap: 4px; align-items: center;
  transition: transform .12s, border-color .12s;
}
.level-btn:hover { transform: translateY(-3px) scale(1.03); border-color: var(--candy); }
.level-btn .lv-emoji { font-size: 32px; }
.level-btn .lv-sub { font-family: var(--mono); font-size: 13px; opacity: .7; letter-spacing: 1px; }
.level-btn .lv-stars { font-size: 13px; letter-spacing: 1px; color: var(--gold-deep); }
.level-btn.locked { opacity: .45; filter: grayscale(.6); }

/* ---------- game HUD ---------- */
#screen-game { justify-content: flex-start; padding: 10px 14px; gap: 8px; }
.hud {
  width: 100%; max-width: 1100px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: rgba(13, 10, 43, .55); backdrop-filter: blur(8px); border-radius: 18px; padding: 8px 14px;
  box-shadow: inset 0 0 0 2px rgba(255, 204, 77, .25);
}
.hud-left { display: flex; align-items: center; gap: 10px; }
.hud-mode { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--gold); }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hearts { font-size: 22px; letter-spacing: 2px; min-height: 28px; }
.hearts .lost { filter: grayscale(1) opacity(.35); }
.hud-progress { width: 220px; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--sky)); border-radius: 999px; transition: width .3s; }
.hud-right { display: flex; justify-content: flex-end; gap: 14px; }
.score-box, .combo-box { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.score-box span, .combo-box span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; opacity: .7; }
.score-box strong { font-family: var(--display); font-size: 28px; color: var(--gold); }
.combo-box strong { font-family: var(--display); font-size: 28px; color: var(--candy); transition: transform .15s; }
.combo-box.hot strong { color: #fff; text-shadow: 0 0 14px var(--candy), 0 0 30px var(--candy); }
.combo-box.bump strong { transform: scale(1.4) rotate(-8deg); }

/* ---------- stage ---------- */
#stage {
  position: relative; width: 100%; max-width: 1100px; flex: 1; min-height: 200px; overflow: hidden;
  border-radius: 22px; background: rgba(13, 10, 43, .25); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08);
}
#countdown {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 5;
  font-family: var(--display); font-size: 140px; font-weight: 700; color: var(--gold);
  text-shadow: 0 6px 0 #7a4b00, 0 0 40px rgba(255, 204, 77, .6);
}
#countdown.show { display: flex; }
#countdown span { animation: pop .9s cubic-bezier(.2, .9, .3, 1.4); display: inline-block; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } 60% { transform: scale(1.2); } }
.castle { position: absolute; left: 10px; bottom: 6px; font-size: 96px; line-height: 1; display: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); z-index: 2; }
.castle.hit { animation: castleHit .5s; }
@keyframes castleHit { 20% { transform: translateX(-8px) rotate(-4deg); filter: drop-shadow(0 0 20px var(--danger)); } 60% { transform: translateX(6px); } }
#stage-layer { position: absolute; inset: 0; }

.drop {
  position: absolute; left: 0; top: 0; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 30px; color: #3b2000; will-change: transform;
  background: radial-gradient(circle at 35% 30%, #fff9df, var(--gold) 60%, var(--gold-deep));
  box-shadow: 0 0 18px rgba(255, 204, 77, .55), inset 0 -4px 0 rgba(0, 0, 0, .15);
}
.drop::before { content: ''; position: absolute; top: -18px; left: 50%; width: 3px; height: 22px; background: linear-gradient(to top, rgba(255, 255, 255, .8), transparent); transform: translateX(-50%); }
.drop.c2 { background: radial-gradient(circle at 35% 30%, #ffe1ef, var(--candy) 60%, #c23a7a); color: #4a0b2a; box-shadow: 0 0 18px rgba(255, 111, 174, .55); }
.drop.c3 { background: radial-gradient(circle at 35% 30%, #e0fff3, var(--mint) 60%, #22a56f); color: #063c25; box-shadow: 0 0 18px rgba(110, 231, 183, .55); }
.drop.c4 { background: radial-gradient(circle at 35% 30%, #e6f4ff, var(--sky) 60%, #2a7fc4); color: #0a2f4a; box-shadow: 0 0 18px rgba(124, 199, 255, .55); }
.drop.bonus { background: radial-gradient(circle at 35% 30%, #fff, var(--lilac) 60%, #7a3fd6); color: #2a0a5e; box-shadow: 0 0 28px rgba(201, 160, 255, .9); animation: spin 2s linear infinite; }
@keyframes spin { to { filter: hue-rotate(360deg); } }
.drop.pop { animation: dropPop .25s forwards; }
@keyframes dropPop { to { transform: scale(2) !important; opacity: 0; } }

.monster {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; will-change: transform; z-index: 1;
}
.monster .m-emoji { font-size: 58px; line-height: 1; animation: walk .5s ease-in-out infinite alternate; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
@keyframes walk { from { transform: rotate(-6deg) translateY(0); } to { transform: rotate(6deg) translateY(-4px); } }
.monster .m-word {
  font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: 2px; padding: 4px 12px; border-radius: 12px;
  background: var(--parchment); color: var(--parchment-ink); box-shadow: 0 3px 0 #b08a3e;
}
.monster .m-word .done { color: var(--candy); }
.monster.active .m-word { box-shadow: 0 0 0 3px var(--candy), 0 0 20px var(--candy); }
.monster.active .m-emoji { animation-duration: .25s; }
.monster.dead { animation: monsterDie .4s forwards; }
@keyframes monsterDie { 40% { transform: scale(1.3) rotate(15deg); } to { transform: scale(0) rotate(90deg); opacity: 0; } }
.monster.boss .m-emoji { font-size: 84px; }

/* floating score text */
.float-text {
  position: absolute; font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--gold); pointer-events: none;
  text-shadow: 0 2px 0 #7a4b00, 0 0 16px rgba(255, 204, 77, .6); animation: floatUp .9s ease-out forwards; z-index: 4; white-space: nowrap;
}
.float-text.big { font-size: 44px; color: var(--candy); text-shadow: 0 3px 0 #7a1a45, 0 0 24px var(--candy); }
.float-text.bad { color: var(--danger); text-shadow: 0 2px 0 #5a0000; }
@keyframes floatUp { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); } to { transform: translate(-50%, -80px) scale(1); opacity: 0; } }

/* story */
.story-area { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; }
.scene { font-size: 72px; line-height: 1; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .5)); }
.story-text {
  font-family: var(--mono); font-size: clamp(22px, 3.2vw, 36px); line-height: 1.7; margin: 0; max-width: 900px; text-align: center;
  background: linear-gradient(170deg, var(--parchment), var(--parchment-2)); color: var(--parchment-ink); padding: 22px 30px; border-radius: 22px;
  box-shadow: 0 8px 0 #b08a3e, 0 20px 40px rgba(0, 0, 0, .4);
}
.story-text .ch { display: inline-block; min-width: .4em; white-space: pre; border-radius: 4px; transition: color .1s, background .1s; }
.story-text .ch.done { color: #2aa36b; }
.story-text .ch.cur { background: var(--gold); color: #3b2000; animation: blinkbg 1s steps(2) infinite; box-shadow: 0 2px 0 var(--gold-deep); }
@keyframes blinkbg { 50% { background: #fff2c2; } }
.story-text .ch.err { animation: errFlash .3s; }
@keyframes errFlash { 50% { background: var(--danger); color: #fff; } }
.story-stats { display: flex; gap: 24px; font-family: var(--display); font-size: 22px; color: var(--gold); font-weight: 600; }

/* finger school */
.finger-area { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.key-stream { display: flex; gap: 12px; align-items: center; }
.key-stream .k {
  width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 32px; background: rgba(255, 244, 214, .15); color: var(--parchment);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); transition: transform .15s, background .15s; text-transform: uppercase;
}
.key-stream .k.now {
  width: 92px; height: 92px; font-size: 48px; background: var(--parchment); color: var(--parchment-ink);
  box-shadow: 0 6px 0 #b08a3e, 0 0 30px var(--gold); transform: scale(1.05);
}
.key-stream .k.space::after { content: '␣'; }
.finger-hint { font-family: var(--display); font-size: 26px; font-weight: 600; color: #fff; padding: 8px 22px; border-radius: 999px; background: var(--f-index); color: #112; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }

/* fairy */
.fairy { position: absolute; right: 16px; top: 12px; font-size: 44px; z-index: 3; animation: float 2.5s ease-in-out infinite; }
.fairy-bubble {
  position: absolute; right: 54px; top: 2px; font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--parchment-ink);
  background: var(--parchment); padding: 8px 14px; border-radius: 16px 16px 4px 16px; white-space: nowrap; opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .25s cubic-bezier(.2, .9, .3, 1.5); box-shadow: 0 3px 0 #b08a3e;
}
.fairy-bubble.show { opacity: 1; transform: scale(1); }

/* ---------- keyboard ---------- */
.keyboard-wrap { width: 100%; max-width: 1100px; }
.hands { display: flex; align-items: center; justify-content: center; gap: 10px; }
.hand { width: 96px; height: 112px; flex: none; }
.hand .f { fill: rgba(255, 244, 214, .18); stroke: rgba(255, 244, 214, .35); stroke-width: 2; transition: fill .15s; }
.hand .palm { fill: rgba(255, 244, 214, .12); stroke: rgba(255, 244, 214, .3); stroke-width: 2; }
.hand .f.on { stroke: #fff; stroke-width: 3; animation: fingerPulse .6s ease-in-out infinite alternate; }
@keyframes fingerPulse { to { transform: translateY(-5px); } }
.keyboard { display: flex; flex-direction: column; gap: 5px; padding: 10px; border-radius: 18px; background: rgba(13, 10, 43, .55); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 2px rgba(255, 204, 77, .2); }
.krow { display: flex; gap: 5px; justify-content: center; }
.key {
  width: 42px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 17px; text-transform: uppercase; color: #fff;
  background: rgba(255, 255, 255, .1); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform .08s, background .12s, box-shadow .12s; position: relative;
}
.key.wide { width: 70px; font-size: 12px; }
.key.space { width: 260px; }
.key[data-f]::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--fc); opacity: .9; }
.key.home::before { content: ''; position: absolute; bottom: 9px; width: 10px; height: 2px; background: rgba(255, 255, 255, .6); border-radius: 1px; }
.key.next { background: var(--fc); color: #0d0a2b; box-shadow: 0 0 18px var(--fc), inset 0 -3px 0 rgba(0, 0, 0, .25); transform: translateY(-3px) scale(1.08); z-index: 1; }
.key.down { transform: translateY(2px) scale(.95); background: #fff; color: #0d0a2b; box-shadow: none; }
.key.bad { background: var(--danger); color: #fff; }

/* ---------- result ---------- */
.result-stars { font-size: 48px; letter-spacing: 6px; min-height: 60px; }
.result-stars span { display: inline-block; animation: starIn .5s cubic-bezier(.2, .9, .3, 1.5) both; }
.result-stars span:nth-child(2) { animation-delay: .2s; } .result-stars span:nth-child(3) { animation-delay: .4s; }
@keyframes starIn { from { transform: scale(0) rotate(-180deg); opacity: 0; } }
.result-stars .dim { filter: grayscale(1) opacity(.3); }
.result-score { display: flex; flex-direction: column; align-items: center; margin: 6px 0 14px; }
.result-score span { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; opacity: .6; }
.result-score strong { font-family: var(--display); font-size: 64px; line-height: 1; color: var(--gold-deep); text-shadow: 0 3px 0 #fff; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.result-grid div { background: rgba(74, 47, 18, .08); border-radius: 14px; padding: 10px; }
.result-grid div b { display: block; font-family: var(--display); font-size: 24px; }
.result-grid div span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; opacity: .6; }
.result-best { font-weight: 800; color: #c23a7a; min-height: 20px; margin: 0 0 12px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- board ---------- */
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.tabs button { font-size: 26px; width: 56px; height: 52px; border-radius: 14px; border: 3px solid #d9b36a; background: #fffaf0; transition: transform .12s; }
.tabs button.on { background: var(--gold); border-color: var(--gold-deep); transform: scale(1.1); }
.board-list { list-style: none; padding: 0; margin: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.board-list li { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 10px; align-items: center; background: #fffaf0; border-radius: 14px; padding: 8px 14px; font-weight: 800; animation: cardIn .4s both; }
.board-list li:nth-child(n+2) { animation-delay: calc(var(--i) * 40ms); }
.board-list .rank { font-family: var(--display); font-size: 22px; text-align: center; }
.board-list .nm { font-family: var(--display); font-size: 20px; }
.board-list .sc { font-family: var(--display); font-size: 22px; color: #c23a7a; }
.board-list .meta { font-size: 12px; opacity: .6; }
.board-list li.me { outline: 3px solid var(--candy); }
.board-list .empty { text-align: center; opacity: .6; padding: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hand { display: none; }
  .key { width: 32px; height: 34px; font-size: 14px; }
  .key.wide { width: 50px; font-size: 10px; } .key.space { width: 160px; }
  .hud-progress { width: 140px; }
  .castle { font-size: 64px; }
  .mode-card { padding: 14px 10px; } .mode-emoji { font-size: 40px; }
  .panel { padding: 20px 16px; }
}
@media (max-height: 700px) {
  .keyboard { padding: 6px; gap: 3px; } .key { height: 32px; }
}
