/* 만지작 수학실 — 화면 스타일. 색은 토큰만 쓴다(교구 색은 --m-* · 표상 단계는 .rep-c/.rep-p/.rep-s). */
:root {
  --bg: #f6f4ee; --paper: #fffdf8; --ink: #1f2a37; --ink-2: #4b5563; --line: #d9d4c7; --line-2: #ebe7dc;
  --accent: #2f6fde; --accent-2: #e7efff; --warn: #e08a00; --ok: #1f9d55; --bad: #d64545;
  --gb-accent: #2f6fde; --gb-accent-ink: #ffffff; --gb-bg: #fffdf8; --gb-panel: #fffdf8; --gb-panel-2: #f1ede3; --gb-line: #d9d4c7;
  --gb-text: #1f2a37; --gb-dim: #5b6472; --gb-gold: #9a6400; --gb-danger: #c93636; --gb-font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --m-one: #f5b83d; --m-ten: #3b8fe0; --m-hund: #2fb37a; --m-thou: #9a63d8;
  --m-red: #e55a4e; --m-blue: #3b8fe0; --m-green: #2fb37a; --m-yellow: #f5c33d; --m-purple: #9a63d8; --m-orange: #f08a3c; --m-pink: #e86aa6; --m-teal: #23a8a8; --m-brown: #a87447; --m-gray: #8f96a3;
  --r: 14px; --r-sm: 10px; --shadow: 0 2px 10px rgba(31, 42, 55, .08);
  --top-h: 60px; --bottom-h: 74px; --drawer-w: 260px; --panel-w: 300px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
:root[data-big='1'] { --top-h: 72px; --bottom-h: 92px; font-size: 18px; }
:root[data-contrast='1'] { --line: #6b7280; --ink-2: #1f2937; --bg: #ffffff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.screen { min-height: 100%; }
h1, h2, h3 { margin: 0; }
.ic { display: block; flex: none; }

.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn:focus-visible, .icon-btn:focus-visible, .mode-card:focus-visible { outline: 3px solid #f5b83d; outline-offset: 2px; }
.icon-btn { width: 44px; height: 44px; min-width: 44px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn[aria-pressed='true'], .icon-btn.on { background: var(--accent-2); border-color: var(--accent); color: var(--accent); }
.icon-btn.sm { width: 44px; height: 44px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ── 첫 화면 ── */
.home { max-width: 1100px; margin: 0 auto; padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.home-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: conic-gradient(var(--m-one) 0 25%, var(--m-ten) 0 50%, var(--m-hund) 0 75%, var(--m-red) 0); }
.home-tools { display: flex; gap: 6px; }
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-card { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; min-height: 92px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.mode-card:hover { border-color: var(--accent); }
.mode-ic { grid-row: 1 / span 2; width: 52px; height: 52px; border-radius: 12px; background: var(--accent-2); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.mode-name { font-size: 1.15rem; font-weight: 800; }
.mode-desc { color: var(--ink-2); font-size: .92rem; }
.home-challenge { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ch-head h2 { font-size: 1.1rem; }
.growth-line { margin: 0; color: var(--ink-2); font-size: .9rem; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.home-quick h2, .home-join h2 { font-size: 1.05rem; }
.quick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.grade-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.grade-chips button { min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; }
.grade-chips button[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tool-chip { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); text-align: left; }
.tool-chip:hover { border-color: var(--accent); }
.tool-chip .tc-ic { width: 34px; height: 34px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--line-2); }
.tool-chip .tc-name { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.tool-chip .tc-g { display: block; color: var(--ink-2); font-size: .78rem; font-weight: 500; }
.area-num .tc-ic { background: #fff1d6; color: #9a6400; }
.area-rel .tc-ic { background: #ffe3ef; color: #a1336b; }
.area-geo .tc-ic { background: #ddf4ea; color: #19744c; }
.area-data .tc-ic { background: #e5ecff; color: #2a4fae; }
.area-ext .tc-ic { background: #eee; color: #555; }
.join-form { display: flex; gap: 8px; max-width: 420px; }
.join-form input { flex: 1; min-height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line); padding: 0 14px; font-size: 1.2rem; letter-spacing: .2em; text-transform: uppercase; background: var(--paper); }
.home-foot { color: var(--ink-2); font-size: .85rem; text-align: center; }

/* ── 작업판 ── */
.ws { height: 100%; display: grid; grid-template-columns: var(--drawer-w) 1fr var(--panel-w); grid-template-rows: var(--top-h) 1fr var(--bottom-h); grid-template-areas: 'top top top' 'drawer stage panel' 'bottom bottom bottom'; }
.ws.no-drawer { grid-template-columns: 0 1fr var(--panel-w); }
.ws.no-drawer .drawer { display: none; }
.ws-top { grid-area: top; display: flex; align-items: center; gap: 6px; padding: 0 8px; background: var(--paper); border-bottom: 1px solid var(--line); min-width: 0; }
.ws-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-mode { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.rep-toggle { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.rep-toggle button { min-height: 44px; padding: 0 12px; border: 0; background: transparent; font-weight: 700; font-size: .9rem; }
.rep-toggle button[aria-checked='true'] { background: var(--ink); color: #fff; }
.ws-actions { display: flex; gap: 2px; flex: none; }
.drawer { grid-area: drawer; background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.drawer-head { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line-2); }
.drawer-head input { min-height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); padding: 0 10px; background: var(--bg); }
.drawer-head .grade-chips button { min-width: 44px; padding: 0 6px; font-size: .85rem; }
.tool-list { overflow-y: auto; padding: 6px 8px 20px; display: flex; flex-direction: column; gap: 4px; }
.tool-list h3 { font-size: .8rem; color: var(--ink-2); margin: 10px 4px 2px; font-weight: 700; }
.tool-list .tool-chip { min-height: 48px; padding: 6px 8px; }
.tool-list .tool-chip[aria-current='true'] { border-color: var(--accent); background: var(--accent-2); }
.stage-wrap { grid-area: stage; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.stage { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage > svg { width: 100%; height: 100%; display: block; }
.stage .widget { position: absolute; inset: 0; overflow: auto; touch-action: pan-y; }
.ink-layer { position: absolute; inset: 0; pointer-events: none; }
.ink-layer.active { pointer-events: auto; touch-action: none; cursor: crosshair; }
.ink-layer svg { width: 100%; height: 100%; display: block; }
.zoom-ctl { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.cover { position: absolute; left: 10%; top: 12%; width: 40%; height: 30%; background: repeating-linear-gradient(45deg, #2d3748, #2d3748 12px, #374151 12px, #374151 24px); border-radius: 12px; cursor: move; touch-action: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.cover .cover-resize { position: absolute; right: 0; bottom: 0; width: 44px; height: 44px; cursor: nwse-resize; }
.panel { grid-area: panel; background: var(--paper); border-left: 1px solid var(--line); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel-head, .cards-head { font-size: .8rem; color: var(--ink-2); font-weight: 700; }
.rep-sym { font-size: 1.9rem; font-weight: 800; line-height: 1.35; min-height: 52px; word-break: keep-all; font-variant-numeric: tabular-nums; }
.rep-say { color: var(--ink-2); font-size: .98rem; line-height: 1.5; }
.rep-extra { font-size: .9rem; }
.card-box { display: flex; flex-direction: column; gap: 6px; }
.explore-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; background: var(--bg); font-size: .92rem; line-height: 1.45; }
.explore-card b { display: block; margin-bottom: 2px; }
.recipe-box { border-top: 1px solid var(--line-2); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ws-bottom { grid-area: bottom; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--paper); border-top: 1px solid var(--line); overflow-x: auto; }
.palette { display: flex; gap: 6px; flex: none; }
.pal-item { min-height: 56px; min-width: 56px; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .8rem; font-weight: 600; touch-action: none; }
.pal-item svg.pv { width: 34px; height: 26px; }
.pal-item[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-2); }
.tool-actions { display: flex; gap: 6px; flex: none; }
.tool-actions .btn { min-height: 48px; }
.tool-actions select, .tool-actions input[type=number] { min-height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line); padding: 0 8px; background: var(--paper); }
.tool-actions label { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; font-weight: 600; }
.common-tools { margin-left: auto; display: flex; gap: 2px; flex: none; border-left: 1px solid var(--line-2); padding-left: 6px; }

/* 교구 그림 공통(SVG) */
.stage svg text { font-family: var(--font); }
.obj { cursor: grab; }
.obj:active { cursor: grabbing; }
.obj.sel > :first-child { stroke: var(--accent) !important; stroke-width: 3 !important; }
.handle { fill: #fff; stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.lbl { font-weight: 700; fill: var(--ink); pointer-events: none; }
.lbl-sm { font-size: 18px; font-weight: 600; fill: var(--ink-2); pointer-events: none; }
.grid-line { stroke: #ddd6c6; stroke-width: 1; }
.grid-line.major { stroke: #c9c1ae; }
.drop-zone { fill: rgba(47, 111, 222, .05); stroke: #9fb7e8; stroke-dasharray: 8 6; stroke-width: 2; }
/* 표상 단계: 그림(p) = 납작한 도식, 식(s) = 교구 흐리게 */
.rep-p .shade, .rep-p .gloss { display: none; }
.rep-p .obj > rect, .rep-p .obj > circle, .rep-p .obj > path, .rep-p .obj > polygon { fill: #fff !important; stroke: #374151 !important; stroke-width: 2 !important; }
.rep-p .fill-keep { fill: #374151 !important; }
.rep-s svg .scene { opacity: .14; }
.rep-s .rep-sym { font-size: 2.6rem; }
.stage .big-sym { display: none; }
.rep-s .big-sym { display: block; position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 800; pointer-events: none; }

/* 위젯형 교구 공통 */
.wg { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 980px; margin: 0 auto; }
.wg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wg table { border-collapse: collapse; background: var(--paper); }
.wg td, .wg th { border: 1px solid var(--line); padding: 6px 10px; text-align: center; min-width: 44px; height: 44px; }
.wg th { background: var(--line-2); }
.cell-in { width: 64px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; text-align: center; background: #fff; }

/* 모달·토스트 */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-card { position: relative; background: var(--paper); border-radius: var(--r); padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal-x { position: absolute; right: 8px; top: 8px; }
.modal h2 { font-size: 1.2rem; margin-bottom: 10px; padding-right: 44px; }
.modal p { line-height: 1.55; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-box svg { width: min(320px, 70vw); height: auto; background: #fff; padding: 8px; border-radius: 8px; }
.qr-url { font-size: .8rem; word-break: break-all; color: var(--ink-2); max-width: 100%; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.room-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.room-item .ri-name { font-weight: 700; }
.room-code { font-size: 2.6rem; font-weight: 800; letter-spacing: .25em; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 16px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 600; z-index: 60; max-width: 90vw; text-align: center; }
.unsupported { max-width: 560px; margin: 15vh auto; padding: 24px; background: #fff; border-radius: 14px; line-height: 1.6; }
.text-box { position: absolute; min-width: 60px; min-height: 44px; padding: 6px 10px; background: #fffbe6; border: 2px solid #f5c33d; border-radius: 8px; font-size: 1.4rem; font-weight: 700; touch-action: none; cursor: move; }
.text-pad { display: flex; flex-wrap: wrap; gap: 6px; }
.text-pad button { min-width: 48px; min-height: 48px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 1.1rem; }
.timer-big { font-size: 4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.measure-ov { position: absolute; pointer-events: none; inset: 0; }

/* 도전 모드 */
.ch { max-width: 1100px; margin: 0 auto; padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.ch-top { display: flex; align-items: center; gap: 8px; }
.ch-top h1 { flex: 1; font-size: 1.25rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.shop { border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding: 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; min-height: 120px; }
.shop.locked { opacity: .55; }
.shop .shop-name { font-weight: 800; }
.shop .shop-sub { color: var(--ink-2); font-size: .85rem; }
.stars { color: #e0a100; font-weight: 800; letter-spacing: .05em; }
.companion { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; }
.companion img { width: 84px; height: 84px; object-fit: contain; }
.companion .cp-name { font-weight: 800; }
.companion .cp-goal { color: var(--ink-2); font-size: .9rem; }
.pz { display: grid; grid-template-rows: auto 1fr auto; height: calc(100vh - 24px); gap: 8px; }
.pz-top { display: flex; align-items: center; gap: 8px; }
.pz-goal { flex: 1; font-weight: 700; font-size: 1.05rem; }
.pz-stage { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; touch-action: none; }
.pz-stage svg { width: 100%; height: 100%; display: block; }
.pz-bottom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pz-say { position: absolute; left: 12px; top: 12px; max-width: 70%; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-weight: 600; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.pz-say img { width: 40px; height: 40px; object-fit: contain; }
.result { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.result .stars { font-size: 2.6rem; }

/* 좁은 화면 — 서랍·패널은 아래 시트 */
@media (max-width: 900px) {
  :root { --panel-w: 0px; --drawer-w: 0px; }
  .ws { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr auto var(--bottom-h); grid-template-areas: 'top' 'stage' 'panel' 'bottom'; }
  .panel { border-left: 0; border-top: 1px solid var(--line); max-height: 28vh; padding: 8px 12px; }
  .panel .cards-head, .panel .card-box { display: none; }
  .panel.open .cards-head, .panel.open .card-box { display: flex; }
  .rep-sym { font-size: 1.4rem; min-height: 0; }
  .drawer { position: fixed; z-index: 30; left: 0; top: var(--top-h); bottom: var(--bottom-h); width: min(320px, 88vw); box-shadow: 4px 0 20px rgba(0, 0, 0, .15); }
  .ws.no-drawer .drawer { display: none; }
  .ws:not(.no-drawer) .drawer { display: flex; }
  .rep-toggle button { padding: 0 8px; font-size: .8rem; }
  .ws-actions #btnRoom, .ws-actions #btnPrint, .ws-actions #btnReset { display: none; }
  .ws-title { font-size: .95rem; }
}
@media (max-width: 560px) {
  .mode-cards { grid-template-columns: 1fr; }
  .mode-card { min-height: 76px; }
  .ws-actions #btnRedo { display: none; }
  .ws-mode { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print {
  body * { visibility: hidden; }
  #printSheet, #printSheet * { visibility: visible; }
  #printSheet { position: absolute; left: 0; top: 0; width: 100%; }
}
.print-sheet { display: none; }
@media print { .print-sheet { display: block; } }
.print-sheet { font-family: var(--font); color: #000; padding: 10mm; }
.print-sheet h1 { font-size: 18pt; margin-bottom: 4mm; }
.print-sheet .ps-meta { font-size: 10pt; margin-bottom: 4mm; border-bottom: 1px solid #000; padding-bottom: 2mm; display: flex; gap: 12mm; }
.print-sheet .ps-fig svg { width: 100%; max-height: 150mm; }
.print-sheet .ps-fig svg * { filter: grayscale(1); }
.print-sheet .ps-q { margin-top: 6mm; font-size: 12pt; line-height: 2; }
.print-sheet .ps-line { border-bottom: 1px solid #555; height: 9mm; }

/* 키트 셸 위에 덮기 — 첫 화면 폭·순위 카드 테두리 */
.gb-home.home { max-width: 1100px; }
.gb-rank { background: var(--paper) !important; border: 1px solid var(--line) !important; box-shadow: var(--shadow); }
.gb-mode { background: var(--bg) !important; border: 1px solid var(--line) !important; min-height: 76px; }
.fx-dot { position: fixed; width: 12px; height: 12px; border-radius: 50%; pointer-events: none; z-index: 70; animation: fxdot .6s ease-out forwards; }
@keyframes fxdot { to { transform: translate(var(--tx), var(--ty)) scale(.2); opacity: 0; } }
.pen-bar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); z-index: 6; }
.pen-c { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.note-del { position: absolute; right: -14px; top: -14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.note-del svg { background: #fff; border: 1px solid var(--line); border-radius: 50%; padding: 3px; width: 24px; height: 24px; }
.note-prev { min-height: 56px; font-size: 1.6rem; font-weight: 800; border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }

/* ── 도전 모드 ── */
.ch { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.ch-top { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--paper); border-bottom: 1px solid var(--line); }
.ch-title { font-size: 1.15rem; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-right { display: flex; align-items: center; gap: 6px; }
.ch-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow: auto; position: relative; }
.ch-kk { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; flex-wrap: wrap; }
.ch-kk > div { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.ch-kk-img { width: 84px; height: 84px; object-fit: contain; }
.ch-goalline { color: var(--ink-2); font-weight: 600; }
.ch-bar-xp { height: 10px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.ch-bar-xp i { display: block; height: 100%; background: linear-gradient(90deg, #f5b83d, #f08a3c); }
.ch-ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ch-ws { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; min-height: 196px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.ch-ws img { width: 96px; height: 96px; object-fit: contain; }
.ch-ws b { font-size: 1.1rem; }
.ch-ws-sub, .ch-ws-n { font-size: .85rem; color: var(--ink-2); }
.ch-ws.locked { opacity: .5; filter: grayscale(.8); cursor: default; }
.ch-ws-head { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.ch-ws-head img { width: 88px; height: 88px; object-fit: contain; }
.ch-tier { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.ch-tier > b { min-width: 80px; }
.ch-dots { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.ch-dot { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); font-weight: 800; }
.ch-dot.s1 { background: #fde9c0; border-color: #f5b83d; } .ch-dot.s2 { background: #f9d27c; border-color: #e09a00; } .ch-dot.s3 { background: #f5b83d; border-color: #b97800; color: #fff; }
.ch-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ch-page { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px; min-height: 76px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); }
.ch-page.locked { opacity: .5; }
.ch-hud { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-hud:empty { display: none; }
.ch-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); font-weight: 700; }
.ch-heart { color: #c9c1ae; } .ch-heart.on { color: var(--bad); }
.ch-goal { background: var(--paper); border: 2px solid var(--accent); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.ch-goal-t { font-size: 1.15rem; font-weight: 800; }
.ch-prog { color: var(--ink-2); font-weight: 600; }
.ch-prog:empty { display: none; }
.ch-hint { background: #fff6d6; border: 1px dashed #e0a800; border-radius: var(--r-sm); padding: 6px 10px; font-weight: 600; }
.ch-views { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.ch-views figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .85rem; font-weight: 700; }
.ch-table { border-collapse: collapse; align-self: flex-start; }
.ch-table th, .ch-table td { border: 1px solid var(--ink); padding: 4px 12px; text-align: center; font-weight: 700; }
.ch-table th { background: var(--accent-2); }
.ch-stage { position: relative; flex: 1; min-height: 340px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
.ch-stage > svg { width: 100%; height: 100%; display: block; position: absolute; inset: 0; }
.ch-stage .widget { position: absolute; inset: 0; overflow: auto; touch-action: pan-y; }
.ch-actbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ch-util { display: flex; gap: 6px; margin-left: auto; }
.ch-answer { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ch-ans-in { width: 120px; min-height: 48px; font-size: 1.4rem; font-weight: 800; text-align: center; border-radius: var(--r-sm); border: 2px solid var(--line); background: #fff; }
.ch-choices { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 12px; }
.ch-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r); border: 2px solid var(--line); background: var(--bg); font-weight: 800; min-height: 120px; }
.ch-choice:hover { border-color: var(--accent); }
.ch-choice.wrong { opacity: .45; border-color: var(--bad); }
.ch-stars { display: inline-flex; gap: 4px; } .ch-star { color: #d8d2c3; } .ch-star.on { color: #f5b83d; }
.ch-result { position: fixed; inset: 0; background: rgba(31, 42, 55, .45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.ch-result-card { background: var(--paper); border-radius: 20px; padding: 22px 24px; max-width: 420px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.ch-result-card .ch-stars .ic { width: 40px; height: 40px; }
.ch-result-card p { margin: 0; color: var(--ink-2); font-weight: 600; }
.ch-result-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
@media (max-width: 560px) { .ch-ws-grid { grid-template-columns: repeat(2, 1fr); } .ch-ws { min-height: 170px; } .ch-ws img { width: 72px; height: 72px; } .ch-util { margin-left: 0; } .ch-choices { grid-template-columns: 1fr 1fr; } }
