/* ─────────────────────────────────────────────────────────────
   잇다 — 보드게임 우드 타일
   웜 린넨 바탕 · 크림 아이보리 타일 · 부드러운 하단 그림자
   나눔스퀘어라운드(제목·강조) · 프리텐다드(단어 타일·본문)
   난이도 5색: 민트 · 코발트 · 앰버 · 라벤더 · 크림슨
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Pretendard';
  src: url('../fonts/PretendardVariable.woff2') format('woff2-variations'),
       url('../fonts/PretendardVariable.woff2') format('woff2');
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquareRound';
  src: url('../fonts/NanumSquareRound-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquareRound';
  src: url('../fonts/NanumSquareRound-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquareRound';
  src: url('../fonts/NanumSquareRound-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 종이·타일 — 눈부시지 않은 크림 아이보리와 웜 린넨 */
  --linen: #EFECE4;
  --tile: #FCF9F2;
  --edge: #E5DECF;
  --sh: #DFD6C4;
  --edge-strong: #D8CFBC;
  --well: #E8E2D5;          /* 움푹한 홈(세그먼트 트랙) */
  --well-2: #F2ECE2;        /* 더 깊은 홈 */
  --fill: #F5F0E6;          /* 칩 배경 */

  /* 글자 — 부드러운 차콜 브라운 */
  --ink: #2E2923;
  --ink-soft: #574F42;
  --mute: #6F6757;
  --mute-2: #7E7565;

  /* 포인트 */
  --terra: #C4503B;         /* 기본 행동(대전 시작·입력) */
  --terra-sh: #A8412E;
  --terra-ink: #9E3A2A;
  --terra-soft: #FBEDE8;
  --terra-edge: #EFC6B9;
  --terra-edge-sh: #E2B0A0;

  --sage: #2F9070;          /* 나 · 확인 · 이어짐 */
  --sage-sh: #1E6B52;
  --sage-ink: #1F6B50;
  --sage-soft: #E7F3EC;
  --sage-edge: #C4E0D2;
  --sage-line: #B7DAC8;

  --gold: #C98A2E;          /* 콤보 · 이어짐 강조 */
  --gold-soft: #FBF1DC;
  --gold-edge: #EBD3A3;
  --gold-ink: #96600F;

  --plum: #7E64B8;          /* 라벤더 · 두음 */
  --plum-soft: #F1ECFA;
  --plum-edge: #D8CAEE;
  --plum-ink: #58408F;

  --sky: #3D7EC8;           /* 사전 · 스카이 */
  --sky-soft: #E9F2FC;
  --sky-edge: #C3D9F2;
  --sky-ink: #2A5D9B;

  --teal: #2E8794;          /* 미션 */
  --teal-soft: #E6F4F5;
  --teal-edge: #C2E2E4;
  --teal-ink: #1F6670;

  --coral: #CB4B3F;         /* 압박 · 한방 · 시간 경고 */
  --coral-soft: #FBEAE7;
  --coral-edge: #EFC4BC;
  --coral-ink: #9B392B;

  /* 말풍선·점수 색 구분: 나 = 세이지, 봇 = 클레이 */
  --me: var(--sage);
  --me-ink: var(--sage-ink);
  --me-soft: var(--sage-soft);
  --me-edge: var(--sage-edge);
  --me-sh: #B4D6C5;
  --bot: #C05A43;
  --bot-ink: #A2402E;
  --bot-soft: #FBEFEA;
  --bot-edge: #EFCCC0;
  --bot-sh: #E0B4A4;
  --accent: var(--sage);
  --accent-2: var(--terra);

  /* 난이도 기본값(Lv.1 민트) — 각 카드/화면이 자기 색으로 덮어쓴다 */
  --lv: #3E9B79;
  --lv-ink: #1F6B50;
  --lv-soft: #E7F3EC;
  --lv-edge: #C4E0D2;
  --lv-track: #E4EEE7;
  --lv-sh: #AFD1C0;

  --radius: 16px;
  --radius-sm: 13px;

  /* 모션: 튀지 않고 끝에서 부드럽게 멎는 감속 곡선 하나로 통일한다 */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: .16s;
  --dur-mid: .24s;
  --dur-slow: .34s;
  --font: 'Pretendard', 'Pretendard Variable', -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --display: 'NanumSquareRound', 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  --lv-tint: var(--lv);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--linen);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  --vvh: 100dvh;
}

button, input { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ── 스크롤바: 화면마다 같은 얇은 나무색 막대로 ────────────────
   목록·설정·결과 시트가 길어질 때 브라우저 기본 회색 막대(윈도·데스크톱
   크롬은 15px 에 화살표까지)가 화면 오른쪽에 세로 줄처럼 드러났다.
   단어 타일 목록(.chain)에 이미 쓰던 방식 그대로, 폭을 줄이고 테두리와
   같은 계열의 색만 남겨 배경에 묻히게 한다. */
.screen-setup, .dict-body, .sheet {
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 125, 100, .42) transparent;
}
.screen-setup::-webkit-scrollbar,
.dict-body::-webkit-scrollbar,
.sheet::-webkit-scrollbar { width: 8px; height: 8px; }
.screen-setup::-webkit-scrollbar-track,
.dict-body::-webkit-scrollbar-track,
.sheet::-webkit-scrollbar-track { background: transparent; }
.screen-setup::-webkit-scrollbar-thumb,
.dict-body::-webkit-scrollbar-thumb,
.sheet::-webkit-scrollbar-thumb { background: rgba(140, 125, 100, .38); border-radius: 99px; }
.screen-setup::-webkit-scrollbar-thumb:hover,
.dict-body::-webkit-scrollbar-thumb:hover,
.sheet::-webkit-scrollbar-thumb:hover { background: rgba(120, 105, 80, .56); }
.screen-setup::-webkit-scrollbar-button,
.dict-body::-webkit-scrollbar-button,
.sheet::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* ── 바탕: 린넨 결 위로 아주 옅은 색 번짐 ──────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--linen);
  background-image:
    radial-gradient(90% 60% at 12% -8%, rgba(62,155,121,.075), rgba(62,155,121,0) 62%),
    radial-gradient(80% 55% at 92% 8%, rgba(217,146,47,.065), rgba(217,146,47,0) 60%),
    radial-gradient(90% 60% at 50% 112%, rgba(126,100,184,.055), rgba(126,100,184,0) 62%),
    repeating-linear-gradient(0deg, rgba(120,105,80,.018) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(90deg, rgba(120,105,80,.018) 0 1px, transparent 1px 6px);
}
#app { position: relative; z-index: 1; height: var(--vvh, 100dvh); }

/* ── 화면 ─────────────────────────────────────────────────── */
.screen { height: var(--vvh, 100dvh); }
.screen[hidden] { display: none; }
/* 화면 전환: 배경색이 그대로인 채 8px만 떠오르며 옅게 나타난다 */
.screen:not([hidden]) { animation: screenIn .3s var(--ease-out) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── 로고 타일 ────────────────────────────────────────────── */
.logo-mark { text-align: center; line-height: 1; }
.logo-mark .lt {
  display: inline-flex;
  vertical-align: top;
  margin: 0 4px;
  width: 62px; height: 62px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 34px; font-weight: 800; line-height: 1; padding-bottom: 4px;
  color: var(--sage-ink);
  background: var(--sage-soft);
  border: 1px solid var(--sage-edge);
  border-radius: 15px;
  box-shadow: 0 3px 0 var(--sage-sh), 0 10px 18px -14px rgba(60,110,86,.55), inset 0 1px 0 #fff;
  text-shadow: none;
}
.logo-mark .lt:first-child { transform: rotate(-2.5deg); }
.logo-mark .lt:last-child {
  transform: rotate(2deg);
  color: var(--terra-ink);
  background: var(--terra-soft);
  border-color: var(--terra-edge);
  box-shadow: 0 3px 0 var(--terra-sh), 0 10px 18px -14px rgba(140,70,50,.5), inset 0 1px 0 #fff;
}

.brand-kicker {
  margin: 0;
  font-family: var(--display);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .38em;
  text-indent: .38em;
  color: var(--sage-ink);
}

/* ── 로딩 ─────────────────────────────────────────────────── */
.screen-loading { display: grid; place-items: center; padding: 24px; }
.load-inner { width: 100%; max-width: 320px; text-align: center; }
.load-inner .brand-kicker { margin-bottom: 14px; }
.load-inner .logo-mark { margin-bottom: 4px; }
.load-title { color: var(--mute); font-size: 13px; margin: 20px 0 12px; letter-spacing: -.1px; }
.load-bar {
  height: 10px; border-radius: 5px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(110,95,70,.16);
  overflow: hidden;
}
.load-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--sage), #59B392 62%, var(--gold));
  transition: width .2s ease-out;
}
.load-meta { margin-top: 10px; color: var(--mute-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.load-error { color: var(--terra-ink); font-size: 12.5px; line-height: 1.6; margin-top: 16px; }

/* ── 설정 ─────────────────────────────────────────────────── */
.screen-setup { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.setup {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

/* ── 화면 위 모서리 버튼: ⚙ 설정 · 📖 사전 ─────────────────── */
.top-actions {
  position: absolute;
  top: max(11px, env(safe-area-inset-top));
  right: 18px;
  z-index: 3;
  display: flex; align-items: center; gap: 6px;
}
.top-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px 9px;
  border-radius: 11px;
  border: 1px solid var(--edge-strong);
  background: var(--fill);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 11.5px; font-weight: 800; letter-spacing: .03em; line-height: 1;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) ease, box-shadow var(--dur-fast) ease,
              border-color var(--dur-fast) ease, color var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-out);
}
.top-btn svg {
  width: 12px; height: 12px;
  fill: none; stroke-width: 1.3;
  stroke-linejoin: round; stroke-linecap: round;
}
.top-btn-dict svg { stroke: var(--sky); }
.top-btn-settings svg { stroke: var(--gold-ink); }
.top-btn-dict:hover { background: var(--sky-soft); border-color: var(--sky-edge); color: var(--sky-ink); }
.top-btn-settings:hover,
.top-btn-settings[aria-expanded="true"] {
  background: var(--gold-soft); border-color: var(--gold-edge); color: var(--gold-ink);
}
.top-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.top-btn:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.brand { margin-top: 30px; display: flex; flex-direction: column; align-items: center; }
.brand .logo-mark { margin-top: 13px; }
.brand-sub { margin: 12px 0 0; font-size: 11px; color: var(--mute); letter-spacing: .01em; }

.field { display: flex; flex-direction: column; gap: 9px; margin-top: 30px; }
.field-time { margin-top: 22px; }
.field-first { margin-top: 18px; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.field-head span {
  flex: none;
  font-family: var(--display);
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  color: var(--ink-soft);
}
.field-head em {
  min-width: 0;
  font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 제한 시간 숫자 배지 — 라벨 옆에 지금 고른 초를 또렷하게 */
.field-head .time-badge {
  flex: none;
  display: inline-flex; align-items: baseline; gap: 1px;
  padding: 3px 9px 4px;
  border-radius: 9px;
  border: 1px solid var(--sage-edge);
  background: var(--sage-soft);
  color: var(--sage-ink);
  font-family: var(--display);
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 #fff;
  white-space: nowrap; overflow: visible;
}
.field-head .time-badge b {
  font-size: 15px; font-weight: 800; line-height: 1;
}

/* ── 슬라이더 (제한 시간 · 음량) ────────────────────────────
   네이티브 range 는 썸만 그리고, 트랙·채움은 아래 깔린 .slider-track 이 맡는다.
   채움 폭은 --ratio(0~1) 로 계산해 썸 가운데까지 정확히 맞춘다. */
.slider {
  position: relative;
  display: flex; align-items: center;
  height: 26px;
  --thumb: 18px;
  --sl: var(--sage);
  --sl-sh: var(--sage-sh);
}
.slider-track {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 10px; transform: translateY(-50%);
  border-radius: 5px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(110,95,70,.16);
  overflow: hidden;
  pointer-events: none;
}
.slider-fill {
  display: block; height: 100%;
  width: calc(var(--thumb) * .5 + (100% - var(--thumb)) * var(--ratio, 0));
  border-radius: 5px;
  background: linear-gradient(90deg, var(--sl-2, #4DAE8B), var(--sl));
  transition: width .06s linear;
}
.range {
  -webkit-appearance: none; appearance: none;
  position: relative; z-index: 1;
  width: 100%; height: 26px; margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 0%;
  -webkit-tap-highlight-color: transparent;
}
.range::-webkit-slider-runnable-track {
  height: 10px; border-radius: 5px;
  background: transparent;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  box-sizing: border-box;
  width: var(--thumb); height: var(--thumb);
  margin-top: -4px;
  border-radius: 50%;
  border: 2px solid var(--sl);
  background: linear-gradient(180deg, #FFFDF8, var(--tile));
  box-shadow: 0 2px 0 rgba(120,105,80,.16), 0 3px 8px -2px rgba(70,90,76,.32);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.range::-moz-range-track { height: 10px; border-radius: 5px; background: transparent; }
.range::-moz-range-progress { background: transparent; }
.range::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb); height: var(--thumb);
  border-radius: 50%;
  border: 2px solid var(--sl);
  background: linear-gradient(180deg, #FFFDF8, var(--tile));
  box-shadow: 0 2px 0 rgba(120,105,80,.16), 0 3px 8px -2px rgba(70,90,76,.32);
}
.range:hover::-webkit-slider-thumb { box-shadow: 0 2px 0 rgba(120,105,80,.16), 0 5px 12px -3px rgba(70,90,76,.4); }
.range:active::-webkit-slider-thumb { transform: scale(1.08); }
.range:focus { outline: none; }
.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--sage-soft), 0 2px 0 rgba(120,105,80,.16);
}
.range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--sage-soft), 0 2px 0 rgba(120,105,80,.16);
}

/* ── 제한 시간 슬라이더의 0~50초 눈금자 ─────────────────
   눈금은 트랙을 뚫지 않는다. 트랙 바로 아래에 눈금자를 따로 그리고,
   왼쪽 끝(0)에 윗변을 가지런히 맞춰 길이만 달라지게 했다.
     · 0 · 50      가장 굵고 길고 진한 눈금 + 아래 숫자 0초 · 50초
     · 10의 배수   그 다음으로 굵고 길고 진한 눈금
     · 5의 배수    가장 얇고 짧고 연한 눈금
   자리는 썸이 움직이는 구간(양끝 썸 반지름만큼 안쪽)을 10등분한 지점이라
   값 / 50 위치의 썸 가운데와 눈금이 언제나 겹친다. */
.slider.slider-time {
  position: relative;
  display: block;
  --band: 26px;        /* 트랙(썸)이 놓이는 위쪽 띠 = .range 높이 */
  --track-h: 10px;
  --ruler-gap: 1.5px;  /* 트랙 아래와 눈금 사이 숨 */
  --tk-end: 13px;
  --tk-10: 9px;
  --tk-5: 5px;
  --ends-h: 9px;
  height: calc(var(--band) / 2 + var(--track-h) / 2 + var(--ruler-gap)
              + var(--tk-end) + 2px + var(--ends-h) + 3px);
}
.slider.slider-time .slider-track { top: calc(var(--band) / 2); }
.slider.slider-time .range {
  position: absolute; top: 0; left: 0;
  width: 100%; height: var(--band);
}
.slider-ticks {
  position: absolute; left: 0; right: 0;
  top: calc(var(--band) / 2 + var(--track-h) / 2 + var(--ruler-gap));
  height: var(--tk-end);
  pointer-events: none;
}
.slider-ticks i {
  position: absolute; top: 0;
  left: calc(var(--thumb) * .5);
  border-radius: 1px;
  transform: translateX(-50%);
}
/* 5의 배수 ·5·15·25·35·45 — 가장 얇고 짧고 연하다 */
.slider-ticks i.tk-5 { width: 1.5px; height: var(--tk-5); background: rgba(46, 41, 35, .28); }
/* 10의 배수 ·10·20·30·40 — 그 다음으로 굵고 길고 진하다 */
.slider-ticks i.tk-10 { width: 2px; height: var(--tk-10); background: rgba(46, 41, 35, .48); }
/* 0 · 50 — 가장 굵고 길고 진하다 */
.slider-ticks i.tk-end { width: 2.5px; height: var(--tk-end); background: var(--ink); }
.slider-ticks i:nth-child(2) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .1); }
.slider-ticks i:nth-child(3) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .2); }
.slider-ticks i:nth-child(4) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .3); }
.slider-ticks i:nth-child(5) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .4); }
.slider-ticks i:nth-child(6) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .5); }
.slider-ticks i:nth-child(7) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .6); }
.slider-ticks i:nth-child(8) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .7); }
.slider-ticks i:nth-child(9) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .8); }
.slider-ticks i:nth-child(10) { left: calc(var(--thumb) * .5 + (100% - var(--thumb)) * .9); }
.slider-ticks i:nth-child(11) { left: calc(var(--thumb) * .5 + (100% - var(--thumb))); }
.slider-ends {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--ends-h);
  pointer-events: none;
}
.slider-ends i {
  position: absolute; bottom: 0;
  font-family: var(--display);
  font-size: 9.5px; font-weight: 700; line-height: var(--ends-h); letter-spacing: .01em;
  color: var(--ink-soft);
  opacity: .85;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.slider-ends i:first-child { left: calc(var(--thumb) * .5); transform: translateX(-50%); }
.slider-ends i:last-child { right: calc(var(--thumb) * .5); transform: translateX(50%); }

/* 난이도 타일 5종 — 단계마다 고유한 색 */
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.level {
  min-width: 0;
  height: 84px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 0 3px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--tile);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--sh), 0 8px 14px -12px rgba(100,82,56,.45), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease,
              background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.level b { font-family: var(--display); font-size: 13px; font-weight: 800; color: var(--lv-ink); margin-top: 5px; letter-spacing: .01em; }
