/* 자모 점프
   색의 의미: 주황 = 자음 점프, 보라 = 모음 점프, 민트 = 출발/성공, 코랄 = 깃발/오답, 금색 = 말과 별 */
:root {
  --ink: #0F1014;
  --mat: #17181D;
  --line: #23252D;
  --tile: #2E3039;
  --tile-hi: #3A3D48;
  --side: #0A0B0E;
  --text: #F2F3F7;
  --soft: #C9CBD3;
  --muted: #8A8E9A;
  --dim: #5D616E;
  --orange: #FF8A3D;
  --purple: #9B6BFF;
  --purple-text: #B79BFF;
  --mint: #3DDC97;
  --coral: #FF5A5F;
  --gold: #FFD166;
  --display: 'Black Han Sans', 'Pretendard Variable', sans-serif;
  --body: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background: radial-gradient(140% 50% at 50% -14%, rgba(150, 30, 42, .32), transparent 62%), var(--ink);
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
/* iOS 기본 입력창 그림자와 버튼 광택을 없앤다 */
button, input { -webkit-appearance: none; appearance: none; border-radius: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
b { font-weight: 800; }

#app { max-width: 520px; margin: 0 auto; padding: 0 16px; }
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100dvh; }

/* 공통 3D 타일 */
.tile3d {
  display: grid;
  place-items: center;
  font-family: var(--display);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 7px 0 var(--side), 0 12px 18px rgba(0, 0, 0, .5);
}
@keyframes drop { from { transform: translateY(-18px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 스플래시 ---------- */
#splash { align-items: center; justify-content: center; cursor: pointer; }
.splash-logo { position: relative; --w: clamp(62px, 18vw, 78px); --step: calc(var(--w) + 8px); }
.logo-tiles { display: flex; gap: 8px; }
.logo-tiles i {
  font-style: normal;
  font-family: var(--display);
  font-size: clamp(34px, 10vw, 46px);
  width: var(--w, 72px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 8px 0 var(--side), 0 14px 20px rgba(0, 0, 0, .5);
  animation: drop .55s cubic-bezier(.2, .9, .3, 1.2) both;
}
.logo-tiles i:nth-child(2) { animation-delay: .06s; }
.logo-tiles i:nth-child(3) { animation-delay: .12s; color: var(--orange); }
.logo-tiles i:nth-child(4) { animation-delay: .18s; color: var(--purple-text); }
.logo-tiles i:first-child { box-shadow: inset 0 0 0 3px var(--mint), inset 0 1px 0 rgba(255, 255, 255, .09), 0 8px 0 var(--side), 0 14px 20px rgba(0, 0, 0, .5); }
.splash-pawn {
  position: absolute;
  z-index: 2;
  left: calc(var(--w) / 2 - 15px);
  top: -34px;
  width: 30px; height: 30px;
  animation: splashHop 1.15s .6s cubic-bezier(.45, 0, .55, 1) both;
}
.splash-pawn i, .pawn i, .me i {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF6D8 0 14%, var(--gold) 15% 58%, #D99A1E 100%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(0, 0, 0, .18);
}
@keyframes splashHop {
  0% { transform: translate(0, -30px); opacity: 0; }
  10% { transform: translate(0, 0); opacity: 1; }
  20% { transform: translate(calc(var(--step) * .5), -38px); }
  33% { transform: translate(var(--step), 0); }
  43% { transform: translate(calc(var(--step) * 1.5), -38px); }
  56% { transform: translate(calc(var(--step) * 2), 0); }
  66% { transform: translate(calc(var(--step) * 2.5), -38px); }
  79%, 100% { transform: translate(calc(var(--step) * 3), 0); opacity: 1; }
}

/* ---------- 지도 ---------- */
#map.active { height: 100dvh; min-height: 0; }
.map-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 12px) 0 6px; }
.mini-logo { display: flex; gap: 4px; }
.mini-logo i {
  font-style: normal; font-family: var(--display); font-size: 16px;
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%); box-shadow: 0 3px 0 var(--side);
}
.mini-logo i:nth-child(3) { color: var(--orange); }
.mini-logo i:nth-child(4) { color: var(--purple-text); }
.map-head-right { display: flex; align-items: center; gap: 4px; }
.star-total { font-size: 15px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.tower-wrap {
  flex: 1;
  overflow-y: auto;
  margin: 0 -16px;
  -webkit-mask: linear-gradient(transparent, #000 40px, #000 calc(100% - 30px), transparent);
  mask: linear-gradient(transparent, #000 40px, #000 calc(100% - 30px), transparent);
}
.tower { position: relative; margin: 0 16px; }
.tower > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 58px; height: 58px;
  border-radius: 17px;
  font-family: var(--display);
  font-size: 24px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 7px 0 var(--side), 0 12px 18px rgba(0, 0, 0, .5);
}
.node:active:not(:disabled) { transform: translate(-50%, -46%); }
.node.boss { width: 72px; height: 72px; border-radius: 20px; font-size: 28px; background: linear-gradient(180deg, #5A2E34, #43232A 70%); }
.node.cleared { color: var(--soft); }
.node.locked { opacity: .32; }
.node.current { box-shadow: inset 0 0 0 3px var(--mint), inset 0 1px 0 rgba(255, 255, 255, .09), 0 7px 0 var(--side), 0 12px 24px rgba(61, 220, 151, .25); }
.node .num { position: relative; top: 1px; }
.node .stars { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); display: flex; gap: 1px; }
.node .stars svg { width: 12px; height: 12px; }
.crown { position: absolute; right: -9px; top: -11px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); box-shadow: 0 3px 0 #8E2A2E; }
.crown svg { width: 15px; height: 15px; fill: #fff; }
.me { position: absolute; left: 50%; top: -30px; width: 26px; height: 26px; margin-left: -13px; animation: bob 1.1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-7px); } }
.map-foot { padding: 10px 0 calc(var(--safe-b) + 16px); }
.play-btn {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-radius: 20px;
  background: var(--text);
  color: var(--ink);
  font-family: var(--display);
  font-size: 22px;
  transition: transform .12s;
}
.play-btn:active { transform: scale(.98); }
.play-btn small { font-family: var(--body); font-size: 13px; font-weight: 800; color: var(--coral); }
.map-credit { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--dim); }
.map-credit a { color: var(--muted); }
.end-credit { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.play-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 플레이 ---------- */
.bar { display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; padding: calc(var(--safe-t) + 10px) 0 4px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--soft); }
.icon-btn:active { background: var(--mat); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bar-mid { display: grid; justify-items: center; gap: 7px; }
.stage-title { font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1; }
.stage-title.boss { color: var(--coral); }
.prog { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; width: 150px; align-items: center; }
.prog i { height: 4px; border-radius: 2px; background: var(--tile); }
.prog i.boss { height: 8px; }
.prog i.done { background: var(--mint); }
.prog i.cur { background: var(--text); }
.pill-btn { justify-self: end; height: 36px; padding: 0 13px; border-radius: 999px; background: var(--mat); border: 1px solid var(--line); font-size: 13px; font-weight: 800; color: var(--gold); white-space: nowrap; }
.pill-btn.plain { color: var(--soft); }
.pill-btn.spent { color: var(--dim); }
.pill-btn.arm { color: var(--ink); background: var(--gold); border-color: var(--gold); }
.pill-btn:active { background: var(--tile); }

.cond { margin: 10px auto 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.rule { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--text); background: var(--mat); border: 1px solid var(--line); }
.rule.vowelOnly { color: var(--purple-text); background: rgba(155, 107, 255, .12); border-color: rgba(155, 107, 255, .35); }
.rule.consonantOnly { color: var(--orange); background: rgba(255, 138, 61, .1); border-color: rgba(255, 138, 61, .35); }
.rule.visitAll { color: var(--mint); background: rgba(61, 220, 151, .08); border-color: rgba(61, 220, 151, .32); }
.rule.visitOnce { color: #7FE3FF; background: rgba(127, 227, 255, .08); border-color: rgba(127, 227, 255, .32); }
.rule.useBoth { color: var(--text); background: rgba(242, 243, 247, .08); border-color: rgba(242, 243, 247, .3); }
.rule.maxJumps, .rule.exactJumps { color: var(--gold); background: rgba(255, 209, 102, .08); border-color: rgba(255, 209, 102, .3); }

/* ---------- 게임판 ---------- */
.board-host {
  --g: .14;
  --cell: min(80px, calc((min(100vw, 520px) - 32px) / 5.2));
  display: grid;
  place-items: center;
  perspective: 1000px;
}
#board { flex: 1 1 0; padding: 18px 0 22px; min-height: 0; }
/* 놀이 화면은 화면 높이에 딱 맞추고, 판은 남은 높이에 맞춰 칸 크기를 정한다(app.js sizeBoard) */
#play.active { height: 100vh; height: 100dvh; min-height: 0; }
.mat {
  padding: calc(var(--cell) * .3);
  border-radius: calc(var(--cell) * .36);
  background: linear-gradient(180deg, #1B1C22, #141519);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 30px 60px -20px rgba(0, 0, 0, .8);
  transform: rotateX(16deg);
  transform-origin: 50% 70%;
}
.plane {
  position: relative;
  width: calc(var(--cols) * var(--cell) * (1 + var(--g)) - var(--cell) * var(--g));
  height: calc(var(--rows) * var(--cell) * (1 + var(--g)) - var(--cell) * var(--g));
}
.tile, .void {
  position: absolute;
  left: calc(var(--x) * var(--cell) * (1 + var(--g)));
  top: calc(var(--y) * var(--cell) * (1 + var(--g)));
  width: var(--cell);
  height: var(--cell);
  transition: opacity .3s;
}
.void::after { content: ''; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #2A2C34; }
.tile {
  --ring: 0 0 0 0 transparent;
  --glow: 0 0 0 0 transparent;
  display: grid;
  place-items: center;
  border-radius: calc(var(--cell) * .2);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: var(--ring), var(--glow), inset 0 1px 0 rgba(255, 255, 255, .09), 0 calc(var(--cell) * .13) 0 var(--side), 0 calc(var(--cell) * .22) calc(var(--cell) * .28) rgba(0, 0, 0, .55);
  transition: box-shadow .3s ease, opacity .3s;
}
.tile .glyph { font-family: var(--display); font-size: calc(var(--cell) * .46); line-height: 1; }
.tile.start { --ring: inset 0 0 0 max(2px, calc(var(--cell) * .045)) var(--mint); }
.tile.goal { --ring: inset 0 0 0 max(2px, calc(var(--cell) * .045)) var(--coral); background: linear-gradient(180deg, #43292E, #321F23 70%); }
.tile .flag { width: 44%; color: var(--coral); display: grid; }
.tile .flag:not(:only-child) { position: absolute; top: 7%; right: 7%; width: 26%; }
.tile .flag svg { width: 100%; height: auto; }
.tile.lit { --glow: 0 0 calc(var(--cell) * .45) calc(var(--cell) * .02) var(--glow-c, var(--mint)); }
.tile.bad { animation: tileShake .4s ease; }
@keyframes tileShake { 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }
.plane.spot .tile:not(.focus), .plane.spot .void { opacity: .25; }
.tile.focus::after {
  content: '';
  position: absolute;
  inset: calc(var(--cell) * -.1);
  border-radius: calc(var(--cell) * .28);
  border: 2px solid var(--text);
  animation: ring 1.3s ease-out infinite;
  pointer-events: none;
}
@keyframes ring { from { transform: scale(.92); opacity: .9; } to { transform: scale(1.16); opacity: 0; } }

.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.lines text { font-family: var(--display); font-size: .34px; paint-order: stroke; stroke: var(--ink); stroke-width: .09px; stroke-linejoin: round; }
.lines .head, .lines text { transition: opacity .2s ease; }
.lines .faint { opacity: .5; }
.lines .faint.far { opacity: .18; }

.pawn {
  position: absolute;
  z-index: 3;
  left: calc(var(--x) * var(--cell) * (1 + var(--g)) + var(--cell) / 2);
  top: calc(var(--y) * var(--cell) * (1 + var(--g)) + var(--cell) / 2);
  width: calc(var(--cell) * .36);
  height: calc(var(--cell) * .36);
  /* 말은 칸 윗변에 서 있게 두어 자음이 가려지지 않게 한다 */
  margin: calc(var(--cell) * -.62) 0 0 calc(var(--cell) * -.18);
  transition: left .42s cubic-bezier(.45, 0, .25, 1), top .42s cubic-bezier(.45, 0, .25, 1);
  pointer-events: none;
}
.pawn.still { transition: none; }
.pawn.hop i { animation: hop .42s cubic-bezier(.3, 0, .4, 1); }
.pawn.miss i { animation: tileShake .4s ease; }
@keyframes hop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-70%) scale(1.08); }
  85% { transform: translateY(0) scale(1.06, .9); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------- 입력 ---------- */
.bottom {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: 14px 16px calc(14px + var(--safe-b));
  border-radius: 26px 26px 0 0;
  background: #15161B;
  border-top: 1px solid var(--line);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, .45);
}
.bottom:has(> .coach[hidden]):has(> .dock[hidden]) { display: none; }
.coach + .dock:not([hidden]) { margin-top: 14px; }
.abilities { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; min-height: 32px; margin-bottom: 10px; }
.prompt { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.jamo, .hint-tile {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  font-family: var(--display); font-size: 16px; color: var(--text);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 0 0 2px var(--mint), 0 3px 0 var(--side);
}
.hint-tile { box-shadow: inset 0 0 0 2px var(--gold), 0 3px 0 var(--side); }
.hint-tile.q { color: var(--dim); box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--side); }
.ab { display: flex; align-items: center; gap: 5px; animation: pop .18s ease-out; }
.ab b { font-family: var(--display); font-weight: 400; font-size: 20px; margin-right: 2px; color: var(--muted); }
.ab.here b { color: var(--mint); }
.chip { padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.chip.o { color: var(--orange); background: rgba(255, 138, 61, .14); }
.chip.p { color: var(--purple-text); background: rgba(155, 107, 255, .16); }
.chip.off { color: var(--dim); background: #1F2128; font-weight: 700; }
.chip.blocked { text-decoration: line-through; opacity: .45; }

/* 입력창과 점프 버튼을 한 덩어리로: 두 글자를 다 쓰면 버튼이 민트로 켜진다 */
.field {
  display: flex; align-items: center; gap: 6px;
  padding: 4px;
  border-radius: 18px;
  background: var(--ink);
  border: 1.5px solid #2A2C34;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: #4A4E5A; box-shadow: 0 0 0 4px rgba(242, 243, 247, .05); }
#answer {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 0 0 calc(44px + .4em); /* 오른쪽 버튼만큼 왼쪽도 비워 글자가 가운데 오게 */
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  caret-color: var(--mint);
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: .4em;
  text-align: center;
}
#answer::placeholder { font-family: var(--body); font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--dim); }
#answer:focus { outline: none; }
#answer:disabled { opacity: .45; }
#btn-submit {
  flex: none;
  width: 44px; height: 44px; min-width: 44px;
  padding: 0;
  border-radius: 13px;
  background: var(--tile);
  color: var(--muted);
  box-shadow: none;
  transition: background .2s, color .2s, transform .12s;
}
#btn-submit svg { width: 24px; height: 24px; }
.field.ready #btn-submit { background: var(--mint); color: var(--ink); }
.field.shake { animation: tileShake .36s ease; border-color: var(--coral); }
.btn-primary {
  height: 58px;
  min-width: 58px;
  padding: 0 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 17px;
  background: var(--text);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  transition: transform .12s, opacity .2s;
}
#btn-submit { padding: 0; }
.btn-primary svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary:active:not(:disabled) { transform: scale(.97); }
.btn-primary:disabled { opacity: .3; }
.btn-primary.wide { width: 100%; }
.btn-text { height: 44px; font-size: 15px; font-weight: 700; color: var(--muted); }

/* ---------- 튜토리얼 코치 ---------- */
.coach { padding-top: 2px; animation: coachIn .35s cubic-bezier(.2, .85, .2, 1); }
@keyframes coachIn { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.coach-dots { display: flex; gap: 5px; margin-bottom: 14px; }
.coach-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--tile); transition: width .25s, background .25s; }
.coach-dots i.on { width: 18px; background: var(--text); }
.coach-dots i.done { background: var(--dim); }
.coach-title { margin: 0; font-family: var(--display); font-size: 25px; line-height: 1.3; }
.coach-title .o { color: var(--orange); }
.coach-title .p { color: var(--purple-text); }
.coach-title .m { color: var(--mint); }
.coach-title .c { color: var(--coral); }
.coach-sub { margin: 6px 0 0; min-height: 22px; font-size: 15px; line-height: 1.6; color: var(--soft); }
.coach-sub b { color: var(--text); }
.coach-sub .o { color: var(--orange); }
.coach-sub .p { color: var(--purple-text); }
.coach-sub a { color: var(--text); }
.coach-sub.bad { color: var(--coral); }
.coach-letters { display: flex; gap: 10px; margin-top: 16px; }
.coach-letters:empty { display: none; }
.fill-chip { height: 40px; padding: 0 14px; border-radius: 12px; background: #1F2128; border: 1px dashed #3A3D48; font-size: 14px; font-weight: 700; color: var(--soft); }
.fill-chip b { font-family: var(--display); font-weight: 400; color: var(--text); margin: 0 2px; }

/* 튜토리얼 개념 그림 (판이 나오기 전) */
.concept { display: grid; gap: 22px; justify-items: center; align-content: center; padding: 10px 0; }
.c-row { display: flex; gap: 10px; align-items: center; }
.c-tile { width: 62px; height: 62px; border-radius: 15px; font-size: 30px; position: relative; }
.c-tile.start { box-shadow: inset 0 0 0 3px var(--mint), inset 0 1px 0 rgba(255,255,255,.09), 0 7px 0 var(--side); }
.c-tile.goal { color: var(--coral); background: linear-gradient(180deg, #43292E, #321F23 70%); box-shadow: inset 0 0 0 3px var(--coral), 0 7px 0 var(--side); }
.c-tile.goal svg { width: 42%; }
.c-tile.word { background: transparent; box-shadow: none; border: 2px dashed #3A3D48; color: var(--dim); font-size: 26px; }
.c-tile.big { width: 76px; height: 76px; font-size: 40px; }
.c-eq { font-size: 22px; font-weight: 800; color: var(--dim); }
.c-jamo { width: 42px; height: 42px; border-radius: 11px; font-size: 22px; color: var(--dim); background: #1F2128; display: grid; place-items: center; font-family: var(--display); }
.c-jamo.o { color: var(--orange); background: rgba(255,138,61,.15); box-shadow: inset 0 0 0 2px rgba(255,138,61,.5); }
.c-jamo.p { color: var(--purple-text); background: rgba(155,107,255,.16); box-shadow: inset 0 0 0 2px rgba(155,107,255,.5); }
.c-arrow { font-size: 26px; font-weight: 900; }
.c-arrow.o { color: var(--orange); }
.c-arrow.p { color: var(--purple-text); }
.c-arrow.m { color: var(--dim); }
.c-vgrid { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }
.c-vgrid span { padding: 7px 10px; border-radius: 10px; background: #1F2128; font-size: 14px; font-weight: 800; color: var(--purple-text); white-space: nowrap; }
.c-vgrid span.off { color: var(--dim); }
.c-vgrid.wide { grid-template-columns: repeat(4, 1fr); width: 100%; }
.c-vgrid em { font-style: normal; margin-left: 2px; }
.c-list { width: 100%; display: grid; gap: 8px; }
.c-ex { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: #1A1B21; border: 1px solid var(--line); }
.c-ex.off .c-tile { opacity: .55; }
.c-tile.sm { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 4px 0 var(--side); }
.c-ex-chips { flex: none; display: flex; gap: 4px; }
.c-ex-note { font-size: 14px; line-height: 1.45; color: var(--soft); }
.c-ex-note b { color: var(--text); }
.c-ico { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--tile); font-family: var(--display); font-size: 18px; color: var(--text); }
.c-ico svg { width: 55%; }
.c-ico.c { color: var(--coral); background: #3A2329; }
.c-ico.g { color: var(--ink); background: var(--gold); font-family: var(--body); font-weight: 900; }
.c-book { width: 86px; height: 104px; border-radius: 10px 16px 16px 10px; display: grid; place-items: center; font-family: var(--display); font-size: 24px; line-height: 1.2; text-align: center; background: linear-gradient(180deg, #3A3D48, #2E3039); box-shadow: inset 6px 0 0 #23252D, 0 7px 0 var(--side); }
.c-credit { text-align: center; display: grid; gap: 8px; justify-items: center; }
.c-credit .show { font-family: var(--display); font-size: 30px; }
.c-credit .ep { font-size: 14px; font-weight: 700; color: var(--muted); }
.letter {
  width: 64px; height: 64px;
  border-radius: 16px;
  font-size: 32px;
  transition: transform .12s, opacity .2s;
  animation: pop .3s ease-out both;
}
.letter:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 3px 0 var(--side); }
.letter.want { box-shadow: inset 0 0 0 2px var(--text), inset 0 1px 0 rgba(255, 255, 255, .09), 0 7px 0 var(--side), 0 12px 18px rgba(0, 0, 0, .5); }
.letter.o { color: var(--orange); box-shadow: inset 0 0 0 2px var(--orange), 0 7px 0 var(--side); }
.letter.p { color: var(--purple-text); box-shadow: inset 0 0 0 2px var(--purple), 0 7px 0 var(--side); }
.letter.bad { animation: tileShake .4s ease; }
.coach .btn-primary.wide { margin-top: 18px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: calc(var(--safe-t) + 12px);
  width: max-content;
  max-width: min(92vw, 480px);
  padding: 11px 16px;
  border-radius: 18px;
  line-height: 1.45;
  background: var(--text);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transform: translate(-50%, -160%);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.1);
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--coral); color: #fff; }
.toast.ok { background: var(--mint); }

/* ---------- 시트 ---------- */
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(5, 6, 8, .62); opacity: 0; transition: opacity .25s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed;
  z-index: 30;
  left: 0; right: 0; bottom: 0;
  max-width: 520px;
  max-height: 88dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 20px calc(16px + var(--safe-b));
  border-radius: 28px 28px 0 0;
  background: var(--mat);
  border-top: 1px solid #2A2C35;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .6);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform .38s cubic-bezier(.2, .85, .2, 1), visibility 0s .38s;
}
.sheet.open { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.2, .85, .2, 1); }
.handle { width: 40px; height: 4px; margin: 4px auto 14px; border-radius: 2px; background: #3A3D48; }
.kicker { margin: 0; text-align: center; font-size: 14px; font-weight: 800; color: var(--mint); }
.kicker.boss { color: var(--coral); }
.kicker.muted { color: var(--muted); }
.stars-row { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.stars-row svg { width: 38px; height: 38px; animation: pop .35s cubic-bezier(.2, .9, .3, 1.4) both; }
.stars-row svg:nth-child(2) { animation-delay: .1s; width: 46px; height: 46px; margin-top: -6px; }
.stars-row svg:nth-child(3) { animation-delay: .2s; }
.star-on { fill: var(--gold); }
.star-off { fill: var(--tile); }
.word { display: flex; justify-content: center; gap: 8px; margin: 12px 0; }
.word span {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px;
  font-family: var(--display); font-size: 27px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 5px 0 var(--side);
}
.steps { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.steps.long .step { padding: 4px 9px 4px 4px; font-size: 12px; gap: 5px; }
.steps.long .step b { width: 22px; height: 22px; font-size: 13px; }
.step { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 14px; font-weight: 800; }
.step b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-family: var(--display); font-weight: 400; font-size: 16px; }
.step.o { color: var(--orange); background: rgba(255, 138, 61, .12); }
.step.o b { background: rgba(255, 138, 61, .2); }
.step.p { color: var(--purple-text); background: rgba(155, 107, 255, .13); }
.step.p b { background: rgba(155, 107, 255, .22); }
.others { margin: 12px 0 0; text-align: center; }
.others summary { display: inline-block; cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 8px; }
.others summary::-webkit-details-marker { display: none; }
.others summary::after { content: ' ▾'; }
.others[open] summary::after { content: ' ▴'; }
.others p { margin: 6px 0 0; font-size: 14px; line-height: 1.7; color: var(--soft); }
.sheet-actions { display: grid; gap: 4px; margin-top: 16px; }
#result .stars-row svg { width: 30px; height: 30px; }
#result .stars-row svg:nth-child(2) { width: 36px; height: 36px; margin-top: -4px; }
#result .word { margin: 8px 0; }
#result .word span { width: 44px; height: 44px; font-size: 23px; }
#result .sheet-actions { margin-top: 10px; }

.intro-badge { margin: 4px auto 0; width: max-content; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--ink); background: var(--text); }
.intro-badge.boss { background: var(--coral); color: #fff; }
.intro-badge.rule { background: var(--gold); }
.intro-title { margin: 12px 0 6px; text-align: center; font-family: var(--display); font-weight: 400; font-size: 34px; }
.intro-sub { margin: 0; text-align: center; font-size: 15px; line-height: 1.6; color: var(--soft); }

.verdict { margin: 6px 0 4px; text-align: center; font-family: var(--display); font-weight: 400; font-size: 64px; line-height: 1.1; color: var(--gold); }
.end-stars { margin: 0; text-align: center; font-size: 18px; font-weight: 800; color: var(--soft); }

/* ---------- 처음 화면: 모드 고르기 ---------- */
#home { padding: calc(var(--safe-t) + 12px) 0 calc(var(--safe-b) + 20px); gap: 12px; }
.home-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card { width: 100%; display: grid; gap: 14px; padding: 18px; text-align: left; border-radius: 24px; background: var(--mat); border: 1px solid var(--line); transition: transform .12s; }
button.card:active { transform: scale(.985); }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-kicker { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.card-meta { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.card.climb { grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 16px 18px; }
.card.climb .card-kicker { font-size: 20px; }
.chev { font-size: 26px; line-height: 1; opacity: .5; }

/* 처음 화면 모드 카드: 제목, 한 줄 설명, 배경 그림만 */
#home { gap: 14px; }
.mode-card {
  position: relative;
  flex: 1 1 0;
  min-height: 210px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  overflow: hidden;
  isolation: isolate;
  text-align: left;
  border-radius: 28px;
  border: 1px solid var(--line);
  transition: transform .14s ease;
}
.mode-card:active { transform: scale(.98); }
.mode-card::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, transparent 38%, var(--fade) 88%);
}
.mode-card.daily {
  --fade: rgba(28, 16, 20, .96);
  background: radial-gradient(90% 80% at 85% 10%, rgba(255, 90, 95, .3), transparent 65%), linear-gradient(165deg, #2A171C, #1A1216 70%);
  border-color: rgba(255, 90, 95, .3);
}
.mode-card.endless {
  --fade: rgba(20, 18, 30, .96);
  background: radial-gradient(90% 80% at 80% 0%, rgba(155, 107, 255, .26), transparent 65%), linear-gradient(165deg, #1C1A28, #151520 70%);
  border-color: rgba(155, 107, 255, .26);
}
.mc-text { position: relative; z-index: 2; display: grid; gap: 7px; }
.mc-title { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1; }
.mc-line { font-size: 15px; font-weight: 600; color: var(--soft); }
.mc-badge {
  position: absolute; z-index: 2; top: 18px; left: 18px;
  padding: 6px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text); background: rgba(15, 16, 20, .72); border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mc-badge.live { color: var(--mint); }
.mc-badge.warn { color: var(--coral); }
.mc-badge.done { color: var(--gold); }
.mc-art { position: absolute; z-index: 0; pointer-events: none; }
.mc-art i {
  position: absolute;
  display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 15px;
  font-style: normal; font-family: var(--display); font-size: 26px; color: var(--soft);
  background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 0 var(--side), 0 14px 18px rgba(0, 0, 0, .5);
}
.mc-pawn {
  position: absolute; z-index: 3; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF6D8 0 14%, var(--gold) 15% 58%, #D99A1E 100%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(0, 0, 0, .18);
}
/* 오늘의 도전: 왕관까지 오르는 계단 */
.stairs { right: 18px; top: 16px; width: 274px; height: 226px; transform-origin: top right; }
.mode-card { container-type: size; }
@container (max-height: 320px) { .stairs { transform: scale(.78); } }
@container (max-height: 250px) { .stairs { transform: scale(.62); } }
.stairs i { left: calc(var(--i) * 54px); bottom: calc(var(--i) * 40px); opacity: calc(.55 + var(--i) * .1); }
.stairs i:first-child { box-shadow: inset 0 0 0 3px var(--mint), inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 0 var(--side), 0 14px 18px rgba(0, 0, 0, .5); opacity: 1; }
.stairs i.top { opacity: 1; color: var(--gold); background: linear-gradient(180deg, #4A3A22, #362A19 70%); box-shadow: inset 0 0 0 3px var(--gold), 0 8px 0 var(--side), 0 0 34px rgba(255, 209, 102, .35); }
.stairs i.top svg { width: 30px; fill: currentColor; }
.stairs .mc-pawn { left: 70px; bottom: 104px; animation: stairHop 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes stairHop {
  0%, 55%, 100% { transform: translateY(0); }
  65% { transform: translateY(-16px); }
  75% { transform: translateY(0) scale(1.08, .9); }
  82% { transform: translateY(0); }
}
/* 무한 모드: 멀리까지 이어지는 판 */
.mc-field {
  inset: 0 0 18% 0; perspective: 700px;
  -webkit-mask-image: linear-gradient(180deg, transparent 2%, #000 34%, #000 62%, transparent 100%), linear-gradient(90deg, transparent 0, #000 45%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(180deg, transparent 2%, #000 34%, #000 62%, transparent 100%), linear-gradient(90deg, transparent 0, #000 45%);
  mask-composite: intersect;
}
.field-plane {
  position: absolute; right: -10px; top: -40px;
  display: grid; grid-template-columns: repeat(4, 58px); gap: 12px;
  transform: rotateX(54deg) rotateZ(-34deg);
  transform-origin: 50% 50%;
}
.field-plane i { position: relative; opacity: .7; }
.field-plane i.start { opacity: 1; color: var(--text); box-shadow: inset 0 0 0 3px var(--mint), inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 0 var(--side), 0 0 30px rgba(61, 220, 151, .3); }
.field-plane i.start::after {
  content: ''; position: absolute; left: 50%; top: -14px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF6D8 0 14%, var(--gold) 15% 58%, #D99A1E 100%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .55);
}
@media (prefers-reduced-motion: reduce) { .stairs .mc-pawn { animation: none; } }

/* 무한 모드 난이도 */
.level-btn {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 6px 8px 6px 14px; border-radius: 999px;
  font-family: var(--display); font-size: 19px; line-height: 1;
  background: var(--mat); border: 1px solid var(--line);
}
.level-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.level-btn:active { background: var(--tile); }
.levels-title { margin: 0 0 14px; text-align: center; font-family: var(--display); font-weight: 400; font-size: 26px; }
.level-list { display: grid; gap: 10px; }
.level-row {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px;
  padding: 16px; border-radius: 18px; text-align: left;
  background: var(--ink); border: 1.5px solid var(--line);
}
.level-row[aria-checked="true"] { border-color: var(--mint); background: rgba(61, 220, 151, .06); }
.level-row:active { transform: scale(.985); }
.lv-dots { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.lv-dots i { width: 7px; border-radius: 2px; background: var(--c); }
.lv-dots i:nth-child(1) { height: 9px; }
.lv-dots i:nth-child(2) { height: 15px; }
.lv-dots i:nth-child(3) { height: 21px; }
.level-row.easy { --c: var(--mint); }
.level-row.normal { --c: var(--gold); }
.level-row.hard { --c: var(--coral); }
.lv-text { display: grid; gap: 3px; }
.lv-text strong { font-family: var(--display); font-weight: 400; font-size: 20px; }
.lv-text small { font-size: 13px; font-weight: 600; color: var(--muted); }
.lv-best { font-size: 13px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

/* 오늘의 도전 첫 안내 */
.intro-list { margin: 16px 0 0; padding: 6px 16px; list-style: none; border-radius: 18px; background: var(--ink); border: 1px solid var(--line); }
.intro-list li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 11px 0; }
.intro-list li + li { border-top: 1px solid var(--line); }
.intro-list span { font-size: 17px; line-height: 1.4; }
.intro-list p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--soft); }

.map-title { font-family: var(--display); font-weight: 400; font-size: 20px; }
.node .ntime { position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); font-family: var(--body); font-size: 11px; font-weight: 800; color: var(--mint); font-variant-numeric: tabular-nums; }
.node.failed { box-shadow: inset 0 0 0 3px var(--coral), inset 0 1px 0 rgba(255,255,255,.09), 0 7px 0 var(--side); }
.play-btn small.muted { color: var(--muted); }

/* ---------- 상단 바: 무한/도전 ---------- */
.bar-right { justify-self: end; display: flex; align-items: center; }
.bar-sub { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer { width: 150px; height: 6px; border-radius: 3px; background: var(--tile); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width .2s linear, background .3s; }
.timer.low i { background: var(--coral); }
.clock { font-family: var(--display); font-size: 24px; color: var(--gold); font-variant-numeric: tabular-nums; }
.clock.low { color: var(--coral); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }

/* ---------- 도전 정산 ---------- */
.verdict.sm { font-size: 48px; color: var(--text); }
.verdict.ok { color: var(--mint); }
.verdict.bad { color: var(--coral); }
.settle-rounds { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.settle-rounds li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: #1F2128; border: 1px solid transparent; }
.sr-val { font-weight: 800; text-align: right; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sr-boss { padding: 3px 8px; border-radius: 999px; font-size: 12px; color: var(--dim); background: var(--mat); }
.sr-boss.on { color: var(--ink); background: var(--gold); }
.sr-ans { font-family: var(--display); font-weight: 400; font-size: 17px; }
.settle-rounds li.done { border-color: rgba(61, 220, 151, .3); }
.settle-rounds li.fail { border-color: rgba(255, 90, 95, .35); }
.sr-lv { flex: 1; font-weight: 800; }
.sr-lv small { margin-left: 4px; font-weight: 700; color: var(--muted); }
.sr-word { font-family: var(--display); font-size: 19px; }
.sr-word.dim { color: var(--muted); }
.sr-time { min-width: 42px; text-align: right; font-weight: 800; color: var(--mint); font-variant-numeric: tabular-nums; }
.sr-fail { font-size: 13px; font-weight: 800; color: var(--coral); }
.sr-answer { font-size: 13px; color: var(--muted); }
.sr-answer b { font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--soft); margin-left: 2px; }
.sr-none { font-size: 13px; font-weight: 700; color: var(--dim); }
.settle-next { margin: 12px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

@media (min-width: 560px) {
  .bottom { margin: 0 0 16px; border-radius: 24px; border: 1px solid var(--line); }
}
@media (max-height: 700px) {
  #board { padding: 10px 0 16px; }
  .board-host { --cell: min(64px, calc((min(100vw, 520px) - 32px) / 5.2)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* 결과 모달: 이어하기·다시하기 버튼과 한 줄 설명 */
.choice { height: auto; min-height: 58px; padding: 10px 18px; display: grid; gap: 3px; place-items: center; text-align: center; }
.choice small { font-size: 12.5px; font-weight: 600; opacity: .6; }
.btn-ghost { width: 100%; border-radius: 17px; background: var(--mat); border: 1.5px solid #343742; color: var(--text); font-size: 16px; font-weight: 800; transition: transform .12s; }
.btn-ghost:active { transform: scale(.97); }
.sr-rank { padding: 0 !important; border-color: rgba(255, 209, 102, .3) !important; }
.sr-rank button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; }
.sr-rank .sr-val { color: var(--gold); }

/* 오늘의 랭킹 */
.rank-btn svg { stroke: var(--gold); }
.rank-sub { margin: -8px 0 14px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.rank-me { padding: 14px 16px; border-radius: 18px; background: linear-gradient(160deg, rgba(255, 209, 102, .1), rgba(255, 209, 102, .02)); border: 1px solid rgba(255, 209, 102, .28); }
.rm-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; }
.rm-name input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); color: var(--text); font: inherit; font-weight: 700; }
.rm-edit { flex: none; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--soft); background: var(--tile); }
.rm-edit.on { color: var(--ink); background: var(--gold); }
.rm-stat { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.rm-stat b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; color: var(--gold); }
.rm-stat b small { font-size: 20px; margin-left: 2px; }
.rm-stat span { font-size: 13.5px; font-weight: 700; line-height: 1.5; color: var(--soft); }
.rank-note { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.rank-me > .rank-note:only-child { margin: 0; }
.rank-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.rank-list li { display: grid; grid-template-columns: 34px 1fr auto 46px; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 12px; background: #1F2128; font-size: 14px; font-weight: 700; }
.rank-list li.mine { background: rgba(255, 209, 102, .1); outline: 1px solid rgba(255, 209, 102, .35); }
.rank-list .rk { text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-list .rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .rr { color: var(--soft); }
.rank-list .rt { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-list li.empty { display: block; text-align: center; color: var(--muted); font-weight: 600; }

/* 키패드가 올라와 있을 때: 헤더를 숨기고 보이는 영역 안에 판과 입력창을 고정한다 (app.js의 visualViewport 처리) */
body.kb { overflow: hidden; }
body.kb #play.active {
  position: fixed; z-index: 10;
  left: 0; right: 0; top: var(--vvt, 0px);
  height: var(--vvh, 100dvh); min-height: 0;
  max-width: 520px; margin: 0 auto; padding: 0 16px;
  background: var(--ink);
}
body.kb .bar { position: absolute; z-index: 6; top: 8px; right: 16px; display: block; padding: 0; }
body.kb .bar > .icon-btn, body.kb .bar-mid, body.kb #btn-skip { display: none; }
body.kb .clock { display: block; padding: 4px 10px; border-radius: 999px; font-size: 18px; background: rgba(15, 16, 20, .85); border: 1px solid var(--line); }
body.kb .cond { margin-top: 8px; }
body.kb #board { flex: 1 1 0; min-height: 0; padding: 10px 0 4px; }
body.kb .bottom { position: static; margin-top: auto; padding: 10px 16px; border-radius: 22px 22px 0 0; box-shadow: none; }
body.kb .abilities { margin-bottom: 8px; min-height: 28px; }
body.kb .toast { top: calc(var(--vvt, 0px) + 10px); }


/* 이어하기: 친구를 기다리는 동안 점이 깜빡이고, 열리면 민트 버튼 */
.btn-primary.go { background: var(--mint); color: var(--ink); }
.waiting { color: var(--soft); font-weight: 700; }
.waiting::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }


/* ---------- 게임 안 한글 키패드 ---------- */
@property --cell { syntax: '<length>'; inherits: true; initial-value: 64px; }
.board-host.anim { transition: --cell .32s cubic-bezier(.2, .8, .2, 1); }
.board-host.anim .pawn { transition: none; }
.field.active { border-color: rgba(61, 220, 151, .55); box-shadow: 0 0 0 4px rgba(61, 220, 151, .08); }
#answer[readonly] { cursor: pointer; -webkit-user-select: none; user-select: none; }
.kp-wrap { max-height: 0; overflow: hidden; transition: max-height .32s cubic-bezier(.2, .8, .2, 1); }
.keypad {
  display: grid; gap: 7px;
  padding-top: 12px;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
.kp-row { display: grid; grid-template-columns: repeat(20, 1fr); gap: 5px; }
.kp-key {
  grid-column: span 2;
  height: 44px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-family: var(--display); font-size: 20px; line-height: 1; color: var(--text);
  background: linear-gradient(180deg, #3A3D48, #30323B);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 0 #0A0B0E;
  transition: transform .06s, background .06s;
}
.kp-key.v { color: #CDBBFF; }
.kp-key.down { transform: translateY(2px); background: #4A4E5A; box-shadow: none; }
.kp-row.r1 .kp-key:first-child { grid-column: 2 / span 2; }
.kp-key.fn { grid-column: span 3; font-family: var(--body); font-size: 20px; color: var(--soft); background: linear-gradient(180deg, #26282F, #202228); }
.keypad.shifted .kp-key.shift { color: var(--ink); background: var(--text); }
.kp-key.close { grid-column: span 5; }
.kp-key.close svg, .kp-key.go svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.kp-key.go { grid-column: span 15; display: flex; justify-content: center; gap: 6px; font-size: 16px; font-weight: 800; color: var(--muted); }
.field.ready ~ * .kp-key.go, body.kp .bottom:has(.field.ready) .kp-key.go { color: var(--ink); background: var(--mint); }


/* 힌트: 입력 패널 오른쪽 위 */
.dock-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dock-top .abilities { flex: 1; min-width: 0; margin-bottom: 0; }
.hint-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 800; color: var(--gold);
  background: rgba(255, 209, 102, .1);
  border: 1px solid rgba(255, 209, 102, .3);
  transition: background .2s, color .2s;
}
.hint-btn b { min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; font-size: 11px; color: var(--ink); background: var(--gold); }
.hint-btn.spent { color: var(--dim); background: transparent; border-color: var(--line); }
.hint-btn.spent b { color: var(--muted); background: var(--tile); }
.hint-btn.arm { color: var(--ink); background: var(--gold); border-color: var(--gold); }
.hint-btn.arm b { display: none; }
.hint-btn:active { transform: scale(.96); }

/* 만든 사람 */
.home-actions { display: flex; align-items: center; gap: 4px; }
.maker-btn { height: 34px; padding: 0 13px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--soft); background: var(--mat); border: 1px solid var(--line); }
.maker-btn:active { background: var(--tile); }
.about-logo { display: flex; justify-content: center; gap: 6px; margin: 6px 0 16px; }
.about-logo i { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; font-style: normal; font-family: var(--display); font-size: 24px; background: linear-gradient(180deg, var(--tile-hi), var(--tile) 70%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 5px 0 var(--side); }
.about-logo i:first-child { box-shadow: inset 0 0 0 2.5px var(--mint), 0 5px 0 var(--side); }
.about-logo i:nth-child(3) { color: var(--orange); }
.about-logo i:nth-child(4) { color: var(--purple-text); }
.about-title { margin: 0 0 10px; text-align: center; font-family: var(--display); font-weight: 400; font-size: 26px; }
.about-text { margin: 0; text-align: center; font-size: 15px; line-height: 1.65; color: var(--soft); }
.about-src { display: block; width: max-content; margin: 10px auto 0; font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; }
.about-cta { margin-top: 20px; padding: 16px; border-radius: 20px; background: var(--ink); border: 1px solid var(--line); text-align: center; }
.about-cta p { margin: 0 0 12px; font-size: 15px; font-weight: 800; }
.threads-btn { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; height: 52px; }
.threads-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }


.about-maker { margin: -2px 0 14px; display: grid; gap: 2px; justify-items: center; text-align: center; }
.about-maker b { font-size: 15px; font-weight: 800; color: var(--gold); }
.about-maker span { font-size: 13px; font-weight: 600; color: var(--muted); }

