:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #ebeae4;
  --text: #1f2430;
  --text-soft: #636a78;
  --line: #c9cdd6;
  --line-strong: #39404f;
  --given: #10225a;
  --user: #1556c8;
  --wrong: #c4362c;
  --gain: #2e7d4f;
  --wrong-bg: #fbe4e1;
  --rel: #eef0f5;
  --same: #d6e4fb;
  --sel: #bcd4fb;
  --note: #59606e;
  --accent: #0a46b4;
  --accent-text: #ffffff;
  --hint-area: #fbf1d2;
  --hint-key: #ffe27a;
  --hint-target: #9fd3b4;
  --elim: #d4570f;
  --shadow: 0 6px 24px rgba(20, 24, 36, .14);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14161b;
  --surface: #1c1f26;
  --surface-2: #262a33;
  --text: #e7e9ef;
  --text-soft: #9aa1ae;
  --line: #3a404c;
  --line-strong: #a3abba;
  --given: #e7e9ef;
  --user: #8fbcff;
  --wrong: #ff7d73;
  --gain: #7fd3a0;
  --wrong-bg: #4a2523;
  --rel: #232833;
  --same: #31405e;
  --sel: #2c4a8a;
  --note: #aab1be;
  --accent: #5b9bff;
  --accent-text: #0f1320;
  --hint-area: #3b3420;
  --hint-key: #66561f;
  --hint-target: #285a3f;
  --elim: #ff9a55;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app {
  --board: min(calc(100vw - 24px), 540px, calc(100dvh - 352px));
  max-width: 564px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 12px env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.top { width: 100%; display: flex; align-items: center; gap: 4px; height: 52px; }
.brand { display: flex; align-items: center; margin: 0 6px 0 4px; line-height: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.diff-btn { display: inline-flex; align-items: center; gap: 2px; padding: 6px 8px 6px 10px; border-radius: 999px; background: var(--surface-2); font-size: 14px; font-weight: 600; }
.diff-btn svg { width: 16px; height: 16px; }
.spacer { flex: 1; }
.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--text-soft); min-width: 46px; text-align: right; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); }
.status { width: 100%; min-height: 26px; align-items: center; font-size: 13px; color: var(--text-soft); display: flex; gap: 12px; }
.status { position: relative; }
/* 진행 축하 알림: 판 바로 위 줄 가운데, 판과 단추를 가리지 않고 누르기를 막지 않는다 */
.cheer { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 8px); padding: 2px 12px 2px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(20, 24, 36, .16); color: var(--text); font-size: 14px; font-weight: 700; line-height: 20px; white-space: nowrap; opacity: 0; }
.cheer[hidden] { display: none; }
.cheer svg { width: 20px; height: 20px; flex: none; }
.cheer.show { animation: cheerShow 1.8s ease both; }
@keyframes cheerShow { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.9); } 12%, 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .cheer.show { animation: cheerFade 1.8s ease both; } @keyframes cheerFade { 0% { opacity: 0; } 12%, 82% { opacity: 1; } 100% { opacity: 0; } } }
:root.big .cheer { font-size: 17px; }
.status .bad { color: var(--wrong); font-weight: 600; }