.level small { font-size: 8.5px; font-weight: 800; letter-spacing: .05em; color: var(--mute-2); font-family: var(--font); }
.pips { display: flex; gap: 3px; }
.pips i {
  display: block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--lv-track);
  transition: background .16s ease;
}
.pips i.on { background: var(--lv); }
.level:hover { border-color: var(--lv-edge); }
.level[aria-checked="true"] {
  background: var(--lv-soft);
  border-color: var(--lv-edge);
  box-shadow: 0 0 0 1px var(--lv-edge), 0 2px 0 var(--lv-sh), inset 0 1px 0 #fff;
  transform: translateY(2px);
}
.level[aria-checked="true"] b { color: var(--lv-ink); }
.level[aria-checked="true"] .pips i.on { background: var(--lv); }
.level:focus-visible { outline: 2px solid var(--lv); outline-offset: 2px; }

/* 단계 색: 카드·결과 칩·대전 화면이 같은 값을 쓴다 */
.level[data-lv="1"], .result-level[data-lv="1"], body[data-level="1"] {
  --lv: #3E9B79; --lv-ink: #1F6B50; --lv-soft: #E7F3EC; --lv-edge: #C4E0D2; --lv-track: #E4EEE7; --lv-sh: #AFD1C0;
}
.level[data-lv="2"], .result-level[data-lv="2"], body[data-level="2"] {
  --lv: #3D7EC8; --lv-ink: #2A5D9B; --lv-soft: #E9F2FC; --lv-edge: #C3D9F2; --lv-track: #E3EDF9; --lv-sh: #AFC8E6;
}
.level[data-lv="3"], .result-level[data-lv="3"], body[data-level="3"] {
  --lv: #D9922F; --lv-ink: #8C580C; --lv-soft: #FDF2DE; --lv-edge: #EFD4A4; --lv-track: #F6EBD5; --lv-sh: #DFC08A;
}
.level[data-lv="4"], .result-level[data-lv="4"], body[data-level="4"] {
  --lv: #7E64B8; --lv-ink: #58408F; --lv-soft: #F1ECFA; --lv-edge: #D9CBEE; --lv-track: #ECE6F7; --lv-sh: #C6B4E3;
}
.level[data-lv="5"], .result-level[data-lv="5"], body[data-level="5"] {
  --lv: #C2453F; --lv-ink: #9B392B; --lv-soft: #FBEDE8; --lv-edge: #EFC6B9; --lv-track: #F5E3DD; --lv-sh: #DFB1A5;
}

/* 모드 타일 (배려모드) */
.toggle-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: 15px;
  background: var(--tile);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 2px 0 var(--sh), 0 8px 14px -12px rgba(100,82,56,.4), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease,
              background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.toggle-card:first-of-type { margin-top: 22px; }
.toggle-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-text b { font-family: var(--display); font-size: 13.5px; font-weight: 800; letter-spacing: .01em; }
.toggle-text b i { font-style: normal; font-size: 12.5px; margin-right: 6px; }
.toggle-text small { font-size: 10px; color: var(--mute); letter-spacing: -.1px; line-height: 1.4; }

.switch {
  position: relative; flex: 0 0 auto; margin-left: auto;
  width: 44px; height: 25px; border-radius: 13px;
  background: #E1D8C7;
  box-shadow: inset 0 1px 3px rgba(110,95,70,.2);
  transition: background .2s ease, box-shadow .2s ease;
}
.switch i {
  position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--tile);
  box-shadow: 0 1px 2px rgba(90,78,58,.24);
  display: block;
  transition: transform .2s var(--ease-out), background .2s ease;
}
.toggle-card[aria-checked="true"] { background: var(--tile); }
.mercy-card[aria-checked="true"] { border-color: var(--sage-edge); background: var(--sage-soft); box-shadow: 0 0 0 1px var(--sage-edge), 0 2px 0 #B4D6C5, inset 0 1px 0 #fff; }
.mercy-card[aria-checked="true"] .toggle-text b { color: var(--sage-ink); }
.mercy-card[aria-checked="true"] .toggle-text small { color: #4F7F69; }
.mercy-card[aria-checked="true"] .switch { background: var(--sage); box-shadow: inset 0 1px 3px rgba(20,80,60,.26); }
.toggle-card[aria-checked="true"] .switch i { transform: translateX(19px); }
.toggle-card:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* 세그먼트 (선공) */
.segmented {
  display: flex; gap: 3px; padding: 3px;
  border-radius: 13px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(110,95,70,.14);
}
.segmented button {
  flex: 1; min-width: 0;
  height: 36px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: #6F6757;
  font-family: var(--display);
  font-size: 12.5px; font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.segmented button[aria-checked="true"] {
  background: var(--tile);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--sh), inset 0 -2px 0 var(--sage-line), inset 0 1px 0 #fff;
}
.segmented button:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }

.setup > #btn-start { margin-top: 16px; }

/* 대전 시작 */
.btn {
  border: 1px solid var(--edge);
  background: var(--tile);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--display);
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease,
              background var(--dur-fast) ease, border-color var(--dur-fast) ease, filter var(--dur-fast);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh), inset 0 1px 0 #fff; }
.btn.ghost { background: var(--fill); }
.btn.ghost:hover { background: #F0EADF; }
.btn.primary {
  border: 0;
  background: linear-gradient(180deg, #CC5B44, var(--terra) 70%);
  color: #fff;
  box-shadow: 0 4px 0 var(--terra-sh), 0 14px 22px -16px rgba(140,50,30,.8), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn.primary:hover { filter: brightness(1.03); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--terra-sh), inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primary.big {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 800; letter-spacing: .04em;
  border-radius: 16px;
}
.btn.primary.big kbd {
  position: absolute;
  right: 14px;
  font-family: var(--font); font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  background: rgba(255,255,255,.2); border-radius: 6px;
  padding: 4px 7px;
}
.btn.primary.big { position: relative; }
#btn-start:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--terra-sh), inset 0 1px 0 rgba(255,255,255,.2); }

/* ── 대전 ─────────────────────────────────────────────────── */
.screen-game {
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: 560px;
  padding-top: env(safe-area-inset-top);
  background: var(--linen);
}

.game-top {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 12px 14px 11px;
  border-bottom: 1px solid var(--edge);
}
.game-top-row { display: flex; align-items: center; gap: 9px; min-width: 0; }

.bot-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bot-face {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--lv-soft);
  border: 1px solid var(--lv-edge);
  border-radius: 11px;
  box-shadow: 0 2px 0 var(--lv-sh), inset 0 1px 0 #fff;
}
.bot-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.15; min-width: 0; }
.bot-text b {
  font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bot-text small {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font); font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--lv-ink);
}
.bot-text small::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--lv); flex: 0 0 auto;
}

.scoreboard { display: flex; align-items: center; gap: 5px; margin-left: auto; font-variant-numeric: tabular-nums; }
.scoreboard .sc {
  display: flex; align-items: baseline; gap: 4px;
  padding: 6px 9px 5px;
  border-radius: 10px;
  background: var(--me-soft);
  border: 1px solid var(--me-edge);
  box-shadow: 0 2px 0 var(--me-sh), inset 0 1px 0 #fff;
}
.scoreboard .sc.bot { background: var(--bot-soft); border-color: var(--bot-edge); box-shadow: 0 2px 0 var(--bot-sh), inset 0 1px 0 #fff; }
.scoreboard .sc i { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .06em; color: var(--mute); }
.scoreboard .sc b { font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: 0; }
.scoreboard .sc.me b { color: var(--me-ink); }
.scoreboard .sc.bot b { color: var(--bot-ink); }

.icon-btn {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--tile);
  color: #6A6353;
  font-size: 12px; line-height: 1;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast);
}
.icon-btn:hover { background: var(--terra-soft); color: var(--terra-ink); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.icon-btn:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* 모드 배지 */
.mercy-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 5px;
  border-radius: 9px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  color: var(--sage-ink);
  background: var(--sage-soft);
  border: 1px solid var(--sage-edge);
  box-shadow: 0 2px 0 #CFE6DA;
  white-space: nowrap;
}
.mercy-badge small { font-size: 9.5px; font-weight: 700; opacity: .85; letter-spacing: .01em; }
.game-top > .mercy-badge { align-self: center; }
.mercy-badge.released {
  color: var(--plum-ink);
  background: var(--plum-soft);
  border-color: var(--plum-edge);
  box-shadow: 0 2px 0 #DED2F0;
}
.result-mercy { display: flex; width: max-content; margin: 9px auto 0; font-size: 11.5px; }

/* 아레나 */
.arena {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 16px 8px;
}

