/* ══════════════════════════════════════════════════════════════
   뮤나리자 등급 공개 방식 비교 — 레이아웃 시안 1-A + 2-A · 표시·배치 수리판
   (layout-preview-1547074012541227018 · 원본 1546813496346288128-v2-20260908-235630)
   비교 시안 · 제품 미반영 · 확률·시간은 시험값.

   색·글꼴·연출 규칙·등급 5색·레일/띠 스위치·잉크통·나무 틀·발광은 원본 값을 그대로 쓴다.
   바꾼 것은 자리잡기뿐이다.

   1  무대를 1920×1080 으로 그려 통째로 등비 축소하던 방식을 걷어냈다.
      바깥 작업판은 grid 두 줄(짧은 머리말 + 전환줄 / 목적 한 줄)이고, 남은 세로 공간 전부를
      무대가 flex 로 쓴다. 글씨 크기와 판넬은 줄이지 않았다.
   2  무대 안은 「상태 한 줄 + 필수 조작」 한 줄과 가운데 작업공간뿐이다.
      상시 좌우 설정 기둥은 없앴다. 작업대는 680px(작품 624px) 그대로다.
   3  비교 설정(#panelPop)과 상세 안내(#detailPop)는 화면 안 오버레이다.
      흐름 밖에 있으므로 열고 닫아도 무대·작업공간·작업대의 크기와 자리가 바뀌지 않는다.
      좁은 폭에서는 화면에 고정(fixed)되고 안쪽만 스크롤된다.
   4  화면이 낮으면 작업대만 픽셀 정수배(48의 배수)로 단계를 낮춰 세로 스크롤을 막는다.
      글씨·판넬은 그대로 두고 작업대 치수만 내린다.
   ══════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; background: #17120d; }
body {
  color: #e8dcc4;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  word-break: keep-all;
  min-height: 100%;
}
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ══ 바깥 작업판 — 두 줄만 쓰고 나머지 세로 공간은 전부 무대에 준다 ══ */
#board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px 12px;
  height: 100vh;
  padding: 6px 12px 8px;
  overflow: hidden;
}
#boardHead {
  grid-column: 1; grid-row: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #1b140f; border: 1px solid #57452c; border-radius: 8px; padding: 4px 10px;
}
#boardHead h1 { font-size: 15px; color: #f0e3c2; letter-spacing: 0.3px; font-weight: 700; white-space: nowrap; }
#shapeTag {
  font-size: 11.5px; font-weight: 800; color: #f4dc9a; white-space: nowrap;
  border: 1px solid #57452c; border-radius: 6px; padding: 3px 8px;
}
.mock-tag {
  font-size: 11px; font-weight: 900; letter-spacing: 0.4px; color: #d8b978;
  border: 1px dashed #8a6f3c; border-radius: 6px; padding: 4px 8px;
}
/* 두 손잡이 — 상세 안내와 비교 설정. 늘 같은 자리에 있어 언제나 닿는다. */
#detailToggle, #panelToggle {
  background: #2e251b; color: #f4dc9a; border: 1px solid #57452c;
  border-radius: 6px; padding: 5px 10px; font-size: 12.5px; font-weight: 800;
  cursor: pointer; line-height: 1.25; white-space: nowrap;
}
#detailToggle:hover:not(:disabled), #panelToggle:hover:not(:disabled) { border-color: #d8b978; }
#detailToggle[aria-expanded="true"], #panelToggle[aria-expanded="true"] { background: #3a3222; border-color: #d8b978; }
#detailToggle:disabled, #panelToggle:disabled { opacity: 0.45; cursor: default; }

