/* 화면 모양 — 낮/밤 색은 맨 위 두 묶음에서만 바꾼다 */
:root {
  --bg: #ECE7DF;
  --bg-2: #E4DDD2;
  --glow: rgba(255, 244, 222, 0.9);
  --ink: #1D1A17;
  --ink-2: #4A443D;
  --muted: #8A8176;
  --line: rgba(29, 26, 23, 0.10);
  --card: rgba(255, 255, 255, 0.58);
  --card-solid: #FBF8F3;
  --card-border: rgba(255, 255, 255, 0.75);
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 28px rgba(60, 40, 20, 0.10);
  --board-shadow: 0 2px 4px rgba(70, 40, 10, 0.18), 0 22px 48px -12px rgba(70, 40, 10, 0.45);
  --btn: #1D1A17;
  --btn-ink: #F7F3EC;
  --seal: #B8432F;
  --seal-soft: rgba(184, 67, 47, 0.12);
  --good: #2F6B55;
  --good-soft: rgba(47, 107, 85, 0.12);
  --radius: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111213;
  --bg-2: #0B0C0D;
  --glow: rgba(255, 214, 150, 0.10);
  --ink: #EEE8DF;
  --ink-2: #C9C1B6;
  --muted: #8C857B;
  --line: rgba(238, 232, 223, 0.10);
  --card: rgba(34, 35, 38, 0.62);
  --card-solid: #1C1D20;
  --card-border: rgba(255, 255, 255, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --board-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 30px 70px -10px rgba(0, 0, 0, 0.8);
  --btn: #EEE8DF;
  --btn-ink: #141414;
  --seal: #E0705B;
  --seal-soft: rgba(224, 112, 91, 0.14);
  --good: #6FC2A0;
  --good-soft: rgba(111, 194, 160, 0.14);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% 38%, var(--glow), transparent 70%),
                    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  transition: background-color .6s ease, color .6s ease;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; border-radius: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── 공통 부품 ─────────────────────────── */
.screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.glass {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-radius: var(--radius);
}
.btn-primary {
  background: var(--btn); color: var(--btn-ink);
  border-radius: 999px; font-weight: 700; letter-spacing: -0.02em;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.45);
}
.btn-primary:active { transform: scale(.97); }
.btn-ghost { border-radius: 999px; padding: 10px 16px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); background: var(--card); }
.btn-ghost:active { transform: scale(.97); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:active { background: var(--line); }
.icon-btn svg { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); }
.stone-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.stone-dot.b { background: radial-gradient(circle at 35% 30%, #666, #111 55%, #000); }
.stone-dot.w { background: radial-gradient(circle at 35% 30%, #fff, #EFEBE3 55%, #C9C2B6); box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }

/* ── 첫 화면 ─────────────────────────── */
#home { justify-content: center; gap: 0; }
.home-wrap { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; }
.home-top { width: 100%; display: flex; justify-content: flex-end; }
.logo { font-family: "Noto Serif KR", "Nanum Myeongjo", serif; font-weight: 700; font-size: clamp(52px, 16vw, 72px); letter-spacing: -0.04em; margin: 4px 0 0; line-height: 1; }
.logo .seal { display: inline-grid; place-items: center; width: .3em; height: .3em; margin-left: .1em; vertical-align: .08em; background: var(--seal); border-radius: 3px; transform: rotate(-6deg); }
.logo .seal::after { content: ""; width: 46%; height: 46%; border-radius: 50%; border: 2px solid #F7F1E8; box-sizing: border-box; }
.tagline { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.hero { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 28px 0 30px; }
.hero canvas { width: 100%; height: 100%; border-radius: 8px; box-shadow: var(--board-shadow); transform: perspective(900px) rotateX(18deg) rotateZ(-4deg); }
.start-btn { width: 100%; height: 64px; font-size: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.start-btn svg { width: 20px; height: 20px; }
.setup-line { margin-top: 12px; display: flex; justify-content: center; }
.setup-line button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 16px; border-radius: 999px; font-size: 14px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); max-width: 100%; }
.setup-line button:active { transform: scale(.98); }
.setup-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); flex: none; }
.setup-line .edit { font-weight: 700; color: var(--seal); margin-left: 4px; }
.quota { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.quota b { color: var(--ink-2); }
.home-cards { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.home-card { padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 96px; transition: transform .15s; }
.home-card:active { transform: scale(.98); }
.home-card .t { font-weight: 700; font-size: 16px; }
.home-card .s { color: var(--muted); font-size: 13px; line-height: 1.4; }
.home-card .bar { margin-top: auto; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.home-card .bar i { display: block; height: 100%; background: var(--seal); border-radius: 4px; transition: width .5s; }
.resume { width: 100%; margin-top: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; text-align: left; }
.resume .t { font-weight: 700; }
.resume .s { color: var(--muted); font-size: 13px; }
.resume .go { margin-left: auto; font-weight: 700; color: var(--seal); }
.proverb { margin-top: 26px; color: var(--muted); font-size: 13px; text-align: center; font-family: "Noto Serif KR", serif; min-height: 20px; }

/* ── 대국 화면 ─────────────────────────── */
#game, #puzzle { padding-top: max(6px, env(safe-area-inset-top)); }
.topbar { width: 100%; max-width: 760px; display: flex; align-items: center; gap: 4px; min-height: 48px; }
.topbar .title { flex: 1; text-align: center; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.game-body { width: 100%; max-width: 1100px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.player {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  transition: box-shadow .3s, border-color .3s, opacity .3s;
}
.player .stone-dot { width: 26px; height: 26px; }
.player .who { display: flex; flex-direction: column; min-width: 0; }
.player .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.player .tag { font-size: 11px; font-weight: 700; color: var(--seal); background: var(--seal-soft); padding: 2px 7px; border-radius: 6px; letter-spacing: .02em; }
.player .sub { font-size: 12px; color: var(--muted); }
.player .clock { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; text-align: right; }
.player .clock small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.player.active { border-color: color-mix(in srgb, var(--seal) 45%, transparent); box-shadow: var(--shadow), 0 0 0 3px var(--seal-soft); }
.player:not(.active) { opacity: .72; }
.player.low .clock { color: var(--seal); }
.thinking { display: inline-flex; gap: 3px; margin-left: 4px; }
.thinking i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.board-wrap { position: relative; width: min(calc(100vw - 16px), calc(100dvh - 300px), 720px); min-width: 280px; aspect-ratio: 1; }
.board-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; box-shadow: var(--board-shadow); touch-action: manipulation; cursor: pointer; }
.board-wrap.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.actions { width: 100%; max-width: 640px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.act svg { width: 22px; height: 22px; }
.act:active { background: var(--line); }
.act:disabled { opacity: .35; }
.act.confirm { background: var(--btn); color: var(--btn-ink); }
.act.armed { background: var(--seal); color: #fff; animation: armPulse 1s ease-in-out infinite; }
@keyframes armPulse { 50% { box-shadow: 0 0 0 6px var(--seal-soft); } }

.notice { width: 100%; max-width: 640px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border-color: color-mix(in srgb, var(--seal) 35%, transparent); }
.notice p { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; line-height: 1.5; }
.notice button { height: 46px; font-size: 15px; }

.side { display: none; }

/* 넓은 화면(PC) — 판은 가운데 크게, 옆에 대국 정보 */
@media (min-width: 980px) and (min-height: 560px) {
  /* 판 옆에 정보를 놓는 가로 배치는 대국 화면에만 (2026-09-26 — 사활 문제 화면까지 옆으로 늘어서던 것 고침) */
  #game .game-body { flex-direction: row; justify-content: center; align-items: center; gap: 28px; }
  #game .board-wrap { width: min(calc(100dvh - 90px), 820px); }
  #puzzle .game-body { justify-content: center; }
  #puzzle .board-wrap { width: min(calc(100dvh - 250px), 640px); }
  .col-info { width: 300px; display: flex; flex-direction: column; gap: 12px; }
  .col-info .player { max-width: none; }
  .col-info .actions { grid-template-columns: repeat(2, 1fr); }
  .side { display: block; padding: 14px 16px; font-size: 13px; color: var(--ink-2); }
  .side h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
  .side .moves { max-height: 180px; overflow: auto; font-variant-numeric: tabular-nums; line-height: 1.8; }
  .side .moves .mv.tap { cursor: pointer; border-radius: 4px; padding: 0 3px; }
  .side .moves .mv.tap:hover { background: var(--line); }
  #gameBody .mobile-only { display: none; }
}
@media (max-width: 979.98px), (max-height: 559.98px) {
  .col-info { display: contents; }
  .col-info .desk-only { display: none; }
  #pTop { order: 1; } #game .board-wrap { order: 2; } #pBottom { order: 3; } #game .actions { order: 4; }
  #game .game-body { justify-content: center; padding-bottom: 8px; }
}

/* ── 알림·시트 ─────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--btn); color: var(--btn-ink); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.scrim { position: fixed; inset: 0; background: rgba(10, 8, 6, .38); opacity: 0; transition: opacity .25s; z-index: 40; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; z-index: 50;
  background: var(--card-solid); border-radius: 24px 24px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.2); transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  max-height: 88dvh; overflow: auto;
}
.sheet:not(.show) { visibility: hidden; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s; }
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 4px 0 16px; font-size: 19px; letter-spacing: -0.02em; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--line); }
.seg button { padding: 10px 4px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.seg button small { font-size: 11px; color: var(--muted); font-weight: 500; }
.seg[data-key="level"] button { padding: 10px 2px; }
.seg[data-key="opp"] button { padding: 10px 2px; }
.seg[data-key="opp"] button small { font-size: 10px; letter-spacing: -0.02em; white-space: nowrap; }
.seg[data-key="level"] button small { font-size: 10px; letter-spacing: -0.02em; }
.seg button[aria-pressed="true"] { background: var(--card-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.sheet .done { width: 100%; height: 54px; font-size: 17px; margin-top: 6px; }
.row-toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.row-toggle small { display: block; color: var(--muted); font-size: 12px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* 계가 결과 */
.result-head { text-align: center; padding: 6px 0 14px; }
.result-head .big { font-family: "Noto Serif KR", serif; font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.result-head .small { color: var(--muted); font-size: 14px; margin-top: 4px; }
.score-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.score-table th, .score-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.score-table th:first-child, .score-table td:first-child { text-align: left; color: var(--muted); font-weight: 500; }
.score-table tr.total td { font-weight: 800; font-size: 16px; border-bottom: 0; color: var(--ink); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn-ghost, .btn-row .btn-primary { height: 50px; }

.scoring-bar { width: 100%; max-width: 640px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.scoring-bar p { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.scoring-bar .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scoring-bar .btns button { height: 46px; }
/* 복기 막대 (09-26) */
.review-bar { width: 100%; max-width: 640px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.review-bar .rv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; }
.review-bar .rv-head b { font-variant-numeric: tabular-nums; }
.review-bar .rv-head span { color: var(--muted); font-size: 13px; }
.review-bar input[type=range] { width: 100%; accent-color: var(--seal); margin: 0; height: 24px; }
.review-bar .rv-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.review-bar .rv-btns button { height: 46px; padding: 0 4px; }
.review-bar button:disabled { opacity: .4; }
.review-bar .rv-judge { height: 44px; }
.review-bar .rv-eval { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; line-height: 1.5; }
.side .moves .mv.on { background: color-mix(in srgb, var(--seal) 22%, transparent); font-weight: 700; }

/* 지난 대국 목록 */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist .m { flex: 1; min-width: 0; }
.hist .m b { display: block; }
.hist .m span { color: var(--muted); font-size: 12px; }
.hist .dl { font-size: 13px; font-weight: 600; color: var(--seal); padding: 8px 10px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: 14px; }

/* ── 사활 문제 ─────────────────────────── */
.pz-head { width: 100%; max-width: 640px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.pz-head .row { display: flex; align-items: center; gap: 8px; }
.pz-head .lv { display: inline-flex; gap: 3px; }
.pz-head .lv i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pz-head .lv i.on { background: var(--seal); }
.pz-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.pz-head .pz-many { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; vertical-align: 3px; white-space: nowrap; }
.pz-head .streak { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--seal); white-space: nowrap; flex: none; }
.pz-head .msg { font-size: 14px; color: var(--ink-2); min-height: 20px; transition: color .2s; }
.pz-head .msg.good { color: var(--good); font-weight: 700; }
.pz-head .msg.bad { color: var(--seal); font-weight: 700; }
.pz-actions { width: 100%; max-width: 640px; display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.pz-actions button { height: 50px; }
.pz-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pz-list button { aspect-ratio: 1; border-radius: 14px; background: var(--line); font-weight: 700; color: var(--ink-2); position: relative; }
.pz-list button.solved { background: var(--good-soft); color: var(--good); }
.pz-list button.cur { box-shadow: 0 0 0 2px var(--seal); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═════════ 월화대국 배경 그림 (2026-09-26) — 달밤(기본)일 때만. '밝게'를 고르면 그림 없이 ═════════ */
.bg-layer { display: none; }
:root[data-theme="dark"] body { background: #07080c; }
:root[data-theme="dark"] .bg-layer {
  display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: #07080c url(img/bg-main.webp) 50% 62% / cover no-repeat;
}
:root[data-theme="dark"] .bg-layer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,7,12,.55) 0%, rgba(6,7,12,.05) 26%, rgba(6,7,12,.05) 46%, rgba(6,7,12,.8) 66%, rgba(6,7,12,.94) 100%);
}
:root[data-theme="dark"] body[data-page="play"] .bg-layer { background-image: url(img/bg-play.webp); background-position: 50% 30%; }
:root[data-theme="dark"] body[data-page="play"] .bg-layer::after { background: rgba(6,7,12,.35); }
.screen, .reading { position: relative; z-index: 1; }

:root[data-theme="dark"] .logo { color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.9); }
:root[data-theme="dark"] .tagline { color: rgba(255,255,255,.86); text-shadow: 0 1px 8px rgba(0,0,0,.9); }
:root[data-theme="dark"] #home .hero { visibility: hidden; height: 30vh; max-height: 300px; min-height: 150px; aspect-ratio: auto; margin: 8px 0; }
:root[data-theme="dark"] .glass, :root[data-theme="dark"] .setup-line button { background: rgba(16,17,24,.66); border-color: rgba(255,255,255,.12); }
:root[data-theme="dark"] .quota, :root[data-theme="dark"] .proverb { color: rgba(255,255,255,.72); text-shadow: 0 1px 6px #000; }
#home { min-height: auto; padding-bottom: 8px; }

/* ═════════ 첫 페이지 읽을거리 + 광고 자리 ═════════ */
.reading { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; }
.reading > :first-child { margin-top: 150px; }          /* 버튼들과 첫 광고 사이 150픽셀 (구글 권장) */
.read { padding: 20px 20px 22px; line-height: 1.75; font-size: 15px; color: var(--ink-2); word-break: keep-all; overflow-wrap: break-word; }   /* 우리말은 낱말 사이에서 줄바꿈 · 긴 주소는 넘치지 않게 (09-26 6단계) */
.read h2 { margin: 0 0 12px; font-family: "Noto Serif KR", serif; font-size: 21px; color: var(--ink); letter-spacing: -0.02em; }
.read h3 { margin: 18px 0 4px; font-size: 16px; color: var(--ink); }
.read p { margin: 0 0 10px; }
.read b { color: var(--ink); }
.today-meta { font-size: 13px; color: var(--muted); }
.today-board { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 6px auto 12px; }
.today-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; box-shadow: var(--board-shadow); }
.today-go { width: 100%; height: 52px; font-size: 16px; margin-top: 6px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0 4px; }

.foot a { color: var(--muted); text-underline-offset: 3px; }

/* ═════════ 온라인 대국 — 친구 초대 (2026-09-26 · 설계서_온라인대국 v1) ═════════ */
.home-card:disabled { opacity: .62; cursor: default; }
.live-bar { word-break: keep-all; }   /* 우리말 줄바꿈은 낱말 사이에서 ("AI 대/국은" 처럼 끊기지 않게 · 09-26 5단계) */
.live-bar .btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.live-bar .btns button { height: 44px; font-size: 14px; }
.player.off { opacity: .62; }
.player.off .sub { color: var(--seal); }
.inv-text { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.inv-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 34px; font-weight: 800; letter-spacing: .12em; text-align: center;
  padding: 14px 0; margin: 0 0 14px; border-radius: 14px; border: 1px dashed var(--line); background: var(--card); color: var(--ink); user-select: all; }
.text-in { width: 100%; box-sizing: border-box; height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-size: 18px; outline: none; }
.text-in:focus { border-color: var(--seal); }
.text-in.code { text-transform: uppercase; letter-spacing: .12em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; text-align: center; font-size: 22px; }
.emote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.emote-grid button { height: 52px; font-size: 15px; }
.btn-ghost.sm { padding: 6px 14px; font-size: 13px; flex: none; }
.link-btn { display: block; margin: 2px auto 0; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.link-btn b { color: var(--seal); font-weight: 700; }
:root[data-theme="dark"] .link-btn { color: rgba(255,255,255,.78); text-shadow: 0 1px 6px #000; }

/* ═════════ 읽을거리 쪽 — 규칙 자세히 · 사활 용어 풀이 · 개인정보 처리방침 (2026-09-26) ═════════ */
.doc-top { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 8px 0; display: flex; align-items: center; gap: 2px; }
.doc-top a { color: var(--ink-2); text-decoration: none; }
.doc-top .doc-home { font-family: "Noto Serif KR", serif; font-weight: 700; font-size: 17px; color: var(--ink); }
:root[data-theme="dark"] .doc-top a { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.9); }
.reading.doc { gap: 16px; }
.reading.doc > :first-child { margin-top: 8px; }          /* 읽을거리 쪽에는 첫 페이지 같은 버튼이 없다 */
.read h1 { margin: 0 0 12px; font-family: "Noto Serif KR", serif; font-size: 24px; line-height: 1.4; color: var(--ink); letter-spacing: -0.02em; }
.reading.doc .read h2 { font-size: 18px; margin: 22px 0 6px; }
.reading.doc .read > h2:first-child { margin-top: 0; }
.read a { color: var(--seal); text-underline-offset: 3px; }
.read ul { margin: 0 0 10px; padding-left: 20px; }
.read li { margin: 2px 0; }
.lesson-board { display: block; width: min(260px, 80%); height: auto; aspect-ratio: 1; margin: 12px auto 8px; border-radius: 6px; box-shadow: var(--board-shadow); }
.pz-go { text-align: center; font-size: 14px; }
.doc-go { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px !important; }
.doc-go a { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 20px; text-decoration: none; }
.doc-go .btn-primary { color: var(--btn-ink); }
.doc-go .btn-ghost { color: var(--ink-2); }

.ad-slot { min-height: 100px; width: 100%; }
.ad-slot.preview { display: grid; place-items: center; min-height: 250px; border: 2px dashed var(--seal); border-radius: 12px; color: var(--seal); font-weight: 700; font-size: 14px; background: rgba(184,67,47,.08); }

/* ═════════ 내 기록 · 급수 · 출석 · 도장 (2026-09-26) ═════════ */
.rank-badge { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 10px; background: var(--seal); color: #fff;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.18), 0 6px 16px -6px rgba(184,67,47,.7); transform: rotate(-4deg); }
.rank-badge b { font-family: "Noto Serif KR", serif; font-size: 17px; letter-spacing: -0.04em; }
.rank-badge.lg { width: 72px; height: 72px; } .rank-badge.lg b { font-size: 22px; }
.dots { display: inline-flex; gap: 5px; vertical-align: middle; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--line); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.dots i.on { background: radial-gradient(circle at 35% 30%, #fff3c4, #f2c14e 60%, #c9912a); box-shadow: 0 0 8px rgba(242,193,78,.6); }
.dots i.fresh { animation: dotPop .9s .5s both; }
@keyframes dotPop { 0% { transform: scale(0); } 60% { transform: scale(1.6); } 100% { transform: scale(1); } }

.mycard { width: 100%; margin-top: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; }
.mycard:active { transform: scale(.99); }
.my-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.my-line { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.my-sub { font-size: 12px; color: var(--muted); }
.my-go { flex: none; text-align: center; font-size: 11px; color: var(--muted); line-height: 1.3; }
.my-go b { font-size: 15px; color: var(--seal); }
.attend { display: flex; align-items: center; gap: 4px; }
.attend i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px dashed var(--muted); opacity: .7; }
.attend i.on { border: 0; opacity: 1; background: var(--seal); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.attend i.today:not(.on) { border-color: var(--seal); opacity: 1; }
.attend .attend-n { font-size: 11px; color: var(--muted); margin-left: 4px; }
.attend.big { gap: 8px; } .attend.big i { width: 26px; height: 26px; }

/* 결과 창의 급수 변화 */
.progress-box { margin: -4px 0 14px; padding: 12px; border-radius: 14px; background: var(--line); }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-t { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.rank-msg b { color: var(--seal); font-size: 16px; }
.ev { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.ev li { display: flex; align-items: center; gap: 8px; }
.ev li.gift::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #f2c14e; }
.ev li.att::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); }
.seal-mini { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; background: var(--seal); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: -0.05em; transform: rotate(-5deg); }

/* 도장첩 창 */
.my-top { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.my-top-t { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.st-line { color: var(--ink-2); line-height: 1.5; } .st-line.muted { color: var(--muted); font-size: 13px; }
.st-block { padding: 14px 0; border-top: 1px solid var(--line); }
.st-h { font-weight: 700; margin-bottom: 10px; } .st-h span { color: var(--seal); font-size: 13px; margin-left: 6px; }
.st-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.week-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.week-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2c14e, var(--seal)); border-radius: 4px; transition: width .6s; }
.stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stampcell { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 6px; border-radius: 12px; background: var(--line); opacity: .55; }
.stampcell .seal-mini { width: 36px; height: 36px; font-size: 12px; background: transparent; color: var(--muted); border: 1.5px dashed var(--muted); }
.stampcell b { font-size: 12px; } .stampcell small { font-size: 10px; color: var(--muted); line-height: 1.35; }
.stampcell.on { opacity: 1; } .stampcell.on .seal-mini { background: var(--seal); color: #fff; border: 0; }

/* 승급 도장 연출 */
.stamp-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; gap: 18px; background: rgba(6,7,12,.45); animation: fadeIn .25s both; }
.stamp { width: 168px; height: 168px; border-radius: 22px; background: #c2412c; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.22), inset 0 0 0 10px #c2412c, inset 0 0 0 12px rgba(255,255,255,.35), 0 20px 60px rgba(0,0,0,.5);
  animation: stampIn .5s cubic-bezier(.3,1.6,.5,1) both; transform-origin: 50% 60%; }
.stamp-big { font-family: "Noto Serif KR", serif; font-size: 48px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.stamp-small { font-size: 13px; letter-spacing: .3em; opacity: .9; }
.stamp-cap { color: #fff; font-weight: 800; font-size: 20px; text-shadow: 0 2px 10px rgba(0,0,0,.6); animation: fadeIn .4s .45s both; }
@keyframes stampIn { 0% { transform: scale(2.6) rotate(-24deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-8deg); } }
.stamp-wrap.out { opacity: 0; transition: opacity .35s; }
.stamp-wrap.still .stamp, .stamp-wrap.still .stamp-cap { animation: none; transform: rotate(-8deg); }
.mycard .attend i { width: 12px; height: 12px; }
.attend .attend-n { white-space: nowrap; }

/* ═════════ 이번 판 최고의 수 (결과 창) ═════════ */
.best { margin: -4px 0 14px; padding: 12px 14px 14px; border-radius: 14px; background: var(--line); }
.best-h { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.best-h .best-no { font-weight: 600; font-size: 12px; color: var(--seal); }
.best-body { display: flex; align-items: center; gap: 12px; }
.best-board { position: relative; width: 148px; flex: none; aspect-ratio: 1; }
.best-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 5px; box-shadow: var(--board-shadow); }
.best-cap { flex: 1; margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.thinking-cap { color: var(--muted); }
.thinking-cap::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; vertical-align: middle; }

/* ═════════ 오늘의 문제 공유 · 실력 진단 (2026-09-27) ═════════ */
.home-card.wide { grid-column: 1 / -1; min-height: auto; }
.home-cards + .home-card.wide, .home-card.wide { margin-top: 10px; width: 100%; }
.today-done { margin: 4px 0 0; font-weight: 700; color: var(--good); }
.today-btns { margin-top: 8px; grid-template-columns: 1fr 1fr; }   /* 두 단추 같은 너비 — 360px 에서 "오늘 결과 공유"가 두 줄로 넘치던 것 (09-27) */
.today-btns .btn-ghost, .today-btns .btn-primary { height: 52px; padding: 0 10px; white-space: nowrap; }
.today-btns .today-go { margin-top: 0; }
.today-btns:has(#todayShare.hidden) { grid-template-columns: 1fr; }
.pz-share { margin-left: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fff; background: var(--seal); }
#puzzle.diag #pzHint, #puzzle.diag #pzReset, #puzzle.diag #pzListBtn { visibility: hidden; }
#puzzle.diag .streak { display: none; }
.diag-rows { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.diag-row { display: grid; grid-template-columns: 1fr 90px 36px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.dr-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.dr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2c14e, var(--seal)); border-radius: 4px; }
.dr-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ═════════ 글자 크게 (설정 · 2026-09-27) — 작은 글자만 골라 키운다. 판 크기는 그대로 ═════════ */
:root[data-big="1"] .tagline { font-size: 17px; }
:root[data-big="1"] .setup-line button { font-size: 16px; }
:root[data-big="1"] .quota, :root[data-big="1"] .proverb { font-size: 15px; }
:root[data-big="1"] .home-card .t { font-size: 18px; }
:root[data-big="1"] .home-card .s, :root[data-big="1"] .resume .s, :root[data-big="1"] .my-sub { font-size: 15px; }
:root[data-big="1"] .my-line { font-size: 16px; }
:root[data-big="1"] .attend .attend-n, :root[data-big="1"] .my-go { font-size: 13px; }
:root[data-big="1"] .read { font-size: 17px; }
:root[data-big="1"] .today-meta, :root[data-big="1"] .foot { font-size: 14px; }
:root[data-big="1"] .topbar .title { font-size: 17px; }
:root[data-big="1"] .player .name { font-size: 17px; }
:root[data-big="1"] .player .sub { font-size: 14px; }
:root[data-big="1"] .player .clock { font-size: 24px; }
:root[data-big="1"] .player .clock small { font-size: 13px; }
:root[data-big="1"] .act { font-size: 15px; }
:root[data-big="1"] .act svg { width: 26px; height: 26px; }
:root[data-big="1"] .notice p, :root[data-big="1"] .scoring-bar p { font-size: 16px; }
:root[data-big="1"] .review-bar .rv-head, :root[data-big="1"] .review-bar .rv-eval { font-size: 16px; }
:root[data-big="1"] .pz-head h2 { font-size: 21px; }
:root[data-big="1"] .pz-head .msg { font-size: 16px; }
:root[data-big="1"] .pz-actions button { font-size: 16px; }
:root[data-big="1"] .toast { font-size: 16px; }
:root[data-big="1"] .sheet h3 { font-size: 21px; }
:root[data-big="1"] .field > label, :root[data-big="1"] .seg button { font-size: 15px; }
:root[data-big="1"] .seg button small, :root[data-big="1"] .row-toggle small { font-size: 13px; }
:root[data-big="1"] .row-toggle { font-size: 17px; }
:root[data-big="1"] .result-head .small, :root[data-big="1"] .score-table, :root[data-big="1"] .ev, :root[data-big="1"] .best-cap, :root[data-big="1"] .rank-t { font-size: 16px; }
:root[data-big="1"] .hist li, :root[data-big="1"] .hist .m span, :root[data-big="1"] .st-note, :root[data-big="1"] .st-line, :root[data-big="1"] .diag-row { font-size: 15px; }
:root[data-big="1"] .stampcell b { font-size: 14px; }
:root[data-big="1"] .stampcell small { font-size: 12px; }
/* 설정 줄 — 낱말 중간에서 끊지 말고 낱말 단위로 줄을 넘긴다 (글자 크게 · 좁은 휴대폰) */
.setup-line button { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
.setup-line button span { white-space: nowrap; }

/* 초읽기 10초 — 시계 카드가 붉게 깜빡 (2026-09-27) */
.player.low { animation: lowBlink 1s ease-in-out infinite; }
.player.low .clock { color: var(--seal); transform: scale(1.12); transform-origin: right center; transition: transform .2s; }
@keyframes lowBlink { 50% { box-shadow: var(--shadow), 0 0 0 4px rgba(224, 112, 91, .55); border-color: rgba(224, 112, 91, .8); } }
@media (prefers-reduced-motion: reduce) { .player.low { animation: none; box-shadow: var(--shadow), 0 0 0 3px rgba(224, 112, 91, .6); } }

/* 돌 소리 종류 — 네 칸이 좁은 화면에서도 한 줄에 들어가게 (2026-09-27) */
.seg[data-pref="stoneStyle"] button { padding: 10px 2px; font-size: 13px; letter-spacing: -0.02em; white-space: nowrap; }