.stage { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stage-hint {
  margin: 0 auto; padding: 14px 20px 15px;
  display: block;
  color: var(--mute); font-size: 12.5px; line-height: 1.7; text-align: center;
  border: 1px dashed var(--edge-strong);
  border-radius: 16px;
  background: rgba(252,249,242,.6);
}
.stage-hint b {
  font-family: var(--display); font-weight: 800; font-size: 17px;
  color: var(--terra-ink);
  background: var(--terra-soft);
  border-radius: 7px;
  padding: 0 5px;
}

.stage-word {
  max-width: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 15px 26px 13px;
  background: var(--tile);
  border: 1px solid var(--edge);
  border-radius: 20px;
  box-shadow: 0 3px 0 var(--sh), 0 18px 30px -24px rgba(100,80,52,.55), inset 0 1px 0 #fff;
  animation: tileLand .36s var(--ease-out) both;
}
.stage-word.me { background: var(--me-soft); border-color: var(--me-edge); box-shadow: 0 3px 0 var(--me-sh), 0 18px 30px -24px rgba(50,110,86,.45), inset 0 1px 0 #fff; }
.stage-word.bot { background: var(--bot-soft); border-color: var(--bot-edge); box-shadow: 0 3px 0 var(--bot-sh), 0 18px 30px -24px rgba(140,70,50,.4), inset 0 1px 0 #fff; }
.stage-who {
  display: flex; align-items: center; gap: 6px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .14em;
  color: var(--mute-2);
  margin-bottom: 3px;
}
.stage-who .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.stage-who.me { color: var(--me-ink); }
.stage-who.bot { color: var(--bot-ink); }
.stage-word h2 {
  margin: 0;
  font-family: var(--font); font-weight: 800;
  font-size: clamp(30px, 9.4vw, 41px);
  line-height: 1.18;
  letter-spacing: -.01em;
  color: var(--ink);
  text-align: center;
  word-break: break-all;
  overflow-wrap: anywhere;
}
/* 긴 단어는 화면 높이까지 함께 본다 — 낮은 창·가로 모드에서 40~70글자
   타일이 보드 밖으로 넘쳐 입력 독에 가려지지 않도록 높이에 맞춰 줄인다. */
.stage-word h2.long {
  font-size: clamp(14px, min(5vw, 4.6dvh), 22px);
  line-height: 1.4; letter-spacing: -.01em; font-weight: 700;
}
.stage-word h2 em.mis {
  font-style: normal;
  color: var(--teal-ink);
  background: rgba(46,135,148,.12);
  border-radius: 8px;
  padding: 0 2px;
  box-shadow: inset 0 -3px 0 rgba(46,135,148,.16);
}
.stage-word h2 em.lk { color: var(--gold-ink); background: rgba(201,138,46,.16); box-shadow: inset 0 -3px 0 rgba(201,138,46,.22); padding: 0 2px; }
.stage-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 9px; }
.stage-sub .gain { font-size: 12px; font-weight: 800; color: var(--sage-ink); font-variant-numeric: tabular-nums; }
.stage-sub .tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--mute);
  background: var(--fill);
  border-radius: 8px;
  padding: 3px 8px;
  white-space: nowrap;
}
.stage-sub .tag.mission { color: var(--teal-ink); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal-edge); }
.stage-sub .tag.danger { color: var(--coral-ink); background: var(--coral-soft); box-shadow: inset 0 0 0 1px var(--coral-edge); font-weight: 800; }
.stage-sub .tag.danger.press { color: var(--plum-ink); background: var(--plum-soft); box-shadow: inset 0 0 0 1px var(--plum-edge); }

@keyframes tileLand {
  0%   { opacity: 0; transform: translateY(-10px) scale(.988); }
  100% { opacity: 1; transform: none; }
}

.bot-bubble {
  align-self: flex-start;
  max-width: 88%;
  padding: 9px 13px 10px;
  border-radius: 13px 13px 13px 4px;
  background: var(--bot-soft);
  border: 1px solid var(--bot-edge);
  box-shadow: 0 2px 0 var(--bot-sh);
  color: var(--bot-ink);
  font-size: 12px;
  line-height: 1.55;
  animation: bubbleIn .24s var(--ease-out);
  transition: opacity .18s ease, transform .18s var(--ease-out);
}
.bot-bubble.me { align-self: flex-end; background: var(--me-soft); border-color: var(--me-edge); box-shadow: 0 2px 0 var(--me-sh); color: var(--me-ink); }
/* 말풍선이 사라질 때: 자리에서 옅게 내려앉듯 빠진다(js 가 클래스를 붙인 뒤 hidden) */
.bot-bubble.out { opacity: 0; transform: translateY(4px); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* 주고받은 단어 타일 */
.chain {
  list-style: none; margin: 0; padding: 6px 6px 8px;
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 9px;
}
.chain::-webkit-scrollbar { display: none; }
/* 적은 수일 때는 보드 바로 위에 붙고, 넘치면 위에서부터 스크롤된다 */
.chain > li:first-child { margin-top: auto; }
/* 위로 더 남아 있을 때 위쪽을 부드럽게 지운다 */
.chain.more-top {
  mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
}.chain li {
  align-self: flex-start;
  max-width: 86%;
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 16px 10px;
  border-radius: 14px;
  background: var(--bot-soft);
  border: 1px solid var(--bot-edge);
  box-shadow: 0 2px 0 var(--bot-sh), inset 0 1px 0 #fff;
  animation: tileLand .32s var(--ease-out) both;
}
.chain li.me {
  align-self: flex-end;
  background: var(--me-soft);
  border-color: var(--me-edge);
  box-shadow: 0 2px 0 var(--me-sh), inset 0 1px 0 #fff;
}
.chain-who { font-size: 8.5px; font-weight: 800; letter-spacing: .14em; color: var(--mute-2); }
.chain li.me .chain-who { color: var(--me-ink); text-align: right; }
.chain li.bot .chain-who { color: var(--bot-ink); }
.chain-word {
  font-family: var(--font);
  font-weight: 700;
  font-size: 20px; line-height: 1.32; letter-spacing: -.01em; color: var(--ink);
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
.chain-word .lk { color: var(--gold-ink); background: rgba(201,138,46,.18); border-radius: 5px; padding: 0 2px; }

/* 턴 패널 */
.turn-panel {
  flex: 0 0 auto;
  padding: 15px 18px calc(16px + env(safe-area-inset-bottom));
  background: var(--tile);
  border-top: 1px solid var(--edge);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -1px 0 #F6F1E7, 0 -10px 26px rgba(110,92,66,.12);
}
.turn-head { display: flex; align-items: flex-end; gap: 11px; }
.need { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.need-label { font-size: 9.5px; font-weight: 800; letter-spacing: .14em; color: var(--mute); }
.need-char { display: flex; align-items: center; gap: 7px; }
.need-char b {
  width: 60px; height: 60px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 31px; font-weight: 800; line-height: 1; letter-spacing: 0;
  color: var(--terra-ink);
  background: var(--terra-soft);
  border: 1px solid var(--terra-edge);
  border-radius: 13px;
  box-shadow: 0 3px 0 var(--terra-edge-sh), inset 0 1px 0 #fff;
  padding-bottom: 4px;
  transition: color .2s, background .2s;
}
.need-char em {
  font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: .04em;
  color: var(--plum-ink); background: var(--plum-soft);
  border-radius: 7px; padding: 3px 7px;
  box-shadow: inset 0 0 0 1px var(--plum-edge);
  animation: altPulse 2.6s ease-in-out infinite;
}
@keyframes altPulse { 50% { background: #E7DDF6; } }

.turn-info { display: flex; flex-wrap: wrap; gap: 5px; align-content: center; min-width: 0; }
.mini {
  font-size: 10px; font-weight: 700; letter-spacing: .01em;
  color: var(--mute);
  background: var(--fill);
  border-radius: 8px;
  padding: 5px 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini:empty { display: none; }
.mini.mission { color: var(--teal-ink); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal-edge); }
.mini.mission b { font-family: var(--display); font-weight: 800; color: var(--teal-ink); }
.mini.combo { color: var(--gold-ink); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-edge); }
.mini.combo b { font-family: var(--display); font-weight: 800; color: var(--gold-ink); }
.mini.mission.pop { animation: chipPop .28s var(--ease-out); }
@keyframes chipPop {
  0%   { opacity: .55; transform: scale(.94); }
  100% { opacity: 1; transform: none; }
}

.countdown { margin-left: auto; display: flex; align-items: baseline; gap: 2px; padding-bottom: 6px; font-variant-numeric: tabular-nums; }
.countdown b { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: 0; color: var(--ink); }
.countdown span { font-size: 10px; color: var(--mute); }
.countdown.waiting b { color: var(--mute-2); letter-spacing: 2px; }
.countdown.waiting span { visibility: hidden; }
.countdown.urgent b { color: var(--coral-ink); animation: urgentPulse 1s ease-in-out infinite; }
@keyframes urgentPulse { 50% { transform: scale(1.06); } }

.timer {
  position: relative;
  height: 8px; margin: 11px 0 12px;
  border-radius: 3px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(110,95,70,.16);
  overflow: hidden;
}
.timer i {
  display: block; height: 100%; width: 100%;
  border-radius: 3px;
  background: var(--sage);
  /* 폭 대신 GPU 가속 transform 으로 줄인다(매 프레임 갱신해도 레이아웃을 다시 잡지 않는다).
     리셋(100%)될 때는 애니메이션 없이 바로 채워져서 뒤로 가는 느낌이 없다. */
  transform: scaleX(1);
  transform-origin: left center;
  will-change: transform;
  transition: background .3s ease;
}
.timer::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(90deg, var(--tile) 0 2px, transparent 2px 22px);
  opacity: .9;
}
.timer.warn i { background: var(--gold); }
.timer.urgent i { background: var(--coral); }

.composer { display: flex; gap: 8px; align-items: stretch; }
.composer input {
  flex: 1 1 auto; min-width: 0;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--edge);
  border-radius: 13px;
  background: var(--tile);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  box-shadow: inset 0 2px 0 #FFF, 0 2px 0 var(--sh);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.composer input::placeholder { color: var(--mute-2); font-weight: 500; }
.composer input:focus {
  border-color: var(--sage-edge);
  box-shadow: 0 0 0 3px rgba(47,144,112,.14), 0 2px 0 var(--sh);
}
.composer input:disabled { opacity: .65; }
.composer input.bad { border-color: var(--coral); background: var(--coral-soft); box-shadow: 0 0 0 3px rgba(203,75,63,.16); }
.composer .btn { padding: 0 18px; font-size: 15px; }
.composer .btn.go {
  flex: 0 0 auto; min-width: 76px;
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #CC5B44, var(--terra) 70%);
  box-shadow: 0 3px 0 var(--terra-sh), inset 0 1px 0 rgba(255,255,255,.26);
  border-radius: 13px;
}
.composer .btn.go:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--terra-sh), inset 0 1px 0 rgba(255,255,255,.2); }
.composer .btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: 0 3px 0 var(--terra-edge-sh); }

/* 오답 흔들기 */
.shake { animation: shake .3s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* 점수 팝업 */
.float-score {
  position: fixed; z-index: 40; pointer-events: none;
  font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: .01em;
  color: var(--sage-ink);
  text-shadow: 0 1px 0 #FFF, 0 2px 10px rgba(120,105,80,.22);
  animation: floatUp 1.1s var(--ease-out) forwards;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.96); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}