/* 짧은 전환줄 — 보기와 모드를 한 줄에. 좁은 폭에서는 줄바꿈으로 전부 보인다 (숨기지 않는다) */
#switchRow {
  grid-column: 2; grid-row: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
}
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#tabBar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bar-title { font-size: 12px; font-weight: 800; color: #b09d7e; margin-right: 2px; white-space: nowrap; }
.bar button {
  background: #2e251b; color: #c9b891; border: 1px solid #57452c;
  border-radius: 6px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; line-height: 1.25;
}
.bar button:hover:not(:disabled) { border-color: #d8b978; }
.bar button[aria-pressed="true"] { background: #3a3222; border-color: #d8b978; color: #f4dc9a; font-weight: 800; }
/* 기존판 탭에서는 체험 모드를 고를 수 없다 — 손잡이와 같은 비활성 표시를 쓴다 */
.bar button:disabled { opacity: 0.45; cursor: default; }
#tabBar button { font-size: 13px; padding: 5px 11px; }
#tabBar button small { font-size: 11px; font-weight: 400; color: #8d7b5f; margin-left: 6px; }
#tabBar button[aria-pressed="true"] small { color: #c9b891; }

#boardNote {
  grid-column: 1 / -1; grid-row: 2;
  font-size: 12.5px; line-height: 1.4; color: #d8b978;
  border: 1px dashed #6a5a2c; border-radius: 8px; padding: 4px 10px;
}

/* 무대를 감싸는 칸 — 남은 세로 공간을 그대로 채운다 (등비 축소 없음) */
#legacyPane, #playPane { grid-column: 1 / -1; grid-row: 3; min-height: 0; display: none; }
#board[data-tab="legacy"] #legacyPane { display: block; }
#board[data-tab="A"] #playPane,
#board[data-tab="B"] #playPane,
#board[data-tab="C"] #playPane { display: block; }
.stage-wrap {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background: #14100c; border: 1px solid #3a2f24; border-radius: 10px;
}
/* 기존판은 원형 보존이라 안을 고칠 수 없다. 1920×1080 iframe 을 그대로 등비 축소한다. */
#legacyFrame {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px; border: 0;
  transform-origin: 0 0;
}

/* ══ 안쪽 무대 — 화면에 남은 공간을 그대로 쓴다 ══ */
#playStage {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px;
  overflow: hidden;
  background: #221c16;
}