.board-wrap { position: relative; width: var(--board); height: var(--board); min-width: 252px; min-height: 252px; margin: 2px 0 8px; }
.board {
  container-type: inline-size;
  width: 100%; height: 100%;
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  border: 2px solid var(--line-strong); border-radius: 6px; overflow: hidden;
  background: var(--surface);
  user-select: none;
}
.cell {
  position: relative;
  display: grid; place-items: center;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 6.4cqw; line-height: 1; font-weight: 600;
  color: var(--user);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.cell.c8 { border-right: 0; } .cell.r8 { border-bottom: 0; }
.cell.bx { border-right: 2px solid var(--line-strong); }
.cell.by { border-bottom: 2px solid var(--line-strong); }
/* 줄 완성 효과: 완성된 칸이 진한 파란색으로 바뀌며 살짝 기울어 흔들렸다 돌아온다. 늦춤은 --wd 단계 x 50ms(app.js). 입력은 막지 않는다. */
:root { --wave: #0a8cff; }
:root[data-theme="dark"] { --wave: #1f5fd0; }
.cell.wave { animation: waveCell 420ms ease-in-out both; animation-delay: calc(var(--wd, 0) * 50ms); position: relative; z-index: 2; }
@keyframes waveCell { 0% { transform: none; } 25% { background-color: var(--wave); color: #fff; transform: rotate(-7deg) scale(1.05); } 50% { background-color: var(--wave); color: #fff; transform: rotate(6deg) scale(1.05); } 75% { background-color: var(--wave); color: #fff; transform: rotate(-3deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .cell.wave { animation-name: waveColor; } @keyframes waveColor { 0%, 100% { background-color: inherit; } 25%, 75% { background-color: var(--wave); color: #fff; } } }
.cell.given { color: var(--given); font-weight: 700; }
.cell.rel { background: var(--rel); }
.cell.same { background: var(--same); }
.cell.sel { background: var(--sel); }
.cell.wrong { color: var(--wrong); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .12em; }
.cell.wrong:not(.sel) { background: var(--wrong-bg); }
.cell.conflict::after, .cell.hint-target::after { content: ""; position: absolute; inset: 1px; border: 2px solid var(--wrong); border-radius: 3px; pointer-events: none; }
.cell.hint-target::after { border-color: #2e9a5e; }
.cell.hint-area { background: var(--hint-area); }
.cell.hint-key { background: var(--hint-key); }
.cell.hint-elim::after { content: ""; position: absolute; inset: 1px; border: 2px dashed var(--elim); border-radius: 3px; pointer-events: none; }
.notes { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 1px; }
.notes span { display: grid; place-items: center; font-size: 2.55cqw; color: var(--note); font-weight: 500; border-radius: 3px; }
.notes span.same { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.notes span.ghost { opacity: .55; font-style: italic; }
.notes span.elim { color: var(--elim); font-weight: 800; text-decoration: line-through; text-decoration-thickness: 2px; }
:root.big .cell { font-size: 7.4cqw; }
:root.big .notes span { font-size: 3.25cqw; }
.board.paused .cell { color: transparent !important; }
.board.paused .notes { visibility: hidden; }
.board.flash .cell { animation: flash .9s ease; }
@keyframes flash { 0% { background: var(--surface); } 40% { background: var(--hint-target); } 100% { background: var(--surface); } }
.pause-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 6px; }
.pause-cover[hidden] { display: none; }
.pause-title { font-size: 20px; font-weight: 700; }

.side { width: var(--board); min-width: 252px; display: flex; flex-direction: column; gap: 8px; }
.msg { min-height: 44px; padding: 8px 12px; border-radius: 10px; background: var(--surface); font-size: 14.5px; line-height: 1.45; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.msg:empty { background: transparent; }
.msg .txt { flex: 1 1 200px; }
.msg.error .txt { color: var(--wrong); font-weight: 600; }
.msg.hint { background: var(--hint-area); }
.msg .tip { color: var(--text-soft); }
.msg .acts { display: flex; gap: 6px; margin-left: auto; }
.msg .stage { font-size: 12px; color: var(--text-soft); margin-right: 4px; }
:root.big .msg { font-size: 17px; }

.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; }
.chip.primary, .primary { background: var(--accent); color: var(--accent-text); }
.primary { padding: 11px 22px; border-radius: 12px; font-weight: 700; font-size: 16px; }

.tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.tool span { white-space: nowrap; } .tools .tool { font-size: clamp(11px, calc(var(--board) * .046), 12.5px); } /* 11-17 밤: 되돌리기, 지우기, 초기화, 메모, 힌트 */
.tool { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 12px; font-size: 12.5px; color: var(--text-soft); }
.tool:hover { background: var(--surface-2); }
.tool svg { width: 24px; height: 24px; color: var(--text); }
.tool .badge { position: absolute; top: 3px; right: calc(50% - 30px); font-size: 9.5px; padding: 1px 5px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); font-weight: 700; }
.tool[aria-pressed="true"] .badge { background: var(--accent); color: var(--accent-text); }
.tool[aria-pressed="true"] { color: var(--accent); }

.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.num { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0 4px; border-radius: 10px; background: var(--surface); min-height: 58px; }
.num:hover { background: var(--surface-2); }
.num:active { transform: scale(.96); }
.num b { font-size: 27px; font-weight: 550; color: var(--user); line-height: 1.05; }
.num small { font-size: 11px; color: var(--text-soft); min-height: 13px; }
.num.done b { opacity: .3; }
.pad.notes-mode .num b { font-size: 20px; color: var(--note); }
:root.big .num b { font-size: 31px; }

.foot { margin-top: auto; padding: 14px 0 10px; font-size: 11.5px; color: var(--text-soft); text-align: center; }

/* 창 */
.modal { position: fixed; inset: 0; background: rgba(10, 12, 18, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.sheet { width: min(100%, 520px); max-height: 88dvh; overflow: auto; background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); }
@media (min-width: 640px) { .modal { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin: 0 0 12px; font-size: 19px; }
.sheet h3 { margin: 16px 0 6px; font-size: 14px; color: var(--text-soft); font-weight: 700; }
.sheet p { margin: 6px 0; line-height: 1.55; font-size: 14.5px; }
.sheet .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); font-size: 15px; }
.sheet .row .sub { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.sheet .row.disabled { opacity: .5; }
.sheet select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.sheet .btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.sheet .btns button { padding: 10px 16px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.sheet .btns .primary { background: var(--accent); color: var(--accent-text); }
.list-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 14px 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; font-size: 16px; font-weight: 600; text-align: left; }
.list-btn small { font-weight: 500; color: var(--text-soft); font-size: 13px; }
.list-btn.current { outline: 2px solid var(--accent); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled { cursor: not-allowed; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tabs button { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; }
.tabs button.on { background: var(--accent); color: var(--accent-text); }
.big-num { font-size: 34px; font-weight: 800; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.result div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; }
.result b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.result span { font-size: 12px; color: var(--text-soft); }
.badge-best { display: inline-block; margin: 2px 0 6px; padding: 4px 10px; border-radius: 999px; background: var(--hint-target); font-weight: 700; font-size: 13px; }
.tech { margin: 8px 0; font-size: 14px; line-height: 1.5; }
.tech b { display: block; }

/* PC: 판 왼쪽, 단추 오른쪽 */
@media (min-width: 900px) and (min-height: 560px) {
  .app {
    --board: min(calc(100dvh - 156px), 620px); --side: 340px;
    max-width: none; width: fit-content;
    display: grid; grid-template-columns: var(--board) var(--side); grid-template-areas: "top top" "status status" "board side" "foot foot";
    column-gap: 28px; align-items: start; align-content: center;
  }
  .top { grid-area: top; } .status { grid-area: status; } .board-wrap { grid-area: board; margin: 0; }
  .side { grid-area: side; width: var(--side); gap: 14px; }
  .foot { grid-area: foot; }
  .pad { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .num { min-height: 76px; }
  .num b { font-size: 34px; }
  .msg { min-height: 96px; align-content: flex-start; }
}
@media (max-height: 640px) and (max-width: 899px) {
  .num { min-height: 48px; } .num b { font-size: 23px; }
  .app { --board: min(calc(100vw - 24px), 540px, calc(100dvh - 322px)); }
}

/* 서버 저장, 한 기기 플레이 (2026-11-15) */
.board.lost { filter: blur(3px); pointer-events: none; }
.lost-cover { z-index: 3; padding: 16px; text-align: center; }
.lost-cover .pause-title { font-size: 17px; }
.foot { display: flex; flex-direction: column; gap: 2px; }
.foot .foot-sub { font-size: 11.5px; opacity: .85; }
.acc-line { margin: 6px 2px; line-height: 1.45; }
.acc-line.sub, .sub-line { font-size: 13px; color: var(--text-soft); }
.acc-line.bad { color: var(--wrong); }
.btns.col { flex-direction: column; align-items: stretch; }
.num:disabled { opacity: .45; }

/* 2026-11-16 새 기능: 위 단추 줄(S02), 판 끝 점수(S03), 일일 도전 달력(S11), 이벤트와 순위표(S12, S13), 상(S14) */
.ic { width: 17px; height: 17px; stroke: none; flex: none; vertical-align: -3px; }
.ic-calendar, .ic-check { stroke: currentColor; }
.chips { width: 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-btn.done { border-color: var(--hint-target); }
/* 단추 줄은 늘 한 줄, 세 단추가 다 보이게(11-16): 오늘 도전과 이벤트 글은 좁으면 줄여서 … 로, 상 단추는 줄이지 않는다(앱도 칸을 나눠 쓰고 넘치는 글은 잘림) */
.chip-btn:not(#chipAwards) { flex: 0 1 auto; min-width: 0; }
.chip-btn .chip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip-btn.ev .ic { fill: #f5b400; }
.chip-btn .ok { color: #1f7a46; }
:root[data-theme="dark"] .chip-btn .ok { color: #6fd39a; }
.tip { font-size: 13.5px; color: var(--text-soft); text-align: center; padding: 2px 4px; }
.score-big { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 8px 0 4px; }
.score-big span { font-size: 14px; color: var(--text-soft); }
.score-big b { font-size: 34px; letter-spacing: .5px; }
.bests { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 10px; }
.bests .best { background: var(--surface-2); border-radius: 10px; padding: 7px 4px; text-align: center; display: flex; flex-direction: column; gap: 1px; }
.bests .best b { font-size: 15px; }
.bests .best span { font-size: 11.5px; color: var(--text-soft); }
.bests .best i { font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent); }
.bests .best.new { outline: 2px solid var(--accent); }
.fin-line { font-size: 14px; margin: 6px 0; }
.rank-box { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; margin: 8px 0; font-size: 14px; }
.rank-box .sub { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 16px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--text-soft); padding: 2px 0; }
.cal-day { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: 14px; }
.cal-day.done { background: var(--hint-target); }
.cal-day i { position: absolute; right: 4px; bottom: 1px; font-style: normal; font-size: 11px; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day.future { opacity: .35; cursor: default; }
.cal-day.none { opacity: .6; }
.cal-line { font-size: 14px; margin: 8px 0 4px; }
.daily-msg { min-height: 20px; font-size: 13.5px; margin: 6px 0; }
.daily-msg.error { color: var(--wrong); }
.trophies { display: flex; gap: 8px; flex-wrap: wrap; }
.trophy { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); opacity: .45; }
.trophy.got { opacity: 1; }
.ev-time { color: var(--text-soft); font-size: 14px; margin: 0 0 6px; }
.ev-have { display: flex; align-items: center; gap: 6px; font-size: 18px; }
.ev-have .ic { width: 24px; height: 24px; fill: #f5b400; }
.ev-bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.ev-bar > div { height: 100%; background: #f5b400; }
.ev-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ev-stage { background: var(--surface-2); border-radius: 10px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: .55; font-size: 12px; }
.ev-stage.got { opacity: 1; }
.ev-stage .ic { width: 22px; height: 22px; }
.board-list h3 { margin-top: 14px; }
.board-mine { font-weight: 600; font-size: 14px; }
.board-rows { list-style: none; margin: 6px 0; padding: 0; }
.board-rows li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--surface-2); font-size: 14px; }
.board-rows li.me { background: var(--same); border-radius: 8px; }
.board-rows .rk { text-align: center; color: var(--text-soft); font-weight: 700; }
.board-rows .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.rep { font-size: 11.5px; padding: 3px 8px; }
/* 랭킹 창(2026-11-18): 탭 둘, 전체 순위(푼 판 수) 목록, 국기, 맨 아래 고정 내 순위, 국가 고르기 */
/* 창 = 위 탭 칸 + 가운데 목록 칸(혼자 스크롤) + 아래 칸(내 순위, [닫기]). 아래 칸은 다른 창과 같은 여백 */
.sheet.rank-sheet { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.rk-tabs { flex: none; margin: 0; padding: 16px 18px 10px; background: var(--surface); border-bottom: 1px solid var(--surface-2); }
.rk-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 18px 8px; overscroll-behavior: contain; }
.rk-foot { flex: none; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--surface-2); background: var(--surface); }
.rk-foot .btns { margin-top: 0; }
#rkMineSlot:empty { display: none; }
.rk-tabs button { padding: 9px 14px; font-size: 14px; }
.rk-all h2 { margin-bottom: 4px; }
.rk-head { display: grid; grid-template-columns: 40px 1fr auto 52px; gap: 8px; padding: 8px 4px 4px; font-size: 12px; color: var(--text-soft); font-weight: 700; }
.rk-head span:nth-child(3) { text-align: right; }
.rk-rows li { grid-template-columns: 40px minmax(0, 1fr) auto 52px; min-height: 40px; }
.rk-rows .rk .ic { width: 22px; height: 22px; vertical-align: middle; }
.rk-rows .nm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nm-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rk-rows .cl { text-align: right; font-variant-numeric: tabular-nums; }
.rk-rows .chip.rep { justify-self: end; }
.me-tag { flex: none; font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--accent); border-radius: 999px; padding: 1px 7px; }
.flag { flex: none; width: 20px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); object-fit: cover; display: inline-block; vertical-align: middle; }
.flag.none { box-shadow: none; background: transparent; }
.rk-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 8px; text-align: center; color: var(--text-soft); background: var(--surface-2); border-radius: 12px; margin: 10px 0; }
.rk-empty .ic { width: 40px; height: 40px; }
.rk-mine { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; background: var(--same); font-size: 14px; }
.rk-mine .nm-t { flex: 1; font-weight: 600; }
.rk-mine b { flex: none; text-align: right; }
.cc-cur { display: inline-flex; align-items: center; gap: 4px; }
#countryInput { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); margin: 6px 0 8px; box-sizing: border-box; }
.cc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 46dvh; overflow: auto; padding: 2px; }
.cc-opt { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); text-align: left; font-size: 14px; min-height: 40px; }
.cc-opt.current { outline: 2px solid var(--accent); }
@media (min-width: 900px) and (min-height: 560px) { .sheet.rank-sheet { width: min(100%, 680px); } }
.aw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.aw { background: var(--surface-2); border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; opacity: .45; }
.aw.got { opacity: 1; }
.aw .ic { width: 30px; height: 30px; }
.aw b { font-size: 13px; }
.aw span { font-size: 11.5px; color: var(--text-soft); }
.aw-line { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.list-btn.danger, .btns .danger { color: var(--wrong); }
.btns .primary.danger { background: var(--wrong); color: #fff; }
#nickInput { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); margin: 8px 0 2px; }
.foot-links a { color: inherit; }
@media (max-width: 400px) { .chips { gap: 4px; } .chip-btn { height: 28px; padding: 0 8px; gap: 3px; font-size: 12px; } .chip-btn .ic { width: 14px; height: 14px; } }

/* ---------- 판 끝 화면 S03 (2026-11-16, 0.3.4 새 구성): 판 자리 바꾸기 ----------
   맨 위 줄, 난이도 줄, 단추 줄은 그대로 두고, 세 칸, 판, 도구, 안내, 숫자 자리만 판 끝 카드(#finPane)로 바뀐다.
   햇살(.fin-sun)과 색종이는 카드 안에서만. 휴대폰은 위아래(제목과 큰 점수, 작은 판, 점수 카드), PC 는 왼쪽 작은 판, 오른쪽 제목과 점수 카드. */
:root { --sun-a: #0a46b4; --sun-b: #0b6bd8; --sun-glow: rgba(255, 255, 255, .30); --mini-bg: #ffffff; --mini-line: #c9cdd6; --mini-strong: #39404f; --mini-given: #10225a; --mini-user: #1556c8; }
:root[data-theme="dark"] { --sun-a: #0a1f55; --sun-b: #0e2d78; --sun-glow: rgba(130, 160, 255, .16); --mini-bg: #1c1f26; --mini-line: #3a404c; --mini-strong: #a3abba; --mini-given: #e7e9ef; --mini-user: #8fbcff; }
.app.finishing .bar, .app.finishing .board-wrap, .app.finishing .msg, .app.finishing .tools, .app.finishing .tip, .app.finishing .pad { display: none; }
.fin-pane { order: 6; position: relative; isolation: isolate; overflow: hidden; width: 100%; max-width: 560px; min-width: 252px; margin: 4px 0 12px; padding: 16px 14px 20px; border-radius: 18px; }
.fin-pane[hidden] { display: none; }
.fin-sun { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 22%, var(--sun-glow), transparent 58%), repeating-conic-gradient(from 0deg at 50% 22%, var(--sun-a) 0deg 7.5deg, var(--sun-b) 7.5deg 15deg); }
.fin-wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "left" "card"; gap: 14px; justify-items: center; }
.fin-head { grid-area: head; text-align: center; color: #fff; }
.fin-praise { margin: 2px 0 0; font-size: 24px; font-weight: 800; color: #fff; letter-spacing: .2px; line-height: 1.25; text-shadow: 0 2px 10px rgba(0, 0, 0, .28); }
.fin-head .score-big { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: #fff; }
.fin-head .score-big b { font-size: 60px; font-weight: 800; line-height: 1.08; letter-spacing: .5px; font-variant-numeric: tabular-nums; text-shadow: 0 3px 14px rgba(0, 0, 0, .3); }
.fin-head .score-big .ic { width: 46px; height: 46px; vertical-align: 0; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); }
.fin-head .score-big.counting b { color: #ffd814; }
.fin-sub { margin: 2px 0 0; font-size: 14.5px; color: rgba(255, 255, 255, .94); text-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.fin-left { grid-area: left; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.fin-mini { width: 168px; background: var(--mini-bg); border-radius: 14px; padding: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.mini-grid { display: grid; grid-template-columns: repeat(9, 1fr); aspect-ratio: 1; border: 2px solid var(--mini-strong); }
.mini-grid span { display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; line-height: 1; color: var(--mini-given); border-right: 1px solid var(--mini-line); border-bottom: 1px solid var(--mini-line); font-variant-numeric: tabular-nums; }
.mini-grid span.u { color: var(--mini-user); font-weight: 500; }
.mini-grid span:nth-child(9n+3), .mini-grid span:nth-child(9n+6) { border-right: 2px solid var(--mini-strong); }
.mini-grid span:nth-child(9n) { border-right: 0; }
.mini-grid span:nth-child(n+19):nth-child(-n+27), .mini-grid span:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--mini-strong); }
.mini-grid span:nth-child(n+73) { border-bottom: 0; }
.fin-card { grid-area: card; width: 100%; background: var(--surface); color: var(--text); border-radius: 18px; padding: 14px 16px 16px; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); }
.fin-stats { margin: 0 0 4px; font-size: 14px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.fin-card .tally { margin-top: 4px; }
.fin-card .bests-title { margin: 12px 0 2px; font-size: 13.5px; color: var(--text-soft); font-weight: 700; }
.fin-card .bests { display: flex; flex-direction: column; gap: 0; margin: 0 0 8px; }
.fin-card .bests .best { display: flex; flex-direction: row; align-items: center; gap: 8px; background: none; border-radius: 0; padding: 8px 2px; border-bottom: 1px solid var(--surface-2); text-align: left; }
.fin-card .bests .best:last-child { border-bottom: 0; }
.fin-card .bests .best span { flex: 1; font-size: 14.5px; color: var(--text); }
.fin-card .bests .best b { font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; min-width: 56px; }
.fin-card .bests .best i.gain { font-style: normal; font-size: 13px; font-weight: 700; color: var(--gain); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-card .bests .best.new { outline: 0; }
.fin-card .bests .best.new b { color: var(--accent); }
.fin-card .fin-line { font-size: 14px; margin: 6px 0; }
.fin-card .sub-line { margin: 6px 0; line-height: 1.5; }
.fin-btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fin-btns button { flex: 1 1 140px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: 15px; }
.fin-btns .primary { background: var(--accent); color: var(--accent-text); }
.rank-box .see-btn { margin-top: 8px; padding: 7px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.fin-ad { width: 100%; text-align: center; }
.fin-ad[hidden] { display: none; }
.ad-label { font-size: 11px; color: rgba(255, 255, 255, .9); margin-bottom: 4px; text-align: left; }
.ad-box { width: 300px; max-width: 100%; height: 250px; margin: 0 auto; background: var(--surface); border-radius: 8px; }
.fin-pane .confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti i { position: absolute; top: -20px; border-radius: 2px; animation: confFall 1.35s cubic-bezier(.25, .6, .45, 1) both; }
@keyframes confFall { 0% { transform: translate(0, 0) rotate(0deg); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(var(--dx), 92vh) rotate(var(--rot)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
/* 일일 도전 연속 축하 장면(0.3.4): 햇살 위 가운데 흰 카드, 큰 불꽃, 연속 일수, 이번 주 월~일, [좋아요]. 아무 곳이나 누르면 판 끝 카드로 */
.fin-pane:has(.streak-card) { display: flex; align-items: center; justify-content: center; min-height: max(var(--board), 440px); cursor: pointer; }
.streak-card { position: relative; z-index: 1; width: min(100%, 380px); background: var(--surface); color: var(--text); border-radius: 22px; padding: 22px 20px 20px; text-align: center; box-shadow: 0 10px 32px rgba(0, 0, 0, .3); animation: streakIn .35s ease both; }
@keyframes streakIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .streak-card { animation: none; } }
.streak-title { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.flame { position: relative; width: 112px; height: 131px; margin: 4px auto 10px; }
.flame-svg { width: 100%; height: 100%; stroke: none; display: block; }
.flame-n { position: absolute; left: 0; right: 0; top: 70px; font-size: 40px; font-weight: 900; line-height: 1; color: #10225a; font-variant-numeric: tabular-nums; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 4px 0 10px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-soft); }
.wd i { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: #fff; }
.wd i .ic { width: 18px; height: 18px; }
.wd.done i { background: var(--accent); color: var(--accent-text); }
.wd.today span { color: var(--text); font-weight: 800; }
.wd.today i { box-shadow: 0 0 0 3px #f5b400; }
.wd.future { opacity: .5; }
.streak-keep { margin: 4px 0 14px; font-size: 14.5px; color: var(--text-soft); line-height: 1.45; }
.streak-card .primary { width: 100%; padding: 13px 16px; font-size: 16px; border-radius: 14px; }
@media (min-width: 900px) and (min-height: 560px) {
  .app.finishing { grid-template-areas: "top top" "diffs diffs" "status status" ". side" "fin fin" "intro intro" "foot foot"; }
  .fin-pane { grid-area: fin; max-width: none; min-height: var(--board); margin: 12px 0 18px; padding: 24px 28px; display: flex; align-items: center; }
  .fin-wrap { width: 100%; grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "left head" "left card"; column-gap: 28px; row-gap: 12px; align-items: start; justify-items: stretch; }
  .fin-head { text-align: left; }
  .fin-head .score-big { justify-content: flex-start; }
  .fin-praise { font-size: 30px; }
  .fin-head .score-big b { font-size: 76px; }
  .fin-head .score-big .ic { width: 58px; height: 58px; }
  .fin-left { align-items: stretch; }
  .fin-mini { width: 300px; padding: 12px; }
  .mini-grid span { font-size: 18px; }
}

/* ---------- 판 화면 배치 (2026-11-16, 사장님 지시): 난이도 한 줄, 오늘 점수, 실수, 시간 세 칸, 설정은 맨 위 오른쪽 ----------
   휴대폰 세로: 난이도 한 줄, 단추 줄(오늘 도전, 이벤트, 상), 세 칸, 축하 알림 줄, 판, 안내, 도구, 숫자 (.side 를 풀어 order 로 줄 세움)
   PC: 판 위에 난이도 한 줄, 오른쪽 열은 단추 줄, 세 칸, 도구, 안내, 숫자(11-16 사장님: 단추 줄을 세 칸 바로 위로) */
.app { --board: min(calc(100vw - 24px), 540px, calc(100dvh - 440px)); }
.side { display: contents; }
.top { order: 1; } .diffs { order: 2; } .chips { order: 3; } .bar { order: 4; } .status { order: 5; } .board-wrap { order: 6; }
.msg { order: 7; } .tools { order: 8; } .tip { order: 9; } .pad { order: 10; } .intro { order: 11; } .foot { order: 12; }
.diffs, .chips, .bar, .msg, .tools, .tip, .pad { width: var(--board); min-width: 252px; }
.msg, .tools, .tip { margin-bottom: 8px; }
.diffs { display: flex; align-items: center; gap: 2px; height: 34px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 14px; }
.diffs::-webkit-scrollbar { display: none; }
.diffs-label { flex: none; color: var(--text-soft); margin-right: 4px; }
.diff-opt { flex: none; padding: 5px 8px; border-radius: 8px; font-weight: 600; color: var(--text-soft); }
.diff-opt:hover { background: var(--surface-2); }
.diff-opt.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.bar { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 6px; margin-bottom: 2px; }
.bar-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 42px; padding: 3px 4px; border-radius: 10px; background: var(--surface); }
.bar-k { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-soft); white-space: nowrap; }
.bar-k .ic { width: 13px; height: 13px; }
.bar-cell b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.bar-cell b.bad { color: var(--wrong); }
.bar-v { display: flex; align-items: center; gap: 2px; }
.bar .timer { color: var(--text); min-width: 0; text-align: left; font-size: 15px; }
.bar .icon-btn { width: 26px; height: 26px; border-radius: 8px; }
.bar .icon-btn svg { width: 17px; height: 17px; }
:root.big .bar-cell b, :root.big .bar .timer { font-size: 17px; }
:root.big .diffs { font-size: 15.5px; }
@media (max-height: 640px) and (max-width: 899px) { .app { --board: min(calc(100vw - 24px), 540px, calc(100dvh - 406px)); } }
@media (max-width: 380px) { .diff-opt { padding: 5px 6px; } .diffs { font-size: 13.5px; } }
@media (min-width: 900px) and (min-height: 560px) {
  .app { --board: min(calc(100dvh - 212px), 620px); grid-template-areas: "top top" "diffs diffs" "status status" "board side" "intro intro" "foot foot"; }
  .diffs { grid-area: diffs; width: auto; }
  .side { display: flex; flex-direction: column; }
  .side > .chips, .side > .msg, .side > .bar, .side > .tools, .side > .tip, .side > .pad { width: auto; min-width: 0; margin-bottom: 0; }
  .side > .chips { order: 0; } .side > .bar { order: 1; } .side > .tools { order: 2; } .side > .msg { order: 3; min-height: 64px; } .side > .tip { order: 4; } .side > .pad { order: 5; }
  .bar-cell { min-height: 52px; }
  .bar-k { font-size: 12.5px; }
  .bar-cell b, .bar .timer { font-size: 17px; }
}
/* 점수 정산 장면(2026-11-16): 기본 점수, 빠르기, 감점 줄이 차례로 나타나고 큰 점수 숫자가 올라간다(1.35초, 움직임 줄이기면 최종 값만) */
.tally { margin: 6px 0 0; border-top: 1px solid var(--surface-2); padding-top: 6px; }
.t-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 2px 2px; font-size: 13.5px; color: var(--text-soft); transition: opacity .22s ease, transform .22s ease; }
.t-row b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-row b.neg { color: var(--wrong); }
.t-row b.pos { color: var(--gain); }
.t-row.wait { opacity: 0; transform: translateY(5px); }
.score-big.counting b { color: var(--accent); }
.fin-card .score-big { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .t-row { transition: none; } }
/* 게임 끝 창(결정 46번, 2026-11-16): 가운데 작은 창, 제목, 한 줄 글, 큰 [광고 보고 계속하기 ▶](주 단추)와 [새 판](보조) */
.modal.go { align-items: center; }
.modal.go .sheet { width: min(calc(100% - 32px), 400px); border-radius: 18px; text-align: center; padding: 26px 22px 22px; }
.modal.go .sheet h2 { font-size: 24px; margin: 0 0 8px; }
.modal.go .sheet p { font-size: 15.5px; color: var(--text-soft); margin: 0 0 6px; }
.modal.go .go-btns { margin-top: 20px; gap: 10px; }
.modal.go .go-btns button { padding: 14px 16px; font-size: 16px; border-radius: 14px; }
.modal.go .go-play { width: 18px; height: 18px; vertical-align: -3px; margin-left: 6px; }
.foot-guide a, .menu-guide a { white-space: nowrap; }
.menu-guide { margin: 10px 2px 0; font-size: 14px; color: var(--text-soft); }

/* 설정 바로 가기 링크(2026-11-16): 글 속 "설정". 밑줄, 강조색, 누르기 쉬운 크기. 다크 모드는 --accent 가 밝은 파랑으로 바뀜 */
.inline-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-weight: 700; padding: 8px 3px; margin: -8px -1px; min-height: 24px; cursor: pointer; background: none; border: 0; border-radius: 6px; }
.inline-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#secAccount.hl, .row.hl { animation: secHl 2.2s ease both; border-radius: 10px; }
@keyframes secHl { 0%, 55% { background: var(--hint-area); box-shadow: 0 0 0 6px var(--hint-area); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }

/* 판 번호(2026-11-16 사장님): 판 바로 아래 왼쪽에 작은 회색 글씨. "이 판이 이상해요" 알릴 때 화면만 보고 어떤 판인지 알게. 누르기를 막지 않음 */
.board-wrap { margin-bottom: 18px; }
@media (min-width: 900px) and (min-height: 560px) { .board-wrap { margin: 0 0 18px; } }
.pz-id { position: absolute; left: 2px; top: calc(100% + 2px); height: 14px; font-size: 11px; line-height: 14px; color: var(--text-soft); font-variant-numeric: tabular-nums; letter-spacing: .02em; pointer-events: none; user-select: text; white-space: nowrap; }
.mini-id { text-align: center; font-size: 11px; line-height: 14px; margin-top: 6px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
/* 웹 새 판 알림(11-16, 0.3.2): 판을 푸는 중이 아닐 때만 맨 위 가운데 작은 띠. 판과 숫자 단추를 가리지 않음 */
.web-new { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.web-new button { padding: 6px 12px; border-radius: 999px; background: var(--accent-text); color: var(--accent); font-weight: 700; }

/* 판 화면 아래 소개 글(2026-11-16, 0.3.4, 웹만): Numoja 소개, 규칙 요약, 글 페이지 링크. 판 푸는 데 방해되지 않게 판과 숫자 아래, 스크롤해야 보인다.
   한국어와 영어 글이 다 들어 있고 화면 언어(html lang)에 맞는 하나만 보인다 */
.intro { width: 100%; max-width: 640px; margin: 176px 0 8px; padding: 18px 4px 0; border-top: 1px solid var(--line); color: var(--text); font-size: 14.5px; line-height: 1.7; }
.intro-lang { display: none; }
:root[lang="ko"] .intro-lang[data-lang="ko"], :root[lang="en"] .intro-lang[data-lang="en"] { display: block; }
.intro h2 { margin: 0 0 8px; font-size: 19px; }
.intro h3 { margin: 18px 0 4px; font-size: 16px; }
.intro p { margin: 0 0 8px; }
.intro .intro-links { margin-top: 14px; color: var(--text-soft); }
.intro a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
:root.big .intro { font-size: 16.5px; }
/* 11-18 사장님 지적(PC): 판 아래 빈칸이 너무 크고(예전 위 여백 max(96px, 100dvh - 판 - 32px) 가 화면 높이만큼 밀어냄), 소개 글이 왼쪽에만 붙어 화면이 둘로 갈라져 보였다
   (소개 칸이 양쪽 빈 여백 열까지 네 칸 전체에 걸쳐 있는데 justify-self: start + max-width 820 이라 페이지 왼쪽 끝부터 820 만 차지).
   넓은 화면: 소개 칸은 판 왼쪽 끝부터 오른쪽 열 오른쪽 끝까지(위 내용과 같은 폭, 구분선도 그 폭), 글은 가운데 최대 880. 판(또는 판 끝) 아래 40px 뒤에 바로 이어짐 */
@media (min-width: 900px) and (min-height: 560px) {
  .intro { grid-area: intro; grid-column: 2 / 4; justify-self: stretch; width: auto; max-width: none; margin: 40px 0 8px; padding: 22px 0 0; }
  .intro-lang { max-width: 880px; margin: 0 auto; }
  /* 소개 글이 판 바로 아래로 오면서 큰 화면(2297x1383, 2560x1440)은 페이지가 화면보다 짧아질 수 있다.
     그때 (1) 그리드가 남는 높이를 줄마다 나눠 판이 아래로 밀리고 (2) 세로 스크롤 막대가 플레이 때 없고 판 끝 때 생겨 판이 옆으로 움직였다.
     줄은 위에서부터 채우고(남는 칸은 바닥글 아래), 스크롤 막대 자리는 늘 잡아 둔다(플레이 = 판 끝 판 자리 0px 유지) */
  .app { align-content: start; }
  html { scrollbar-gutter: stable; }
}

/* 2026-11-16 사장님 지시: 넓은 화면(1200px 이상)은 오른쪽 열을 넓혀 단추 줄 글자("오늘 도전 11월 16일", "별 2, 1일 23시간 남음")가 다 보이게. 좁은 화면은 그대로 줄임 */
@media (min-width: 1200px) and (min-height: 560px) { .app { --side: 480px; } }

/* ---------- 판 끝 카드를 화면 안에 (2026-11-17 사장님 지시, 0.3.5) ----------
   판 끝 카드(제목, 큰 점수, 작은 판, 판 번호, 한 줄 기록, 정산, 최고 점수, 별, 새 상, 설정 링크, 단추)가 세로 스크롤 없이 화면 안에 다 들어가게.
   app.js fitFinish 가 쓸 수 있는 높이(--fin-avail)를 재고, 넘치면 차례로 fit1(여백 줄임), fit2(작은 판을 제목 옆으로, 최고 점수 두 줄 두 칸), fit3(정산 한 줄, 글자 조금 작게)를 붙인다.
   작은 판 크기는 --mini. 그래도 넘치면(큰 글씨) fit-scroll 로 카드 안에서만 스크롤. 소개 글은 카드 아래, 페이지 스크롤로 그대로. 앱 app.gd fit_finish 와 같은 차례 */
.fin-pane { min-height: var(--fin-avail, 0px); }
.fin-pane:has(.streak-card) { min-height: var(--fin-avail, 440px); }
.fin-mini { width: var(--mini, 168px); }
.mini-grid span { font-size: calc((var(--mini, 168px) - 16px) * .0689); }
.t-row .ts { display: none; }
@media (min-width: 900px) and (min-height: 560px) {
  /* 넓은 화면(11-17 오후, 사장님 "웹은 자리를 못 잡은 모양"): 카드가 화면 높이를 다 채우면 내용 밖 빈 햇살이 크다.
     카드는 판 자리 크기(--board)와 내용 중 큰 쪽만큼만, 내용은 가로 900px 안에서 가운데, 햇살 중심은 내용 가운데.
     남는 높이(--fin-rest, app.js fitFinish)는 카드 아래 여백으로 넘겨 소개 글은 그대로 첫 화면 밖(스크롤해야 보임). */
  .fin-pane { min-height: min(var(--fin-avail, var(--board)), var(--board)); margin-bottom: calc(18px + var(--fin-rest, 0px)); }
  .fin-pane:has(.streak-card) { min-height: min(var(--fin-avail, 440px), max(var(--board), 440px)); }
  .fin-wrap { max-width: 900px; margin: 0 auto; }
  .fin-left { align-self: center; }
  .fin-sun { background: radial-gradient(circle at 50% 50%, var(--sun-glow), transparent 62%), repeating-conic-gradient(from 0deg at 50% 50%, var(--sun-a) 0deg 7.5deg, var(--sun-b) 7.5deg 15deg); }
  .fin-wrap { grid-template-columns: var(--mini, 300px) minmax(0, 1fr); }
  .fin-mini { width: var(--mini, 300px); }
  .mini-grid span { font-size: calc((var(--mini, 300px) - 24px) * .0652); }
}
/* fit1: 여백 줄이기 */
.fin-pane.fit1 { padding: 10px 12px 12px; }
.fit1 .fin-wrap { gap: 8px; row-gap: 8px; }
.fit1 .fin-left { gap: 6px; }
.fit1 .fin-mini { padding: 6px; }
.fit1 .mini-id { margin-top: 3px; }
.fit1 .fin-card { padding: 10px 14px 12px; }
.fit1 .fin-card .bests-title { margin: 6px 0 0; }
.fit1 .fin-card .bests { margin: 0 0 4px; }
.fit1 .fin-card .bests .best { padding: 5px 2px; }
.fit1 .fin-card .fin-line, .fit1 .fin-card .sub-line { margin: 3px 0; line-height: 1.4; }
.fit1 .rank-box { margin: 4px 0; padding: 6px 10px; }
.fit1 .fin-btns { margin-top: 8px; }
.fit1 .fin-btns button { padding: 10px 14px; }
.fit1 .streak-card { padding: 14px 16px; }
.fit1 .flame { width: 84px; height: 98px; margin: 0 auto 6px; }
.fit1 .flame-n { top: 52px; font-size: 31px; }
.fit1 .streak-keep { margin: 2px 0 10px; }
@media (min-width: 900px) and (min-height: 560px) { .fin-pane.fit1 { padding: 14px 20px; margin-top: 6px; } }
/* fit2: 최고 점수 네 줄을 두 줄 두 칸으로, 휴대폰은 작은 판을 제목과 큰 점수 왼쪽으로 */
.fit2 .fin-card .bests { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.fit2 .fin-card .bests .best:nth-child(3) { border-bottom: 0; }
.fit2 .fin-card .bests .best span { font-size: 13.5px; }
.fit2 .tally { margin-top: 4px; padding-top: 4px; }
.fit2 .wd i { width: 26px; height: 26px; }
.fit2 .flame { width: 66px; height: 77px; }
.fit2 .flame-n { top: 41px; font-size: 25px; }
.fit2 .streak-title { font-size: 21px; }
@media (max-width: 899px), (max-height: 559px) {
  .fit2 .fin-wrap { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "left head" "card card"; column-gap: 12px; align-items: center; justify-items: stretch; }
  .fit2 .fin-left { width: auto; }
  .fit2 .fin-head { text-align: left; }
  .fit2 .fin-head .score-big { justify-content: flex-start; }
  .fit2 .fin-praise { font-size: 20px; }
  .fit2 .fin-head .score-big b { font-size: 52px; }
  .fit2 .fin-head .score-big .ic { width: 38px; height: 38px; }
}
/* fit3: 정산 줄을 한 줄로(짧은 이름), 글자와 단추 조금 작게 */
.fit3 .tally { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 0; }
.fit3 .t-row { gap: 4px; padding: 1px 0; }
.fit3 .t-row .tl { display: none; }
.fit3 .t-row .ts { display: inline; }
.fit3 .fin-card .bests .best { padding: 3px 2px; }
.fit3 .fin-btns { margin-top: 6px; gap: 6px; }
.fit3 .fin-btns button { padding: 8px 12px; }
.fit3 .fin-praise { font-size: 18px; }
.fit3 .fin-head .score-big b { font-size: 48px; }
.fit3 .fin-sub { font-size: 13px; }
.fit3 .streak-keep { font-size: 13px; }
.fit3 .streak-card .primary { padding: 10px 14px; }
/* 그래도 안 들어가면(큰 글씨, 아주 낮은 창) 카드 안에서만 스크롤 */
.fin-pane.fit-scroll { height: var(--fin-avail); overflow-y: auto; overscroll-behavior: contain; align-items: flex-start; }

/* 숫자 단추 위 안내 칸(11-17, 0.3.5): 글이 없으면 칸을 접어 빈 상자가 보이지 않게. 글이 생기면 부드럽게 펼침 */
.msg { transition: min-height .18s ease, padding .18s ease; }
.msg:empty { min-height: 8px; padding-top: 0; padding-bottom: 0; background: transparent; }
@media (min-width: 900px) and (min-height: 560px) { .side > .msg:empty { min-height: 8px; } }
@media (prefers-reduced-motion: reduce) { .msg { transition: none; } }
/* 판 끝에서는 축하 알림 줄(판 위 알림 자리)을 접어 카드 자리를 넓힘(11-17) */
@media (max-width: 899px), (max-height: 559px) { .app.finishing .status { display: none; } }
/* fit2 최고 점수 두 칸: 이름은 왼쪽, 값은 오른쪽, 오른 만큼(+값)은 값 아래 */
.fit2 .fin-card .bests .best { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; row-gap: 0; align-items: center; }
.fit2 .fin-card .bests .best span { grid-column: 1; grid-row: 1 / span 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fit2 .fin-card .bests .best b { grid-column: 2; grid-row: 1; min-width: 0; line-height: 1.2; }
.fit2 .fin-card .bests .best i.gain { grid-column: 2; grid-row: 2; text-align: right; font-size: 11.5px; line-height: 1.2; }
/* fit2 단추 둘을 한 줄로, fit3 순위 칸의 [순위표 보기]를 글 오른쪽으로 */
.fit2 .fin-btns button { flex-basis: 100px; padding-left: 8px; padding-right: 8px; }
.fit3 .rank-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 5px 8px 5px 10px; }
.fit3 .rank-box > * { grid-column: 1; }
.fit3 .rank-box .see-btn { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 6px 9px; }
/* fit2 휴대폰: 작은 판은 104px 로 고정(제목 옆, 큰 점수가 잘리지 않게), 트로피 조금 작게 */
@media (max-width: 899px), (max-height: 559px) {
  .fit2 .fin-mini { width: 104px; padding: 5px; border-radius: 10px; }
  .fit2 .mini-grid span { font-size: 6.4px; }
  .fit2 .mini-id { font-size: 10px; line-height: 12px; }
  .fit2 .fin-head { min-width: 0; }
  .fit2 .fin-head .score-big { gap: 4px; }
  .fit2 .fin-head .score-big b { font-size: 48px; }
  .fit2 .fin-head .score-big .ic { width: 32px; height: 32px; }
}

/* ---------- 넓은 화면 새 디자인 (2026-11-17 사장님 시안 "웹 화면은 두번째 전달한 이미지처럼") ----------
   PC, 태블릿 가로(900px 이상, 높이 560px 이상)만. 휴대폰 크기 웹과 앱은 그대로.
   1) 머리줄: 메뉴, 로고, [홈] [랭킹] [통계] [설정](아이콘과 글자, 지금 칸은 파란 알약), 오른쪽 계정 동그라미. 연한 흰 바탕을 화면 끝까지. 톱니 단추는 숨김.
      판 끝에서는 단추 줄(오늘 도전, 이벤트, 상)이 계정 단추 왼쪽으로 온다(app.js placeChips). 판 화면에서는 오른쪽 열 맨 위 그대로.
   2) 난이도 줄: "난이도" 굵은 글자 + 알약 단추 넷(지금 난이도는 파란 채움).
   3) 판 끝: 햇살 없이 밝은 바탕, 가로로 긴 파란 띠(그림, 제목, 큰 점수, 세 칸), 흰 카드 둘(다 푼 판, 점수), 맨 아래 단추 둘(app.js finCardWide). */
.topnav, .top-chips, .acct-btn { display: none; }
.streak-top { display: contents; }
@media (min-width: 900px) and (min-height: 560px) {
  :root { --page: #f3f6fb; --hdr: rgba(255, 255, 255, .96); --hdr-line: #e2e7f0; --pill-line: #d5dce8; --band-a: #0b6bd8; --band-b: #0a46b4; --band-c: #083aa0;
    --total-bg: #dbe8fc; --best-bg: #dcf5e3; --best-fg: #1c7a43; --nav-on: #dde9fc; --up: #b6f5c6; --box-shadow: 0 4px 22px rgba(16, 34, 90, .07); }
  :root[data-theme="dark"] { --page: #0f1420; --hdr: #161c29; --hdr-line: #283043; --pill-line: #364055; --band-a: #1a4fa8; --band-b: #12388a; --band-c: #0b2560;
    --total-bg: #20345f; --best-bg: #1b3a29; --best-fg: #84d9a5; --nav-on: #22365f; --up: #9be8b2; --box-shadow: 0 4px 22px rgba(0, 0, 0, .35); }
  body { background: var(--page); }
  .app { --gut: clamp(16px, 3.6vw, 56px); --board: min(calc(100dvh - 232px), 620px);
    width: 100%; max-width: 1552px; margin: 0 auto; padding: 0 var(--gut);
    grid-template-columns: minmax(0, 1fr) var(--board) calc(var(--side) + 28px) minmax(0, 1fr); column-gap: 0;
    grid-template-areas: "top top top top" "diffs diffs diffs diffs" "status status status status" ". board side ." "intro intro intro intro" "foot foot foot foot"; }
  .side { width: auto; padding-left: 28px; }
  /* 머리줄 */
  .top { height: 60px; gap: 6px; margin-bottom: 8px; background: var(--hdr); box-shadow: 0 1px 0 var(--hdr-line), 0 0 0 100vmax var(--hdr); clip-path: inset(0 -100vmax -1px); }
  .top > .icon-btn { flex: none; } /* 11-19: 판 끝에서 단추 줄이 머리줄로 올라와도 메뉴 단추가 줄어 로고가 밀리지 않게 */
  .top .brand { flex: none; margin: 0 clamp(8px, 2vw, 34px) 0 6px; }
  .top .brand img { height: 32px; }
  .topnav { flex: none; display: flex; align-items: center; gap: clamp(2px, .6vw, 10px); min-width: 0; }
  .nav-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 clamp(10px, 1.3vw, 22px); border-radius: 999px; font-size: 15.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
  .nav-btn svg { width: 20px; height: 20px; }
  .nav-btn:hover { background: var(--surface-2); }
  .nav-btn.on { background: var(--nav-on); color: var(--accent); }
  #btnSettings { display: none; }
  .acct-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-left: 8px; border-radius: 50%; border: 1px solid var(--pill-line); background: var(--surface); color: var(--text); }
  .acct-btn:hover { background: var(--surface-2); }
  .acct-btn svg { width: 24px; height: 24px; }
  .top-chips { display: flex; flex: 0 1 auto; min-width: 0; }
  .top-chips > .chips { width: auto; min-width: 0; margin: 0; padding: 0; gap: 8px; }
  .top-chips .chip-btn { height: 40px; padding: 0 16px; gap: 8px; font-size: 15px; font-weight: 700; border-color: var(--pill-line); background: var(--surface); }
  .top-chips .chip-btn .ic { width: 19px; height: 19px; }
  /* 난이도 줄 */
  .diffs { height: auto; padding: 4px 0 6px; gap: 10px; font-size: 15.5px; }
  .diffs-label { margin-right: 8px; color: var(--text); font-size: 17px; font-weight: 800; }
  .diffs-label .colon { display: none; }
  .diff-opt { height: 38px; padding: 0 clamp(16px, 1.7vw, 26px); border-radius: 999px; border: 1px solid var(--pill-line); background: var(--surface); color: var(--text); font-weight: 700; }
  .diff-opt:hover { background: var(--surface-2); }
  .diff-opt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 3px 10px rgba(10, 70, 180, .25); }
  /* 판 끝 자리 */
  /* 11-17 밤 사장님 지시 "플레이 할 때랑 플레이 끝났을 때랑 왼쪽 게임판을 동일한 위치에": 판 끝 자리는 플레이 때 판과 오른쪽 열 두 칸(". fin fin .")을 그대로 쓴다.
     위 줄들(머리줄, 난이도 줄, 알림 줄)은 같은 높이로 남겨(알림 줄은 숨기지 않고 안 보이게만) 판 위 끝이 같고, 왼쪽 판은 --board 크기로 같은 자리.
     띠, 점수 카드, 단추는 오른쪽 열(.fin-right, 플레이 때 숫자 단추 자리, 폭 --side) 안. */
  .app.finishing { grid-template-areas: "top top top top" "diffs diffs diffs diffs" "status status status status" ". fin fin ." "intro intro intro intro" "foot foot foot foot"; }
  .app.finishing .side { display: none; }
  .app.finishing .status { visibility: hidden; }
  .app .fin-pane { grid-area: fin; display: block; min-width: 0; min-height: 0; margin: 0 0 18px; padding: 0; border-radius: 0; overflow: visible; align-self: start; }
  .app .fin-pane.fit1 { padding: 0; margin-top: 0; }
  .app .fin-pane .fin-sun { display: none; }
  .app .fin-wide { display: grid; grid-template-columns: var(--board) minmax(0, 1fr); grid-template-areas: none; gap: 0; align-items: start; width: 100%; max-width: none; margin: 0; }
  /* 파란 띠(오른쪽 열 맨 위, 11-17 밤): 윗줄 그림, 제목과 작은 글, 큰 점수. 아랫줄 세 칸(최고 기록, 이번 주, 이번 달). 오른쪽 열이 좁으면(태블릿 가로) 큰 점수는 제목 아래 */
  .app .fin-wide .fin-band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic title score" "cells cells cells"; align-items: center; column-gap: 14px; row-gap: 0; min-height: 0; padding: 14px 20px 12px; border-radius: 20px; color: #fff; text-align: left;
    background: radial-gradient(90% 160% at 12% 0%, rgba(255, 255, 255, .15), transparent 60%), linear-gradient(100deg, var(--band-a), var(--band-b) 55%, var(--band-c)); box-shadow: 0 10px 26px rgba(10, 70, 180, .2); }
  .band-ic { grid-area: ic; flex: none; display: grid; place-items: center; width: 56px; height: 56px; }
  .band-ic svg { width: 100%; height: 100%; }
  .band-ic .ic-crown, .band-ic .ic-star { width: 78%; height: 78%; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .25)); }
  .band-title { grid-area: title; min-width: 0; }
  .app .fin-wide .fin-band .fin-praise { margin: 0; font-size: 22px; line-height: 1.2; color: #fff; text-shadow: none; }
  .app .fin-wide .fin-band .fin-sub { margin: 3px 0 0; font-size: 13px; color: rgba(255, 255, 255, .85); text-shadow: none; }
  .app .fin-wide .fin-band .score-big { grid-area: score; justify-content: flex-end; margin: 0; }
  .app .fin-wide .fin-band .score-big b { font-size: 54px; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 3px 12px rgba(0, 0, 30, .22); }
  .app .fin-wide .fin-band .score-big.counting b { color: #ffd814; }
  .band-cells { grid-area: cells; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 0 0; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .25); }
  .band-cell { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: 2px 12px; border-left: 1.5px solid rgba(255, 255, 255, .32); }
  .band-cell:first-child { padding-left: 2px; border-left: 0; }
  .band-k { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: rgba(255, 255, 255, .92); white-space: nowrap; }
  .band-k .ic { flex: none; width: 18px; height: 18px; color: #fff; }
  .band-cell b { padding-left: 24px; font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .band-cell b.up { color: var(--up); }
  @container (max-width: 420px) {
    .app .fin-wide .fin-band { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic title" "ic score" "cells cells"; padding: 12px 16px 10px; column-gap: 12px; }
    .app .fin-wide .fin-band .score-big { justify-content: flex-start; margin-top: 2px; }
    .app .fin-wide .fin-band .score-big b { font-size: 48px; }
    .app .fin-wide .fin-band .fin-praise { font-size: 20px; }
    .band-ic { width: 48px; height: 48px; }
    .band-cell { padding: 2px 8px; }
    .band-k { font-size: 12.5px; gap: 4px; }
    .band-k .ic { width: 16px; height: 16px; }
    .band-cell b { padding-left: 0; font-size: 19px; }
  }
  /* 왼쪽 판: 플레이 판(#board)과 같은 크기, 같은 선, 같은 글자 크기. 판 번호도 플레이 판 번호(.pz-id)와 같은 자리 */
  .fin-wide > *, .fin-right > * { grid-area: auto; }
  .app .fin-wide .fin-left { position: relative; display: block; align-self: start; width: var(--board); min-width: 252px; padding: 0 0 18px; gap: 0; } /* 아래 18px: 판 번호(판 아래 2~16px) 자리, 플레이 판 아래 여백과 같음 */
  .app .fin-wide .fin-mini { position: relative; width: var(--board); min-width: 252px; padding: 0; background: none; border-radius: 0; box-shadow: none; }
  .app .fin-wide .mini-grid { width: 100%; height: var(--board); min-height: 252px; aspect-ratio: auto; grid-template-rows: repeat(9, 1fr); border: 2px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
  .app .fin-wide .mini-grid span { font-size: calc((max(var(--board), 252px) - 4px) * .064); font-weight: 700; color: var(--given); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .app .fin-wide .mini-grid span.u { color: var(--user); font-weight: 600; }
  .app .fin-wide .mini-grid span:nth-child(9n+3), .app .fin-wide .mini-grid span:nth-child(9n+6) { border-right: 2px solid var(--line-strong); }
  .app .fin-wide .mini-grid span:nth-child(9n) { border-right: 0; }
  .app .fin-wide .mini-grid span:nth-child(n+19):nth-child(-n+27), .app .fin-wide .mini-grid span:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--line-strong); }
  .app .fin-wide .mini-grid span:nth-child(n+73) { border-bottom: 0; }
  .app .fin-wide .mini-id, .app .fin-pane.fit1 .fin-wide .mini-id { position: absolute; left: 2px; top: calc(100% + 2px); height: 14px; margin: 0; font-size: 11px; line-height: 14px; text-align: left; color: var(--text-soft); white-space: nowrap; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
  .app .fin-wide .fin-ad { margin-top: 26px; }
  /* 오른쪽 열: 띠, 점수 카드, 단추. 아래 끝은 판 아래 끝에 맞춘다(내용이 짧으면 최고 점수 줄 사이를 벌림) */
  .fin-right { container-type: inline-size; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: var(--board); padding-left: 28px; }
  .fin-right-streak { justify-content: center; align-items: stretch; }
  .app .fin-pane .fin-right-streak .streak-card { width: 100%; }
  .app .fin-wide .fin-box, .app .fin-wide .fin-card { background: var(--surface); color: var(--text); border: 1px solid var(--hdr-line); border-radius: 20px; box-shadow: var(--box-shadow); }
  .app .fin-wide .fin-card { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px 20px; }
  .fin-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
  .app .fin-wide .fin-stats { display: flex; align-items: center; flex: 1 1 auto; margin: 0 0 0 2px; font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
  .fin-stats .ic { width: 20px; height: 20px; margin-right: 8px; color: var(--text); }
  .fin-stats .sep { display: inline-block; width: 1.5px; height: 16px; margin: 0 12px; font-size: 0; background: var(--line); }
  .app .fin-wide .badge-best { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 auto; padding: 6px 12px; border-radius: 999px; background: var(--best-bg); color: var(--best-fg); font-size: 13px; font-weight: 800; white-space: nowrap; }
  .badge-best .ic { width: 17px; height: 17px; }
  .tally-box { overflow: hidden; border: 1px solid var(--hdr-line); border-radius: 14px; box-shadow: 0 2px 8px rgba(16, 34, 90, .05); }
  .app .fin-wide .tally { margin: 0; padding: 9px 16px 5px; border-top: 0; }
  .app .fin-wide .t-row { padding: 3px 0; font-size: 14.5px; color: var(--text-soft); }
  .app .fin-wide .t-row b { font-size: 16px; font-weight: 800; }
  .tally-box > .sub-line { margin: 0; padding: 8px 16px 4px; }
  .t-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: var(--total-bg); color: var(--given); }
  .t-total span { font-size: 16px; font-weight: 800; }
  .t-total b { font-size: 26px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .app .fin-wide .fin-card .bests { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0 2px; }
  .app .fin-wide .fin-card .bests .best { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(64px, auto) minmax(70px, auto); align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--hdr-line); background: none; text-align: left; }
  .app .fin-wide .fin-card .bests .best:last-child { border-bottom: 0; }
  .app .fin-wide .fin-card .bests .best > * { grid-column: auto; grid-row: auto; }
  .app .fin-wide .fin-card .bests .best .ic { width: 20px; height: 20px; color: var(--text-soft); }
  .app .fin-wide .fin-card .bests .best span { font-size: 15.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app .fin-wide .fin-card .bests .best i.gain { font-size: 15px; line-height: 1.2; font-weight: 800; text-align: right; }
  .app .fin-wide .fin-card .bests .best b { min-width: 0; font-size: 17px; font-weight: 800; line-height: 1.2; color: var(--accent); text-align: right; }
  .fin-extra { display: flex; flex-direction: column; gap: 5px; }
  .app .fin-wide .fin-extra .fin-line { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 14px; }
  .fin-extra .fin-line .ic { flex: none; width: 18px; height: 18px; }
  .fin-extra .fin-line.ev .ic { color: #f5b400; }
  .app .fin-wide .fin-extra .sub-line { margin: 0; font-size: 13px; line-height: 1.45; }
  .app .fin-wide .fin-extra .rank-box { margin: 0; }
  @container (max-width: 420px) {
    .app .fin-wide .fin-card { padding: 14px 16px; }
    .app .fin-wide .fin-stats { font-size: 15px; }
    .fin-stats .sep { margin: 0 9px; }
    .app .fin-wide .fin-card .bests .best { grid-template-columns: 20px minmax(0, 1fr) auto minmax(56px, auto); gap: 8px; }
    .app .fin-wide .fin-card .bests .best span { font-size: 14.5px; }
  }
  /* 단추 둘: 오른쪽 열 맨 아래 나란히 */
  .app .fin-wide .fin-btns { display: flex; flex-wrap: nowrap; justify-content: center; gap: 12px; width: 100%; margin: 0; }
  .app .fin-wide .fin-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1 1 0; min-width: 0; height: 52px; padding: 0 12px; border: 1px solid var(--pill-line); border-radius: 14px; background: var(--surface); color: var(--text); font-size: 17px; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 8px rgba(16, 34, 90, .06); }
  .app .fin-wide .fin-btns button:hover { background: var(--surface-2); }
  .app .fin-wide .fin-btns .primary, .app .fin-wide .fin-btns .primary:hover { background: linear-gradient(180deg, #0b5fd0, #0a46b4); border-color: #0a46b4; color: #fff; box-shadow: 0 6px 18px rgba(10, 70, 180, .28); }
  :root[data-theme="dark"] .app .fin-wide .fin-btns .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
  .fin-btns svg { flex: none; width: 22px; height: 22px; }
  .fin-btns .ic-play { width: 20px; height: 20px; }
  @container (max-width: 420px) { .app .fin-wide .fin-btns button { font-size: 15px; gap: 6px; padding: 0 8px; } .fin-btns svg { width: 19px; height: 19px; } }
  /* 줄임 단계(app.js fitFinish 넓은 화면): 오른쪽 열이 화면 아래로 넘칠 때만. 왼쪽 판은 그대로 */
  .app .fin-pane.fit1 .fin-right { gap: 10px; }
  .app .fin-pane.fit1 .fin-wide .fin-band { padding: 10px 18px 9px; }
  .app .fin-pane.fit1 .band-cells { margin-top: 8px; padding-top: 7px; }
  .app .fin-pane.fit1 .fin-wide .fin-card { gap: 9px; padding: 12px 18px; }
  .app .fin-pane.fit1 .fin-wide .fin-card .bests .best { padding: 5px 2px; }
  .app .fin-pane.fit1 .fin-wide .t-total { padding-top: 6px; padding-bottom: 6px; }
  .app .fin-pane.fit1 .fin-wide .fin-btns button { height: 48px; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best { grid-template-columns: 18px minmax(0, 1fr) auto auto; gap: 6px; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best:nth-child(3) { border-bottom: 0; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best .ic { width: 18px; height: 18px; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best span, .app .fin-pane.fit2 .fin-wide .fin-card .bests .best i.gain { font-size: 13.5px; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best b { font-size: 15px; }
  .app .fin-pane.fit3 .fin-right { gap: 8px; }
  .app .fin-pane.fit3 .fin-wide .fin-band { padding: 8px 16px 7px; }
  .app .fin-pane.fit3 .band-ic { width: 42px; height: 42px; }
  .app .fin-pane.fit3 .fin-wide .fin-band .score-big b { font-size: 48px; }
  .app .fin-pane.fit3 .fin-wide .fin-band .fin-praise { font-size: 19px; }
  .app .fin-pane.fit3 .band-cells { margin-top: 6px; padding-top: 5px; }
  .app .fin-pane.fit3 .band-cell { gap: 2px; }
  .app .fin-pane.fit3 .band-cell b { font-size: 18px; }
  .app .fin-pane.fit3 .fin-wide .fin-card { gap: 7px; padding: 10px 16px; }
  .app .fin-pane.fit3 .fin-wide .tally { padding: 6px 14px 3px; }
  .app .fin-pane.fit3 .fin-wide .t-total { padding: 4px 14px; }
  .app .fin-pane.fit3 .fin-wide .t-total b { font-size: 22px; }
  .app .fin-pane.fit3 .fin-wide .fin-card .bests .best { padding: 3px 2px; }
  .app .fin-pane.fit3 .fin-wide .fin-btns button { height: 44px; font-size: 16px; }
  /* 그래도 안 들어가면(큰 글씨 등) 점수 카드 안에서만 스크롤, 띠와 단추는 늘 보임 */
  .app .fin-pane.fit-scroll { height: auto; overflow: visible; }
  .app .fin-pane.fit-scroll .fin-right { height: var(--fin-avail); min-height: 0; }
  .app .fin-pane.fit-scroll .fin-wide .fin-card { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  /* 일일 도전 연속 축하 장면: 오른쪽 열 가운데 흰 카드, 위쪽은 판 끝 띠와 같은 파란 칸(제목, 불꽃). 왼쪽 판은 그대로 */
  .app .fin-pane:has(.streak-card) { display: block; min-height: 0; }
  .app .fin-pane .streak-card { width: min(100%, 440px); padding: 0 0 22px; overflow: hidden; border: 1px solid var(--hdr-line); box-shadow: 0 10px 30px rgba(16, 34, 90, .14); }
  .app .fin-pane .streak-top { display: block; margin-bottom: 14px; padding: 22px 20px 12px; color: #fff;
    background: radial-gradient(90% 160% at 12% 0%, rgba(255, 255, 255, .15), transparent 60%), linear-gradient(100deg, var(--band-a), var(--band-b) 55%, var(--band-c)); }
  .app .fin-pane .streak-top .streak-title { color: #fff; }
  .app .fin-pane .streak-card > :not(.streak-top) { margin-left: 22px; margin-right: 22px; }
  .app .fin-pane .streak-card > .primary { width: calc(100% - 44px); }
  .app .fin-pane.fit1 .streak-card { padding: 0 0 14px; }
  .app .fin-pane.fit1 .streak-top { padding: 14px 16px 8px; margin-bottom: 8px; }
  /* 게임 끝 창(실수 제한): 같은 디자인 말씨. 위 파란 선, 보조 단추는 흰 바탕 테두리 */
  .modal.go .sheet { border-top: 6px solid var(--accent); }
  .modal.go .go-btns button:not(.primary) { background: var(--surface); border: 1px solid var(--pill-line); }
}
@media (min-width: 900px) and (min-height: 560px) {
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > * { grid-column: auto; grid-row: auto; text-align: left; }
  .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > b, .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > i.gain { text-align: right; }
  /* 오른쪽 카드가 왼쪽 판보다 짧으면 최고 점수 줄 사이를 고르게 벌린다(시안처럼 카드 아래 빈칸 없이) */
  .app .fin-wide .fin-card .bests { flex: 1 1 auto; justify-content: space-evenly; }
}
/* 좁은 오른쪽 열(태블릿 가로)에서 최고 점수 두 칸(fit2): 그림을 빼고 이름 옆에 최고 점수, 그 아래 +값(이름이 잘리지 않게) */
@media (min-width: 900px) and (min-height: 560px) {
  @container (max-width: 420px) {
    .app .fin-pane.fit2 .fin-wide .fin-card .bests .best { grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; row-gap: 0; }
    .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > .ic { display: none; }
    .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > span { grid-column: 1; grid-row: 1 / span 2; }
    .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > b { grid-column: 2; grid-row: 1; }
    .app .fin-pane.fit2 .fin-wide .fin-card .bests .best > i { grid-column: 2; grid-row: 2; font-size: 12px; text-align: right; }
  }
}
/* 큰 글씨(넓은 화면 판 끝): 글자를 한 단계 키움. 안 들어가면 fitFinish 가 줄임 단계, 그래도 넘치면 오른쪽 카드 안 스크롤 */
@media (min-width: 900px) and (min-height: 560px) {
  :root.big .app .fin-wide .fin-stats { font-size: 17.5px; }
  :root.big .app .fin-wide .t-row { font-size: 16px; }
  :root.big .app .fin-wide .fin-card .bests .best span, :root.big .app .fin-wide .fin-card .bests .best i.gain { font-size: 17px; }
  :root.big .app .fin-wide .fin-card .bests .best b { font-size: 19px; }
  :root.big .app .fin-wide .fin-extra .fin-line { font-size: 15.5px; }
  :root.big .app .fin-wide .fin-extra .sub-line, :root.big .app .fin-wide .fin-band .fin-sub { font-size: 14.5px; }
  :root.big .band-k { font-size: 14.5px; }
  :root.big .app .fin-wide .mini-grid span { font-size: calc((max(var(--board), 252px) - 4px) * .074); }
  :root.big .nav-btn, :root.big .diff-opt { font-size: 17px; }
}
/* 숨긴 판 끝 자리는 넓은 화면에서도 자리를 차지하지 않게 */
.app .fin-pane[hidden] { display: none; }

/* ---------- 언어 고르기 (2026-11-18 사장님 지시) ----------
   머리줄 오른쪽, 계정 단추 바로 왼쪽. 휴대폰 크기는 지구본 아이콘만(40x40, 톱니 단추 왼쪽), 넓은 화면은 지구본 + 지금 언어 알약(계정 단추와 같은 44 높이, 같은 테두리).
   메뉴는 머리줄 밖(.lang-menu, position fixed)에 있고 app.js 가 단추 바로 아래 오른쪽 끝에 맞춰 띄운다. Esc, 바깥 누름, 스크롤, 창 크기 바꿈에 닫힘 */
.lang-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--text); }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: var(--surface-2); }
.lang-btn .lang-cur { display: none; }
.lang-menu { position: fixed; z-index: 70; min-width: 156px; padding: 6px; border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.lang-menu[hidden] { display: none; }
.lang-menu button { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 15px; text-align: left; }
.lang-menu button:hover, .lang-menu button:focus-visible { background: var(--surface-2); }
.lang-menu button[aria-checked="true"] { color: var(--accent); font-weight: 700; }
.lang-menu button[aria-checked="true"]::after { content: ""; width: 7px; height: 12px; margin: -3px 3px 0 0; border: solid currentColor; border-width: 0 2.2px 2.2px 0; transform: rotate(45deg); }
@media (min-width: 900px) and (min-height: 560px) {
  .lang-btn { display: inline-flex; align-items: center; gap: 7px; width: auto; height: 44px; margin-left: 8px; padding: 0 16px 0 13px; border-radius: 999px; border: 1px solid var(--pill-line); background: var(--surface); font-size: 15px; font-weight: 700; white-space: nowrap; }
  .lang-btn:hover, .lang-btn[aria-expanded="true"] { background: var(--surface-2); }
  .lang-btn svg { width: 20px; height: 20px; }
  .lang-btn .lang-cur { display: inline; }
}
/* 넓은 화면이지만 1280 미만(11-19, 1024 en/ko, 1200 en 에서 재서 정함): 머리줄이 좁아 "🌐 English"가 단추 줄 글(Awards)을 "Av…"로 자르던 것. 지구본만 보이고 언어 이름은 aria-label, title 로 */
@media (min-width: 900px) and (max-width: 1279px) and (min-height: 560px) {
  .lang-btn { width: 44px; padding: 0; justify-content: center; }
  .lang-btn .lang-cur { display: none; }
  /* 머리줄이 좁아 오늘 도전 글이 … 로 잘리던 것도 간격을 줄여 한 줄에 다 보이게 */
  .top .brand { margin: 0 8px 0 4px; }
  .nav-btn { padding: 0 9px; gap: 6px; font-size: 15px; }
  .top-chips > .chips { gap: 6px; }
  .top-chips .chip-btn { padding: 0 11px; gap: 6px; font-size: 14px; }
  .lang-btn { margin-left: 2px; }
  .acct-btn { margin-left: 2px; }
}

/* ---------- 판 끝 축하 효과 (2026-11-18 사장님 지시, js/celebrate.js) ----------
   마지막 칸 반짝, 3x3 상자 회전 물결(칸마다 상자 가운데를 축으로 같은 회전, transform 만이라 판 자리, 크기 그대로), 화면 전체 폭죽 캔버스(누르기 안 막음) */
.fx-canvas { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 80; }
.mini-grid.fx-spin { overflow: visible; }
.mini-grid span.fx-on, .mini-grid span.fx-last { position: relative; z-index: 2; background: var(--fx-bg, var(--surface)); }
.mini-grid span.fx-last { z-index: 3; }
/* 돌고 있는 상자: 테두리와 옅은 그림자 틀(빈 div 가 같은 회전), 칸은 그 위. 내려앉으면 둘 다 지움 */
.mini-grid.fx-spin { position: relative; }
.mini-grid .fx-box { position: absolute; z-index: 3; box-sizing: border-box; border: 2px solid var(--accent, #2f86ff); border-radius: 4px; background: var(--fx-bg, var(--surface)); box-shadow: 0 6px 16px rgba(0, 0, 0, .28); pointer-events: none; }
.mini-grid span.fx-on.fx-act { z-index: 4; }

/* 짧은 알림(내 계정 번호 복사, 2026-11-19) */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 99; padding: 10px 18px; border-radius: 999px; background: var(--text, #222); color: var(--bg, #fff); font-size: 14px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: 90vw; overflow-wrap: anywhere; }

/* ---------- 누르는 칸 48x48 (2026-11-19, 웹 공통 패턴 CMN-CM-01 터치 크기) ----------
   휴대폰 폭(899 이하)에서 눌리는 것은 가로 48, 세로 48 CSS px 이상(tests/touch_size_test.js).
   안 되는 것(이유): 판 칸 .cell 과 숫자 단추 가로(9칸이 한 줄이라 360 폭에서 칸당 34~38), 문장 속 링크. 숫자 단추는 세로 58 로 크게 눌린다.
   위 줄 칸은 높이가 늘어 판 위 세로가 28~32 커지므로 세로 700 이상 휴대폰에서만 늘리고, 더 짧은 화면은 판 크기를 지키려고 그대로 둔다. */
@media (max-width: 899px) {
  .top > .icon-btn, .lang-btn { width: 48px; height: 48px; }
  .sheet .btns button, .tabs button, .chip, .sheet select { min-height: 48px; min-width: 48px; }
  .tabs button { display: inline-flex; align-items: center; justify-content: center; }
  .list-btn { min-height: 48px; }
  .foot a, .foot .inline-link, .foot-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 48px; padding: 0 8px; }
  .foot .foot-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0; }
  .foot .foot-links .sep { display: none; }
  .bar .icon-btn { position: relative; }
  .bar .icon-btn::after { content: ""; position: absolute; width: 48px; height: 48px; left: 50%; top: 50%; margin: -24px 0 0 -24px; }
}
@media (max-width: 899px) and (min-height: 700px) {
  .diffs { height: 48px; }
  .diff-opt { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; }
  .chips { padding: 0; }
  .primary { min-height: 48px; } /* 짧은 화면(700 미만)은 판 끝 카드가 스크롤 없이 들어가도록 44 그대로 */
  .chip-btn { position: relative; isolation: isolate; height: 48px; background: none; border: 0; }
  .chip-btn::before { content: ""; position: absolute; inset: 8px 0; z-index: -1; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
  .chip-btn.done::before { border-color: var(--hint-target); }
}

/* 정보 쪽(2026-11-19): 링크 줄은 목록 단추 모양, 글자색 그대로, 밑줄 없음 */
a.list-btn { text-decoration: none; color: inherit; }
.about-link { min-height: 48px; }
#aboutBuildId { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; font-size: 14px; white-space: nowrap; flex: none; text-align: right; }
#aboutBuild > span { flex: 1 1 0; min-width: 0; }
@media (max-width: 899px) {
  .intro-links { display: flex; flex-wrap: wrap; gap: 0 6px; }
  .intro-links a { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; padding: 0 6px; }
}
@media (max-width: 899px) {
  .primary, .chip-btn { min-width: 48px; }
  .lang-menu button { min-height: 48px; }
  .menu-guide a { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; padding: 0 6px; }
  .menu-guide .menu-links { display: flex; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 899px) {
  .cal { gap: 4px 2px; }
  .cal-day { aspect-ratio: auto; min-height: 48px; }
}

/* 소개 글 화면 보기(W1, 2026-11-19): 휴대폰은 옆으로 밀어 보는 줄(칸 맞춤), 넓은 화면은 세 장이 한 줄. 이미지는 영어 화면(홍보 캡처 규칙) */
.intro-shots { list-style: none; margin: 16px 0 6px; padding: 0 0 6px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.intro-shots li { flex: 0 0 min(62%, 220px); scroll-snap-align: start; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.intro-shots img { width: 100%; height: auto; display: block; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.intro-shots span { font-size: 13px; line-height: 1.45; color: var(--text-soft); }
@media (min-width: 720px) { .intro-shots { overflow: visible; justify-content: center; } .intro-shots li { flex: 1 1 0; max-width: 220px; } }
.intro-store[hidden] { display: none; }

/* 공지, 의견 보내기, 버그 신고(2026-11-19, CMN-DS-03 W6, W7): 읽지 않은 공지 점, 공지 목록, 글 쓰는 칸. 누르는 칸은 48 이상 */
.nt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wrong); margin-left: 6px; vertical-align: middle; }
.nt-dot[hidden] { display: none; }
#btnMenu { position: relative; }
#btnMenu.has-dot::after { content: ""; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--wrong); border: 2px solid var(--bg); }
.nt-list, .fb-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 12px; }
.nt-item, .fb-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.nt-item.pinned { border-color: var(--accent); }
.nt-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text-soft); }
.nt-tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); }
.nt-tag.new { background: var(--accent); color: var(--accent-text); }
.sheet h3.nt-h { margin: 6px 0 4px; font-size: 16px; color: var(--text); }
.nt-body, .fb-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; }
.fb-label { display: block; margin: 12px 0 4px; font-weight: 700; font-size: 14px; }
.fb-ta { width: 100%; min-height: 120px; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
.fb-check { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 0; font-size: 15px; cursor: pointer; }
.fb-check input { width: 22px; height: 22px; flex: none; margin: 0; }
.fb-item .btns { margin-top: 8px; }