/* 한방 연출: 탁자 위에 탁 놓인 스탬프 타일 */
.ko-splash {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(46,41,35,.16);
  animation: fadeIn .16s ease-out, fadeOut .24s ease-in .8s forwards;
  pointer-events: none;
}
.ko-splash > div {
  text-align: center;
  padding: 16px 32px 18px;
  background: var(--tile);
  border: 1px solid var(--coral-edge);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--coral-edge), 0 22px 40px -22px rgba(90,40,20,.5);
  transform: rotate(-2deg);
  animation: koPop .42s var(--ease-out);
}
.ko-splash b {
  display: block;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(42px, 15vw, 66px); line-height: 1; letter-spacing: -.01em;
  color: var(--coral);
  text-shadow: 0 3px 0 rgba(203,75,63,.16);
}
.ko-splash span {
  display: block; margin-top: 10px;
  color: var(--mute); font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes koPop { from { transform: scale(.94) rotate(-2deg); opacity: 0; } }

/* ── 결과 시트 ────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(46,41,35,.38);
  animation: fadeIn .18s ease-out;
  /* 닫을 때는 150ms 만에 옅어지며 빠진다(js 가 .ov-out 을 붙인 뒤 hidden) */
  transition: opacity .15s var(--ease-soft);
}
.overlay.ov-out { opacity: 0; pointer-events: none; }
.sheet {
  width: 100%; max-width: 400px;
  background: var(--tile);
  border: 1px solid var(--edge);
  border-radius: 22px;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 4px 0 var(--sh), 0 30px 54px -28px rgba(70,58,40,.55), inset 0 1px 0 #fff;
  animation: sheetIn .3s var(--ease-out);
  max-height: 92dvh;
  overflow-y: auto;
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ── 설정 시트: 음량 · 흑백모드 ───────────────────────────── */
.settings-sheet {
  max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
}
.settings-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-top h2 {
  margin: 0; font-family: var(--display);
  font-size: 18px; font-weight: 800; letter-spacing: .01em; color: var(--ink);
}
.settings-close {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--edge); border-radius: 10px;
  background: var(--fill); color: var(--mute);
  box-shadow: 0 2px 0 var(--sh);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.settings-close svg {
  width: 11px; height: 11px;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round;
}
.settings-close:hover { background: var(--well-2); color: var(--ink); }
.settings-close:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.settings-close:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.settings-block {
  display: flex; flex-direction: column; gap: 6px;
  padding: 13px 15px 15px;
  border: 1px solid var(--edge); border-radius: 15px;
  background: var(--tile);
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
}
.settings-head { display: flex; align-items: center; gap: 9px; }
.settings-label { font-family: var(--display); font-size: 13.5px; font-weight: 800; color: var(--ink); }
.settings-value {
  margin-left: auto;
  padding: 3px 9px 4px; border-radius: 9px;
  border: 1px solid var(--gold-edge); background: var(--gold-soft); color: var(--gold-ink);
  font-family: var(--display); font-size: 12.5px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.vol-icon {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--edge); border-radius: 9px; background: var(--fill);
  font-size: 14px; line-height: 1;
  box-shadow: inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-out);
}
.vol-icon:hover { background: var(--gold-soft); border-color: var(--gold-edge); }
.vol-icon:active { transform: translateY(1px); }
.vol-icon[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold-edge); }
.vol-icon:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.slider-volume { --sl: var(--gold); --sl-2: #E2B96A; }
.toggle-card.mono-card { margin-top: 0; }

/* 흑백모드 — html 에 칠한 .mono 하나로 화면 전체를 회색으로 만든다.
   html/body 에 직접 filter 를 걸면 fixed 요소와 뷰포트 계산이 꼬이므로
   실제로 보이는 판(.bg · #app)과 그 위에 뜨는 겉포장(.overlay · .toast …)에만 건다. */
html.mono .bg,
html.mono #app,
html.mono .overlay,
html.mono .toast,
html.mono .float-score,
html.mono .ko-splash,
html.mono .confetti { filter: grayscale(1); }

.result-sheet { text-align: center; }
.result-badge {
  width: 56px; height: 56px; margin: 0 auto 8px;
  display: grid; place-items: center;
  font-size: 28px; line-height: 1;
  background: var(--fill);
  border: 1px solid var(--edge);
  border-radius: 15px;
  box-shadow: 0 3px 0 var(--sh), inset 0 1px 0 #fff;
}
.result-sheet h2 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.result-sheet.win h2 { color: var(--sage-ink); }
.result-sheet.lose h2 { color: var(--bot-ink); }
.result-sheet.win .result-badge { background: var(--sage-soft); border-color: var(--sage-edge); box-shadow: 0 3px 0 var(--me-sh), inset 0 1px 0 #fff; }
.result-sheet.lose .result-badge { background: var(--bot-soft); border-color: var(--bot-edge); box-shadow: 0 3px 0 var(--bot-sh), inset 0 1px 0 #fff; }
.result-reason { margin: 10px 0 14px; color: var(--mute); font-size: 12.5px; line-height: 1.6; }
.result-level {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 10px auto 0;
  padding: 5px 12px 6px;
  border-radius: 10px;
  border: 1px solid var(--lv-edge);
  background: var(--lv-soft);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
  font-size: 11.5px; font-weight: 800; letter-spacing: .01em;
  color: var(--lv-ink);
}
.result-level-cap { font-size: 9.5px; font-weight: 800; letter-spacing: .1em; color: var(--mute); }
.result-level i { font-style: normal; font-size: 13px; line-height: 1; }
.result-level b { font-family: var(--display); font-weight: 800; font-size: 12.5px; }

.result-score { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 14px; }
.result-score .rs {
  min-width: 76px;
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px 7px;
  background: var(--me-soft);
  border: 1px solid var(--me-edge);
  border-radius: 12px;
  box-shadow: 0 2px 0 var(--me-sh), inset 0 1px 0 #fff;
}
.result-score .rs.bot { background: var(--bot-soft); border-color: var(--bot-edge); box-shadow: 0 2px 0 var(--bot-sh), inset 0 1px 0 #fff; }
.result-score .rs i { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--mute); }
.result-score .rs b { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.result-score .rs.me b { color: var(--me-ink); }
.result-score .rs.bot b { color: var(--bot-ink); }
.result-score .vs { color: var(--mute-2); font-family: var(--display); font-size: 15px; font-weight: 700; }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 15px; }
.result-stats div {
  background: var(--fill);
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 8px 6px 9px;
}
.result-stats dt { font-size: 9.5px; color: var(--mute); font-weight: 700; letter-spacing: .02em; margin-bottom: 3px; }
.result-stats dd { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.result-actions .btn { height: 46px; display: grid; place-items: center; font-size: 14.5px; }

/* 배틀 내역 */
.battle-log-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; margin: 0 0 10px;
  padding: 11px 12px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink-soft);
  font-size: 12px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 2px 0 var(--sh);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast);
}
.battle-log-btn:hover { background: #F0EADF; }
.battle-log-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.battle-log-btn:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.battle-log-btn.empty { color: var(--mute); }
.battle-log-caret { font-style: normal; font-size: 10px; color: var(--mute); transition: transform .2s ease; }
.battle-log-btn[aria-expanded="true"] .battle-log-caret { transform: rotate(180deg); }

.battle-log {
  margin: 0 0 12px; padding: 9px;
  /* 화면 높이에 맞춰 함께 줄어든다 — 펼쳐도 다시 대전/난이도 버튼까지 한 화면에 */
  max-height: clamp(120px, 26dvh, 236px);
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--well-2);
  box-shadow: inset 0 2px 4px rgba(110,95,70,.09);
  scrollbar-width: thin; scrollbar-color: rgba(140,125,100,.4) transparent;
  animation: logIn .22s var(--ease-out);
}
.battle-log.more {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
  padding-bottom: 18px;
}
.battle-log:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.battle-log::-webkit-scrollbar { width: 6px; }
.battle-log::-webkit-scrollbar-thumb { background: rgba(140,125,100,.36); border-radius: 99px; }
@keyframes logIn { from { opacity: 0; transform: translateY(-5px); } }

.battle-log-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.battle-log-empty { padding: 13px 8px; color: var(--mute); font-size: 12px; text-align: center; }

.blog-move { display: flex; align-items: flex-start; gap: 7px; }
.blog-move.bot { flex-direction: row-reverse; }
.blog-turn {
  flex: none; min-width: 20px; height: 20px; margin-top: 1px;
  display: grid; place-items: center;
  border: 1px solid var(--edge); border-radius: 7px;
  background: var(--tile);
  font-size: 9.5px; font-weight: 800; color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.blog-body {
  min-width: 0; max-width: calc(100% - 44px);
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 7px 10px 8px; border-radius: 12px;
  background: var(--tile);
  border: 1px solid var(--edge);
  box-shadow: 0 2px 0 var(--sh);
  text-align: left;
}
.blog-move.me .blog-body { background: var(--me-soft); border-color: var(--me-edge); box-shadow: 0 2px 0 var(--me-sh); }
.blog-move.bot .blog-body {
  align-items: flex-end; text-align: right;
  background: var(--bot-soft); border-color: var(--bot-edge); box-shadow: 0 2px 0 var(--bot-sh);
}
.blog-head { display: flex; align-items: baseline; gap: 6px; }
.blog-who { font-size: 9.5px; font-weight: 800; color: var(--me-ink); letter-spacing: .04em; }
.blog-move.bot .blog-who { color: var(--bot-ink); }
.blog-gain { font-size: 10.5px; font-weight: 800; color: var(--mute); font-variant-numeric: tabular-nums; }
.blog-word {
  margin: 0; max-width: 100%;
  font-family: var(--font); font-weight: 700;
  font-size: 15px; letter-spacing: -.01em; line-height: 1.45;
  color: var(--ink);
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
.blog-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-start; }
.blog-move.bot .blog-tags { justify-content: flex-end; }
.blog-tags .tag {
  font-size: 9px; font-weight: 700;
  color: var(--mute);
  background: var(--fill);
  border-radius: 7px; padding: 2px 6px;
  white-space: nowrap;
}
.blog-tags .tag.mission { color: var(--teal-ink); background: var(--teal-soft); }
.blog-move.bot .blog-tags .tag.mission { background: #DBEDEF; }
.blog-tags .tag.danger { color: var(--coral-ink); background: var(--coral-soft); font-weight: 800; }
.blog-tags .tag.danger.press { color: var(--plum-ink); background: var(--plum-soft); }
.blog-move.bot .blog-tags .tag.danger { background: #F8DED8; }
.blog-move.bot .blog-tags .tag.danger.press { background: #E8DFF7; }

@media (max-width: 520px) {
  .battle-log { max-height: min(28dvh, 220px); }
  .blog-body { max-width: calc(100% - 36px); }
  .blog-word { font-size: 14px; }
}

/* 짧은 화면: 결과 카드의 버튼까지 스크롤 없이 */
@media (max-height: 700px) {
  .sheet { padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); }
  .result-badge { width: 42px; height: 42px; margin-bottom: 4px; font-size: 21px; }
  .result-sheet h2 { font-size: 22px; }
  .result-reason { margin: 6px 0 9px; font-size: 11.5px; }
  .result-level { margin-top: 6px; padding: 4px 10px 5px; }
  .result-score { margin: 9px 0 9px; }
  .result-score .rs { padding: 6px 8px 5px; min-width: 68px; }
  .result-score .rs b { font-size: 20px; }
  .result-stats { margin-bottom: 10px; gap: 6px; }
  .result-stats div { padding: 6px 4px 7px; }
  .result-stats dt { font-size: 9px; }
  .result-stats dd { font-size: 14.5px; }
  .battle-log-btn { padding: 8px 10px; margin-bottom: 8px; }
  .battle-log { max-height: min(24dvh, 168px); margin-bottom: 9px; }
  .result-actions .btn { height: 42px; }
}

/* ── 토스트 ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(112px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  z-index: 45;
  max-width: min(88vw, 420px);
  padding: 10px 14px;
  border-radius: 11px;
  background: #3A342A;
  border: 0;
  color: #FDF9F1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 4px 0 rgba(30,26,20,.3), 0 14px 30px -16px rgba(30,26,20,.6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .22s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.mission { color: #EAF7F8; background: #236067; box-shadow: 0 4px 0 #17454A, 0 14px 30px -16px rgba(20,60,64,.6); }
.toast.mercy { color: #FFF3EE; background: #8C3C29; box-shadow: 0 4px 0 #6B2C1D, 0 14px 30px -16px rgba(80,30,18,.55); }

.confetti {
  position: fixed; top: -12px; z-index: 55;
  width: 7px; height: 12px; border-radius: 2px;
  pointer-events: none;
  animation: confettiFall 2.2s linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(600deg); opacity: .12; }
}

/* ── 단어 사전 ───────────────────────────────────────────── */
.screen-dict { display: flex; justify-content: center; }
.dict {
  display: flex; flex-direction: column; min-height: 0;
  width: 100%; max-width: 560px;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  gap: 9px;
}
.dict-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dict-top, .dict-search, .dict-sorts, .dict-status, .dict-meta, .dict-more, .dict-empty { flex: 0 0 auto; }
.dict-back {
  flex: 0 0 auto;
  padding: 8px 12px 9px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--tile);
  color: var(--ink-soft);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast);
}
.dict-back:hover { background: var(--sky-soft); color: var(--sky-ink); border-color: var(--sky-edge); }
.dict-back:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.dict-back:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.dict-title { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; }
.dict-title b { font-family: var(--display); font-size: 14px; font-weight: 800; letter-spacing: .01em; }
.dict-title small { font-size: 10px; color: var(--mute); letter-spacing: 0; font-variant-numeric: tabular-nums; }

.dict-search { display: flex; gap: 8px; }
.dict-input-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.dict-input {
  width: 100%;
  height: 46px;
  padding: 0 34px 0 13px;
  border: 1px solid var(--edge);
  border-radius: 13px;
  background: var(--tile);
  color: var(--ink);
  font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.dict-input::placeholder { color: var(--mute-2); font-weight: 600; }
.dict-input:focus { border-color: var(--sky-edge); box-shadow: 0 0 0 3px rgba(61,126,200,.13), 0 2px 0 var(--sh); }
.dict-clear {
  position: absolute; top: 50%; right: 7px; transform: translateY(-50%);
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--fill);
  color: var(--mute);
  font-size: 10px; line-height: 1;
  display: grid; place-items: center;
}
.dict-clear:hover { background: var(--well); color: var(--ink-soft); }

.dict-twoeum {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--edge);
  border-radius: 13px;
  background: var(--tile);
  color: var(--mute);
  font-size: 11px; font-weight: 800; letter-spacing: .01em; white-space: nowrap;
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease,
              background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.dict-twoeum:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.dict-twoeum .switch { width: 36px; height: 20px; border-radius: 10px; }
.dict-twoeum .switch i { width: 16px; height: 16px; top: 2px; left: 2px; }
.dict-twoeum[aria-checked="true"] { color: var(--sage-ink); border-color: var(--sage-edge); background: var(--sage-soft); }
.dict-twoeum[aria-checked="true"] .switch { background: var(--sage); box-shadow: inset 0 1px 3px rgba(20,80,60,.26); }
.dict-twoeum[aria-checked="true"] .switch i { transform: translateX(16px); }
.dict-twoeum:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.dict-sorts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px;
  padding: 3px;
  border-radius: 13px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(110,95,70,.14);
}
.dict-sorts button {
  border: 0; border-radius: 10px;
  background: transparent;
  color: #6F6757;
  font-family: var(--display);
  font-size: 12px; font-weight: 700; letter-spacing: .01em;
  padding: 9px 2px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.dict-sorts button[aria-checked="true"] {
  background: var(--tile);
  color: var(--sky-ink);
  box-shadow: 0 2px 0 var(--sh), inset 0 -2px 0 #B9CCEA, inset 0 1px 0 #fff;
}
.dict-sorts button:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }

.dict-meta {
  margin: 0; padding: 0 2px;
  flex: 1 1 auto; min-width: 0;
  font-size: 11px; color: var(--mute); letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dict-meta b { color: var(--sky-ink); font-weight: 800; }
.dict-status { display: flex; align-items: center; gap: 8px; }
/* 후속 단어를 타고 내려간 자리에서 직전 검색어로 돌아가는 작은 칩 */
.dict-back-chip {
  flex: none; max-width: 132px;
  padding: 3px 8px 4px;
  border: 1px solid var(--sky-edge); border-radius: 9px;
  background: var(--sky-soft); color: var(--sky-ink);
  font-family: var(--display);
  font-size: 10.5px; font-weight: 800; letter-spacing: .01em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease, transform .12s ease;
}
.dict-back-chip:hover { background: #DCEBFB; }
.dict-back-chip:active { transform: translateY(1px); }
.dict-back-chip:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }

.dict-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  /* 스크롤 막대가 나타나고 사라질 때 여러 열 카드가 좌우로 흔들리지 않게 자리를 미리 둔다 */
  scrollbar-gutter: stable;
  display: flex; flex-direction: column; gap: 7px;
  padding-bottom: 4px;
}
.dict-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dict-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  padding: 9px 11px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--tile);
  box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
}
.dict-item.oneshot { border-color: #F0D6CF; box-shadow: inset 3px 0 0 #EFC4BC, 0 2px 0 var(--sh), inset 0 1px 0 #fff; }
/* 단어를 누르면 복사 — 글자처럼 보이지만 버튼이다(누를 수 있다는 걸 호버로 알린다) */
.dict-word {
  flex: 1 1 auto; min-width: 0;
  display: block;
  margin: -2px -4px; padding: 2px 4px;
  border: 0; border-radius: 7px;
  background: none;
  text-align: left; cursor: pointer;
  font-family: var(--font); font-weight: 700;
  font-size: 15px; letter-spacing: -.01em; line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  transition: background .14s ease;
}
.dict-word:hover { background: var(--sky-soft); }
.dict-word:active { background: #DCEBFB; }
.dict-word:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
.dict-word b { color: var(--sky-ink); font-weight: 800; background: rgba(61,126,200,.1); border-radius: 4px; padding: 0 1px; }
.dict-tags { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.dict-len { font-size: 10px; font-weight: 700; color: var(--mute-2); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.dict-tail {
  font-size: 10px; font-weight: 700; letter-spacing: 0;
  border-radius: 8px; padding: 3px 7px;
  color: var(--mute); background: var(--fill);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* 후속 O개는 버튼: 누르면 그 끝 글자로 후속 단어를 지금 정렬 그대로 다시 찾는다 */
button.dict-tail {
  border: 0; cursor: pointer;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease, transform .12s ease;
}
button.dict-tail:hover { color: var(--sky-ink); background: var(--sky-soft); box-shadow: inset 0 0 0 1px var(--sky-edge); }
button.dict-tail:active { transform: translateY(1px); }
button.dict-tail:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
.dict-tail.shot { color: var(--coral-ink); background: var(--coral-soft); }
.dict-chip { font-size: 9.5px; font-weight: 800; letter-spacing: 0; border-radius: 8px; padding: 3px 6px; white-space: nowrap; }
.dict-chip.easy { color: var(--sage-ink); background: var(--sage-soft); }
.dict-chip.loan { color: var(--gold-ink); background: var(--gold-soft); }
.dict-chip.twoeum { color: var(--plum-ink); background: var(--plum-soft); }

.dict-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  margin: auto 0;
  padding: 26px 12px;
  border: 1px dashed var(--edge-strong);
  border-radius: 14px;
  background: rgba(252,249,242,.6);
  color: var(--mute);
}
.dict-empty b { font-family: var(--display); font-size: 13.5px; font-weight: 800; color: var(--ink-soft); letter-spacing: .01em; }
.dict-empty small { font-size: 11px; color: var(--mute); line-height: 1.65; max-width: 260px; }
.dict-suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.dict-suggest button {
  width: 34px; height: 34px;
  border: 1px solid var(--sky-edge);
  border-radius: 10px;
  background: var(--sky-soft);
  color: var(--sky-ink);
  font-family: var(--display);
  font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 0 #CFDFF3, inset 0 1px 0 #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast);
}
.dict-suggest button:hover { background: #DFECFA; }
.dict-suggest button:active { transform: translateY(2px); box-shadow: 0 1px 0 #CFDFF3; }

.dict-more {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 2px 0 var(--sh);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast);
}
.dict-more:hover { background: #F0EADF; }
.dict-more:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sh); }
.dict-more small { color: var(--mute); font-weight: 700; font-family: var(--font); font-size: 10.5px; margin-left: 2px; }

/* ── 반응형 ──────────────────────────────────────────────── */
@media (max-width: 430px) {
  .levels { gap: 6px; }
  .level { height: 80px; }
  .level b { font-size: 12.5px; }
  .level small { font-size: 8px; }
  .pips { gap: 2.5px; }
  .pips i { width: 4.5px; height: 4.5px; }
}
@media (max-width: 380px) {
  .setup { padding-left: 16px; padding-right: 16px; }
  .level b { font-size: 11.5px; }
  .level small { font-size: 7.5px; }
  .stage-word h2 { font-size: clamp(26px, 9vw, 34px); }
  .need-char b { width: 54px; height: 54px; font-size: 27px; }
  .countdown b { font-size: 21px; }
  .turn-panel { padding-left: 15px; padding-right: 15px; }
  /* 아주 좁은 화면에서 점수가 다섯 자리가 되면 봇 이름까지 밀려 '잇…' 이 된다 */
  .game-top { padding-left: 11px; padding-right: 11px; }
  .game-top-row { gap: 6px; }
  .bot-info { gap: 7px; }
  .bot-face { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
  .bot-text b { font-size: 13.5px; }
  .scoreboard { gap: 4px; }
  .scoreboard .sc { padding: 5px 7px 4px; gap: 3px; }
  .scoreboard .sc i { font-size: 8px; }
  .scoreboard .sc b { font-size: 13.5px; }
}

/* ── 태블릿 · 폴더블 펼침 (600~819px): 한 줄 구성을 넓은 판으로 ─────
   561~819px 은 폰(≤560)과 데스크톱(≥820) 사이의 빈 구간이었다. 폰 폭 그대로
   가운데 앉아 좌우로 어정쩡한 여백이 남던 것을, 화면 폭에 맞춰 판을 넓히고
   로고·난이도 타일·입력 독을 함께 키워 태블릿 화면에 어울리게 한다.
   사전은 이 구간부터 두 열로 놓아 넓은 화면을 살린다. */
@media (min-width: 600px) and (max-width: 819px) {
  /* 설정 */
  .setup {
    max-width: 640px;
    padding: max(28px, env(safe-area-inset-top)) 30px calc(28px + env(safe-area-inset-bottom));
  }
  .brand { margin-top: 34px; }
  .brand-kicker { font-size: 12px; letter-spacing: .42em; text-indent: .42em; }
  .brand .logo-mark { margin-top: 14px; }
  .logo-mark .lt { width: 74px; height: 74px; font-size: 40px; border-radius: 17px; padding-bottom: 5px; }
  .brand-sub { margin-top: 14px; font-size: 12.5px; }
  .field { margin-top: 30px; gap: 11px; }
  .field-head span { font-size: 12.5px; letter-spacing: .16em; }
  .field-head em { font-size: 11.5px; }
  .levels { gap: 9px; }
  .level { height: 100px; border-radius: 15px; }
  .level b { font-size: 15px; margin-top: 6px; }
  .level small { font-size: 9.5px; }
  .pips { gap: 4px; }
  .pips i { width: 6px; height: 6px; }
  .toggle-card { padding: 15px 18px; }
  .toggle-card:first-of-type { margin-top: 18px; }
  .toggle-text b { font-size: 15px; }
  .toggle-text b i { font-size: 13.5px; }
  .toggle-text small { font-size: 11px; }
  .switch { width: 48px; height: 27px; border-radius: 14px; }
  .switch i { width: 21px; height: 21px; }
  .toggle-card[aria-checked="true"] .switch i { transform: translateX(21px); }
  .field-time { margin-top: 24px; }
  .field-first { margin-top: 20px; }
  .segmented button { height: 44px; font-size: 13.5px; border-radius: 11px; }
  .slider { height: 30px; --thumb: 22px; }
  .range { height: 30px; }
  .slider-track { height: 12px; border-radius: 6px; }
  .slider-fill { border-radius: 6px; }
  .range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; }
  .range::-webkit-slider-thumb { margin-top: -5px; }
  .slider.slider-time { --band: 30px; --track-h: 12px; --tk-end: 15px; --tk-10: 10px; --tk-5: 5.5px; --ends-h: 9.5px; }
  .slider-ends i { font-size: 10px; }
  .field-head .time-badge { font-size: 11.5px; padding: 4px 11px 5px; border-radius: 10px; }
  .field-head .time-badge b { font-size: 17px; }
  .setup > #btn-start { margin-top: 20px; }
  .btn.primary.big { height: 62px; font-size: 20px; border-radius: 17px; }
  .btn.primary.big kbd { right: 16px; font-size: 10px; padding: 4px 8px; }
  .top-actions { top: max(14px, env(safe-area-inset-top)); right: 20px; gap: 7px; }
  .top-btn { padding: 9px 14px 10px; font-size: 12px; border-radius: 12px; }
  .top-btn svg { width: 13px; height: 13px; }

  /* 대전 — 넓은 폰/태블릿 폭에 맞춰 머리·보드·입력 독을 함께 키운다 */
  .screen-game { max-width: 720px; }
  .game-top { padding: 15px 20px 13px; gap: 9px; }
  .game-top-row { gap: 12px; }
  .bot-info { gap: 10px; }
  .bot-face { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; }
  .bot-text b { font-size: 16px; }
  .bot-text small { font-size: 10.5px; }
  .scoreboard .sc { padding: 7px 11px 6px; gap: 5px; border-radius: 11px; }
  .scoreboard .sc i { font-size: 9.5px; }
  .scoreboard .sc b { font-size: 17px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 11px; font-size: 13px; }
  .mercy-badge { font-size: 11.5px; padding: 4px 12px 5px; }

  .arena { padding: 16px 24px 10px; gap: 10px; }
  .chain { padding: 6px 8px 8px; gap: 9px; }
  .chain li { max-width: 74%; padding: 8px 16px 10px; border-radius: 14px; }
  .chain-who { font-size: 9px; }
  .chain-word { font-size: 21px; }
  .bot-bubble { max-width: 70%; font-size: 13px; padding: 10px 14px 11px; }
  .stage-word { padding: 18px 32px 16px; border-radius: 22px; }
  .stage-word h2 { font-size: clamp(36px, 6.6vw, 52px); }
  .stage-word h2.long { font-size: clamp(17px, min(3.2vw, 4.2dvh), 26px); }
  .stage-who { font-size: 10px; }
  .stage-sub { margin-top: 10px; gap: 6px; }
  .stage-sub .gain { font-size: 13px; }
  .stage-sub .tag { font-size: 10px; padding: 3px 9px; }
  .stage-hint { font-size: 14px; padding: 18px 28px 19px; }
  .stage-hint b { font-size: 18px; }

  .turn-panel { padding: 16px 22px calc(17px + env(safe-area-inset-bottom)); }
  .turn-head { gap: 13px; }
  .need { gap: 9px; }
  .need-label { font-size: 10.5px; }
  .need-char b { width: 68px; height: 68px; font-size: 35px; border-radius: 15px; }
  .need-char em { font-size: 10px; padding: 3px 8px; }
  .mini { font-size: 11px; padding: 5px 9px; border-radius: 8px; }
  .countdown { padding-bottom: 7px; }
  .countdown b { font-size: 28px; }
  .countdown span { font-size: 10.5px; }
  .timer { height: 9px; margin: 12px 0 13px; border-radius: 4px; }
  .composer { gap: 9px; }
  .composer input { height: 54px; font-size: 17px; border-radius: 15px; padding: 0 16px; }
  .composer .btn { font-size: 16px; }
  .composer .btn.go { min-width: 96px; border-radius: 15px; }

  /* 사전 — 두 열 카드, 넓은 검색 바 */
  .dict { max-width: 760px; padding: max(18px, env(safe-area-inset-top)) 20px calc(14px + env(safe-area-inset-bottom)); gap: 11px; }
  .dict-top { gap: 14px; }
  .dict-back { padding: 9px 14px 10px; font-size: 12px; }
  .dict-title b { font-size: 16px; }
  .dict-title small { font-size: 11px; }
  .dict-search { gap: 10px; }
  .dict-input { height: 52px; font-size: 16px; border-radius: 14px; }
  .dict-clear { width: 26px; height: 26px; right: 10px; }
  .dict-twoeum { padding: 0 12px 0 14px; border-radius: 14px; font-size: 12px; }
  .dict-twoeum .switch { width: 38px; height: 21px; border-radius: 11px; }
  .dict-twoeum .switch i { width: 17px; height: 17px; }
  .dict-twoeum[aria-checked="true"] .switch i { transform: translateX(17px); }
  .dict-sorts { width: 100%; max-width: 560px; align-self: flex-start; }
  .dict-sorts button { padding: 11px 4px; font-size: 13px; }
  .dict-meta { font-size: 12px; }
  .dict-body { gap: 9px; }
  .dict-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 7px; }
  .dict-item { padding: 10px 13px; border-radius: 12px; }
  .dict-word { font-size: 16.5px; }
  .dict-len, .dict-tail, .dict-chip { font-size: 10px; }
  .dict-more { padding: 12px; font-size: 13px; }
  .dict-empty { padding: 34px 18px; }
  .dict-empty b { font-size: 15px; }
  .dict-empty small { font-size: 12px; max-width: 340px; }
  .dict-suggest button { width: 38px; height: 38px; font-size: 16px; }

  /* 시트(결과·설정)도 태블릿 폭에 맞춰 조금 넉넉하게 */
  .sheet { max-width: 470px; padding: 24px 24px calc(20px + env(safe-area-inset-bottom)); }
  .settings-sheet { max-width: 440px; }
}

/* 짧은 세로 화면: 설정 한 화면 유지 · 게임 여백 압축 */
@media (max-height: 760px) {
  .setup { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .brand { margin-top: 22px; }
  .brand .logo-mark { margin-top: 10px; }
  .logo-mark .lt { width: 54px; height: 54px; font-size: 30px; border-radius: 13px; }
  .field { margin-top: 22px; }
  .toggle-card { padding: 11px 14px; }
  .toggle-card:first-of-type { margin-top: 16px; }
  .field-time { margin-top: 16px; }
  .field-first { margin-top: 12px; }
  .setup > #btn-start { margin-top: 12px; }
  .btn.primary.big { height: 52px; }
}
@media (max-height: 700px) {
  .brand { margin-top: 14px; }
  .brand-sub { margin-top: 8px; font-size: 10.5px; }
  .brand-kicker { font-size: 10.5px; }
  .logo-mark .lt { width: 48px; height: 48px; font-size: 26px; border-radius: 12px; }
  .field { margin-top: 14px; gap: 7px; }
  .level { height: 68px; }
  .field-time { margin-top: 8px; gap: 6px; }
  .field-first { margin-top: 9px; }
  .segmented button { height: 33px; font-size: 12px; }
  .toggle-card { padding: 9px 13px; margin-top: 8px; }
  .toggle-card:first-of-type { margin-top: 12px; }
  .toggle-text b { font-size: 13px; }
  .toggle-text small { font-size: 9.5px; }
  .setup > #btn-start { margin-top: 10px; }
  .btn.primary.big { height: 46px; font-size: 16.5px; }
  .slider { height: 24px; --thumb: 17px; }
  .range { height: 24px; }
  .slider.slider-time { --band: 24px; --track-h: 10px; --tk-end: 11px; --tk-10: 7.5px; --tk-5: 4px; --ends-h: 8.5px; }
  .slider-ends i { font-size: 8.5px; }
  .top-btn { padding: 6px 10px 7px; font-size: 10.5px; }
  .top-actions { top: max(8px, env(safe-area-inset-top)); }
}

@media (max-height: 620px) {
  .stage { min-height: 96px; }
  .stage-word h2 { font-size: clamp(22px, 7.4vw, 30px); }
  .stage-word { padding: 11px 20px 10px; }
  .arena { padding-top: 8px; gap: 8px; }
  .bot-bubble { font-size: 11.5px; padding: 7px 11px; }
  .chain-word { font-size: 17px; }
  .turn-panel { padding-top: 11px; }
  .need-char b { width: 48px; height: 48px; font-size: 25px; }
  .timer { margin: 8px 0 9px; }
  .composer input { height: 44px; }
  .composer .btn { height: 44px; }
  .load-bar { height: 8px; }
}

@media (max-height: 520px) {
  .chain { gap: 6px; }
  .chain li { padding: 5px 11px 6px; }
  .chain-word { font-size: 15px; }
  .turn-panel { padding-top: 9px; border-radius: 18px 18px 0 0; }
  .turn-head { gap: 9px; }
  .need { gap: 5px; }
  .need-char b { width: 42px; height: 42px; font-size: 22px; }
  .timer { margin: 6px 0 7px; height: 7px; }
  .composer input { height: 40px; font-size: 14px; }
  .composer .btn { height: 40px; }
  /* 키보드가 올라와 높이가 줄어든 화면에서는 긴 단어 타일도 한 단계 더 줄인다 */
  .stage-word h2.long { font-size: clamp(13px, 4.2dvh, 19px); }
}

/* 아주 낮은 폰 화면(높이 520px 이하 · 폭 599px 이하): 설정도 스크롤 없이
   대전 시작 버튼까지 한 화면에 — 390×480 같은 분할 화면·키보드 높이 대비 */
@media (max-height: 520px) {
  .setup { padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .brand { margin-top: 10px; }
  .brand-kicker { font-size: 10px; }
  .brand .logo-mark { margin-top: 4px; }
  .logo-mark .lt { width: 42px; height: 42px; font-size: 23px; border-radius: 11px; }
  .brand-sub { margin-top: 5px; font-size: 10px; }
  .field { margin-top: 10px; gap: 6px; }
  .field-time { margin-top: 6px; }
  .field-first { margin-top: 7px; }
  .field-head span { font-size: 10.5px; }
  .level { height: 60px; }
  .level b { font-size: 11.5px; margin-top: 3px; }
  .level small { font-size: 7.5px; }
  .toggle-card { padding: 8px 12px; margin-top: 6px; }
  .toggle-card:first-of-type { margin-top: 8px; }
  .toggle-text b { font-size: 12px; }
  .toggle-text small { font-size: 9px; }
  .segmented button { height: 31px; }
  .setup > #btn-start { margin-top: 6px; }
  .btn.primary.big { height: 42px; font-size: 15.5px; }
}

@media (min-height: 660px) {
  .stage { justify-content: center; }
}

/* ── 데스크톱: 탁자 위에 넓게 펼친 보드 한 벌 ────────────────
   · 모바일(≤819px)은 손대지 않는다. 여기서부터만 와이드 보드로 바뀐다.
   · 모든 화면이 같은 크기의 보드 안에 앉아, 화면을 옮겨도 판이 흔들리지 않는다. */
@media (min-width: 820px) {
  :root {
    --board-w: min(1060px, calc(100vw - 56px));
    --board-h: min(820px, calc(var(--vvh, 100dvh) - 44px));
    --setup-h: min(660px, calc(var(--vvh, 100dvh) - 44px));
  }

  /* 보드는 늘 화면 한가운데 */
  #app {
    display: grid;
    place-items: center;
    height: var(--vvh, 100dvh);
  }
  .screen { height: auto; }

  /* ── 설정: 왼쪽에 브랜드·난이도, 오른쪽에 대전 설정 서랍 ── */
  /* 화면 높이에 맞춘 보드. 보드 내용이 그보다 높아지면(낮은 창·가로 모드)
     위아래가 잘리지 않고 화면이 스크롤된다 — 가운데 정렬은 margin:auto 가 맡는다
     (place-items:center 는 넘칠 때 위쪽을 잘라 스크롤로도 닿지 않게 한다). */
  .screen-setup {
    height: var(--vvh, 100dvh);
    display: flex; justify-content: center; align-items: flex-start;
    overflow-y: auto;
  }
  .setup {
    position: relative;
    width: var(--board-w); max-width: none;
    height: auto; min-height: var(--setup-h);
    margin: auto 0;
    padding: 36px 48px 32px;
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(0, .84fr);
    grid-template-rows: auto auto auto auto;
    column-gap: 56px;
    row-gap: 22px;
    align-content: center;
    background: rgba(252,249,242,.8);
    border: 1px solid var(--edge);
    border-radius: 30px;
    box-shadow: 0 6px 0 var(--sh), 0 54px 92px -54px rgba(90,74,50,.55), inset 0 1px 0 #fff;
  }

  /* 보드 가운데를 가로지르는 결 — 왼쪽은 놀이판, 오른쪽은 대전 설정 */
  .setup::before {
    content: '';
    position: absolute;
    top: 46px; bottom: 46px;
    left: calc(48px + (100% - 152px) * .58 + 28px);
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--edge) 14%, var(--edge) 86%, transparent);
    pointer-events: none;
  }

  .brand { grid-column: 1; grid-row: 1; margin-top: 0; }
  .brand-kicker { font-size: 12px; letter-spacing: .44em; text-indent: .44em; }
  .brand .logo-mark { margin-top: 16px; }
  .logo-mark .lt {
    width: 84px; height: 84px; margin: 0 5px;
    font-size: 46px; border-radius: 20px; padding-bottom: 6px;
  }
  .logo-mark .lt:first-child { transform: rotate(-2deg); }
  .logo-mark .lt:last-child { transform: rotate(1.6deg); }
  .brand-sub { margin-top: 15px; font-size: 12.5px; }
  /* 브랜드 아래 가는 실선 — 판의 머리말과 몸통을 나눈다 */
  .brand::after {
    content: '';
    align-self: stretch;
    height: 1px;
    margin-top: 24px;
    background: linear-gradient(90deg, transparent, var(--edge-strong) 18%, var(--edge-strong) 82%, transparent);
  }

  .field { gap: 11px; margin-top: 0; }
  .field-levels { grid-column: 1; grid-row: 2; margin-top: 0; }
  .field-time { grid-column: 2; grid-row: 2; align-self: start; margin-top: 0; }
  .field-first { grid-column: 2; grid-row: 3; align-self: start; margin-top: 0; }
  .field-head span { font-size: 12px; letter-spacing: .16em; }
  .field-head em { font-size: 11.5px; }
  .levels { gap: 9px; }
  .level {
    height: 150px; gap: 3px; border-radius: 15px;
    transition: transform var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid) ease,
                background var(--dur-fast) ease, border-color var(--dur-fast) ease;
  }
  .level:hover { border-color: var(--lv-edge); transform: translateY(-2px); }
  .level[aria-checked="true"]:hover { transform: translateY(2px); }
  .level b { font-size: 17px; margin-top: 12px; }
  .level small { font-size: 10.5px; letter-spacing: .06em; }
  .pips { gap: 5px; }
  .pips i { width: 7px; height: 7px; }

  .mercy-card { grid-column: 1; grid-row: 3; margin-top: 0; align-self: start; padding: 18px 20px; }
  .toggle-card:hover { border-color: var(--edge-strong); }
  .toggle-text b { font-size: 15px; }
  .toggle-text b i { font-size: 13.5px; }
  .toggle-text small { font-size: 11px; }
  .switch { width: 48px; height: 27px; border-radius: 14px; }
  .switch i { width: 21px; height: 21px; }
  .toggle-card[aria-checked="true"] .switch i { transform: translateX(21px); }

  .segmented button { height: 46px; font-size: 13.5px; }
  .slider { height: 30px; --thumb: 22px; }
  .range { height: 30px; }
  .slider.slider-time { --band: 30px; --track-h: 12px; --tk-end: 15px; --tk-10: 10px; --tk-5: 5.5px; --ends-h: 9.5px; }
  .slider-ends i { font-size: 9.5px; }
  .slider-track { height: 12px; border-radius: 6px; }
  .slider-fill { border-radius: 6px; }
  .range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; }
  .range::-webkit-slider-thumb { margin-top: -5px; }
  .field-head .time-badge { font-size: 11.5px; padding: 4px 11px 5px; border-radius: 10px; }
  .field-head .time-badge b { font-size: 17px; }

  .setup > #btn-start { grid-column: 2; grid-row: 4; margin-top: 0; align-self: end; }
  .btn.primary.big { height: 66px; font-size: 20px; border-radius: 18px; }
  .btn.primary.big kbd { right: 18px; font-size: 10.5px; padding: 5px 9px; border-radius: 7px; }

  .top-actions { top: 20px; right: 22px; gap: 8px; }
  .top-btn {
    padding: 10px 15px 11px; border-radius: 12px;
    font-size: 12.5px; gap: 7px;
  }
  .top-btn svg { width: 13px; height: 13px; }

  /* ── 대전: 넓은 보드 위에 봇·점수, 큰 단어 타일, 넉넉한 입력 독 ── */
  .screen-game {
    width: var(--board-w);
    height: var(--board-h);
    max-width: none;
    margin: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #F7F3EB;
    border: 1px solid var(--edge);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 6px 0 var(--sh), 0 54px 92px -54px rgba(90,74,50,.5), inset 0 1px 0 #fff;
  }
  .game-top { padding: 17px 26px 15px; gap: 11px; }
  .game-top-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; }
  .bot-face { width: 46px; height: 46px; font-size: 22px; border-radius: 13px; }
  .bot-text b { font-size: 17px; }
  .bot-text small { font-size: 10.5px; }
  .scoreboard { margin-left: 0; gap: 8px; }
  .scoreboard .sc { padding: 8px 14px 7px; border-radius: 12px; }
  .scoreboard .sc i { font-size: 10px; }
  .scoreboard .sc b { font-size: 20px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; justify-self: end; }
  .mercy-badge { font-size: 12px; padding: 5px 13px 6px; }
  .mercy-badge small { font-size: 10.5px; }

  .arena { padding: 14px 40px 10px; gap: 11px; }
  .chain { padding: 10px 8px 10px; gap: 10px; }
  .chain li { max-width: 56%; padding: 9px 20px 11px; border-radius: 15px; }
  .chain-who { font-size: 9px; }
  .chain-word { font-size: 22px; }
  .bot-bubble { max-width: 58%; font-size: 13.5px; padding: 10px 15px 11px; }

  .stage-word { padding: 20px 44px 18px; border-radius: 22px; }
  .stage-word h2 { font-size: clamp(44px, 4.7vw, 64px); }
  .stage-word h2.long { font-size: clamp(24px, 2.4vw, 34px); }
  .stage-who { font-size: 10.5px; }
  .stage-hint { font-size: 14px; padding: 18px 30px 19px; }
  .stage-hint b { font-size: 19px; }
  .stage-sub { margin-top: 11px; gap: 7px; }
  .stage-sub .gain { font-size: 13.5px; }
  .stage-sub .tag { font-size: 10.5px; padding: 4px 10px; }

  .turn-panel {
    margin: 0 16px 16px;
    padding: 18px 22px 20px;
    border: 1px solid var(--edge);
    border-radius: 20px;
    box-shadow: 0 2px 0 var(--sh), inset 0 1px 0 #fff;
  }
  .turn-head { gap: 18px; }
  .need { gap: 9px; }
  .need-label { font-size: 10.5px; }
  .need-char b { width: 74px; height: 74px; font-size: 38px; border-radius: 16px; padding-bottom: 5px; }
  .need-char em { font-size: 10.5px; padding: 4px 9px; }
  .mini { font-size: 11px; padding: 6px 10px; border-radius: 9px; }
  .countdown { padding-bottom: 8px; }
  .countdown b { font-size: 30px; }
  .countdown span { font-size: 11px; }
  .timer { height: 10px; margin: 13px 0 14px; border-radius: 5px; }
  .composer input { height: 58px; font-size: 17px; border-radius: 15px; padding: 0 18px; }
  .composer .btn { font-size: 17px; }
  .composer .btn.go { min-width: 108px; border-radius: 15px; }

  /* ── 사전: 넓은 검색 바 + 단어 카드 여러 열 ── */
  .screen-dict { display: grid; place-items: center; }
  .dict {
    width: var(--board-w);
    height: var(--board-h);
    max-width: none;
    padding: 26px 32px 20px;
    gap: 14px;
    background: #F8F4EC;
    border: 1px solid var(--edge);
    border-radius: 28px;
    box-shadow: 0 6px 0 var(--sh), 0 54px 92px -54px rgba(90,74,50,.5), inset 0 1px 0 #fff;
  }
  .dict-top { gap: 16px; }
  .dict-back { padding: 10px 15px 11px; border-radius: 12px; font-size: 12.5px; }
  .dict-title b { font-size: 17px; }
  .dict-title small { font-size: 11.5px; }
  .dict-search { gap: 10px; }
  .dict-input { height: 58px; padding: 0 46px 0 18px; border-radius: 15px; font-size: 17px; }
  .dict-clear { width: 28px; height: 28px; right: 12px; font-size: 11px; }
  .dict-twoeum { padding: 0 14px 0 16px; border-radius: 15px; font-size: 12.5px; }
  .dict-twoeum:hover { border-color: var(--sage-edge); color: var(--sage-ink); }
  .dict-twoeum .switch { width: 40px; height: 22px; border-radius: 11px; }
  .dict-twoeum .switch i { width: 18px; height: 18px; }
  .dict-twoeum[aria-checked="true"] .switch i { transform: translateX(18px); }
  .dict-sorts { width: 460px; max-width: 100%; align-self: flex-start; }
  .dict-sorts button { padding: 12px 4px; font-size: 13.5px; }
  .dict-sorts button:hover { color: var(--sky-ink); }
  .dict-meta { font-size: 12px; }
  .dict-body { gap: 10px; }
  .dict-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 8px;
  }
  .dict-item { padding: 12px 15px; border-radius: 13px; }
  .dict-word { font-size: 17px; }
  .dict-len, .dict-tail, .dict-chip { font-size: 10.5px; }
  .dict-more { padding: 13px; font-size: 13px; border-radius: 13px; }
  .dict-empty { padding: 40px 20px; }
  .dict-empty b { font-size: 15px; }
  .dict-empty small { font-size: 12px; max-width: 340px; }
  .dict-suggest button { width: 40px; height: 40px; font-size: 16px; border-radius: 11px; }

  /* ── 결과 시트: 데스크톱에서도 작아 보이지 않게 ──
     배틀 내역을 펼쳐도 카드가 화면 안에 다 들어와야 하므로 높이를 아껴 쓴다 */
  .overlay { padding: 26px; }
  .sheet {
    max-width: 520px;
    padding: 24px 28px 22px;
    border-radius: 26px;
  }
  .result-badge { width: 58px; height: 58px; margin-bottom: 8px; font-size: 29px; border-radius: 16px; }
  .result-sheet h2 { font-size: 28px; }
  .result-level { margin-top: 10px; padding: 6px 14px 7px; font-size: 12.5px; border-radius: 11px; }
  .result-level i { font-size: 15px; }
  .result-level b { font-size: 13.5px; }
  .result-reason { margin: 10px 0 14px; font-size: 13px; }
  .result-score { margin: 14px 0; gap: 16px; }
  .result-score .rs { min-width: 96px; padding: 9px 13px 8px; border-radius: 14px; }
  .result-score .rs i { font-size: 10px; }
  .result-score .rs b { font-size: 27px; }
  .result-score .vs { font-size: 17px; }
  .result-stats { gap: 9px; margin-bottom: 14px; }
  .result-stats div { padding: 9px 8px 10px; border-radius: 12px; }
  .result-stats dt { font-size: 10px; }
  .result-stats dd { font-size: 18px; }
  .battle-log-btn { padding: 11px; font-size: 13px; margin-bottom: 10px; }
  .battle-log { max-height: 212px; }
  .blog-word { font-size: 18px; line-height: 1.5; }
  .result-actions { gap: 11px; }
  .result-actions .btn { height: 50px; font-size: 16px; }
}