/* ── 등급 5색 — 원본과 같은 값 ── */
.grade-cell { --grade-color: #b09d7e; }
.grade-cell[data-grade="bronze"] { --grade-color: #c07a45; }
.grade-cell[data-grade="silver"] { --grade-color: #c9d2da; }
.grade-cell[data-grade="gold"] { --grade-color: #e8c14a; }
.grade-cell[data-grade="platinum"] { --grade-color: #9ad7e8; }
.grade-cell[data-grade="diamond"] { --grade-color: #d79ae8; }

/* ── 게임 바로 위 한 줄 · 상태와 필수 조작만 ── */
#reviewBar {
  flex: 0 0 auto; height: 40px;
  display: flex; align-items: center; gap: 12px;
  background: #1b140f; border: 1px solid #57452c; border-radius: 8px;
  padding: 0 12px; font-size: 12.5px; color: #b09d7e;
}
#statusLine { font-size: 14px; font-weight: 800; color: #f0e3c2; white-space: nowrap; }
#scopeNote { flex: 1 1 auto; font-size: 13px; color: #9fc37a; font-weight: 800; white-space: nowrap; overflow: hidden; }
.bar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.bar-actions button {
  background: #2e251b; color: #c9b891; border: 1px solid #57452c;
  border-radius: 6px; padding: 5px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.bar-actions button:hover:not(:disabled) { border-color: #d8b978; }
.bar-actions button[aria-pressed="true"] { background: #3a3222; border-color: #d8b978; color: #f4dc9a; }
#nextBtn { background: #d8b978; color: #221c16; border-color: #d8b978; font-weight: 800; }

/* ══ 가운데 작업공간 — 이 화면의 주인공 ══ */
#workspace {
  flex: 1 1 auto; min-height: 0;
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 50% 44%, #34291e 0, #251e17 55%, #1d1712 100%);
  border: 1px solid #493a29; border-radius: 12px;
  padding: 8px 16px;
  overflow: hidden;
}

/* 윗줄 · 원작 카드와 공개 칸 */
.ws-top { flex: 0 0 auto; height: 68px; display: flex; align-items: stretch; gap: 10px; }
.original-card {
  flex: 0 0 auto; width: 232px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: #1d1712; border: 1px solid #57452c; border-radius: 10px;
  padding: 8px 10px; color: #e8dcc4;
}
.original-card canvas {
  image-rendering: pixelated; image-rendering: crisp-edges;
  width: 48px; height: 48px; flex: 0 0 auto;
  border: 2px solid #5b432c; border-radius: 4px; background: #14100c;
}
.original-card .sel-text b { display: block; font-size: 13.5px; color: #f3e7c8; margin-bottom: 3px; }
.original-card .sel-text span { font-size: 11.5px; color: #9b8a6c; line-height: 1.35; display: block; }

/* 등급 칸 — A/B 는 다섯 칸을 켜고, C 는 칸을 아예 그리지 않고 「등급 미공개」만 남긴다 */
#gradeLadder {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  background: rgba(20, 15, 10, 0.94); border: 1px solid #6a5a2c; border-radius: 10px;
  padding: 0 14px;
}
#ladderTitle {
  font-size: 13px; font-weight: 800; color: #f4dc9a; letter-spacing: 0.3px;
  flex: 0 0 auto; width: 72px; text-align: center; line-height: 1.25;
}
#ladderCells { display: flex; gap: 8px; flex: 1 1 auto; }
#ladderNote { font-size: 12.5px; font-weight: 800; color: #c9b891; flex: 1 1 auto; text-align: center; line-height: 1.4; }
.ladder-cell {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 52px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--grade-color); border-radius: 7px;
  opacity: 0.38;
}
.ladder-cell b { font-size: 12.5px; font-weight: 800; color: var(--grade-color); }
.ladder-cell i { font-size: 10px; font-style: normal; color: #b09d7e; height: 12px; line-height: 12px; }
.ladder-cell[data-state="current"] {
  opacity: 1; background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 1px var(--grade-color), 0 0 12px rgba(255, 255, 255, 0.12);
}
.ladder-cell[data-state="current"] i { color: #f0e3c2; }
.ladder-cell[data-state="past"] { opacity: 0.68; }
.ladder-cell[data-final="true"] { box-shadow: 0 0 0 2px var(--grade-color), 0 0 18px var(--grade-color); }

/* 가운데 줄 · 잉크통 + 큰 작업대 + 세로 레일. 줄 높이가 곧 작업대 크기다. */
.ws-mid {
  --bench-size: 680px; --bench-art-size: 624px;
  flex: 0 0 auto; height: var(--bench-size);
  display: flex; align-items: center; justify-content: center; gap: 14px;
}

.ink-cartridge {
  position: relative; flex: 0 0 auto;
  width: 42px; height: 100%; margin-left: 42px;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.55));
}
.ink-cartridge .ink-pipe {
  position: absolute; left: 40%; top: -22px; width: 22%; height: 26px;
  background: #30281e; border: 2px solid #7d6848; border-bottom: 0; border-radius: 3px 3px 0 0;
}
.ink-cartridge .ink-tank {
  position: absolute; left: 10%; right: 10%; top: 0; bottom: 40px;
  border: 3px solid #806849; border-radius: 9px; background: #130d16; overflow: hidden;
}
.ink-cartridge .ink-liquid {
  position: absolute; left: 0; right: 0; bottom: 0; height: 78%;
  background: linear-gradient(90deg, #3f6b8a, #62b6d8 55%, #3f6b8a);
}
.ink-cartridge .ink-liquid::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: rgba(200, 240, 255, 0.75);
}
.ink-cartridge .ink-readout {
  position: absolute; left: -8%; right: -8%; bottom: 0; height: 34px;
  border: 2px solid #806849; border-radius: 5px; background: #2b2118;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #f2d47f;
}

/* 큰 작업대 — 작업대 680 · 작품 624(48×13) · 나무 틀 12px. 원본 v2 는 480/432 였다.
   나무 틀·발광·흔들림·테두리 덮개층은 원본 그대로이며 크기만 따라간다. */
.bench {
  flex: 0 0 auto;
  width: var(--bench-size); height: var(--bench-size);
  cursor: ns-resize;
}
.bench-unit {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: var(--bench-size); height: var(--bench-size);
  background: #14100c;
  border: 12px solid #5b432c;
  border-radius: 6px;
  box-shadow: 0 7px 0 #4a3826, 0 13px 0 #2b2016, 0 18px 20px rgba(0, 0, 0, 0.4);
}
.bench-unit canvas.art {
  image-rendering: pixelated; image-rendering: crisp-edges;
  width: var(--bench-art-size); height: var(--bench-art-size); display: block;
  flex: 0 0 auto;
}
.bench-unit canvas.frame-fx {
  position: absolute; left: -12px; top: -12px;
  width: var(--bench-size); height: var(--bench-size);
  image-rendering: pixelated; image-rendering: crisp-edges;
  pointer-events: none;
}
.bench-unit[data-glow="true"] {
  box-shadow: 0 7px 0 #4a3826, 0 13px 0 #2b2016, 0 18px 20px rgba(0, 0, 0, 0.4),
              0 0 0 2px var(--glow, #e8c14a), 0 0 34px var(--glow, #e8c14a);
}
.bench-unit[data-glow="strong"] {
  box-shadow: 0 7px 0 #4a3826, 0 13px 0 #2b2016, 0 18px 20px rgba(0, 0, 0, 0.4),
              0 0 0 3px #f6f2ff, 0 0 20px var(--glow, #d79ae8), 0 0 44px var(--glow, #d79ae8);
}
/* 색판이 착 맞는 순간 그림이 한 번 흔들린다 */
.bench-unit.shake canvas.art { animation: bench-snap 0.28s linear; }
@keyframes bench-snap {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-2px, 0); }
  100% { transform: translate(0, 0); }
}

/* ── 인쇄 진행 — 세로 레일과 가로 눈금띠가 같은 자료를 그린다 ── */
.p-label { font-size: 13px; font-weight: 900; color: #f0e3c2; letter-spacing: 0.4px; white-space: nowrap; }
.p-word { font-size: 10.5px; color: #b09d7e; white-space: nowrap; }
.p-cell {
  display: flex; align-items: center; justify-content: center;
  background: #241c14; border: 2px solid #4a3d2c; border-radius: 5px;
  color: #6a563a; font-size: 12px; font-weight: 800;
}
.p-cell[data-state="done"] { background: #3f6b8a; border-color: #62b6d8; color: #e9f6ff; box-shadow: inset 0 -3px 0 #2c4c63; }
.p-cell[data-state="current"] { border-color: #f1d37e; color: #f4dc9a; box-shadow: 0 0 0 2px rgba(241, 211, 126, 0.22); }

#progressRail {
  flex: 0 0 auto; width: 84px; height: 100%;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  background: rgba(20, 15, 10, 0.94); border: 1px solid #6a5a2c; border-radius: 10px;
  padding: 8px 6px;
}
#progressRail .p-head { display: flex; flex-direction: column; align-items: center; gap: 1px; height: 32px; flex: 0 0 auto; }
#railCells { flex: 1 1 auto; display: flex; flex-direction: column; gap: 5px; }
#railCells .p-cell { flex: 1 1 0; min-height: 0; }

/* 아랫줄 · 가로 눈금띠와 조작 안내가 같은 줄을 쓴다 (진행 UI 를 바꿔도 세로 높이가 그대로다) */
.ws-under { flex: 0 0 auto; height: 40px; display: flex; align-items: stretch; gap: 10px; }
#progressStrip {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  background: rgba(20, 15, 10, 0.94); border: 1px solid #6a5a2c; border-radius: 10px;
  padding: 0 10px;
}
#progressStrip .p-head { display: flex; flex-direction: column; align-items: flex-start; width: 84px; flex: 0 0 auto; }
#stripCells { flex: 1 1 auto; display: flex; gap: 5px; height: 24px; }
#stripCells .p-cell { flex: 1 1 0; min-width: 0; }

/* 진행 UI 스위치 — 한 번에 하나만 보인다 */
#workspace[data-progress-ui="rail"] #progressStrip { display: none; }
#workspace[data-progress-ui="strip"] #progressRail { display: none; }

#controlHint {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; color: #c9b891; white-space: nowrap;
  border: 1px dashed #4a3d2c; border-radius: 8px;
}
#controlHint b { color: #f0e3c2; }
#controlHint kbd { font-family: inherit; font-size: 11px; color: #8d7b5f; border: 1px solid #4a3d2c; border-radius: 4px; padding: 1px 5px; }

/* 최종 발표 줄 — 그림을 덮는 배너가 아니라 작업대 아래 한 줄 */
#resultLine {
  flex: 0 0 auto; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: #f0e3c2; letter-spacing: 1px;
  text-shadow: 0 2px 0 #14100c, 0 0 18px rgba(0, 0, 0, 0.8);
  white-space: nowrap; overflow: hidden;
}
#resultLine[data-state="idle"] { font-size: 15px; color: #8d7b5f; font-weight: 800; letter-spacing: 0.3px; }
#resultLine[data-jackpot="true"] { text-shadow: 0 0 10px #f6f2ff, 0 0 26px var(--result-color, #d79ae8); }
#phaseLine {
  flex: 0 0 auto; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: #b09d7e; white-space: nowrap; overflow: hidden;
}

/* ══ 화면 안 오버레이 — 비교 설정과 상세 안내 ══
   둘 다 흐름 밖(absolute)이라 열고 닫아도 무대·작업공간·작업대의 자리가 바뀌지 않는다.
   기본은 둘 다 접힘이고, 닫기 버튼과 Esc 로 닫는다. 안쪽이 길면 안쪽만 스크롤된다. */
#panelPop {
  position: absolute; right: 12px; top: 52px; width: 420px;
  max-height: calc(100vh - 76px);
  z-index: 40;
  display: flex; flex-direction: column; gap: 10px;
  background: #1d1712; border: 1px solid #6a5a2c; border-radius: 10px;
  padding: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}
#detailPop {
  position: absolute; right: 12px; top: 52px; width: 420px;
  max-height: calc(100vh - 76px);
  z-index: 40;
  display: flex; flex-direction: column; gap: 10px;
  background: #1d1712; border: 1px solid #6a5a2c; border-radius: 10px;
  padding: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}
#board[data-panel="closed"] #panelPop { display: none; }
#board[data-detail="closed"] #detailPop { display: none; }
.pop-head { display: flex; align-items: flex-start; gap: 10px; }
.pop-head h3 { font-size: 15px; color: #f4dc9a; letter-spacing: 0.4px; }
.pop-head p { font-size: 11.5px; color: #8d7b5f; line-height: 1.45; margin-top: 4px; }
#panelHead, .pop-title { flex: 1 1 auto; min-width: 0; }
.pop-close {
  flex: 0 0 auto;
  background: #2e251b; color: #c9b891; border: 1px solid #57452c;
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.pop-close:hover { border-color: #d8b978; }
.pop-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#panelSummary {
  flex: 0 0 auto;
  font-size: 11.5px; color: #b09d7e; line-height: 1.55;
  border: 1px dashed #4a3d2c; border-radius: 6px; padding: 6px 8px;
}
#paceBar:empty { display: none; }

#panelBody { display: flex; flex-direction: column; gap: 10px; }
.opt-group { display: flex; flex-direction: column; gap: 5px; }
.opt-title { font-size: 12px; font-weight: 800; color: #b09d7e; letter-spacing: 0.3px; }
.opt-title small { font-weight: 400; color: #8d7b5f; margin-left: 6px; }
.opt-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.opt-buttons[data-cols="3"] { grid-template-columns: 1fr 1fr 1fr; }
.opt-buttons button {
  background: #2e251b; color: #c9b891; border: 1px solid #57452c;
  border-radius: 6px; padding: 7px 6px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
  line-height: 1.2;
}
.opt-buttons button:hover:not(:disabled) { border-color: #d8b978; }
.opt-buttons button[aria-pressed="true"] { background: #3a3222; border-color: #d8b978; color: #f4dc9a; font-weight: 800; }
.opt-buttons button:disabled { opacity: 0.45; cursor: default; }
.opt-buttons button[data-set="result"]::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 0;
  background: var(--dot, #8d7b5f); border-radius: 2px;
}
.opt-buttons button[data-value="random"] { --dot: #8d7b5f; }
.opt-buttons button[data-value="bronze"] { --dot: #c07a45; }
.opt-buttons button[data-value="silver"] { --dot: #c9d2da; }
.opt-buttons button[data-value="gold"] { --dot: #e8c14a; }
.opt-buttons button[data-value="platinum"] { --dot: #9ad7e8; }
.opt-buttons button[data-value="diamond"] { --dot: #d79ae8; }
.panel-hint { font-size: 11.5px; color: #d8b978; line-height: 1.45; border: 1px dashed #6a5a2c; border-radius: 6px; padding: 5px 8px; }

.prob-list { display: flex; flex-direction: column; gap: 3px; }
.prob-cell {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--grade-color); border-radius: 6px;
  padding: 3px 8px; height: 24px;
}
.prob-cell b { font-size: 12px; font-weight: 800; color: var(--grade-color); }
.prob-cell i { font-size: 13px; font-weight: 800; color: #e8dcc4; font-style: normal; }
#probSum { font-size: 11.5px; color: #d8b978; font-weight: 800; text-align: right; }

/* 상세 안내 안쪽 — 예전 오른쪽 안내줄에 있던 긴 글이 전부 여기로 왔다 */
.info-box { background: #241c14; border: 1px solid #3a2f24; border-radius: 8px; padding: 9px 11px; }
.info-box h3 { font-size: 12px; font-weight: 800; color: #b09d7e; letter-spacing: 0.3px; margin-bottom: 5px; }
.info-box p { font-size: 12.5px; color: #e8dcc4; line-height: 1.5; }
#stageShapeTag { font-weight: 800; color: #f4dc9a; }
#idTag { font-size: 11.5px; color: #9fc37a; line-height: 1.5; margin-top: 4px; }
#planLine { font-weight: 800; }
#fxPlanLine { font-size: 12px; color: #c9b891; }
.info-box ul { list-style: none; font-size: 12px; color: #c9b891; line-height: 1.6; }
.info-box ul b { color: #f0e3c2; }
#eventLogList { list-style: none; font-size: 11.5px; color: #b09d7e; line-height: 1.55; }
#eventLogList li b { color: #f4dc9a; }
.info-box .mock-tag { display: inline-block; margin-top: 6px; }

/* ══ 낮은 화면 — 작업대만 픽셀 정수배로 단계를 낮춰 세로 스크롤을 막는다 ══
   글씨·판넬·안내는 그대로 두고 작업대 치수만 내린다. 작품은 언제나 48의 배수라
   픽셀이 뭉개지지 않고, 나무 틀 12px 두 겹 안에 들어간다. */
@media (max-height: 1065px) { .ws-mid { --bench-size: 608px; --bench-art-size: 576px; } }
@media (max-height: 993px)  { .ws-mid { --bench-size: 536px; --bench-art-size: 480px; } }
@media (max-height: 921px)  { .ws-mid { --bench-size: 464px; --bench-art-size: 432px; } }
@media (max-height: 849px)  { .ws-mid { --bench-size: 392px; --bench-art-size: 336px; } }
@media (max-height: 777px)  { .ws-mid { --bench-size: 320px; --bench-art-size: 288px; } }
@media (max-height: 705px)  { .ws-mid { --bench-size: 272px; --bench-art-size: 240px; } }

/* ══ 좁은 폭 — 390×844 에서도 작업대까지 바로 닿는다 ══
   상시 설정 기둥이 없으므로 머리말·전환줄·상태줄 다음이 곧 작업대다.
   설정·상세는 화면에 고정된 오버레이로 뜨고 안쪽만 스크롤되므로, 열고 닫아도
   작업대와 무대의 자리가 밀리지 않는다. 보조 글씨는 12px 아래로 내려가지 않는다. */
@media (max-width: 640px) {
  #board {
    display: flex; flex-direction: column;
    height: auto; min-height: 100vh; overflow: visible;
    padding: 8px 8px 16px; gap: 8px;
  }
  #boardHead { padding: 8px 10px; gap: 6px; }
  #boardHead h1 { font-size: 14px; white-space: normal; }
  #switchRow { gap: 8px; }
  #tabBar button { padding: 8px 10px; font-size: 12.5px; }
  .bar button { padding: 7px 10px; font-size: 12px; }
  #boardNote { font-size: 12px; line-height: 1.55; padding: 6px 10px; }
  /* small 은 크기를 안 적으면 부모 글씨에 브라우저 기본 비율이 곱해져 10px 로 내려간다 */
  #idTag, #shapeTag, #tabBar button small, .mock-tag, .opt-title small { font-size: 12px; }

  #legacyPane, #playPane { min-height: 0; }
  .stage-wrap { height: auto; }
  #playStage { height: auto; padding: 10px; gap: 10px; }
  #reviewBar { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  #statusLine { white-space: normal; }
  #scopeNote { flex: 1 1 100%; white-space: normal; overflow: visible; }
  .bar-actions { flex: 1 1 100%; flex-wrap: wrap; }

  /* 390px 첫 화면에서 작업대에 바로 닿게 한다 — 작업대 → 원작·공개 칸 → 진행·조작 → 결과 순.
     PC 순서(공개 칸이 작업대 위)는 그대로다. 좁은 폭에서만 읽는 차례를 바꾼다. */
  #workspace { max-width: none; justify-content: flex-start; gap: 10px; padding: 12px; overflow: visible; }
  .ws-mid { order: 1; }
  .ws-top { order: 2; height: auto; flex-direction: column; gap: 10px; }
  .ws-under { order: 3; }
  #resultLine { order: 4; }
  #phaseLine { order: 5; }
  .original-card { width: 100%; }
  .original-card .sel-text span { font-size: 12px; }
  #gradeLadder { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 12px; }
  #ladderTitle { width: auto; text-align: left; }
  #ladderCells { flex-wrap: wrap; gap: 6px; }
  .ladder-cell { flex: 1 1 96px; height: 48px; }
  .ladder-cell i { font-size: 12px; height: auto; line-height: 1.35; }
  #ladderNote { text-align: left; }

  /* 잉크통은 작업대 옆에 그대로 두고 세로 레일만 아래로 접는다 — 작업대가 위로 올라온다 */
  .ws-mid {
    --bench-size: 264px; --bench-art-size: 240px;
    height: auto; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  }
  .ink-cartridge { width: 40px; height: 200px; margin: 22px 0 0; }
  #progressRail { flex: 0 0 auto; width: 92px; height: 420px; margin: 6px auto 0; }
  #progressRail .p-head { height: 36px; }

  .ws-under { height: auto; flex-direction: column; gap: 10px; }
  #progressStrip { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; }
  #progressStrip .p-head { flex-direction: row; align-items: center; gap: 8px; width: auto; }
  #stripCells { flex-wrap: wrap; height: auto; gap: 6px; }
  #stripCells .p-cell { flex: 0 0 auto; width: 34px; height: 28px; min-width: 34px; }
  .p-word { font-size: 12px; }
  #controlHint { white-space: normal; text-align: center; line-height: 1.5; padding: 8px 10px; }
  #controlHint kbd { font-size: 12px; }

  #resultLine {
    height: auto; white-space: normal; text-align: center; line-height: 1.3;
    font-size: 22px; min-height: 44px; padding: 4px 8px;
  }
  #resultLine[data-state="idle"] { font-size: 15px; }
  #phaseLine { height: auto; white-space: normal; text-align: center; min-height: 28px; padding: 2px 8px; }

  /* 오버레이는 화면에 고정되고 안쪽만 스크롤된다 — 흐름을 밀어내지 않는다 */
  #panelPop, #detailPop {
    position: fixed; left: 8px; right: 8px; top: 8px; bottom: 8px;
    width: auto; max-height: none; z-index: 60;
  }
  .pop-head p, .panel-hint, #probSum, #eventLogList, #panelSummary { font-size: 12px; }
  .opt-buttons { grid-template-columns: 1fr 1fr; }
}
