:root {
  --bg: #f4eee4;
  --surface: #ffffff;
  --surface-2: #faf6f0;
  --ink: #2b2118;
  --ink-2: #5b4b3c;
  --muted: #968877;
  --border: #e7dccb;
  --accent: #6b4426;        /* 수찾사 갈색 (호두나무) */
  --accent-hover: #54341b;
  --accent-soft: #f5ebdd;
  --ok: #18794e;
  --ok-soft: #eaf5ef;
  --ng: #b42318;
  --ng-soft: #fcefed;
  --gold: #b7791f;
  --gold-soft: #fbf3e4;
  --mark: #d92d20;
  --radius: 16px;
  /* 버튼 크기 기준: 모든 버튼 44px, 보기 버튼만 48px */
  --h-control: 44px;
  --h-choice: 48px;
  --r-control: 10px;
  --shadow: 0 1px 2px rgba(58, 38, 18, .06), 0 8px 24px rgba(58, 38, 18, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
svg.board, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* ── 상단 바 ── */
.appbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.appbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; flex: none; object-fit: cover; border-radius: 8px; }
.brand-title { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 13px; color: var(--muted); }
.meter { width: 180px; flex: none; }
.meter-label { font-size: 12.5px; color: var(--ink-2); text-align: right; margin-bottom: 6px; font-weight: 600; }
.meter-bar { height: 6px; border-radius: 99px; background: #ece2d3; overflow: hidden; }
.meter-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s ease; }

.container { max-width: 1040px; margin: 0 auto; padding: 18px 20px 28px; }

/* ── 홈 ── 하바사 홈과 같은 틀 (머리 띠 · 주 버튼 · 2×2 타일 · 손글씨 문구) */
:root {
  --font-display: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", serif;
  --font-hand: "Nanum Pen Script", cursive;
  --kaya: #e2b86c;          /* 비자나무 바둑판 */
  --kaya-soft: #f6ead2;
  --kaya-line: #e3cfa6;
  --slate: #17191c;         /* 흑돌 */
  --shell: #fbfaf7;         /* 백돌 */
}
.brand[role=button] { cursor: pointer; }
.home { max-width: 440px; margin: 0 auto; }
.home.show { display: block; }

.hh { margin: -18px -20px 0; padding: 24px 22px 18px; background: linear-gradient(160deg, var(--kaya-soft) 0%, #f1e2c4 100%);
  border-bottom: 1px solid var(--kaya-line); }
.hh-top { display: flex; align-items: center; gap: 18px; }
.hh-illust { width: 124px; flex: none; padding: 4px 4px 0; border: 0; border-radius: 10px; background: var(--kaya); cursor: pointer;
  box-shadow: 0 3px 10px rgba(61, 42, 18, .18); display: flex; flex-direction: column; align-items: stretch; }
.hh-illust:active { transform: scale(.97); }
.hh-illust-cap { padding: 4px 0 5px; font-size: 11px; font-weight: 700; color: #5c4210; text-align: center; }
.hh-greet { display: flex; flex-direction: column; line-height: 1.5; }
.hh-hello { font-size: 13.5px; font-weight: 500; color: #7a5b28; }
.hh-name { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.hh-saying { margin-top: 14px; padding: 2px 0 0 12px; border-left: 3px solid #d2a95a; min-height: 3.6em; }
.hh-saying-text { display: block; font-size: 15px; line-height: 1.6; color: #3b3326; word-break: keep-all; }
.hh-saying-ref { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: #9a6c1f; }

.home-body { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 22px 0 8px; }
.primary-tile { display: flex; align-items: center; gap: 18px; width: 100%; padding: 22px 20px; border: 0; border-radius: 20px;
  background: linear-gradient(135deg, #9c6b3e 0%, var(--accent) 100%); color: #fff; text-align: left; cursor: pointer;
  box-shadow: 0 4px 20px rgba(84, 52, 27, .25); transition: transform .13s, box-shadow .15s; }
.primary-tile:active { transform: scale(.98); }
.pt-icon svg { width: 42px; height: 42px; display: block; }
.pt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pt-label { font-size: 17px; font-weight: 800; }
.pt-sub { margin-top: 2px; font-size: 13px; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-chev svg { width: 22px; height: 22px; display: block; opacity: .7; stroke-width: 2.5; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 8px 18px;
  border: 0; border-radius: 16px; background: var(--surface); cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); transition: transform .13s, box-shadow .15s; }
.tile:active { transform: scale(.97); }
.tile-icon { color: var(--accent); display: flex; }
.tile-icon svg { width: 32px; height: 32px; }
.tile-label { font-size: 14px; font-weight: 700; }
.tile-sub { margin-top: -6px; font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-sub.done { color: var(--ok); }
.tile-badge { position: absolute; top: 12px; right: 12px; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; border: 2px solid var(--surface); }
@media (hover: hover) {
  .primary-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(23, 25, 28, .32); }
  .tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, .1); }
}
.primary-tile:focus-visible, .tile:focus-visible, .util-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.tagline { margin-top: 10px; text-align: center; font-family: var(--font-hand); font-size: 30px; color: #7a5b28; letter-spacing: .04em; }
.util-row { display: flex; justify-content: center; }
.util-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.util-btn svg { width: 15px; height: 15px; }
.font-sheet { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.font-sheet-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; text-align: center; }
.font-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.font-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 64px; justify-content: center;
  border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.font-opt span { font-weight: 800; color: var(--ink); }
.font-opt.on { border-color: var(--slate); background: var(--surface-2); }

/* 문제집 목록 */
.lib { display: grid; gap: 12px; }
.lib-item { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px; border: 0; border-radius: 16px; text-align: left;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); cursor: pointer; }
.lib-item:active { transform: scale(.99); }
.lib-cover { width: 92px; flex: none; padding: 3px; border-radius: 8px; background: var(--kaya); }
.lib-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.lib-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.lib-meta { font-size: 13px; color: var(--muted); }
.lib-body .bar { margin-top: 4px; }

/* 하위 화면 공통: ‹ 홈 */
.subpage { max-width: 720px; margin: 0 auto; }
.sub-topbar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.sub-topbar .back { margin: 0; }
.sub-title { font-size: 15px; font-weight: 800; color: var(--ink-2); }
.sub-topbar::after { content: ""; flex: 1; }

/* 놓아보기 화면 */
.free-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.free-panel { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.free-size { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.free-size .seg.on { background: var(--slate); color: #fff; border-color: var(--slate); }
.free-turn { margin: 0; font-weight: 700; }
@media (max-width: 820px) { .free-wrap { grid-template-columns: minmax(0, 1fr); } }

/* 내 기록 화면 */
.rec-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.rec-stat { padding: 14px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.rec-stat b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rec-stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rec-clear { width: 100%; margin-top: 16px; }

.thumb { display: block; width: 100%; height: auto; border-radius: 6px; pointer-events: none; }

@media (max-width: 560px) {
  .hh { margin: -12px -12px 0; padding: 20px 16px 16px; }
  .hh-illust { width: 112px; }
}

/* ── 문제집 안 (단원 목록) ── */
.book { max-width: 720px; margin: 0 auto; }
.back { height: 36px; padding: 0 12px 0 6px; margin: 0 0 10px; border: 0; background: none; cursor: pointer;
  font-size: 14.5px; font-weight: 700; color: var(--accent); }
.book-head { padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 12px; }
.book-title { margin: 0 0 2px; font-size: 21px; font-weight: 800; }
.book-sub { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.units { display: grid; gap: 8px; }
.unit { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; }
.unit .uno { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 800; color: var(--ink-2); }
.unit.done .uno { background: var(--ok); border-color: var(--ok); color: #fff; }
.unit .ubody { flex: 1; min-width: 0; }
.unit .uname { font-weight: 800; font-size: 15px; }
.unit .umeta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.unit .bar { height: 5px; }
#study .setbar .back { margin: 0; }

/* ── 문제집·단원 ── */
.setbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: #e9e6df; }
.tab {
  height: 36px; padding: 0 16px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(58, 38, 18, .12); }
.unit-select {
  height: var(--h-control); min-width: 220px; padding: 0 12px; border-radius: var(--r-control);
  border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
}

/* ── 문제 번호: 한 줄 + 펼치는 번호판 ── */
.pnav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pn-arrow { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: var(--r-control);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--ink); }
.pn-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pn-arrow:disabled { opacity: .35; cursor: default; }
.pn-cur { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-control); border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.pn-cur small { font-weight: 600; color: var(--muted); }
.pn-caret { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.pn-cur[aria-expanded="true"] .pn-caret { transform: rotate(180deg); }
.pn-st { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; color: #fff; }
.pn-st.todo { border: 1.5px solid #cdbfab; }
.pn-st.solved { background: var(--ok); }
.pn-st.perfect { background: var(--gold); }
.pgrid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin: -4px 0 14px; padding: 12px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.pg { height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); padding: 0; }
.pg.solved { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pg.perfect { background: var(--gold-soft); border-color: transparent; color: var(--gold); }
.pg.now { background: var(--ink); border-color: var(--ink); color: #fff; }
.pg.reviewed { box-shadow: inset 0 -3px 0 var(--gold); }
@media (max-width: 560px) { .pgrid { gap: 5px; padding: 10px; } .pg { height: 32px; font-size: 12.5px; } }

/* ── (예전) 문제 번호 ── */
.pager { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  transition: border-color .15s, background .15s;
}
@media (hover: hover) { .pill:hover { border-color: #cdbfab; } }
.pill .st { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; }
.pill.perfect .st { background: var(--gold); }
.pill.solved .st { background: var(--ok); }
.pill.todo .st { border: 1.5px solid #cdbfab; }
.pill.now { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill.now.todo .st { border-color: rgba(255, 255, 255, .5); }

/* ── 화면 ── */
.screen { display: none; }
.screen.show { display: block; }
.layout.show { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .layout.show { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

/* ── 바둑판 ── */
.board-frame {
  background: var(--surface); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
}
svg.board { display: block; width: 100%; height: auto; border-radius: 10px; user-select: none; }
.gb-grid line { stroke: #3d2a12; stroke-opacity: .85; }
.gb-star { fill: #3d2a12; }
.gb-num { font-size: 17px; font-weight: 700; text-anchor: middle; font-family: "Pretendard", system-ui, sans-serif; }
.gb-num.on-black { fill: #fff; }
.gb-num.on-white { fill: #1d2433; }
.gb-mark { fill: none; stroke: var(--mark); stroke-width: 3; stroke-linejoin: round; }
.gb-letter { cursor: pointer; }
.gb-letter circle { fill: rgba(255, 255, 255, .92); stroke: var(--accent); stroke-width: 2; transition: fill .15s; }
.gb-letter text { font-size: 16px; font-weight: 800; fill: var(--accent); text-anchor: middle; font-family: "Pretendard", system-ui, sans-serif; }
@media (hover: hover) { .gb-letter:hover circle { fill: var(--accent); } }
@media (hover: hover) { .gb-letter:hover text { fill: #fff; } }
.gb-letter.off { cursor: default; opacity: .3; }
.gb-letter.off:hover circle { fill: rgba(255, 255, 255, .92); }
.gb-letter.off:hover text { fill: var(--accent); }
.gb-ghost { opacity: .5; pointer-events: none; }
.gb-cross { stroke: var(--ng); stroke-width: 2.6; stroke-linecap: round; opacity: .8; pointer-events: none; }
.gb-hit rect { cursor: pointer; }
.gb-pop { animation: gb-pop .32s cubic-bezier(.2, .9, .3, 1.2); transform-box: fill-box; transform-origin: center; }
@keyframes gb-pop { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }

.board-caption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.board-caption #qnum { color: var(--ink-2); font-weight: 700; }
.board-caption .dot { margin: 0 6px; }

/* ── 오른쪽 패널 ── */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
  display: flex; flex-direction: column; }
.panel > .eyebrow, .panel > .prompt { order: 0; }
#turn-panel, #waiting, #end-panel { order: 1; }
.panel > .timeline { order: 2; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
@media (max-width: 820px) { .panel { padding: 20px; } }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; margin-bottom: 6px; }
.prompt { font-size: 21px; line-height: 1.4; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 6px; }
.sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choices button {
  height: var(--h-choice); border-radius: var(--r-control); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 18px; font-weight: 800; color: var(--ink);
  transition: border-color .15s, background .15s, transform .08s;
}
@media (hover: hover) { .choices button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); } }
.choices button:active:not(:disabled) { transform: scale(.97); background: var(--accent-soft); }
.btn:active { transform: scale(.98); }
.choices button.tried { background: var(--surface-2); color: #c3c0b8; border-style: dashed; cursor: default; text-decoration: line-through; }
.notice { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.6;
  background: var(--ng-soft); color: var(--ng); }
.notice.good { background: var(--ok-soft); color: var(--ok); }
.notice:empty { display: none; }
.confirm { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--accent-soft); }
.confirm span { flex: 1; font-weight: 700; font-size: 14.5px; }
.confirm .btn { flex: none; height: 40px; padding: 0 16px; }
.choices { margin-top: 12px; }

.hint-toggle {
  margin-top: 0; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent); font-size: 14px; font-weight: 600;
}
@media (hover: hover) { .hint-toggle:hover { text-decoration: underline; } }
.turn-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer-toggle { color: var(--ink-2); }
.verdict.shown { background: var(--accent-soft); }
.verdict.shown .verdict-icon { background: var(--accent); }
.verdict.shown .verdict-title { color: var(--accent); }
.hint-box {
  margin-top: 10px; padding: 14px 16px; border-radius: 12px;
  background: var(--gold-soft); border: 1px solid #f0dfbd; color: #5c4210; line-height: 1.7;
}

/* 한 수씩 주고받기 */

.turn-label { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.waiting { margin: 0; padding: 14px 0; color: var(--muted); font-size: 14px; }

/* 놓아보기 */
#sandbox { order: 1; }
.sandbox { padding: 14px; border-radius: 12px; border: 1.5px solid var(--accent); background: var(--accent-soft); }
.sandbox-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.sandbox-head span { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.sandbox-help { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.sandbox-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sandbox-tools .seg { font-size: 13px; padding: 0 4px; }
.sandbox-end { width: 100%; margin-top: 10px; }

/* 선생님 검토 모드 */
.review-badge { margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--gold); color: #fff; font-size: 11.5px; font-weight: 700; vertical-align: 2px; }
.review { margin-top: 16px; padding: 14px; border-radius: 12px; border: 1.5px dashed var(--gold); background: var(--gold-soft); }
.review-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.review-head span { font-size: 12.5px; color: var(--ink-2); }
.review-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.review-tools .seg.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.review-help { margin: 0 0 8px; font-size: 13px; color: #5c4210; }
.review-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rv-chip { height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.rv-chip.ans { border-color: var(--ok); color: var(--ok); }
.rv-chip.removed { text-decoration: line-through; color: var(--ng); border-color: var(--ng); background: var(--ng-soft); }
.rv-chip.added { border-color: var(--gold); color: var(--gold); }
.review-memo { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border); font: inherit; font-size: 14px; resize: vertical; background: var(--surface); }
.review-actions { display: flex; gap: 8px; margin-top: 8px; }
.review-actions .btn { flex: 1 1 0; }
.gb-plus { stroke: var(--gold); stroke-width: 3.2; stroke-linecap: round; pointer-events: none; }
.pill.reviewed::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-left: 2px; }

/* 판정 */
.verdict { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: 12px; margin-bottom: 24px; }
.verdict.ok { background: var(--ok-soft); }
.verdict.ng { background: var(--ng-soft); }
.verdict-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 17px; }
.verdict.ok .verdict-icon { background: var(--ok); }
.verdict.ng .verdict-icon { background: var(--ng); }
.verdict-title { font-weight: 800; font-size: 16.5px; }
.verdict.ok .verdict-title { color: var(--ok); }
.verdict.ng .verdict-title { color: var(--ng); }
.verdict-sub { font-size: 13.5px; color: var(--ink-2); }

/* 수순 타임라인 */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.counter { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li {
  position: relative; display: flex; gap: 12px; padding: 8px 10px; border-radius: 10px;
  transition: opacity .25s, background .25s;
}
.timeline li::before {
  content: ""; position: absolute; left: 22px; top: 34px; bottom: -8px; width: 1.5px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline li.todo { opacity: .28; }
.timeline li.done { opacity: .65; }
.timeline li.now { background: var(--accent-soft); }
.stone-badge {
  position: relative; z-index: 1; flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.stone-badge.black { background: radial-gradient(circle at 35% 30%, #666, #111 60%); color: #fff; }
.stone-badge.white { background: radial-gradient(circle at 35% 30%, #fff, #e3e0d8); color: var(--ink); border: 1px solid #cdbfab; }
.step-body { line-height: 1.65; padding-top: 1px; }
.step-who { font-weight: 800; margin-right: 6px; }
.tri { color: var(--mark); font-weight: 800; }

/* 수순 넘기기: 같은 크기 버튼 3개 */
.player { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
#j-player { grid-template-columns: repeat(4, 1fr); }
#j-auto.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg {
  height: var(--h-control); border-radius: var(--r-control); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); transition: background .15s, border-color .15s;
}
@media (hover: hover) { .seg:not(.on):hover:not(:disabled) { background: var(--surface-2); border-color: #cdbfab; } }
.seg:disabled { opacity: .4; cursor: default; }
.seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* 정리 */
.lesson { margin-top: 16px; padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lesson-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; }
.lesson-title { font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.lesson-title:empty { display: none; }
.lesson-text { margin: 0; color: var(--ink-2); line-height: 1.7; }

/* 버튼 */
/* 나란히 놓인 버튼은 같은 너비 */
.actions { display: flex; gap: 8px; margin-top: 24px; }
.actions .btn { flex: 1 1 0; }
.actions.center { max-width: 400px; margin-left: auto; margin-right: auto; }
.btn {
  height: var(--h-control); padding: 0 16px; border-radius: var(--r-control); cursor: pointer;
  font-size: 15px; font-weight: 700; border: 1.5px solid transparent; transition: background .15s, border-color .15s;
}
.btn.primary { background: var(--accent); color: #fff; }
@media (hover: hover) { .btn.primary:hover { background: var(--accent-hover); } }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
@media (hover: hover) { .btn.secondary:hover { border-color: #cdbfab; } }

/* 결과 화면 */
.summary { max-width: 520px; margin: 24px auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 28px; text-align: center; }
.summary-big { font-size: 52px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.summary-detail { margin: 0 0 6px; color: var(--ink-2); }
.summary-msg { margin: 0; color: var(--muted); }

/* 아래 */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.foot-note { font-size: 12px; color: var(--muted); text-align: center; }
.link { background: none; border: 0; padding: 6px 0; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.link:hover:not(:disabled) { color: var(--accent); }
.link:disabled { opacity: .35; cursor: default; }
@media (max-width: 820px) {
  .board-caption { margin-top: 6px; }
}
@media (max-width: 560px) {
  :root { --h-choice: 52px; --radius: 14px; }
  body { font-size: 15px; padding-bottom: env(safe-area-inset-bottom); }
  .appbar-inner { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .container { padding: 12px 12px 24px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-title { font-size: 16px; }
  .brand-sub { display: none; }
  .meter { width: 104px; }
  .meter-label { font-size: 11.5px; margin-bottom: 4px; }

  /* 문제집 탭·단원: 화면 너비에 꽉 차게 */
  .setbar { gap: 8px; margin-bottom: 10px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1 1 0; padding: 0 8px; font-size: 13.5px; }
  .unit-select { width: 100%; min-width: 0; }

  /* 문제 번호: 한 줄로, 옆으로 밀어서 보기 */
  .pager { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 2px 12px 6px;
           scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .pager::-webkit-scrollbar { display: none; }
  .pill { flex: none; height: 34px; padding: 0 12px; }

  .layout.show { gap: 12px; }
  .board-frame { padding: 6px; }
  .board-caption { font-size: 12px; }
  .panel { padding: 16px; }
  .eyebrow { display: none; }
  .prompt { font-size: 17.5px; margin-bottom: 10px; }
  .turn-label { margin-bottom: 10px; font-size: 13.5px; }
  .verdict { margin-bottom: 12px; padding: 12px 14px; }
  .lesson { margin-top: 12px; padding: 14px; }
  .actions { margin-top: 16px; flex-wrap: wrap; }
  .actions .btn { flex: 1 1 40%; height: 48px; }
  .timeline li { padding: 6px 4px; }
  .timeline li::before { left: 16px; }
  .step-body { font-size: 14.5px; }

  /* 아래 이동 버튼 */
  .foot { margin-top: 14px; }
  .foot-note { display: none; }
  .link { height: 44px; padding: 0 14px; border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--border); }
  .summary { margin: 8px auto; padding: 28px 18px; }
}

/* 홈·문제집 화면에서는 위쪽 진행 막대 대신 원형 그래프를 씀 */
body[data-screen="home"] .meter, body[data-screen="book"] .meter, body[data-screen="free"] .meter, body[data-screen="records"] .meter { visibility: hidden; }
.book-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.unit .uname { font-size: 15.5px; }

/* 급수 · 연속 학습일 · 오늘의 목표 */
.hh-top { position: relative; }
.hh-greet { flex: 1; min-width: 0; }
.hh-level { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: #7a5b28; font-weight: 600; }
.hh-level b { padding: 1px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; }
.goal { width: 58px; height: 58px; flex: none; position: relative; }
.goal svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
.goal .track { fill: none; stroke: rgba(122, 91, 40, .18); stroke-width: 6; }
.goal .val { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.goal .goal-text { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.05;
  font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.goal .goal-text small { display: block; font-size: 9.5px; font-weight: 700; color: #7a5b28; }
.rec-level { display: grid; gap: 8px; padding: 18px; margin-bottom: 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.rec-level-top { display: flex; align-items: baseline; justify-content: space-between; }
.rec-level-top b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.rec-level-top span { font-size: 13px; color: var(--muted); }
.rec-level .bar { height: 8px; }
.rec-level p { margin: 0; font-size: 13px; color: var(--ink-2); }
@media (max-width: 560px) { .goal { width: 52px; height: 52px; } }

/* 진행 막대 (단원·급수) */
.bar { display: block; height: 6px; border-radius: 99px; background: #ece2d3; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; }

/* 문제집을 받는 동안 */
.loader { position: fixed; left: 50%; top: calc(72px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 20;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }

/* 놓아보기: 판이 화면 크기에 맞춰 저절로 커지고 작아짐 */
#free.subpage { max-width: 1240px; }
#free .free-wrap { grid-template-columns: auto minmax(300px, 340px); justify-content: center; align-items: start; }
:root { --z: 1; }
#free .board-frame { width: min(calc(100vw / var(--z) - 430px), calc(100vh / var(--z) - 170px), 900px); min-width: 280px; }
#free .free-panel { position: sticky; top: 16px; user-select: none; -webkit-user-select: none; }
@supports (height: 100dvh) {
  #free .board-frame { width: min(calc(100vw / var(--z) - 430px), calc(100dvh / var(--z) - 170px), 900px); }
}
@media (max-width: 820px) {
  #free .free-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  #free .board-frame { width: min(100%, calc(100vh / var(--z) - 300px)); min-width: 0; }
  #free .free-panel { position: static; width: 100%; }
}
@media (max-width: 820px) and (min-aspect-ratio: 1/1) {
  #free .board-frame { width: min(100%, calc(100vh / var(--z) - 200px)); }
}
@media (max-width: 560px) { #free .board-frame { width: 100%; } }

/* 결과 화면 버튼: 주 버튼은 넓게 한 줄, 나머지는 아래 한 줄에 같은 크기 */
#end-panel .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
#end-panel .btn { white-space: nowrap; }
#end-panel .btn.wide { order: -1; flex: 1 0 100%; height: 50px; font-size: 16px; }
#end-panel .btn.sub { flex: 1 1 0; min-width: 0; height: 46px; padding: 0 8px; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
#end-panel .btn.sub svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
#end-panel .btn.sub svg polygon { fill: currentColor; stroke: none; }
@media (hover: hover) { #end-panel .btn.sub:hover { color: var(--accent); border-color: var(--accent); } }

/* 점수 · 아이디 · 순위표 */
.hh-score { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.login-card { padding: 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.login-title { font-weight: 800; font-size: 15px; }
.login-sub { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.login-row { display: flex; gap: 8px; }
.login-input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: var(--r-control); border: 1.5px solid var(--border);
  font: inherit; font-size: 15px; letter-spacing: .04em; background: var(--surface); color: var(--ink); }
.login-input:focus { outline: none; border-color: var(--accent); }
.login-row .btn { flex: none; }
.login-err { margin: 8px 0 0; font-size: 13px; color: var(--ng); }
.login-err:empty { display: none; }
.rec-level .rule { font-size: 12px; color: var(--muted); line-height: 1.6; }
.rank { margin-bottom: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 6px; }
.rank:empty { display: none; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.rank-head b { font-size: 15px; }
.rank-head span { font-size: 12px; color: var(--ok); font-weight: 700; }
.rank-head span::before { content: "●"; margin-right: 4px; font-size: 9px; vertical-align: 1px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; }
.rank-row.me { background: var(--accent-soft); }
.rank-no { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rank-row.top1 .rank-no { background: #e3b341; color: #fff; }
.rank-row.top2 .rank-no { background: #b4a594; color: #fff; }
.rank-row.top3 .rank-no { background: #c08457; color: #fff; }
.rank-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rank-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { font-size: 12px; color: var(--muted); }
.rank-score { font-variant-numeric: tabular-nums; font-size: 15px; }
.rank-empty { margin: 0; font-size: 13.5px; color: var(--muted); }
.rec-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.rec-account-who { display: grid; gap: 2px; min-width: 0; }
.rec-account-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.rec-account-who b { font-size: 15.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-logout { flex: none; height: 40px; padding: 0 16px; }
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30;
  padding: 10px 18px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 24px rgba(84, 52, 27, .3); pointer-events: none; }
.toast.show { animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast.show { animation: none; } }

/* 오늘의 문제: 난이도 목록 */
.lv-date { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.lv-list { display: grid; gap: 10px; }
.lv-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-radius: 16px; text-align: left; cursor: pointer;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.lv-item:active { transform: scale(.99); }
.lv-badge { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 15px; }
.lv-item.done .lv-badge { background: var(--ok-soft); color: var(--ok); }
.lv-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.lv-name { font-weight: 800; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.lv-rec { padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 800; }
.lv-dots { display: flex; gap: 6px; }
.lv-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--border); }
.lv-dots i.ok { background: var(--ok); }
.lv-dots i.star { background: var(--gold); }
.lv-count { flex: none; font-size: 13.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lv-item.done .lv-count { color: var(--ok); }
body[data-screen="dailies"] .meter { visibility: hidden; }

/* 휴대폰에서 화면이 흔들리거나 밀리지 않게 */
html, body { overflow-x: clip; max-width: 100%; }
@supports not (overflow-x: clip) { html, body { overflow-x: hidden; } }
body { overscroll-behavior: none; }                    /* 끝에서 튕기거나 당겨서 새로고침되는 움직임 막기 */
.login-input, .unit-select, .review-memo { font-size: 16px; }   /* 아이폰이 입력 칸을 누를 때 확대하지 않게 */
svg.board { touch-action: pan-y; }                    /* 판을 누를 때 좌우로 끌리지 않게 (위아래 스크롤은 됨) */
@media (max-width: 820px) {
  /* "이 자리에 둘까요?"는 화면 아래에 떠 있게 → 내용이 밀리지 않음 */
  .confirm { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 25;
    margin: 0; padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--accent);
    box-shadow: 0 10px 30px rgba(84, 52, 27, .25); }
  .confirm .btn { height: 44px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

html, body { touch-action: manipulation; }             /* 두 번 눌러 확대 막기 */
#end-panel .btn.wide { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#end-panel .btn.wide svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* 홈 타일이 홀수면 마지막 타일은 넓게 */
.tiles .tile:last-child:nth-child(odd) { grid-column: span 2; }

/* 정석 외우기 */
.jstudy { max-width: 1040px; margin: 0 auto; }
.jstudy.show { display: block; }
.j-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.j-modes .seg { font-size: 13.5px; padding: 0 4px; }
.j-modes .seg.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.j-why { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.j-status { margin-bottom: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-weight: 700; font-size: 15px; }
.j-status.ok { background: var(--ok-soft); color: var(--ok); }
.j-status.ng { background: var(--ng-soft); color: var(--ng); }
.j-status:empty { display: none; }
.jstudy .timeline { margin-top: 12px; }
.jstudy .timeline li.hide .step-body span:last-child { filter: blur(4px); }
.lv-item .lv-badge.new { background: var(--surface-2); color: var(--ink-2); }
.lv-item .lv-badge.learn { background: var(--gold-soft); color: var(--gold); }
.lv-item .lv-badge.due { background: var(--ng-soft); color: var(--ng); }
.lv-item .lv-badge.done { background: var(--ok-soft); color: var(--ok); }
body[data-screen="jlist"] .meter, body[data-screen="jstudy"] .meter { visibility: hidden; }

/* 정석 화면: 묶음 제목 */
.lv-sec { margin: 18px 2px 8px; font-size: 15px; font-weight: 800; color: var(--ink); }
.lv-sec:first-of-type { margin-top: 6px; }
.lv-group { margin: 10px 4px 2px; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; color: var(--accent); }

/* 맨 위 띠가 없으므로 휴대폰 상단(노치) 여백은 본문에서 */
body { padding-top: env(safe-area-inset-top, 0px); }

/* 안 보고 두기 결과: 틀린 수 */
.timeline li.miss { background: var(--ng-soft); }
.timeline li.miss .step-who { color: var(--ng); }

/* 정석 결과: 대등 · 흑 좋음 · 백 좋음 */
.j-result { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.5; background: var(--surface-2); color: var(--ink-2); }
.j-result b { color: var(--ink); }
.j-result.black { background: #ece7e1; } .j-result.black b { color: #1f1a16; }
.j-result.white { background: var(--accent-soft); } .j-result.white b { color: var(--accent); }
.j-result.even b { color: var(--ok); }
.j-chip { display: inline-block; white-space: nowrap; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; vertical-align: 1px; }
.j-chip.even { background: var(--ok-soft); color: var(--ok); }
.j-chip.black { background: #2b2118; color: #fff; }
.j-chip.white { background: #fff; color: var(--ink); border: 1px solid var(--border); }

/* 정석 묶음 카드 */
.jgroups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.jgroup { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 0; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow); text-align: left; cursor: pointer; min-width: 0; }
.jgroup:active { transform: scale(.98); }
.jg-name { font-weight: 800; font-size: 15.5px; }
.jg-sub { font-size: 12.5px; color: var(--muted); }
.jg-bar { width: 100%; height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; }
.jg-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.jg-count { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.jg-count.due { color: var(--ng); }
.j-chip.first { margin-left: 0; }

/* ── 정석 강의 ── */
.lz-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.lz-tab { flex: none; height: 36px; padding: 0 12px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.lz-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lz-tab.joseki:not(.on) { border-color: var(--ok); color: var(--ok); }
.lz-tab.bad:not(.on) { color: var(--ng); }
.lz-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 16px; }
.lz-chip { padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--surface-2); color: var(--ink-2); }
.lz-chip.joseki { background: var(--ok-soft); color: var(--ok); }
.lz-chip.bad { background: var(--ng-soft); color: var(--ng); }
.lz-chip.good { background: #ece7e1; color: #2b2118; }
.lz-chip.old { background: var(--gold-soft); color: var(--gold); }
.lz-text { margin: 0 0 10px; font-size: 15.5px; line-height: 1.75; word-break: keep-all; }
.lz-memo { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--gold); font-family: var(--font-hand); font-size: 21px; color: #7a5b28; }
.lz-choices { display: flex; gap: 10px; margin-bottom: 10px; }
.lz-choices:empty { display: none; }
.lz-choice { flex: 1; height: 48px; font-size: 18px; font-weight: 800; }
#lz-player { grid-template-columns: repeat(4, 1fr); }
#lz-auto.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 강의의 A·B: 그 자리에 둘 쪽 색으로 (흑 = 검은 바탕 흰 글자, 백 = 흰 바탕 검은 글자) */
.gb-letter.stone-b circle { fill: #1f1b18; stroke: #000; stroke-width: 1.5; }
.gb-letter.stone-b text { fill: #fff; }
.gb-letter.stone-w circle { fill: #fbfaf7; stroke: #3a332c; stroke-width: 1.5; }
.gb-letter.stone-w text { fill: #1f1b18; }
@media (hover: hover) { .gb-letter.stone-b:hover circle { fill: #1f1b18; } .gb-letter.stone-b:hover text { fill: #fff; }
  .gb-letter.stone-w:hover circle { fill: #fbfaf7; } .gb-letter.stone-w:hover text { fill: #1f1b18; } }

/* A·B가 처음 나타날 때: 작게 시작해 살짝 커졌다가 제자리로 */
.gb-letter.appear { animation: letter-in .45s ease-out both; }
@keyframes letter-in {
  0% { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .gb-letter.appear { animation: none; } }

/* 강의 버튼: 좁으면 줄을 바꿔 쌓고 글자는 한 줄로 */
#lz-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#lz-actions .btn { flex: 1 1 140px; white-space: nowrap; }

/* 정석 그림: 외워야 할 것 */
.lz-tab.joseki { background: var(--ok-soft); }
.lz-tab.joseki.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.lz-joseki .board-frame { box-shadow: 0 0 0 3px var(--ok), var(--shadow); }
.lz-joseki .panel { box-shadow: inset 0 0 0 2px var(--ok), var(--shadow); }
.lz-head { flex-wrap: wrap; }
.lz-band { flex: 1 0 100%; margin: -2px 0 4px; padding: 6px 12px; border-radius: 10px; background: var(--ok); color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: .02em; }
#lz-actions .lz-memo-btn { background: var(--ok); }
@media (hover: hover) { #lz-actions .lz-memo-btn:hover { background: #0f5f3c; } }

/* 그림 보기의 수 표시: 버튼 위 오른쪽에 작게 */
.lz-count { margin: 4px 2px -6px; text-align: right; font-size: 13px; font-weight: 700; color: var(--muted); }

/* 놓아보기: 확인하고 두기 */
.free-confirm { display: flex; align-items: center; gap: 12px; margin: 8px 0; padding: 10px; border-radius: 12px; background: var(--accent-soft); }
.free-pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 40px); gap: 4px; flex: none; }
.free-pad [data-d="up"] { grid-column: 2; grid-row: 1; }
.free-pad [data-d="left"] { grid-column: 1; grid-row: 2; }
.free-pad [data-d="down"] { grid-column: 2; grid-row: 2; }
.free-pad [data-d="right"] { grid-column: 3; grid-row: 2; }
.free-pad .seg { height: 40px; min-height: 0; padding: 0; font-size: 15px; }
.free-confirm-btns { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.free-confirm-btns .btn { width: 100%; }

/* 놓아보기: 접바둑 */
.free-hcap, .free-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; font-weight: 700; font-size: 14.5px; }
.free-row-label { flex: none; min-width: 64px; }
.free-hcap { gap: 10px; }
.free-hcap select { flex: 1; height: 40px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; font-size: 16px; color: var(--ink); }

/* 두는 방식: 판 크기 버튼과 같은 모양의 둘 중 하나 고르기 */
.free-mode-seg { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.free-mode-seg .seg { height: 40px; font-size: 14.5px; font-weight: 700; }
.free-mode-seg .seg.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 장면 질문의 A·B·C: 동그라미 없이 글자만 (판 색 테두리로 줄 위에서도 또렷하게) */
.gb-letter.plain circle { fill: transparent; stroke: none; }
.gb-letter.plain text { font-size: 28px; font-weight: 800; fill: #1f1b18; stroke: #dfb46c; stroke-width: 5px; paint-order: stroke; stroke-linejoin: round; }
@media (hover: hover) { .gb-letter.plain:hover circle { fill: transparent; } .gb-letter.plain:hover text { fill: var(--accent); } }
.gb-letter.plain.off { opacity: .35; }
#lz-actions .lz-replay { flex-basis: 100%; }

/* 정석 외우기 끝난 뒤 버튼: 주 버튼은 한 줄 전체, 보조 버튼은 나란히 (글자는 한 줄) */
#j-actions { flex-wrap: wrap; }
#j-actions .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; padding-right: 8px; }
#j-actions .btn.primary { flex-basis: 100%; }

/* 강의 진도: 그림마다 점 (본 그림 ✓) */
.lz-prog { flex: 1 0 100%; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.lz-dot { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 800; color: var(--muted); cursor: pointer; padding: 0; }
.lz-dot.seen { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.lz-dot.j { border-color: var(--ok); }
.lz-dot.now { background: var(--accent); border-color: var(--accent); color: #fff; }
.lz-dot.now.j { background: var(--ok); border-color: var(--ok); }
.lz-prog-txt { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
#lz-actions .lz-next-do { flex-basis: 100%; }

/* 강의 버튼 정리: 주 버튼 한 줄 전체, 보조 버튼은 나란히 */
#lz-actions .btn.lz-main { flex-basis: 100%; }
#lz-actions .btn.secondary { flex: 1 1 0; }
.lz-head .lz-prog-txt { margin-left: auto; }

/* 강의 진도 초기화 */
.lz-reset { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.lz-reset .btn { flex: none; height: 38px; padding: 0 14px; font-size: 14px; }

/* ── 로그인 ── */
.auth-gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(160deg, var(--kaya-soft) 0%, #f1e2c4 100%); overflow-y: auto; }
.auth-card { width: 100%; max-width: 380px; padding: 32px 24px 24px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.auth-mark { width: 64px; height: 64px; border-radius: 16px; }
.auth-title { margin: 12px 0 2px; font-family: var(--font-display); font-size: 28px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; text-align: left; }
.auth-label { margin: 10px 0 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.auth-input { height: 50px; padding: 0 14px; border: 1.5px solid var(--border); border-radius: 12px; font: inherit; font-size: 17px; background: var(--surface); color: var(--ink); }
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-btn { margin-top: 18px; height: 52px; font-size: 17px; }
.auth-err { min-height: 1.4em; margin: 10px 0 0; color: var(--ng); font-size: 14px; font-weight: 700; text-align: center; }
.auth-help { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.auth-step { margin: 0 0 6px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 14.5px; font-weight: 700; line-height: 1.5; }
.auth-loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; background: var(--bg); z-index: 90; }

/* 정석 강의 목록: 장 탭 + 10강 묶음 */
.lz-chtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 2px 0 14px; }
.lz-chtab { height: auto; min-height: 56px; padding: 8px 10px; flex-direction: column; gap: 2px; }
.lz-chtab .lz-chname { font-size: 15px; font-weight: 800; color: var(--ink); }
.lz-chtab .lz-chcount { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lz-chtab.on { background: var(--accent); border-color: var(--accent); }
.lz-chtab.on .lz-chname, .lz-chtab.on .lz-chcount { color: #fff; }
.lz-chintro { margin: 0 2px 2px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.lv-sec.lz-range { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lz-rangecount { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.lz-item { padding: 10px 14px; gap: 12px; border-radius: 14px; }
.lz-item .lv-badge { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
.lz-item .lv-body { gap: 3px; }
.lz-item .lv-name { font-size: 14.5px; line-height: 1.4; }
.lz-item.lz-next { box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(0, 0, 0, .07); }
.lz-item.lz-next .lv-badge { background: var(--accent); color: #fff; }
@media (max-width: 420px) { .lz-grid { grid-template-columns: 1fr; } }

/* 놓아보기 오른쪽 칸: 설정(이름 위·버튼 아래) → 차례 → 확인 → 도구 */
#free .free-panel { gap: 14px; padding: 18px; }
.free-field { display: grid; gap: 6px; }
.free-label { font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.free-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.free-seg .seg { height: 38px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
@media (hover: hover) { .free-seg .seg:not(.on):hover:not(:disabled) { background: rgba(255, 255, 255, .55); } }
.free-seg .seg.on, .free-size .seg.on, .free-mode-seg .seg.on { background: var(--surface); color: var(--accent); border: 0;
  box-shadow: 0 1px 2px rgba(84, 52, 27, .12), 0 2px 8px rgba(84, 52, 27, .10); }
.free-field select { height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); }
.free-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.free-stone { width: 26px; height: 26px; flex: none; border-radius: 50%; }
.free-stone.b { background: radial-gradient(circle at 35% 30%, #5a5a5a, #111 70%); }
.free-stone.w { background: radial-gradient(circle at 35% 30%, #fff, #d9d4cc 80%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.free-status-text { display: grid; gap: 1px; }
.free-status-text b { font-size: 16px; color: var(--ink); }
.free-status-text span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#free .notice:empty { display: none; }
.free-confirm { display: grid; gap: 10px; justify-items: center; margin: 0; padding: 14px; border-radius: 12px; border: 1.5px solid var(--accent); background: var(--accent-soft); }
.free-confirm[hidden] { display: none; }
.free-confirm-help { font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-align: center; line-height: 1.5; }
.free-pad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 44px); gap: 6px; }
.free-pad .seg { height: 44px; }
.free-pad .seg svg { width: 20px; height: 20px; }
.free-confirm-btns { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; width: 100%; flex-direction: unset; }
.free-confirm-btns .btn { height: 44px; white-space: nowrap; }
.free-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.free-tools .seg { height: auto; min-height: 58px; padding: 8px 4px; flex-direction: column; gap: 4px; font-size: 12.5px; white-space: nowrap; }
.free-tools .seg svg { width: 18px; height: 18px; }

/* 설정 */
.set-wrap { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.set-profile { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 8px; border-radius: 16px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.set-avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 21px; font-weight: 800; }
.set-profile-main { display: grid; gap: 3px; min-width: 0; }
.set-profile-main b { font-size: 18px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-profile-main span { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.set-title { margin: 8px 6px 0; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.set-card { border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); overflow: hidden; }
.set-pad { padding: 16px; display: grid; gap: 12px; }
.set-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 14px 0 16px; border: 0; background: transparent;
  font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.set-item + .set-item { border-top: 1px solid var(--border); }
.set-item:hover { background: var(--surface-2); }
.set-ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.set-ico svg, .set-chev { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-item-name { flex: 1; font-size: 15.5px; font-weight: 700; }
.set-chev { color: var(--muted); }
.set-item.danger { color: var(--ng); }
.set-item.danger .set-ico { background: var(--ng-soft); color: var(--ng); }
.set-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.set-note { font-size: 12.5px; color: var(--muted); }
.set-pad .font-options { grid-template-columns: repeat(4, 1fr); gap: 0; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.set-pad .font-opt { height: 62px; border: 0; border-radius: 9px; background: transparent; gap: 3px; }
.set-pad .font-opt .fo-a { font-weight: 800; color: var(--ink-2); line-height: 1; }
.set-pad .font-opt .fo-l { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.set-pad .font-opt.on { background: var(--surface); box-shadow: 0 1px 2px rgba(84, 52, 27, .12), 0 2px 8px rgba(84, 52, 27, .10); }
.set-pad .font-opt.on .fo-a, .set-pad .font-opt.on .fo-l { color: var(--accent); }
.set-preview { margin: 0; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--border); font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* 가운데 창 (비밀번호 바꾸기 · 로그아웃 확인) */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(40, 26, 14, .45); }
.modal[hidden] { display: none; }
.modal-card { width: min(100%, 380px); display: grid; gap: 12px; padding: 22px 20px 18px; border-radius: 18px; background: var(--surface);
  box-shadow: 0 20px 60px rgba(40, 26, 14, .35); }
.modal-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.modal-sub { margin: -6px 0 2px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.set-input { display: grid; gap: 5px; }
.set-input span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.set-input input { height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  font: inherit; font-size: 17px; letter-spacing: .2em; color: var(--ink); }
.set-input input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-err { margin: 0; min-height: 0; color: var(--ng); font-size: 13.5px; font-weight: 700; }
.modal-err:empty { display: none; }
.modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.modal-btns .btn { height: 46px; }
.btn.primary.danger { background: var(--ng); border-color: var(--ng); }
body.modal-open { overflow: hidden; }

/* 놓아보기 v2: 차례 한 줄, 착수 확인은 제목·방향키 한 줄 + 착수/취소 한 줄 */
.free-status { padding: 10px 14px; gap: 10px; }
.free-stone { width: 22px; height: 22px; }
#free-turn { font-size: 15.5px; color: var(--ink); }
.free-turn-sub { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.free-confirm { grid-template-columns: 1fr auto; grid-template-areas: "t pad" "btns btns"; align-items: center; justify-items: stretch;
  gap: 12px; padding: 12px 14px; border: 1px solid var(--border); background: var(--surface-2); }
.free-confirm-title { grid-area: t; align-self: start; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.free-pad { grid-area: pad; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 4px; }
.free-pad .seg { height: 40px; border-radius: 10px; }
.free-pad .seg svg { width: 18px; height: 18px; }
.free-confirm-btns { grid-area: btns; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.free-confirm-btns .btn { height: 46px; font-size: 15.5px; }

/* 강의 목록 칸의 상태 줄 */
.lz-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.lz-dots { display: inline-flex; gap: 3px; }
.lz-dots i { width: 14px; height: 5px; border-radius: 3px; background: var(--border); }
.lz-dots i.on { background: var(--accent); }
.lz-item.done .lz-dots i.on { background: var(--ok); }
.lz-meta-label { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.lz-chip { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; line-height: 1.5; white-space: nowrap; }
.lz-chip.memo { background: var(--gold-soft); color: var(--gold); }
.lz-chip.todo { background: var(--accent-soft); color: var(--accent); }
.lz-chip.new { background: var(--surface-2); color: var(--ink-2); }
.lz-done { width: 26px; height: 26px; flex: none; }
.lz-item.done .lz-done { display: grid; place-items: center; border-radius: 50%; background: var(--ok); }
.lz-done svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }

/* 오늘의 문제: 문제 미리보기 + 난이도 표 */
.dl-item { gap: 16px; padding: 12px 16px 12px 12px; }
.dl-thumb { width: 96px; flex: none; padding: 3px; border-radius: 9px; background: var(--kaya); box-shadow: inset 0 0 0 1px rgba(84, 52, 27, .12); }
.dl-thumb .thumb { aspect-ratio: auto; min-height: 60px; }
.dl-item .lv-name { gap: 8px; }
.dl-level { padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.dl-item.done .dl-level { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 420px) { .dl-thumb { width: 78px; } }

/* 홈 v2: 머리 띠(날짜·설정 / 인사 / 급수 → 내 기록 / 문구) · 이어서 풀기 진행 막대 · 2×2 타일 · 내 기록 한 줄 */
.hh { margin: 0; padding: 18px 20px 16px; border: 1px solid var(--kaya-line); border-radius: 20px; display: grid; gap: 6px; }
.hh-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hh-hello { font-size: 13px; font-weight: 600; color: #7a5b28; }
.hh-gear { width: 38px; height: 38px; margin: -6px -8px -6px 0; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: #7a5b28; cursor: pointer; }
.hh-gear:hover { background: rgba(255, 255, 255, .5); }
.hh-gear svg { width: 21px; height: 21px; }
.hh-name { font-family: inherit; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.hh-rank { justify-self: start; display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; padding: 5px 8px 5px 5px;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, .6); font: inherit; cursor: pointer; }
.hh-rank:hover { background: rgba(255, 255, 255, .85); }
.hh-rank b { padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; }
.hh-rank .hh-score { margin: 0; font-size: 13.5px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.hh-streak { font-size: 13px; font-weight: 600; color: #7a5b28; }
.hh-streak::before { content: "·"; margin-right: 8px; color: #b99a63; }
.hh-rank-chev { width: 16px; height: 16px; fill: none; stroke: #9a7a44; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hh-tag { margin-top: 6px; font-family: var(--font-hand); font-size: 21px; line-height: 1.1; color: #8a6a32; letter-spacing: .03em; }
.home-body { padding-top: 14px; }
.pt-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pt-bar { flex: 1; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.pt-bar span { display: block; height: 100%; border-radius: inherit; background: #fff; }
.pt-count { font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .85); font-variant-numeric: tabular-nums; }
.row-tile { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--surface);
  text-align: left; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); transition: transform .13s, box-shadow .15s; }
.row-tile:active { transform: scale(.98); }
@media (hover: hover) { .row-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, .1); } }
.row-tile-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.row-tile-icon svg { width: 22px; height: 22px; }
.row-tile-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-tile-text .tile-sub { margin: 0; }
.row-tile-chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* 책의 표시 (△ ○ □ ×) */
.gb-shape { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.gb-shape.on-black { stroke: #fff; }
.gb-shape.on-white { stroke: #1d2433; }
.gb-shape.on-empty { stroke: #1d2433; }
.gb-shape.on-empty.x { stroke: var(--ng); stroke-width: 3; }

/* 입문 연습문제 */
#ipractice .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#ipractice .actions .lz-main { grid-column: 1 / -1; }
.ip-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.ip-kind { font-size: 16px; font-weight: 800; color: var(--ink); }
.ip-count { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.ip-dots { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.ip-dot { width: 14px; height: 14px; padding: 0; border: 0; border-radius: 4px; background: var(--border); cursor: pointer; }
.ip-dot.ok { background: var(--ok); }
.ip-dot.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ip-prompt { font-size: 16px; font-weight: 600; }
.ip-ox { font-size: 20px; font-weight: 800; }
.lz-memo.lz-intro { padding: 10px 14px; border-left-color: var(--accent); border-radius: 0 10px 10px 0; background: var(--kaya-soft); font-family: inherit; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.lz-tab.lz-practice-tab { border-color: var(--accent); color: var(--accent); font-weight: 800; }
body[data-screen="ipractice"] .meter { visibility: hidden; }

/* 홈: 오늘의 공부 */
.today { display: grid; gap: 10px; padding: 16px; border-radius: 20px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.today-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.today-title { font-size: 16px; font-weight: 800; color: var(--ink); }
.today-sum { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.today-list { display: grid; gap: 8px; }
.today-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 12px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); text-align: left; cursor: pointer; font: inherit; color: var(--ink); transition: transform .13s, box-shadow .15s; }
.today-row:active { transform: scale(.98); }
.today-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.today-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.today-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.today-label { font-size: 15px; font-weight: 800; }
.today-sub { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.today-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.today-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.today-count { font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.today-chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.today-row.now { border: 0; background: linear-gradient(135deg, #9c6b3e 0%, var(--accent) 100%); color: #fff; box-shadow: 0 4px 16px rgba(84, 52, 27, .25); }
.today-row.now .today-ico { background: rgba(255, 255, 255, .18); color: #fff; }
.today-row.now .today-sub, .today-row.now .today-count { color: rgba(255, 255, 255, .8); }
.today-row.now .today-bar { background: rgba(255, 255, 255, .25); }
.today-row.now .today-bar span { background: #fff; }
.today-row.now .today-chev { stroke: #fff; }
.today-row.complete .today-ico { background: var(--ok-soft); color: var(--ok); }
.today-row.complete .today-bar span { background: var(--ok); }
@media (hover: hover) { .today-row:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); } .today-row.now:hover { box-shadow: 0 8px 24px rgba(84, 52, 27, .3); } }

/* 위쪽 막대: 화면 맨 위에 붙어 있고, 뒤로 가기(왼쪽) · 화면 이름(가운데) */
.sub-topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
  min-height: 52px; margin: -18px -20px 14px; padding: 4px 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.sub-topbar::after { content: none; }
.sub-topbar .sub-title { grid-column: 2; max-width: min(56vw, 520px); font-size: 16px; font-weight: 800; color: var(--ink); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-topbar .back { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; }
.back { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 12px 0 4px; border-radius: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; font-weight: 700; color: var(--accent); }
.back::before { content: ""; width: 22px; height: 22px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") center / contain no-repeat; }
.back:hover { background: var(--accent-soft); }
@media (max-width: 560px) { .sub-topbar .sub-title { font-size: 15px; } .back { font-size: 13.5px; } }

/* 아래 탭 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--border); }
body:is([data-screen="home"], [data-screen="lessons"], [data-screen="library"], [data-screen="book"], [data-screen="records"], [data-screen="dailies"], [data-screen="settings"], [data-screen="review"], [data-screen="homework"], [data-screen="teacher"], [data-screen="week"], [data-screen="badges"], [data-screen="rankplan"], [data-screen="notice"]) .tabbar { display: grid; }
body:is([data-screen="home"], [data-screen="lessons"], [data-screen="library"], [data-screen="book"], [data-screen="records"], [data-screen="dailies"], [data-screen="settings"], [data-screen="review"], [data-screen="homework"], [data-screen="teacher"], [data-screen="week"], [data-screen="badges"], [data-screen="rankplan"], [data-screen="notice"]) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
.tab-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; height: 52px; justify-content: center; border: 0; border-radius: 12px;
  background: transparent; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab-btn.on { color: var(--accent); }
.tab-btn.on svg { stroke-width: 2.3; }
@media (hover: hover) { .tab-btn:hover { background: var(--accent-soft); } }
@media (min-width: 821px) { .tabbar { left: 50%; right: auto; bottom: 14px; transform: translateX(-50%); width: 420px; padding: 6px; border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 8px 30px rgba(40, 26, 14, .15); } }

/* 내 기록: 강의 · 수읽기 훈련 진행 (한 줄씩, 문제집은 펼치기) */
#rec-units { display: block; }
.rec-sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 6px 8px; }
.rec-sec h2 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.rec-sec span { font-size: 12px; color: var(--muted); }
.rec-card { border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); overflow: hidden; }
.rec-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main pct chev" "bar bar bar"; align-items: center;
  column-gap: 10px; row-gap: 10px; padding: 14px 16px; }
.rec-row + .rec-row, .rec-units-list + .rec-row { border-top: 1px solid var(--border); }
.rec-row.tap { cursor: pointer; }
.rec-row.tap:hover { background: var(--surface-2); }
.rec-row-main { grid-area: main; display: grid; gap: 2px; min-width: 0; }
.rec-row-name { font-size: 15px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-row-sub { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.rec-row-pct { grid-area: pct; font-size: 15px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.rec-row.complete .rec-row-pct { color: var(--ok); }
.rec-row-bar { grid-area: bar; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.rec-row-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.rec-row.complete .rec-row-bar span { background: var(--ok); }
.rec-chev { grid-area: chev; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.rec-row.open .rec-chev { transform: rotate(180deg); }
.rec-row:not(.book) { grid-template-areas: "main pct pct" "bar bar bar"; }
.rec-units-list { display: grid; padding: 2px 8px 10px; background: var(--surface-2); border-top: 1px solid var(--border); }
.rec-unit { display: grid; grid-template-columns: minmax(0, 1fr) 72px 48px; align-items: center; gap: 12px; padding: 10px 10px; border: 0; border-radius: 10px;
  background: transparent; font: inherit; text-align: left; cursor: pointer; }
.rec-unit:hover { background: var(--surface); }
.rec-unit-name { font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-unit-bar { height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.rec-unit-bar span { display: block; height: 100%; background: var(--accent); }
.rec-unit.complete .rec-unit-bar span { background: var(--ok); }
.rec-unit-count { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rec-unit.complete .rec-unit-name { color: var(--ok); }

/* 장면 탭이 많으면(입문 1장 등) 옆으로 밀지 않고 여러 줄로 */
.lz-tabs { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }

/* 강의 첫 화면: 큰 묶음 카드 */
.course-list { display: grid; gap: 10px; }
.course { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border: 0; border-radius: 18px; background: var(--surface);
  text-align: left; font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); transition: transform .13s, box-shadow .15s; }
.course:active { transform: scale(.99); }
@media (hover: hover) { .course:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .1); } }
.course-ico { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.course-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.course.first .course-ico { background: var(--accent); color: #fff; }
.course.complete .course-ico { background: var(--ok-soft); color: var(--ok); }
.course-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.course-name { font-size: 17px; font-weight: 800; }
.course-desc { font-size: 13px; color: var(--ink-2); }
.course-meta { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.course-bar { height: 5px; margin-top: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.course-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.course.complete .course-bar span { background: var(--ok); }
.course-next { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-chev { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* 휴대폰: 착수 확인 칸을 화면 아래에 떠 있게 (판을 누른 뒤 바로 손이 닿는 곳) */
@media (max-width: 820px) {
  #free .free-confirm { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; grid-template-columns: 1fr; grid-template-areas: "pad" "btns";
    gap: 8px; padding: 10px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 34px rgba(40, 26, 14, .28); }
  #free .free-confirm-title { display: none; }
  #free .free-pad { grid-template-columns: repeat(4, 1fr); grid-template-rows: 44px; width: 100%; }
  #free .free-pad [data-d="left"] { grid-column: 1; grid-row: 1; }
  #free .free-pad [data-d="up"] { grid-column: 2; grid-row: 1; }
  #free .free-pad [data-d="down"] { grid-column: 3; grid-row: 1; }
  #free .free-pad [data-d="right"] { grid-column: 4; grid-row: 1; }
  #free .free-confirm-btns .btn { height: 50px; font-size: 16.5px; }
}

/* 홈 머리 띠: 앱 아이콘 + 이름 */
.hh-brand { display: inline-flex; align-items: center; gap: 8px; }
.hh-logo { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 1px 3px rgba(61, 42, 18, .25); }
.hh-brand b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; color: var(--accent); }
.hh-bar + .hh-hello { margin-top: 8px; }
/* 오늘의 문제 미리보기: 모두 같은 크기 (판 모양이 달라도 가운데 맞춤) */
.dl-thumb { height: 76px; display: grid; place-items: center; }
.dl-thumb .thumb { width: 100%; height: 100%; min-height: 0; }

/* 수읽기 훈련 단원: 다음에 풀 문제 미리보기 */
.unit.unit-prev { gap: 14px; padding: 10px 14px 10px 10px; }
.unit-thumb { position: relative; width: 84px; height: 68px; flex: none; display: grid; place-items: center; padding: 3px; border-radius: 9px;
  background: var(--kaya); box-shadow: inset 0 0 0 1px rgba(84, 52, 27, .12); }
.unit-thumb .thumb { width: 100%; height: 100%; }
.unit.done .unit-thumb .thumb { opacity: .45; }
.unit-check { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--ok); }

/* 점수 알림(+10점 등): 갈색 버튼과 헷갈리지 않게 밝은 금색 바탕 · 진한 글씨 */
.toast { background: #fff7e3; color: #7a4e12; border: 1.5px solid #e6c27a; box-shadow: 0 8px 24px rgba(84, 52, 27, .22); }

/* 고른 칸은 갈색 바탕 · 흰 글씨로 또렷하게 (놓아보기 판 크기·두는 방식, 설정 글씨 크기) */
.free-seg .seg.on, .free-size .seg.on, .free-mode-seg .seg.on { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(84, 52, 27, .25); }
.set-pad .font-opt.on { background: var(--accent); box-shadow: 0 2px 8px rgba(84, 52, 27, .25); }
.set-pad .font-opt.on .fo-a, .set-pad .font-opt.on .fo-l { color: #fff; }

/* 시작 화면 (불러오는 동안) */
.auth-loading { flex-direction: column; background: radial-gradient(120% 80% at 50% 30%, #fbf3e2 0%, var(--bg) 70%); }
.splash { display: grid; justify-items: center; gap: 6px; padding: 24px; text-align: center; animation: splash-in .5s ease-out both; }
.splash-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 10px 30px rgba(84, 52, 27, .25); margin-bottom: 10px; }
.splash-name { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.splash-tag { font-family: var(--font-hand); font-size: 22px; color: #8a6a32; }
.splash-stones { display: flex; gap: 10px; margin-top: 22px; }
.splash-stones i { width: 14px; height: 14px; border-radius: 50%; animation: splash-stone 1.2s ease-in-out infinite; }
.splash-stones i:nth-child(odd) { background: radial-gradient(circle at 35% 30%, #5a5a5a, #111 70%); }
.splash-stones i:nth-child(even) { background: radial-gradient(circle at 35% 30%, #fff, #d9d4cc 80%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.splash-stones i:nth-child(2) { animation-delay: .15s; }
.splash-stones i:nth-child(3) { animation-delay: .3s; }
.splash-msg { margin: 14px 0 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.auth-loading.error .splash-board { display: none; }
.auth-loading.error .splash-msg { color: var(--ng); }
@keyframes splash-stone { 0%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-8px); opacity: 1; } }
@keyframes splash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .splash, .splash-stones i { animation: none; } }
/* 문제를 받는 동안 위쪽 작은 알림 */
.loader { display: inline-flex; align-items: center; gap: 8px; }
.loader[hidden] { display: none; }
.loader-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: loader-spin .8s linear infinite; }
@keyframes loader-spin { to { transform: rotate(360deg); } }

/* 시작 화면: 작은 바둑판에 흑·백이 한 수씩 놓였다가 다시 처음부터 */
.splash-board { width: 132px; height: 132px; margin-top: 22px; filter: drop-shadow(0 6px 16px rgba(84, 52, 27, .22)); }
.sb-wood { fill: #e2b86c; }
.sb-lines line { stroke: #5c4210; stroke-width: 1.4; opacity: .75; }
.sb-star { fill: #5c4210; }
.ss { opacity: 0; transform-box: fill-box; transform-origin: center; animation: ss-play 5.8s ease-out infinite; }
.ss.b { fill: url(#sp-b); }
.ss.w { fill: url(#sp-w); stroke: rgba(0, 0, 0, .25); stroke-width: 1; }
@keyframes ss-play { 0% { opacity: 0; transform: scale(.4); } 4% { opacity: 1; transform: scale(1.08); } 7% { transform: scale(1); } 74% { opacity: 1; } 82%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ss { animation: none; opacity: 1; } }
.splash-logo { width: 64px; height: 64px; border-radius: 17px; margin-bottom: 6px; }

/* 고른 칸은 눌린 뒤(휴대폰의 남는 hover)에도 갈색 그대로 */
.free-seg .seg.on, .free-seg .seg.on:hover, .free-seg .seg.on:active { background: var(--accent); color: #fff; }

/* 입문 연습문제: 착수 확인 칸 (놓아보기와 같은 모양) */
#ipractice .free-confirm { margin: 0 0 12px; }
@media (max-width: 820px) {
  #ipractice .free-confirm { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; grid-template-columns: 1fr; grid-template-areas: "pad" "btns";
    gap: 8px; margin: 0; padding: 10px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 34px rgba(40, 26, 14, .28); }
  #ipractice .free-confirm-title { display: none; }
  #ipractice .free-pad { grid-template-columns: repeat(4, 1fr); grid-template-rows: 44px; width: 100%; }
  #ipractice .free-pad [data-d="left"] { grid-column: 1; grid-row: 1; }
  #ipractice .free-pad [data-d="up"] { grid-column: 2; grid-row: 1; }
  #ipractice .free-pad [data-d="down"] { grid-column: 3; grid-row: 1; }
  #ipractice .free-pad [data-d="right"] { grid-column: 4; grid-row: 1; }
  #ipractice .free-confirm-btns .btn { height: 50px; font-size: 16.5px; }
}

/* 홈 머리 띠 맨 아래: [아이콘] 수찾사 : 수(手)를 찾고 싶은 사람들 */
.hh-sign { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #dcc394; min-width: 0; }
.hh-sign .hh-logo { width: 24px; height: 24px; border-radius: 6px; flex: none; }
.hh-sign b { font-size: 15px; font-weight: 800; color: var(--accent); flex: none; }
.hh-sign-colon { color: #b99a63; font-weight: 700; }
.hh-sign .hh-tag { margin: 0; font-size: 19px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 놓아보기: 이어서 두는 판 안내 */
.free-resume { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--kaya-soft); border: 1px solid var(--kaya-line); }
.free-resume[hidden] { display: none; }
.free-resume > span { font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.free-resume b { color: var(--ink); }
.free-resume span span { color: var(--muted); font-variant-numeric: tabular-nums; }
.free-resume .btn { flex: none; height: 36px; padding: 0 14px; font-size: 14px; }

/* 홈: 오늘의 한마디 */
.saying { display: grid; gap: 6px; width: 100%; padding: 14px 16px; border: 1px solid var(--kaya-line); border-radius: 16px; background: var(--surface);
  text-align: left; font: inherit; color: var(--ink); cursor: pointer; border-left: 4px solid var(--gold); }
.saying[hidden] { display: none; }
.saying-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.saying-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--gold); }
.saying-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.saying-line { font-size: 15.5px; font-weight: 800; line-height: 1.45; }
.saying-text { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.saying-card { width: min(100%, 460px); max-height: min(80vh, 640px); grid-template-rows: auto minmax(0, 1fr) auto; }
.saying-list { display: grid; gap: 10px; overflow-y: auto; padding-right: 4px; }
.saying-item { display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.saying-item.today { background: var(--gold-soft); }
.saying-item-day { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.saying-item b { font-size: 14.5px; }
.saying-item span:last-child { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.modal-btns.one { grid-template-columns: 1fr; }
/* 장면이 7개 이상이면 점 대신 짧은 막대 하나 */
.lz-dots.bar { width: 60px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; display: block; }
.lz-dots.bar i { display: block; height: 100%; border-radius: 0; background: var(--accent); }
.lz-meta { flex-wrap: nowrap; }
/* 휴대폰: 긴 화면 이름이 왼쪽 뒤로 가기 글자를 덮지 않게 */
@media (max-width: 560px) {
  .sub-topbar { grid-template-columns: auto minmax(0, 1fr) 40px; }
  .sub-topbar .back { max-width: 34vw; }
  .sub-topbar .sub-title { max-width: none; }
}

/* 오답 노트 · 숙제 · 선생님 화면 · 신고 */
.rv-sum { display: grid; gap: 10px; padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); margin-bottom: 14px; }
.rv-sum-top { display: flex; align-items: center; gap: 10px; }
.rv-sum-n { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.rv-sum-unit { font-size: 13px; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.rv-sum-stats { margin-left: auto; display: flex; gap: 14px; }
.rv-sum-stats span { display: grid; justify-items: center; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.rv-sum-stats b { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rv-sum-sub { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.rv-start { display: grid; gap: 8px; }
.rv-start:empty { display: none; }
.rv-start .btn { height: 48px; }
.rv-how { margin: 0; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12.5px; line-height: 1.55; color: var(--muted); }
#rv-list { display: grid; gap: 8px; }
.rv-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 16px; border: 0; background: transparent; font: inherit; text-align: left; color: var(--ink); cursor: pointer; }
.rv-row + .rv-row { border-top: 1px solid var(--border); }
.rv-row:hover { background: var(--surface-2); }
.rv-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rv-main b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-main span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-steps { display: flex; gap: 3px; flex: none; }
.rv-steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.rv-steps i.on { background: var(--ok); }
.rv-when { flex: none; min-width: 52px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.hw-title { font-size: 19px; font-weight: 800; }
.hw-prog { margin-top: 0; }
.rv-row.complete .rv-main b { color: var(--ok); }
.hw-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; }
.rv-row.complete .hw-mark { background: var(--ok); }
.t-tabs { margin-bottom: 14px; }
#t-rep-n { margin-left: 2px; color: var(--ng); font-weight: 800; }
#t-body { display: grid; gap: 10px; }
.t-member { display: grid; gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.t-mhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.t-mhead b { font-size: 16px; }
.t-rank { font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.t-msub { font-size: 12.5px; color: var(--muted); }
.t-mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.t-mgrid span { display: grid; justify-items: center; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); }
.t-mgrid b { font-size: 16px; font-variant-numeric: tabular-nums; }
.t-mgrid small { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.t-mhw { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.t-mhw .today-bar { flex: 1; }
.t-mweak { font-size: 12.5px; color: var(--ng); line-height: 1.5; }
.t-memo { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.t-form { display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .07); }
.t-form input[type=date] { letter-spacing: 0; }
.t-pick, .t-chosen { display: grid; gap: 6px; }
.set-input-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.t-pick select { height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 15px; }
.t-checks { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; }
.t-checks label { display: flex; align-items: center; gap: 6px; padding: 5px 2px; font-size: 14px; cursor: pointer; }
.t-checks input { width: 18px; height: 18px; accent-color: var(--accent); }
#hw-chosen { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.t-chip { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.report-link { justify-self: start; display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.report-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.report-link:hover { background: var(--surface-2); color: var(--ink-2); }
.rep-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-reason { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.rep-reason.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.set-input textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 15px; color: var(--ink); resize: vertical; }

/* 이번 주 공동체 문제 · 배지 · 순위 탭 */
.wk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wk-range { font-size: 13px; font-weight: 700; color: var(--muted); }
.wk-mine-l { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.wk-mine-l b { font-size: 18px; color: var(--accent); margin-left: 4px; font-variant-numeric: tabular-nums; }
#wk-comm { display: grid; gap: 8px; }
.wk-goal { display: flex; align-items: baseline; justify-content: space-between; }
.wk-goal b { font-size: 16px; }
.wk-goal span { font-size: 14px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.wk-bar { height: 8px; }
.wk-people { display: flex; flex-wrap: wrap; gap: 6px; }
.wk-p { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wk-p.done { background: var(--ok-soft); color: var(--ok); }
.wk-p.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.badges .rank-head span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.badge-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.badge { display: grid; justify-items: center; gap: 2px; padding: 10px 2px 8px; border-radius: 12px; background: var(--surface-2); opacity: .55; }
.badge.got { opacity: 1; background: var(--gold-soft); box-shadow: inset 0 0 0 1px #ecd29b; }
.badge-ic { font-size: 22px; line-height: 1.1; }
.badge b { font-size: 12px; }
.badge small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.badge-tip { margin: 8px 2px 0; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 420px) { .badge-row { grid-template-columns: repeat(3, 1fr); } }
.rank-tabs { display: inline-grid; grid-auto-flow: column; padding: 2px; }
.rank-tabs .seg { height: 30px; padding: 0 12px; font-size: 12.5px; }
.badges .rank-head span::before, .rank-head .rank-tabs::before { content: none; }
.rank-head .rank-tabs { color: inherit; }

/* 배지 모음 */
.medal { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 22px; background: var(--surface-2); filter: grayscale(1); opacity: .6; }
.medal.got { filter: none; opacity: 1; }
.medal.bronze { background: radial-gradient(circle at 35% 30%, #f6dcc2, #d49a6a); box-shadow: inset 0 0 0 2px #b97a4a; }
.medal.silver { background: radial-gradient(circle at 35% 30%, #f7f7f7, #c6c9cf); box-shadow: inset 0 0 0 2px #9da2ab; }
.medal.gold { background: radial-gradient(circle at 35% 30%, #fff3c4, #e9bf4f); box-shadow: inset 0 0 0 2px #c79a26; }
.medal.platinum { background: radial-gradient(circle at 35% 30%, #eefbff, #a9d6e8); box-shadow: inset 0 0 0 2px #6fa9c2; }
.badge-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge-empty { font-size: 13px; color: var(--muted); }
.badge-more { width: 100%; height: 42px; margin-top: 10px; }
.bd-sec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 4px 8px; }
.bd-sec h2 { margin: 0; font-size: 15px; font-weight: 800; }
.bd-sec span { font-size: 12px; color: var(--muted); text-align: right; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.bd-card { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 12px 6px 10px; border-radius: 14px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .06); text-align: center; }
.bd-card b { font-size: 12.5px; line-height: 1.3; }
.bd-card small { font-size: 11px; line-height: 1.35; color: var(--muted); }
.bd-card:not(.got) b { color: var(--muted); }
.bd-prog { display: grid; gap: 2px; width: 100%; padding: 0 6px; }
.bd-prog em { font-style: normal; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 묶음 전체 진도 초기화 */
.course-reset { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface); }

/* 배지 알림: 메달 왼쪽, 글은 세 줄로 가지런히 */
.toast.badge-toast { display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(92vw, 360px); padding: 12px 18px 12px 12px;
  border-radius: 18px; text-align: left; white-space: normal; }
.toast.badge-toast .medal { width: 46px; height: 46px; font-size: 24px; }
.bt-text { display: grid; gap: 1px; min-width: 0; line-height: 1.3; }
.bt-text small { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #9a6c1f; }
.bt-text b { font-size: 16px; font-weight: 800; color: #5a3a0c; }
.bt-text span { font-size: 12.5px; font-weight: 600; color: #7a5b28; }

/* 수읽기·정석 외우기의 착수 확인 칸 (놓아보기·연습문제와 같은 모양) */
#study .free-confirm, #jstudy .free-confirm { margin: 0 0 12px; }
#study .free-confirm[hidden], #jstudy .free-confirm[hidden] { display: none; }
#jstudy .free-pad[hidden] { display: none; }
@media (max-width: 820px) {
  #study .free-confirm, #jstudy .free-confirm { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; grid-template-columns: 1fr; grid-template-areas: "pad" "btns";
    gap: 8px; margin: 0; padding: 10px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 34px rgba(40, 26, 14, .28); }
  #study .free-confirm-title, #jstudy .free-confirm-title { display: none; }
  #study .free-pad, #jstudy .free-pad { grid-template-columns: repeat(4, 1fr); grid-template-rows: 44px; width: 100%; }
  #study .free-pad [data-d="left"], #jstudy .free-pad [data-d="left"] { grid-column: 1; grid-row: 1; }
  #study .free-pad [data-d="up"], #jstudy .free-pad [data-d="up"] { grid-column: 2; grid-row: 1; }
  #study .free-pad [data-d="down"], #jstudy .free-pad [data-d="down"] { grid-column: 3; grid-row: 1; }
  #study .free-pad [data-d="right"], #jstudy .free-pad [data-d="right"] { grid-column: 4; grid-row: 1; }
  #study .free-confirm-btns .btn, #jstudy .free-confirm-btns .btn { height: 50px; font-size: 16.5px; }
}
.place-seg { margin-bottom: 2px; }
.place-note { margin: 0 0 8px; line-height: 1.5; }

/* 강의 목록: 부분별 불 (강의 · 외우기 · 연습) */
.lz-lamps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.lz-lamp { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 7px; border-radius: 999px; background: var(--surface-2);
  font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lz-lamp i { width: 8px; height: 8px; border-radius: 50%; background: #cfc3b1; }
.lz-lamp.on { background: var(--ok-soft); color: var(--ok); }
.lz-lamp.on i { background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 122, 79, .18); }
.lz-lamp.lamp-memo.on { background: var(--gold-soft); color: var(--gold); }
.lz-lamp.lamp-memo.on i { background: var(--gold); box-shadow: 0 0 0 3px rgba(183, 121, 31, .2); }
.lz-lamp.due { background: #fdeee0; color: #b4580f; }
.lz-lamp.due i { background: #e07b2a; box-shadow: 0 0 0 3px rgba(224, 123, 42, .2); }
.lz-lamp.part { color: var(--accent); }
.lz-lamp.part i { background: linear-gradient(90deg, var(--accent) 50%, #cfc3b1 50%); }
.lz-item .lv-body { gap: 4px; }
.lz-lamp.lamp-memo.due { background: #fdeee0; color: #b4580f; } .lz-lamp.lamp-memo.due i { background: #e07b2a; box-shadow: 0 0 0 3px rgba(224, 123, 42, .2); }

/* 정답 판정: 오른쪽 점수 칸 */
.verdict > div:not(.verdict-score) { flex: 1; min-width: 0; }
.verdict-sub { margin-top: 2px; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.verdict-score { flex: none; display: grid; justify-items: end; gap: 1px; padding-left: 12px; border-left: 1px solid rgba(47, 122, 79, .25); }
.verdict-score b { font-size: 22px; font-weight: 800; color: var(--ok); line-height: 1.1; font-variant-numeric: tabular-nums; }
.verdict-score small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.verdict-score.star small { color: var(--gold); }
.verdict-score.none b { color: var(--muted); }

/* 내 기록 배지: 메달 옆에 이름과 받은 이유 */
.badge-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.badge-item .medal { width: 38px; height: 38px; font-size: 19px; }
.badge-item-tx { display: grid; gap: 1px; min-width: 0; }
.badge-item-tx b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-item-tx small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-strip .badge-empty { grid-column: 1 / -1; }

/* 오늘의 한마디 줄바꿈: 낱말 안에서 끊지 않고, 줄마다 따로 */
.saying-line, .saying-text, .saying-item b, .saying-item > span:last-child { word-break: keep-all; overflow-wrap: break-word; }
.say-ln { display: block; }
.saying-line .say-ln + .say-ln { margin-top: 1px; }
.saying-text .say-ln + .say-ln { margin-top: 3px; }

/* 급수 안내 */
.rec-guide { width: 100%; height: 42px; margin-top: 10px; }
.rp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rp-now { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.rp-score { font-size: 15px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rp-sub { display: grid; gap: 2px; }
.rp-sub b { font-size: 14.5px; }
.rp-sub span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rp-ways, .rp-plan { padding: 6px 0; }
.rp-way { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); grid-template-areas: "a b" "a c"; column-gap: 12px; padding: 10px 16px; }
.rp-way + .rp-way { border-top: 1px solid var(--border); }
.rp-way b { grid-area: a; font-size: 14px; word-break: keep-all; }
.rp-way span { grid-area: b; font-size: 13.5px; color: var(--ink); line-height: 1.45; word-break: keep-all; }
.rp-way small { grid-area: c; font-size: 11.5px; color: var(--muted); }
.rp-note { margin: 0; padding: 12px 16px 8px; border-top: 1px dashed var(--border); font-size: 12.5px; line-height: 1.6; color: var(--ink-2); word-break: keep-all; }
.rp-step { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.rp-step + .rp-step { border-top: 1px solid var(--border); }
.rp-n { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; }
.rp-step > span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: 1px; }
.rp-step b { font-size: 14px; }
.rp-step small { font-size: 12px; color: var(--muted); word-break: keep-all; }
.rp-step em { flex: none; font-style: normal; font-size: 12.5px; font-weight: 800; color: var(--ok); white-space: nowrap; }
.rp-table { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rp-row { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.rp-row b { font-size: 14px; }
.rp-row span { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rp-row em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--ok); min-width: 1.6em; text-align: right; }
.rp-row.past b { color: var(--ok); }
.rp-row.now { background: var(--accent); }
.rp-row.now b, .rp-row.now span, .rp-row.now em { color: #fff; }
.rp-row.future b { color: var(--ink-2); }
@media (max-width: 420px) { .rp-table { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.saying { cursor: default; }

/* 공동체 순위: 기준 시각 + 새로고침 */
.rank-upd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 8px; }
.rank-upd > span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-refresh { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.rank-refresh svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rank-refresh.spin svg { animation: loader-spin .8s linear infinite; }
.rank-refresh:disabled { opacity: .6; }

/* 선생님 화면 v2 */
.t-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.t-sum-c { display: grid; justify-items: center; gap: 1px; padding: 12px 4px; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 10px rgba(0,0,0,.06); }
.t-sum-c b { font-size: 18px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.t-sum-c small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.t-sum-c.warn b { color: var(--ng); }
.t-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 2px 0; }
.t-bar > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.t-sort { flex: 1; max-width: 260px; }
.t-sort .seg { height: 32px; font-size: 12.5px; }
.t-list { padding: 2px 0; }
.t-row { display: flex; gap: 12px; padding: 12px 14px; }
.t-row + .t-row { border-top: 1px solid var(--border); }
.t-av { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 15px; }
.t-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.t-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.t-top b { font-size: 15px; white-space: nowrap; }
.t-top .t-rank { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-pill { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.t-pill.ok { background: var(--ok-soft); color: var(--ok); }
.t-pill.mid { background: var(--surface-2); color: var(--ink-2); }
.t-pill.warn { background: var(--ng-soft); color: var(--ng); }
.t-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.t-stats span { display: grid; justify-items: center; padding: 5px 2px; border-radius: 8px; background: var(--surface-2); }
.t-stats small { font-size: 10.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.t-stats b { font-size: 14px; font-variant-numeric: tabular-nums; }
.t-hw { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.t-hw small, .t-weak small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.t-hw em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.t-weak { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.t-weak span { font-size: 12.5px; color: var(--ng); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-hwcur { display: grid; gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.07); }
.t-hwcur .t-top b { font-size: 16px; }
.t-hwcur .t-top .t-pill { margin-left: auto; }
.t-form .set-input input { letter-spacing: 0; font-size: 15.5px; }
#t-body > .set-title { margin-top: 6px; }

/* 선생님 화면: 회원 관리 */
.t-tabs { grid-auto-columns: 1fr; }
.t-tabs .seg { font-size: 13px; padding: 0 2px; }
.t-form-title { font-size: 16px; }
.t-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.t-add input { height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 16px; color: var(--ink); }
.t-add input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.t-add .btn { height: 46px; padding: 0 20px; }
.t-mrow { align-items: center; }
.t-mrow .t-main { gap: 1px; }
.t-mrow .t-main b { font-size: 15px; }
.t-mrow .t-main small { font-size: 12px; color: var(--muted); }
.t-mact { display: flex; gap: 6px; flex: none; }
.t-mact .btn { height: 34px; padding: 0 10px; font-size: 12.5px; }
.t-del { color: var(--ng); }

/* 잠긴 강의 */
.lz-item.locked { opacity: .62; box-shadow: none; background: var(--surface-2); }
.lz-item.locked .lv-badge { background: transparent; font-size: 18px; }
.lz-item.locked .lv-name { color: var(--muted); }

/* 회원 관리: ⋯ 버튼과 아래 메뉴 */
.t-more { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.t-more svg { width: 20px; height: 20px; fill: currentColor; }
@media (hover: hover) { .t-more:hover { background: var(--surface-2); color: var(--ink); } }
.modal.sheet { align-items: end; padding: 0; }
.sheet-card { width: min(100%, 480px); gap: 4px; padding: 16px 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 20px 20px 0 0; }
@media (min-width: 821px) { .modal.sheet { align-items: center; padding: 20px; } .sheet-card { border-radius: 18px; } }
.sheet-head { display: grid; gap: 2px; padding: 2px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.sheet-head b { font-size: 17px; }
.sheet-head span { font-size: 12.5px; color: var(--muted); }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.sheet-item svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
.sheet-item span { display: grid; gap: 1px; font-size: 15px; font-weight: 700; }
.sheet-item small { font-size: 12px; font-weight: 500; color: var(--muted); }
.sheet-item.danger, .sheet-item.danger svg { color: var(--ng); }
.sheet-item[hidden] { display: none; }
@media (hover: hover) { .sheet-item:hover { background: var(--surface-2); } }
.sheet-cancel { height: 46px; margin-top: 6px; }

/* 화면 맨 아래 한 줄: 진도 초기화(왼쪽) · 신고(오른쪽) — 배우기 흐름과 떼어 작게 */
.lz-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.lz-foot .lz-reset { display: contents; }
.lz-foot .lz-reset[hidden] { display: none; }
.foot-link { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.foot-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lz-foot > :last-child { margin-left: auto; }
@media (hover: hover) { .foot-link:hover { background: var(--surface-2); color: var(--ink-2); } }

/* 강의 묶음: 필수 정석 먼저 */
.course.locked { background: var(--surface-2); box-shadow: none; }
.course.locked .course-name, .course.locked .course-desc { color: var(--muted); }
.course.locked .course-ico { background: transparent; color: var(--muted); }
.course.locked .course-meta { color: var(--accent); }
.course-first { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; vertical-align: 2px; }

.lz-lockcard { display: grid; gap: 8px; padding: 16px; margin: 4px 0 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.07); }
.lz-lockcard b { font-size: 16px; }
.lz-lockcard span { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.lz-lockcard .btn { height: 46px; margin-top: 4px; }
#rename-modal .set-input input { letter-spacing: 0; font-size: 16px; }

/* 정석 외우기 결과 칸 */
.j-status.j-result-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 400; }
.jr-main { flex: 1; min-width: 0; display: grid; gap: 3px; word-break: keep-all; }
.jr-main b { font-size: 16.5px; font-weight: 800; }
.jr-main span { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.jr-score { flex: none; display: grid; justify-items: end; gap: 1px; padding-left: 12px; border-left: 1px solid rgba(47, 122, 79, .25); }
.jr-score b { font-size: 22px; font-weight: 800; color: var(--ok); line-height: 1.1; font-variant-numeric: tabular-nums; }
.jr-score small { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.j-status.ng .jr-main b { color: var(--ng); }

/* 관리자 화면: 추천 숙제 */
.t-reco { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--accent-soft); border: 1px solid #e3cfb4; }
.t-reco-tx { flex: 1; min-width: 0; display: grid; gap: 2px; }
.t-reco-tx b { font-size: 15px; }
.t-reco-tx small { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; word-break: keep-all; }
.t-reco .btn { flex: none; height: 42px; padding: 0 16px; }
.t-reco-why { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--accent); }
.t-reco-why b { font-size: 14px; color: var(--accent); }
.t-reco-why ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.5; color: var(--ink); word-break: keep-all; }
.t-reco-why small { font-size: 12px; color: var(--muted); }
/* 알림 카드 (진도 초기화 등): 배지 카드와 같은 틀, 둥근 갈색 아이콘 */
.toast.badge-toast .medal.info-ic { background: var(--accent); color: #fff; font-size: 22px; font-weight: 800; }
/* 계정 전환: 다른 계정으로 공부하는 중 띠 · 관리자 화면의 전환 버튼 */
.sw-banner { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(84, 52, 27, .06); }
.sw-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--gold, #c79a26); }
.sw-who { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-back { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 99px; background: var(--accent); color: #fff; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.t-switch { justify-self: end; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.t-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#teacher .sub-topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
/* 숙제 마감 */
.t-due-note { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.t-due-note.warn { color: #b5531b; }
.hw-closed { margin: 8px 0 0; padding: 9px 12px; border-radius: 10px; background: #fbefe4; color: #8a4316; font-size: 12.5px; font-weight: 600; line-height: 1.5; word-break: keep-all; }
/* 잠긴 문제집 */
.lib-cover { position: relative; }
.lib-item.locked { background: var(--surface-2); box-shadow: none; }
.lib-item.locked .thumb { opacity: .35; filter: grayscale(.6); }
.lib-item.locked .lib-name { color: var(--muted); }
.lib-item.locked .lib-meta { color: var(--accent); font-weight: 700; }
.lib-lock { position: absolute; inset: 0; border-radius: 8px; background: rgba(250, 244, 234, .72); display: grid; place-content: center; justify-items: center; gap: 2px; color: var(--accent); }
.lib-lock svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lib-lock small { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* 공지: 홈 카드 · 공지 화면 · 관리자 공지 탭 */
.notice-card { display: grid; gap: 4px; width: 100%; padding: 13px 16px; border: 1px solid var(--kaya-line); border-left: 4px solid var(--accent); border-radius: 16px;
  background: var(--surface); text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.notice-card[hidden] { display: none; }
.nc-head { display: flex; align-items: center; gap: 6px; }
.nc-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--accent); }
.nc-label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nc-new { padding: 1px 7px; border-radius: 99px; background: #c0392b; color: #fff; font-size: 10.5px; font-weight: 800; }
.nc-date { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.nc-title { font-size: 15.5px; font-weight: 800; line-height: 1.4; word-break: keep-all; }
.nc-body { font-size: 13px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; word-break: keep-all; }
.nc-more { font-size: 12px; font-weight: 700; color: var(--accent); }
.nt-item { display: grid; gap: 6px; padding: 16px; margin-bottom: 12px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.07); }
.nt-item.pin { border-left: 4px solid var(--accent); }
.nt-head { display: flex; align-items: center; gap: 6px; }
.nt-pin { padding: 1px 8px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; }
.nt-date { font-size: 12px; color: var(--muted); }
.nt-title { margin: 0; font-size: 16.5px; font-weight: 800; line-height: 1.4; word-break: keep-all; }
.nt-body { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--ink); white-space: pre-line; word-break: keep-all; }
.nt-empty { margin: 0; padding: 24px 16px; text-align: center; font-size: 13.5px; color: var(--muted); }
.t-form textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 15px; line-height: 1.6; resize: vertical; color: var(--ink); }
.t-form textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.nt-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 700; cursor: pointer; }
.nt-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.nt-check small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.nt-row { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.nt-row + .nt-row { border-top: 1px solid var(--border); }
.nt-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nt-row-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-row-main small { font-size: 12px; color: var(--muted); }
.nt-btn { flex: none; height: 34px; padding: 0 12px; font-size: 13px; }
.nt-btn.danger { color: #b3261e; }
/* 공지 알림 켜기 (공지 화면 맨 위) */
.nt-push { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.07); }
.nt-push-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft, #f3e6d6); color: var(--accent); }
.nt-push-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nt-push-tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.nt-push-tx b { font-size: 14.5px; }
.nt-push-tx small { font-size: 12px; color: var(--muted); line-height: 1.4; word-break: keep-all; }
.nt-switch { position: relative; width: 50px; height: 30px; flex: none; border: 0; border-radius: 99px; background: #d9cfc2; cursor: pointer; transition: background .2s; }
.nt-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; }
.nt-switch.on { background: var(--accent); }
.nt-switch.on::after { transform: translateX(20px); }
.nt-switch:disabled { opacity: .6; }
.nt-row.sched .nt-row-main small { color: #a36a12; font-weight: 700; }
.t-form input[type=datetime-local] { letter-spacing: 0; }

.turn-label:empty, .rv-sum-sub:empty, .today-sum:empty { display: none; }

/* 한국어는 낱말 중간에서 줄을 바꾸지 않음 */
body { word-break: keep-all; overflow-wrap: break-word; }
.lz-item.locked .lv-badge .lock-ic { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* 좁은 화면: 이전 수·다음 수 단추 글자가 두 줄로 나뉘지 않게 */
#j-prev, #j-next, #j-first, #lz-prev, #lz-next { white-space: nowrap; }

/* 홈 맨 위 공지 버튼 */
.hh-tools { display: inline-flex; align-items: center; gap: 2px; }
.hh-bell { position: relative; margin-right: 2px; }
.hh-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #c0392b; box-shadow: 0 0 0 2px #f6e9cf; }
.hh-dot[hidden] { display: none; }
/* 문제집 화면 아래 진도 초기화 */
.book-foot { margin-top: 14px; }
.book-foot .foot-link[hidden] { display: none; }
/* 알림(토스트)은 아래 탭 막대보다 앞, 탭 막대가 있는 화면에서는 그 위로 */
.toast { z-index: 60; }
body:is([data-screen="home"], [data-screen="lessons"], [data-screen="library"], [data-screen="book"], [data-screen="records"], [data-screen="dailies"], [data-screen="settings"], [data-screen="review"], [data-screen="homework"], [data-screen="teacher"], [data-screen="week"], [data-screen="badges"], [data-screen="rankplan"], [data-screen="notice"]) .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 821px) { body:is([data-screen="home"], [data-screen="lessons"], [data-screen="library"], [data-screen="book"], [data-screen="records"], [data-screen="dailies"], [data-screen="settings"], [data-screen="review"], [data-screen="homework"], [data-screen="teacher"], [data-screen="week"], [data-screen="badges"], [data-screen="rankplan"], [data-screen="notice"]) .toast { bottom: 96px; } }
/* 수읽기 훈련: 사활 · 행마 탭 */
.lib-tabs { margin: 0 0 12px; }
.lib-tabs[hidden] { display: none; }
.lib-tabs .seg { height: 40px; font-size: 14.5px; font-weight: 800; }
/* 잠긴 단원 (행마) */
.unit.locked { background: var(--surface-2); box-shadow: none; }
.unit.locked .unit-thumb { position: relative; }
.unit.locked .thumb { opacity: .35; filter: grayscale(.6); }
.unit.locked .uname { color: var(--muted); }
.unit.locked .umeta { color: var(--accent); font-weight: 700; }

/* 공지 사진 */
.notice-card { position: relative; }
.nc-img { position: absolute; top: 12px; right: 12px; width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.nc-img[hidden] { display: none; }
.notice-card:has(.nc-img:not([hidden])) .nc-title, .notice-card:has(.nc-img:not([hidden])) .nc-body { padding-right: 62px; }
.nt-imgs { display: grid; gap: 8px; margin-top: 4px; }
.nt-imgs img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); cursor: zoom-in; }
.nt-img-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nt-img-list { display: contents; }
.nt-img-item { position: relative; width: 72px; height: 72px; }
.nt-img-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.nt-img-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #3b3326; color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.nt-img-add { width: 72px; height: 72px; display: grid; place-content: center; justify-items: center; gap: 2px; border: 1.5px dashed var(--border); border-radius: 10px; color: var(--accent); cursor: pointer; background: var(--surface-2); }
.nt-img-add[hidden] { display: none; }
.nt-img-add svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nt-img-add small { font-size: 11px; font-weight: 700; }
/* 관리자 화면: 접속 표시 */
.t-online { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.t-online.now { color: #1e8e4e; }
.t-online.now::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22a55a; box-shadow: 0 0 0 3px rgba(34, 165, 90, .18); }
.t-top { flex-wrap: wrap; row-gap: 4px; }
/* 공지 사진 크게 보기 */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(20, 14, 8, .92); display: flex; }
.lightbox[hidden] { display: none; }
.lb-scroll { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: calc(56px + env(safe-area-inset-top, 0px)) 12px calc(20px + env(safe-area-inset-bottom, 0px)); }
.lb-scroll img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; cursor: zoom-in; }
.lightbox.zoom .lb-scroll { align-items: flex-start; justify-content: flex-start; }
.lightbox.zoom .lb-scroll img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 1; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }

/* 공지 목록: 한 줄씩 → 누르면 한 개 보기 */
.nt-rows { padding: 4px 0; }
.nt-line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 16px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.nt-line + .nt-line { border-top: 1px solid var(--border); }
.nt-line-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.nt-line-main b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-line.unread .nt-line-main b { font-weight: 800; }
.nt-line-main small { font-size: 12px; color: var(--muted); }
.nt-line .set-chev { flex: none; }
.nt-push[hidden], #nt-push[hidden] { display: none; }
/* 관리자 공지 탭: 목록 머리 */
.nt-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.nt-count { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.nt-add { height: 40px; padding: 0 16px; font-size: 14px; }
/* 급수 안내: 접고 펼치는 칸 */
.rp-sec { margin-top: 12px; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.07); overflow: hidden; }
.rp-sum { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 16px; font-size: 15.5px; font-weight: 800; cursor: pointer; }
.rp-sum::-webkit-details-marker { display: none; }
.rp-sum::after { content: ""; width: 9px; height: 9px; border-right: 2.2px solid var(--muted); border-bottom: 2.2px solid var(--muted); transform: rotate(45deg); margin-right: 4px; transition: transform .2s; }
.rp-sec[open] > .rp-sum::after { transform: rotate(-135deg); }
.rp-sec > .rec-card { box-shadow: none; border-radius: 0; border-top: 1px solid var(--border); margin: 0; }

/* 로그인 화면: 회원가입 요청 */
.auth-join { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.auth-join-btn { border: 0; background: none; padding: 6px 4px; font: inherit; font-size: 13.5px; font-weight: 800; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-back { display: block; margin: 10px auto 0; }
.auth-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.auth-done { text-align: center; display: grid; gap: 10px; }
.auth-done > b { font-size: 18px; }
.auth-done p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); word-break: keep-all; }

/* 새 배지 알림: 누르면 배지 화면 */
.toast.tap { pointer-events: auto; cursor: pointer; }
.toast .bt-chev { flex: none; width: 18px; height: 18px; margin-left: -4px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
/* 배지 누르기 */
button.bd-card, button.badge-item { border: 0; font: inherit; color: var(--ink); cursor: pointer; }
button.badge-item { text-align: left; }
.bd-card:active, .badge-item:active { transform: scale(.97); }
.bd-card.focus { box-shadow: 0 0 0 3px var(--accent), 0 2px 10px rgba(0, 0, 0, .08); animation: bd-pulse 1.2s ease-in-out 2; }
@keyframes bd-pulse { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .bd-card.focus { animation: none; } }
.badge-tip.tap { cursor: pointer; }
/* 배지 자세히 */
.bdm-card { justify-items: center; text-align: center; gap: 10px; padding-top: 26px; }
.bdm-medal { width: 76px; height: 76px; font-size: 40px; }
.bdm-group { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--accent); }
.bdm-card .modal-title { margin-top: -6px; font-size: 20px; }
.bdm-how { display: grid; gap: 3px; width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.bdm-how small { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.bdm-how b { font-size: 15px; color: var(--ink); }
.bdm-how span { font-size: 12.5px; line-height: 1.5; color: var(--muted); word-break: keep-all; }
.bdm-how span[hidden] { display: none; }
.bdm-state { display: grid; gap: 4px; width: 100%; font-variant-numeric: tabular-nums; }
.bdm-state b { font-size: 15px; color: var(--ink); }
.bdm-state span { font-size: 12.5px; color: var(--muted); }
.bdm-state .today-bar { margin-top: 4px; }
.bdm-state.got b { color: var(--accent); }
.bdm-next { display: grid; gap: 2px; width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: none; font: inherit; text-align: left; color: var(--ink); cursor: pointer; }
.bdm-next[hidden] { display: none; }
.bdm-next small { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.bdm-next span { font-size: 13.5px; }
.bdm-card .modal-btns { width: 100%; }

/* ── 로그인 화면 다듬기 ── */
.auth-gate { background:
    linear-gradient(rgba(122, 82, 40, .07) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(122, 82, 40, .07) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(160deg, var(--kaya-soft) 0%, #f1e2c4 100%); }
.auth-card { padding: 30px 24px 24px; border: 1px solid rgba(122, 82, 40, .12); box-shadow: 0 2px 4px rgba(84, 52, 27, .05), 0 18px 48px rgba(84, 52, 27, .14); }
.auth-mark { box-shadow: 0 4px 14px rgba(84, 52, 27, .22); }
.auth-title { margin-top: 14px; letter-spacing: .02em; }
.auth-sub { margin-bottom: 0; font-size: 13.5px; }
.auth-form { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--border); }
.auth-head { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: var(--ink); }
.auth-label { margin: 12px 0 6px; font-size: 13.5px; }
.auth-input { width: 100%; height: 50px; font-size: 16px; background: var(--surface-2); border-color: transparent; transition: border-color .15s, background .15s, box-shadow .15s; }
.auth-input::placeholder { color: var(--muted); opacity: .75; }
.auth-input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-pw-wrap { position: relative; }
.auth-pw-wrap .auth-input { padding-right: 50px; }
.auth-eye { position: absolute; top: 0; right: 0; width: 50px; height: 50px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 12px; }
.auth-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.auth-eye.on { color: var(--accent); }
.auth-eye.on svg path { stroke-dasharray: none; }
.auth-err { min-height: 0; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(192, 57, 43, .08); font-size: 13.5px; line-height: 1.45; }
.auth-err:empty { display: none; }
.auth-btn { margin-top: 20px; height: 52px; font-size: 16.5px; border-radius: 14px; }
.auth-help { margin: 12px 0 0; font-size: 12.5px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font-size: 12.5px; color: var(--muted); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-btn2 { height: 48px; font-size: 15px; border-radius: 14px; }
.auth-bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 36px; margin-bottom: 6px; }
.auth-bar .auth-head { margin: 0; }
.auth-back { position: absolute; left: -8px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 2px; margin: 0; padding: 6px 8px; border: 0; background: none; border-radius: 8px;
  font: inherit; font-size: 13.5px; font-weight: 700; color: var(--accent); cursor: pointer; }
.auth-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.auth-form .auth-head { text-align: center; }
.auth-note { margin: 4px 0 4px; font-size: 13px; line-height: 1.6; color: var(--muted); text-align: center; word-break: keep-all; }
.auth-note b { color: var(--ink); }
.auth-done { justify-items: center; }
.auth-done-ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.auth-done-ic svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.auth-done .auth-btn { width: 100%; }
@media (max-height: 640px) { .auth-card { padding-top: 22px; } .auth-mark { width: 52px; height: 52px; } .auth-title { font-size: 24px; margin-top: 8px; } }

/* 글자 알림: 화면 폭을 넉넉히 쓰고, 낱말 중간에서 줄을 바꾸지 않음 */
.toast:not(.badge-toast) { width: max-content; max-width: min(calc(100vw - 32px), 420px); text-align: center; line-height: 1.45;
  word-break: keep-all; overflow-wrap: break-word; text-wrap: balance; border-radius: 16px; padding: 11px 18px; }