/* 세로로 긴 태블릿(820px 이상 · 높이 1000px 이상): 보드를 세로로 더 펼쳐
   화면 위아래로 크게 남던 여백을 줄인다. */
@media (min-width: 820px) and (min-height: 1000px) {
  :root {
    --board-h: min(980px, calc(var(--vvh, 100dvh) - 60px));
    /* 설정 판은 내용 높이에 맞춰 둔다 — 세로로 긴 화면에서 판만 늘리면
       위아래가 크게 비어 오히려 허전해 보인다. */
    --setup-h: min(700px, calc(var(--vvh, 100dvh) - 60px));
  }
}

/* ── 큰 화면: 화면이 커진 만큼 판도 함께 커진다 ───────────
   보드 폭·높이만 키우면 판 안의 글자가 작아 보이므로, 단계마다
   단어 타일·난이도 카드·입력 독 같은 중심 요소도 같이 키운다. */
@media (min-width: 1400px) {
  :root {
    --board-w: min(1240px, calc(100vw - 80px));
    --board-h: min(920px, calc(var(--vvh, 100dvh) - 56px));
    --setup-h: min(760px, calc(var(--vvh, 100dvh) - 56px));
  }
  .logo-mark .lt { width: 96px; height: 96px; font-size: 52px; border-radius: 23px; }
  .level { height: 168px; }
  .level b { font-size: 19px; }
  .level small { font-size: 11.5px; }
  .setup > #btn-start .btn, .btn.primary.big { height: 72px; font-size: 21px; }
  .bot-face { width: 52px; height: 52px; font-size: 25px; }
  .bot-text b { font-size: 19px; }
  .bot-text small { font-size: 11.5px; }
  .scoreboard .sc b { font-size: 22px; }
  .chain li { max-width: 52%; }
  .chain-word { font-size: 24px; }
  .bot-bubble { max-width: 54%; font-size: 14.5px; }
  .stage-word h2 { font-size: clamp(52px, 3.4vw, 76px); }
  .stage-word h2.long { font-size: clamp(28px, 2vw, 42px); }
  .stage-who { font-size: 11.5px; }
  .stage-sub .gain { font-size: 15px; }
  .need-char b { width: 82px; height: 82px; font-size: 42px; border-radius: 18px; }
  .need-label { font-size: 11.5px; }
  .mini { font-size: 12px; padding: 7px 11px; }
  .countdown b { font-size: 34px; }
  .turn-panel { padding: 20px 26px 22px; }
  .composer input { height: 64px; font-size: 18px; border-radius: 17px; }
  .composer .btn { font-size: 18px; }
  .composer .btn.go { min-width: 122px; border-radius: 17px; }
  .dict { padding: 30px 36px 24px; }
  .dict-input { height: 64px; font-size: 18px; }
  .dict-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .dict-word { font-size: 18px; }
  .dict-sorts { width: 520px; }
  .dict-sorts button { padding: 13px 4px; font-size: 14px; }
  .sheet { max-width: 560px; padding: 28px 32px 26px; }
  .result-sheet h2 { font-size: 31px; }
  .result-badge { width: 64px; height: 64px; font-size: 32px; }
  .result-score .rs b { font-size: 30px; }
  .result-stats dd { font-size: 20px; }
  .blog-word { font-size: 19px; }
  .battle-log { max-height: clamp(140px, 26dvh, 300px); }
  .result-actions .btn { height: 54px; font-size: 17px; }
  .settings-sheet { max-width: 430px; padding: 26px 26px 24px; }
}

@media (min-width: 1800px) {
  :root {
    --board-w: min(1420px, calc(100vw - 140px));
    --board-h: min(960px, calc(var(--vvh, 100dvh) - 72px));
    --setup-h: min(800px, calc(var(--vvh, 100dvh) - 72px));
  }
  .logo-mark .lt { width: 104px; height: 104px; font-size: 56px; }
  .level { height: 180px; }
  .level b { font-size: 20px; }
  .stage-word h2 { font-size: clamp(58px, 3.2vw, 84px); }
  .stage-word h2.long { font-size: clamp(32px, 1.9vw, 46px); }
  .need-char b { width: 88px; height: 88px; font-size: 45px; }
  .composer input { height: 68px; font-size: 19px; }
  .chain-word { font-size: 25px; }
  .bot-bubble { font-size: 15px; }
  .dict-word { font-size: 19px; }
  .dict-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

@media (min-width: 2300px) {
  :root {
    --board-w: min(1640px, calc(100vw - 220px));
    --board-h: min(1020px, calc(var(--vvh, 100dvh) - 100px));
    --setup-h: min(860px, calc(var(--vvh, 100dvh) - 100px));
  }
  .setup { padding: 44px 60px 40px; }
  .logo-mark .lt { width: 116px; height: 116px; font-size: 62px; border-radius: 28px; }
  .brand-sub { font-size: 14px; }
  .level { height: 196px; }
  .level b { font-size: 22px; }
  .level small { font-size: 12.5px; }
  .btn.primary.big { height: 78px; font-size: 23px; }
  .stage-word h2 { font-size: clamp(64px, 3vw, 96px); }
  .stage-word h2.long { font-size: clamp(36px, 1.8vw, 52px); }
  .need-char b { width: 94px; height: 94px; font-size: 48px; }
  .countdown b { font-size: 38px; }
  .composer input { height: 74px; font-size: 20px; }
  .chain-word { font-size: 27px; }
  .bot-bubble { font-size: 16px; }
  .turn-panel { padding: 22px 30px 24px; }
  .dict { padding: 34px 44px 28px; }
  .dict-word { font-size: 20px; }
  .dict-list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
  .dict-input { height: 70px; font-size: 19px; }
}

/* 좁은 데스크톱 창(820~1050px): 보드가 줄어든 만큼 여백·글자를 함께 줄인다 */
@media (min-width: 820px) and (max-width: 1050px) {
  .setup { padding: 28px 30px 26px; column-gap: 34px; row-gap: 16px; }
  .setup::before { left: calc(30px + (100% - 94px) * .58 + 17px); top: 36px; bottom: 36px; }
  .logo-mark .lt { width: 68px; height: 68px; font-size: 37px; border-radius: 17px; }
  .brand::after { margin-top: 18px; }
  .level { height: 100px; }
  .level b { font-size: 13px; margin-top: 6px; }
  .level small { font-size: 8.5px; }
  .segmented button { height: 42px; font-size: 12.5px; }
  .btn.primary.big { height: 58px; font-size: 18px; }
  .arena { padding: 12px 26px 10px; }
  .turn-panel { margin: 0 12px 12px; padding: 15px 17px 17px; }
  .need-char b { width: 62px; height: 62px; font-size: 32px; }
  .composer input { height: 52px; font-size: 16px; }
  .composer .btn.go { min-width: 92px; }
  .dict { padding: 20px 22px 16px; }
  .dict-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* 낮은 데스크톱 창(높이 680px 이하): 보드가 낮아진 만큼 한 화면에 다시 맞춘다 */
@media (min-width: 820px) and (max-height: 680px) {
  .setup { padding: 24px 32px 22px; row-gap: 14px; }
  .brand .logo-mark { margin-top: 10px; }
  .logo-mark .lt { width: 62px; height: 62px; font-size: 34px; border-radius: 15px; }
  .brand::after { margin-top: 14px; }
  .brand-sub { margin-top: 10px; font-size: 11.5px; }
  .level { height: 108px; }
  .level b { font-size: 14px; margin-top: 6px; }
  .mercy-card { padding: 13px 16px; }
  .toggle-text b { font-size: 14px; }
  .toggle-text small { font-size: 10px; }
  .field-time { margin-top: 0; }
  .field-first { margin-top: 0; }
  .segmented button { height: 40px; font-size: 12.5px; }
  .btn.primary.big { height: 54px; font-size: 18px; }
  .need-char b { width: 60px; height: 60px; font-size: 30px; }
  .composer input { height: 48px; font-size: 16px; }
  .timer { margin: 9px 0 10px; }
}

/* ── 낮은 데스크톱 창 · 가로 모드 휴대폰 (높이 560px 이하) ──────
   넓이는 데스크톱 보드인데 높이가 짧으면, 머리·입력 독이 화면을 다 먹어
   가운데 단어 타일이 입력 독 뒤로 숨어 버렸다. 여백·글자를 함께 줄여
   단어 타일 자리를 남기고, 결과 카드도 한 화면에 들어오게 맞춘다. */
@media (min-width: 820px) and (max-height: 560px) {
  /* 설정 보드: 낮은 높이에 맞춰 로고·카드·여백을 줄여 스크롤 없이 한 화면에 */
  .setup { padding: 18px 30px 16px; column-gap: 32px; row-gap: 12px; }
  .setup::before { top: 24px; bottom: 24px; left: calc(30px + (100% - 92px) * .58 + 16px); }
  .brand { margin-top: 0; }
  .brand-kicker { font-size: 10.5px; }
  .brand .logo-mark { margin-top: 8px; }
  .logo-mark .lt { width: 56px; height: 56px; font-size: 29px; border-radius: 13px; margin: 0 4px; }
  .brand-sub { margin-top: 7px; font-size: 10.5px; }
  .brand::after { margin-top: 12px; }
  .field { gap: 7px; }
  .field-head span { font-size: 11px; }
  .field-head em { font-size: 10px; }
  .levels { gap: 7px; }
  .level { height: 92px; }
  .level b { font-size: 13px; margin-top: 5px; }
  .level small { font-size: 8px; }
  .pips i { width: 5px; height: 5px; }
  .mercy-card { padding: 9px 13px; }
  .toggle-text b { font-size: 13px; }
  .toggle-text small { font-size: 9.5px; }
  .segmented { padding: 2px; }
  .segmented button { height: 36px; font-size: 12.5px; }
  .setup > #btn-start { margin-top: 0; }
  .btn.primary.big { height: 46px; font-size: 16.5px; }
  .top-actions { top: 10px; right: 14px; }
  .btn.primary.big kbd { font-size: 9px; padding: 3px 6px; }

  .game-top { padding: 8px 16px; gap: 6px; }
  .bot-face { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
  .bot-text b { font-size: 14px; }
  .bot-text small { font-size: 9px; }
  .scoreboard .sc { padding: 5px 9px 4px; border-radius: 9px; }
  .scoreboard .sc i { font-size: 8.5px; }
  .scoreboard .sc b { font-size: 15px; }
  .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
  .mercy-badge { font-size: 10px; padding: 3px 9px 4px; }
  .mercy-badge small { font-size: 8.5px; }

  .arena { padding: 6px 16px 4px; gap: 4px; }
  .chain { padding: 0 4px; gap: 5px; }
  .chain li { padding: 5px 11px 6px; border-radius: 11px; }
  .chain-who { font-size: 8px; }
  .chain-word { font-size: 15px; }
  .stage { min-height: 0; }
  .bot-bubble { max-width: 70%; font-size: 10.5px; padding: 5px 9px; }
  .stage-word { padding: 10px 18px 9px; border-radius: 16px; }
  .stage-who { font-size: 8.5px; margin-bottom: 1px; }
  .stage-sub { margin-top: 5px; gap: 5px; }
  .stage-sub .gain { font-size: 11px; }
  .stage-sub .tag { font-size: 8.5px; padding: 2px 6px; }
  .stage-hint { font-size: 11.5px; padding: 9px 16px 10px; }
  .stage-hint b { font-size: 15px; }
  /* 타일 글자는 높이에 맞춰 — 44~64px 그대로 두면 9글자만 되어도 두 줄이 되어
     보드 아래 말풍선·입력 독을 밀어낸다 */
  .stage-word h2 { font-size: clamp(24px, 6.6dvh, 38px); }
  .stage-word h2.long { font-size: clamp(13px, min(4.2dvh, 3.4vw), 20px); }

  .turn-panel { margin: 0 8px 8px; padding: 9px 13px 10px; border-radius: 15px; }
  .turn-head { gap: 10px; }
  .need { gap: 4px; }
  .need-label { font-size: 8.5px; }
  .need-char b { width: 40px; height: 40px; font-size: 21px; border-radius: 10px; padding-bottom: 2px; }
  .need-char em { font-size: 8.5px; padding: 2px 5px; }
  .mini { font-size: 9px; padding: 3px 6px; border-radius: 7px; }
  .countdown { padding-bottom: 3px; }
  .countdown b { font-size: 19px; }
  .countdown span { font-size: 9px; }
  .timer { height: 6px; margin: 6px 0 7px; border-radius: 3px; }
  .composer input { height: 38px; font-size: 14px; border-radius: 11px; padding: 0 12px; }
  .composer .btn { font-size: 13px; }
  .composer .btn.go { min-width: 72px; border-radius: 11px; }

  .overlay { padding: 10px; }
  .sheet { max-width: 470px; padding: 13px 16px 12px; border-radius: 18px; }
  .result-badge { width: 38px; height: 38px; margin-bottom: 3px; font-size: 19px; border-radius: 11px; }
  .result-sheet h2 { font-size: 20px; }
  .result-mercy { margin-top: 5px; font-size: 10px; }
  .result-level { margin-top: 4px; padding: 3px 9px 4px; font-size: 10.5px; }
  .result-level i { font-size: 12px; }
  .result-level b { font-size: 11px; }
  .result-reason { margin: 4px 0 7px; font-size: 10.5px; line-height: 1.45; }
  .result-score { margin: 7px 0; gap: 10px; }
  .result-score .rs { min-width: 62px; padding: 5px 8px 4px; border-radius: 10px; }
  .result-score .rs i { font-size: 8.5px; }
  .result-score .rs b { font-size: 19px; }
  .result-score .vs { font-size: 13px; }
  .result-stats { gap: 5px; margin-bottom: 7px; }
  .result-stats div { padding: 5px 4px 6px; border-radius: 9px; }
  .result-stats dt { font-size: 8.5px; margin-bottom: 1px; }
  .result-stats dd { font-size: 13.5px; }
  .battle-log-btn { padding: 7px 9px; font-size: 11.5px; margin-bottom: 6px; }
  .battle-log { max-height: 84px; margin-bottom: 6px; padding: 7px; }
  .blog-word { font-size: 13.5px; }
  .blog-body { padding: 5px 8px 6px; }
  .result-actions .btn { height: 38px; font-size: 13.5px; }
  .settings-sheet { padding: 15px 17px; gap: 10px; }
  .settings-top h2 { font-size: 16px; }
}

/* 낮은 데스크톱 창(높이 561~680px): 결과 카드의 배틀 내역을 펼쳐도
   다시 대전 버튼까지 스크롤 없이 한 화면에 들어오게 압축한다. */
@media (min-width: 820px) and (min-height: 561px) and (max-height: 680px) {
  .sheet { max-width: 500px; padding: 17px 22px 15px; }
  .result-badge { width: 44px; height: 44px; margin-bottom: 4px; font-size: 22px; }
  .result-sheet h2 { font-size: 23px; }
  .result-level { margin-top: 6px; padding: 4px 11px 5px; font-size: 11px; }
  .result-level b { font-size: 12px; }
  .result-reason { margin: 6px 0 9px; font-size: 11.5px; }
  .result-score { margin: 9px 0; gap: 13px; }
  .result-score .rs { min-width: 78px; padding: 6px 10px 5px; }
  .result-score .rs b { font-size: 21px; }
  .result-stats { gap: 7px; margin-bottom: 9px; }
  .result-stats div { padding: 6px 6px 7px; }
  .result-stats dt { font-size: 9px; }
  .result-stats dd { font-size: 15px; }
  .battle-log-btn { padding: 8px 10px; font-size: 11.5px; margin-bottom: 8px; }
  .battle-log { max-height: min(150px, 24dvh); margin-bottom: 8px; padding: 7px; }
  .blog-word { font-size: 14.5px; }
  .result-actions .btn { height: 42px; font-size: 14px; }
}

/* ── 아주 낮은 데스크톱 창 · 가로 모드 폰 (높이 460px 이하) ─────
   844×390 같은 화면에서 설정 보드가 403px 이 되어 위아래로 잘리거나
   스크롤됐다. 로고·난이도 타일·여백을 한 단계 더 줄여 한 화면에 앉힌다. */
@media (min-width: 820px) and (max-height: 460px) {
  .setup { padding: 14px 26px 12px; column-gap: 28px; row-gap: 8px; }
  .setup::before { top: 18px; bottom: 18px; left: calc(26px + (100% - 80px) * .58 + 14px); }
  .brand { margin-top: 0; }
  .brand-kicker { font-size: 9.5px; }
  .brand .logo-mark { margin-top: 4px; }
  .logo-mark .lt { width: 44px; height: 44px; font-size: 23px; border-radius: 11px; margin: 0 3px; }
  .brand-sub { margin-top: 5px; font-size: 9.5px; }
  .brand::after { margin-top: 6px; }
  .field { gap: 5px; }
  .field-head span { font-size: 10px; letter-spacing: .12em; }
  .field-head em { font-size: 9.5px; }
  .levels { gap: 5px; }
  .level { height: 74px; border-radius: 10px; }
  .level b { font-size: 11.5px; margin-top: 3px; }
  .level small { font-size: 7px; }
  .pips { gap: 3px; }
  .pips i { width: 4px; height: 4px; }
  .mercy-card { padding: 7px 11px; }
  .toggle-text b { font-size: 12px; }
  .toggle-text b i { font-size: 11px; margin-right: 4px; }
  .toggle-text small { font-size: 8.5px; }
  .switch { width: 38px; height: 22px; border-radius: 11px; }
  .switch i { width: 17px; height: 17px; }
  .toggle-card[aria-checked="true"] .switch i { transform: translateX(16px); }
  .field-time { margin-top: 0; }
  .field-first { margin-top: 0; }
  .segmented { padding: 2px; }
  .segmented button { height: 31px; font-size: 11.5px; }
  .slider { height: 22px; --thumb: 15px; }
  .range { height: 22px; }
  .slider-track { height: 8px; border-radius: 4px; }
  .slider-fill { border-radius: 4px; }
  .range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; }
  .range::-webkit-slider-thumb { margin-top: -3.5px; }
  .slider.slider-time { --band: 22px; --track-h: 8px; --tk-end: 9px; --tk-10: 6px; --tk-5: 3.5px; --ends-h: 7.5px; }
  .slider-ends i { font-size: 7.5px; }
  .field-head .time-badge { font-size: 9.5px; padding: 2px 7px 3px; border-radius: 8px; }
  .field-head .time-badge b { font-size: 13px; }
  .btn.primary.big { height: 38px; font-size: 15px; border-radius: 12px; }
  .btn.primary.big kbd { font-size: 8px; padding: 2px 5px; border-radius: 5px; }
  .top-actions { top: 8px; right: 12px; gap: 5px; }
  .top-btn { padding: 5px 9px 6px; font-size: 9.5px; border-radius: 9px; gap: 5px; }
  .top-btn svg { width: 11px; height: 11px; }
}

/* ── 아주 낮은 화면(높이 480px 이하): 결과·설정 시트를 한 화면에 ──
   배틀 내역을 펼치면 카드가 화면보다 길어져 다시 대전/난이도 변경 버튼이
   스크롤 아래로 밀렸다. 여백·글자를 압축해 버튼까지 한 화면에 남긴다. */
@media (max-height: 480px) {
  .overlay { padding: 8px; }
  .sheet { padding: 10px 14px calc(8px + env(safe-area-inset-bottom)); border-radius: 16px; max-height: calc(var(--vvh, 100dvh) - 16px); }
  .result-badge { width: 30px; height: 30px; margin-bottom: 4px; font-size: 16px; border-radius: 9px; }
  .result-sheet h2 { font-size: 17px; line-height: 1.2; }
  .result-mercy { margin-top: 3px; font-size: 9px; padding: 2px 8px 3px; }
  .result-mercy small { font-size: 8px; }
  .result-level { margin-top: 3px; padding: 2px 8px 3px; font-size: 10px; border-radius: 8px; }
  .result-level i { font-size: 11px; }
  .result-level b { font-size: 10.5px; }
  .result-reason { margin: 2px 0 5px; font-size: 10px; line-height: 1.4; }
  .result-score { margin: 5px 0; gap: 8px; }
  .result-score .rs { min-width: 56px; padding: 4px 7px 3px; border-radius: 9px; }
  .result-score .rs i { font-size: 8px; }
  .result-score .rs b { font-size: 17px; }
  .result-score .vs { font-size: 12px; }
  .result-stats { gap: 4px; margin-bottom: 5px; }
  .result-stats div { padding: 4px 3px 5px; border-radius: 8px; }
  .result-stats dt { font-size: 8px; margin-bottom: 1px; }
  .result-stats dd { font-size: 12.5px; }
  .battle-log-btn { padding: 6px 8px; font-size: 10.5px; margin-bottom: 5px; border-radius: 9px; }
  .battle-log { max-height: min(72px, 19dvh); margin-bottom: 5px; padding: 6px; border-radius: 10px; }
  .battle-log-list { gap: 4px; }
  .blog-body { padding: 4px 7px 5px; border-radius: 9px; }
  .blog-word { font-size: 12.5px; }
  .blog-turn { min-width: 17px; height: 17px; font-size: 8.5px; border-radius: 5px; }
  .blog-who { font-size: 8.5px; }
  .blog-gain { font-size: 9.5px; }
  .result-actions { gap: 7px; }
  .result-actions .btn { height: 32px; font-size: 12.5px; border-radius: 10px; }
  .settings-sheet { padding: 12px 14px; gap: 8px; }
  .settings-top h2 { font-size: 15px; }
  .settings-close { width: 28px; height: 28px; }
  .settings-block { padding: 9px 11px 10px; gap: 4px; border-radius: 12px; }
  .settings-head { gap: 7px; }
  .vol-icon { width: 26px; height: 26px; font-size: 12px; }
  .settings-label { font-size: 12px; }
  .settings-value { font-size: 11px; padding: 2px 7px 3px; }
  .toggle-card { padding: 8px 11px; }
  .toggle-text b { font-size: 12px; }
  .toggle-text small { font-size: 8.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* 움직임을 줄여도 읽을 것은 그대로 남긴다(연출만 끈다) */
  .ko-splash, .ko-splash > div { animation: none !important; }
  .float-score { animation: none !important; opacity: 1; transform: translate(-50%, 0); }
  .confetti { display: none; }
}
