:root {
  --bg: #1e2226;
  --panel: #2b3138;
  --panel2: #343b44;
  --text: #e8e6e3;
  --dim: #9aa2ab;
  --accent: #6fa84f;
  --accent2: #86c05f;
  --danger: #c85450;
  --wood: #d9a35e;
  --wood2: #c8924e;
  --best: #4caf50;
  --good: #9ccc65;
  --inacc: #ffca28;
  --mist: #ff9800;
  --blun: #ef5350;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }
.dim { color: var(--dim); font-size: 0.85rem; }

.banner {
  background: #3d4757;
  color: #ffd97a;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.9rem;
}
.banner.error { color: #ff9b98; }
.banner.ok { color: #a7e07f; }

.screen { max-width: 1100px; margin: 0 auto; padding: 20px 14px 40px; }

/* ─── 프로필 선택 화면 ─── */
.profile-screen { max-width: 640px; text-align: center; }
.profile-screen h1 { margin-top: 60px; font-size: 2.4rem; }
.profile-grid { display: flex; justify-content: center; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
.profile-card {
  width: 200px; height: 200px; border-radius: 18px; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  font-size: 1.35rem; font-weight: 700; color: var(--text); cursor: pointer;
  border: 3px solid transparent; box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.profile-card:hover { border-color: var(--accent2); transform: translateY(-2px); }
.profile-card .avatar {
  width: 88px; height: 88px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: #fff;
}
.profile-card.p0 .avatar { background: #4f7dc9; }
.profile-card.p1 .avatar { background: #c95f9b; }
.profile-card.p2 .avatar { background: #d08a2e; }
.profile-card.p3 .avatar { background: #3f9c6b; }
.profile-card.p4 .avatar { background: #7a63c4; }
.profile-current { color: var(--dim); font-size: 0.9rem; margin: -6px 0 14px; }
.profile-current span { color: var(--text); font-weight: 700; }
.profile-current a { color: var(--accent2); margin-left: 8px; }
@media (max-width: 520px) { .profile-card { width: 150px; height: 150px; font-size: 1.15rem; } .profile-card .avatar { width: 68px; height: 68px; font-size: 1.6rem; } }
.test-note { background: #3d4757; color: #ffd97a; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 0.9rem; text-align: left; }

/* ─── 홈 ─── */
#screen-home { max-width: 480px; text-align: center; }
#screen-home h1 { margin-top: 28px; font-size: 2rem; }
.subtitle { color: var(--dim); margin: 8px 0 24px; }

.card {
  background: var(--panel);
  border-radius: 14px;
  padding: 20px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.card.slim { padding: 14px; }

.field { margin-bottom: 18px; }
.field label { display: block; color: var(--dim); font-size: 0.85rem; margin-bottom: 7px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto;
  min-width: 52px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 6px;
  font-size: 0.95rem;
  cursor: pointer;
}
.seg button.on { background: var(--accent); color: #fff; font-weight: 700; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.95rem;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.rank-select {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 11px 10px;
  font-size: 1rem;
  font-family: inherit;
}
button.primary { background: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover { background: var(--accent2); }
button.danger { background: #5a3b3a; color: #ffb3b0; }
button.big { width: 100%; padding: 14px; font-size: 1.1rem; }

/* ─── 대국/리뷰 레이아웃 ─── */
.game-layout, .review-layout {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: center;
}
.board-wrap { flex: 0 1 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.side { flex: 0 0 240px; display: flex; flex-direction: column; gap: 14px; }
.review-side { flex: 0 0 300px; }

.statusbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--dim);
  padding: 2px 4px;
}
#turnIndicator { color: var(--text); font-weight: 600; }
#turnIndicator.thinking { color: #ffd97a; }

canvas#board, canvas#reviewBoard, canvas.board-canvas {
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  touch-action: manipulation;
  max-width: 100%;
}

#confirmBar { width: 100%; }

.side-info {
  background: var(--panel);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--dim);
}
.side-info b { color: var(--text); }
.side-buttons { display: flex; flex-direction: column; gap: 8px; }

/* ─── 랭크 ─── */
.rank-card { padding: 16px; }
.rank-top { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.tier-emblem {
  width: 64px; height: 64px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tier, #6f6460); box-shadow: inset 0 -6px 0 rgba(0,0,0,0.25), 0 0 0 3px rgba(255,255,255,0.08);
  color: #fff; font-weight: 800; font-size: 1.2rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-size: 1.25rem; font-weight: 800; }
.lp-bar { height: 10px; border-radius: 5px; background: var(--panel2); overflow: hidden; margin: 6px 0 4px; }
#lpFill, .end-lp > div { height: 100%; width: 0; background: var(--tier, var(--accent)); transition: width 0.9s ease; }
.rank-sub { color: var(--dim); font-size: 0.85rem; }
.rank-recent { display: flex; gap: 4px; margin: 2px 0 12px; flex-wrap: wrap; }
.rank-recent .rr { font-size: 0.75rem; padding: 2px 6px; border-radius: 5px; background: var(--panel2); color: var(--dim); }
.rank-recent .rr.w { color: #9be07a; }
.rank-recent .rr.l { color: #ff9b98; }
.practice-title { font-weight: 700; margin-bottom: 12px; }
.end-rank { margin: 8px 0 12px; padding: 12px; border-radius: 10px; background: var(--panel2); text-align: left; }
.end-rank .er-head { display: flex; align-items: center; gap: 10px; }
.end-rank .tier-emblem { width: 44px; height: 44px; font-size: 0.9rem; }
.end-rank .er-lp { font-size: 1.4rem; font-weight: 800; margin-left: auto; }
.end-rank .er-lp.up { color: #9be07a; }
.end-rank .er-lp.down { color: #ff9b98; }
.end-rank .er-msg { margin-top: 8px; font-weight: 700; }
.end-lp { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.game-mode { display: inline-block; font-size: 0.75rem; font-weight: 800; padding: 1px 7px; border-radius: 5px; margin-right: 4px;
  background: var(--panel2); color: var(--dim); }
.game-mode.ranked { background: #d8a845; color: #1e2226; }

/* ─── 이어서 두기 ─── */
.resume-box { margin-bottom: 12px; }
.home-row { margin-top: 12px; }
.resume-box .dim { margin-top: 6px; text-align: center; }

/* ─── 홈 하단 버튼 줄 / 훈련 ─── */
.home-row { display: flex; gap: 10px; margin-top: 10px; }
.home-row button { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--panel2); border-radius: 10px; padding: 12px 10px; text-align: center; }
.tile .k { color: var(--dim); font-size: 0.8rem; }
.tile .v { font-size: 1.6rem; font-weight: 800; line-height: 1.25; }
.tile .s { color: var(--dim); font-size: 0.75rem; }
.quiz-grade { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.quiz-grade.correct { color: var(--best); }
.quiz-grade.partial { color: var(--inacc); }
.quiz-grade.wrong { color: var(--blun); }
.quiz-lines { font-size: 0.9rem; line-height: 1.6; }
.quiz-cands { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 8px; }
.quiz-cands td { padding: 4px 4px; border-top: 1px solid rgba(255,255,255,0.08); }
.quiz-cands td.r { text-align: right; color: var(--dim); }
.quiz-cands .lab {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; font-size: 0.72rem; font-weight: 800; color: #fff; background: var(--best); margin-right: 6px;
}
.quiz-cands .lab.mine { background: #5c9eff; }
.quiz-cands .lab.game { background: var(--blun); }

/* ─── AI 코치 설정 / 해설 ─── */
.gem-row { display: flex; gap: 8px; }
.gem-row input { flex: 1; min-width: 0; background: var(--panel2); color: var(--text); border: none; border-radius: 8px; padding: 10px; font-size: 0.95rem; font-family: inherit; }
.coach-ai { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--panel2); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.coach-ai .tag { color: var(--dim); font-size: 0.78rem; margin-bottom: 4px; }

/* ─── 원리 해설 ─── */
.exp { margin: 8px 0 6px; font-size: 0.9rem; line-height: 1.55; }
.exp-row { margin-bottom: 4px; }
.exp-row b { color: var(--accent2); margin-right: 2px; }
.exp-prs { margin-top: 8px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 8px; }
.exp-pr { margin-bottom: 6px; }
.exp-pr b { color: #ffd97a; }

/* ─── 형세 판단 ─── */
.judge-input { width: 100%; background: var(--panel); border-radius: 10px; padding: 10px 12px; }
.judge-guess { text-align: center; font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; }
.judge-slider { display: flex; align-items: center; gap: 10px; }
.judge-slider input { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.judge-steps { display: flex; gap: 6px; margin-top: 8px; }
.judge-steps button { flex: 1; padding: 8px 4px; font-size: 0.88rem; }

/* ─── 성장 기록 (차트) ─── */
.growth-body { display: flex; flex-direction: column; gap: 14px; }
.tiles.four { grid-template-columns: repeat(4, 1fr); }
.tile .s.good { color: var(--accent2); }
.tile .s.bad { color: #ff9b98; }
.growth-headline { margin-top: 12px; font-size: 0.92rem; line-height: 1.5; }
.viz-title { font-size: 1rem; margin-bottom: 2px; }
.viz { width: 100%; margin-top: 6px; }
.viz svg { display: block; max-width: 100%; touch-action: pan-y; font-family: inherit; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 0.82rem; color: var(--dim); }
.viz-legend.col { flex-direction: column; gap: 4px; }
.viz-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend .lk { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.viz-legend .lk.line { height: 3px; border-radius: 2px; }
.viz-details { margin-top: 10px; font-size: 0.85rem; color: var(--dim); }
.viz-details summary { cursor: pointer; }
.viz-scroll { overflow-x: auto; }
.viz-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.viz-table th { color: var(--dim); font-weight: 400; text-align: right; padding: 4px 6px; white-space: nowrap; }
.viz-table td { color: var(--text); text-align: right; padding: 4px 6px; border-top: 1px solid rgba(255,255,255,0.08); white-space: nowrap; }
.viz-table th:first-child, .viz-table td:first-child { text-align: left; }
.viz-tip {
  position: fixed; z-index: 80; pointer-events: none; background: #14171a; color: var(--text);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5); max-width: 260px;
}
.viz-tip .tt { color: var(--dim); margin-bottom: 4px; }
.viz-tip .tr { display: flex; align-items: center; gap: 6px; line-height: 1.5; }
.viz-tip .key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-tip .nm { color: var(--dim); }
@media (max-width: 560px) { .tiles.four { grid-template-columns: repeat(2, 1fr); } }

/* ─── 모달 ─── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-box {
  background: var(--panel);
  border-radius: 16px;
  padding: 26px;
  width: 100%; max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.modal-box h2 { margin-bottom: 10px; }
#endResult { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.score-table { width: 100%; border-collapse: collapse; margin: 8px 0 2px; font-size: 0.92rem; }
.score-table th { color: var(--dim); font-weight: 400; font-size: 0.8rem; padding: 2px 4px; }
.score-table td { padding: 4px 4px; text-align: center; border-top: 1px solid rgba(255,255,255,0.08); }
.score-table td:first-child { text-align: left; }
.modal-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }

.progress {
  margin-top: 10px;
  height: 10px; border-radius: 5px;
  background: var(--panel2);
  overflow: hidden;
}
#reviewProgressBar { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
#reviewProgress p { margin-top: 14px; color: var(--dim); font-size: 0.9rem; }

/* ─── 리뷰 ─── */
.nav-buttons { display: flex; gap: 8px; }
.nav-buttons button { min-width: 56px; font-size: 1.1rem; }

canvas#wrChart {
  width: 100%;
  border-radius: 8px;
  background: var(--panel);
  cursor: ew-resize;
  touch-action: none;   /* 모바일에서 드래그 스크럽 중 페이지가 스크롤되지 않게 */
  user-select: none;
}

/* 선택한 수 주변 ±3수만 보여주는 미니 수순 */
.movelist.window { width: 100%; max-height: none; overflow: visible; }
.movelist.window .mrow { padding: 4px 10px; font-size: 0.86rem; }
.movelist.window .mrow.sel { background: var(--panel2); border-left-color: var(--accent); font-weight: 700; }
.movelist.window .mrow.dim-row { opacity: 0.75; }

.movelist {
  background: var(--panel);
  border-radius: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.mrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.mrow:hover { background: var(--panel2); }
.mrow.sel { background: var(--panel2); border-left-color: var(--accent); }
.mrow .num { color: var(--dim); width: 36px; }
.mrow .mv { width: 52px; font-weight: 600; }
.mrow .pts { margin-left: auto; color: var(--dim); font-size: 0.82rem; }

.badge {
  font-size: 0.72rem; font-weight: 700;
  border-radius: 5px; padding: 2px 6px; color: #14200e;
}
.badge.best { background: var(--best); color: #fff; }
.badge.good { background: var(--good); }
.badge.inaccuracy { background: var(--inacc); }
.badge.mistake { background: var(--mist); }
.badge.blunder { background: var(--blun); color: #fff; }

#reviewSummary { font-size: 0.88rem; line-height: 1.6; }
#reviewSummary h3 { font-size: 0.95rem; margin: 8px 0 4px; }
#reviewSummary .tag { cursor: pointer; text-decoration: underline; margin-right: 8px; }
#reviewSummary .tag.w { color: var(--blun); }
#reviewSummary .tag.b { color: var(--best); }

/* ─── 리뷰: chess.com 스타일 ─── */
.board-row { display: flex; gap: 8px; align-items: stretch; }
.evalbar {
  width: 16px; border-radius: 6px; background: #f2f2f2; position: relative; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.4); flex: none;
}
#evalFill { position: absolute; left: 0; top: 0; width: 100%; height: 50%; background: #111; transition: height 0.25s; }
#evalText {
  position: absolute; left: 0; right: 0; bottom: 4px; text-align: center;
  font-size: 0.6rem; font-weight: 700; color: #333; writing-mode: vertical-rl; text-orientation: sideways; transform: rotate(180deg);
}
.evalbar.black-lead #evalText { color: #eee; bottom: auto; top: 4px; }

.ci {   /* 분류 아이콘 (원형 배지) */
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 0.7rem; font-weight: 800;
  color: #fff; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.ci.brilliant { background: #26c6da; } .ci.great { background: #5c9eff; }
.ci.best { background: #4caf50; }      .ci.excellent { background: #7cb342; }
.ci.good { background: #9e9e9e; }      .ci.inaccuracy { background: #ffca28; color: #222; }
.ci.mistake { background: #ff9800; }   .ci.miss { background: #ff5252; }
.ci.blunder { background: #e53935; }   .ci.pass { background: #607d8b; }

.acc-row { display: flex; gap: 10px; margin: 4px 0 10px; }
.acc-tile { flex: 1; background: var(--panel2); border-radius: 10px; padding: 10px 8px; text-align: center; }
.acc-tile .who { color: var(--dim); font-size: 0.8rem; }
.acc-tile .acc { font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.acc-tile .phases { color: var(--dim); font-size: 0.72rem; margin-top: 2px; }

.cat-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.cat-table td { padding: 3px 4px; }
.cat-table td.n { width: 34px; text-align: center; font-weight: 700; }
.cat-table td.lab { text-align: center; color: var(--dim); }
.cat-table tr.zero td { opacity: 0.45; }

.coach { min-height: 64px; font-size: 0.9rem; line-height: 1.55; }
.review-side.practicing #coachBox { order: -1; }
.coach .head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.coach .evalchg { color: var(--dim); font-size: 0.82rem; margin-top: 4px; }

.key-moments { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.key-moments .km {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border-radius: 8px;
  padding: 4px 8px; font-size: 0.8rem; cursor: pointer;
}
.key-moments .km:hover { background: var(--panel2); }
.key-moments .km-title { width: 100%; color: var(--dim); font-size: 0.78rem; }

.mrow .ci { margin-right: 2px; }
.mrow .cat { color: var(--dim); font-size: 0.8rem; }

@media (max-width: 760px) {
  .board-row { flex-direction: column; gap: 6px; }
  .evalbar { width: 100%; height: 20px; border-radius: 10px; }
  #evalFill { height: 100% !important; width: var(--fill, 50%); transition: width 0.25s; }
  #evalText {
    writing-mode: horizontal-tb; transform: none; bottom: auto; top: 0; line-height: 20px;
    right: 8px; left: auto; font-size: 0.7rem;
  }
  .evalbar.black-lead #evalText { top: 0; left: 8px; right: auto; }
}

/* ─── 지난 대국 목록 (카드형) ─── */
.games-list { display: flex; flex-direction: column; gap: 10px; }
.gcard {
  background: var(--panel2); border-radius: 12px; padding: 12px 14px;
  border-left: 6px solid #78838f; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  transition: transform 0.08s, background 0.12s;
}
.gcard:hover { background: #3c444e; transform: translateY(-1px); }
.gcard.win { border-left-color: var(--best); }
.gcard.loss { border-left-color: var(--blun); }
.gres { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; }
.gbadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; color: #fff; flex: none;
  background: #78838f;
}
.gcard.win .gbadge { background: var(--best); }
.gcard.loss .gbadge { background: var(--blun); }
.gmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gdate { font-weight: 700; color: var(--text); margin-right: 4px; font-size: 0.95rem; }
.chip {
  background: rgba(255,255,255,0.08); border-radius: 999px; padding: 3px 9px;
  font-size: 0.82rem; color: var(--text);
}
.chip.ai { background: rgba(111,168,79,0.22); }
.chip.acc { background: rgba(92,158,255,0.22); }
.chip.est { background: rgba(255,202,40,0.2); }
.gopen { align-self: flex-end; color: var(--accent2); font-size: 0.85rem; font-weight: 700; }

/* ─── 지난 대국 목록 ─── */
.games-list .grow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; font-size: 0.92rem;
}
.games-list .grow:hover { background: var(--panel2); }
.games-list .grow .date { color: var(--dim); width: 92px; flex: none; }
.games-list .grow .meta { color: var(--dim); font-size: 0.85rem; }
.games-list .grow .res { margin-left: auto; font-weight: 700; white-space: nowrap; }
.games-list .grow .rev { font-size: 0.72rem; background: var(--best); color: #fff;
  border-radius: 5px; padding: 2px 6px; }
.games-list .empty { color: var(--dim); padding: 12px 6px; }

/* ─── 모바일 ─── */
@media (max-width: 760px) {
  .game-layout, .review-layout { flex-direction: column; align-items: center; }
  .side, .review-side { flex: none; width: 100%; max-width: 480px; }
  .side-buttons { flex-direction: row; flex-wrap: wrap; }
  .side-buttons button { flex: 1 1 40%; }
  .movelist { max-height: 220px; }
  .screen { padding: 10px 8px 30px; }
}

/* ─── 배우기 (입문 튜토리얼) ─── */
.learn-card { margin-bottom: 12px; padding: 16px; border: 1px solid rgba(134,192,95,0.35);
  background: linear-gradient(135deg, #2f3a33 0%, var(--panel) 70%); }
.learn-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.learn-icon { width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--wood); position: relative;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.18); }
.learn-icon span { position: absolute; width: 22px; height: 22px; border-radius: 50%; top: 17px; }
.learn-icon span:first-child { left: 8px; background: radial-gradient(circle at 35% 30%, #666, #0a0a0a); }
.learn-icon span:last-child { left: 26px; background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf); }
.learn-main { flex: 1; min-width: 0; }
.learn-title { font-size: 1.2rem; font-weight: 800; }
.learn-title .dim { font-weight: 400; margin-left: 4px; }
#learnCardFill, .learn-top .lp-bar > div { height: 100%; width: 0; background: var(--accent2); transition: width 0.8s ease; }

.learn-top { margin-bottom: 12px; }
.lt-count { font-weight: 700; margin-bottom: 2px; }
.learn-list { display: flex; flex-direction: column; gap: 8px; }
.lch { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 14px; padding: 12px 14px;
  cursor: pointer; border: 2px solid transparent; transition: transform 0.08s, background 0.12s; }
.lch:hover { background: var(--panel2); }
.lch.next { border-color: var(--accent2); }
.lch.locked { opacity: 0.4; cursor: default; }
.lch-num { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--panel2); display: flex;
  align-items: center; justify-content: center; font-weight: 800; }
.lch.done .lch-num { background: var(--accent); color: #fff; }
.lch.next .lch-num { background: var(--accent2); color: #14200e; }
.lch-main { flex: 1; min-width: 0; }
.lch-title { font-weight: 700; }
.lch-sub { color: var(--dim); font-size: 0.82rem; }
.lch-stars .st, .lc-stars .st { color: #4a525c; font-size: 1.05rem; }
.lch-stars .st.on, .lc-stars .st.on { color: #ffca28; }
.lch-go { background: var(--accent2); color: #14200e; font-weight: 800; font-size: 0.8rem; border-radius: 999px; padding: 4px 10px; }

.lesson-screen { max-width: 500px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lesson-bar { width: 100%; display: flex; align-items: center; gap: 12px; }
.lesson-x { background: none; color: var(--dim); font-size: 1.3rem; padding: 4px 8px; }
.lesson-prog { flex: 1; height: 12px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
#lessonProgFill { height: 100%; width: 0; background: var(--accent2); border-radius: 6px; transition: width 0.4s ease; }
.lesson-title { width: 100%; color: var(--dim); font-size: 0.85rem; font-weight: 700; }
.lesson-text { width: 100%; background: var(--panel); border-radius: 14px; padding: 14px 16px; font-size: 1.02rem; line-height: 1.6; }
.lesson-text b { color: #ffd97a; }
.lesson-fb { width: 100%; border-radius: 14px; padding: 12px 16px; font-size: 0.95rem; line-height: 1.55; animation: fbIn 0.18s ease; }
.lesson-fb .fb-head { font-weight: 800; margin-bottom: 2px; }
.lesson-fb .fb-head:empty { display: none; }
.lesson-fb.ok { background: rgba(76,175,80,0.18); border: 1px solid rgba(76,175,80,0.5); }
.lesson-fb.ok .fb-head { color: #9be07a; }
.lesson-fb.no { background: rgba(239,83,80,0.15); border: 1px solid rgba(239,83,80,0.45); }
.lesson-fb.no .fb-head { color: #ff9b98; }
.lesson-fb.info { background: var(--panel2); color: var(--text); }
@keyframes fbIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lesson-actions { width: 100%; display: flex; gap: 8px; }
.lesson-actions button { flex: 1; }
.lesson-actions.options { flex-direction: column; }
.lesson-actions button.right { background: var(--accent); color: #fff; }
.lesson-actions button.wrong { background: #5a3b3a; color: #ffb3b0; }
.lesson-score { width: 100%; display: flex; justify-content: space-between; align-items: center; background: var(--panel);
  border-radius: 12px; padding: 8px 14px; }
.lesson-score .cs b { font-size: 1.3rem; margin-left: 4px; }
.lesson-score .cs.goal { color: var(--dim); font-size: 0.85rem; }
.lesson-clear { text-align: center; padding: 18px 0 8px; }
.lc-title { font-size: 1.5rem; font-weight: 800; }
.lc-stars { font-size: 2rem; margin: 8px 0 6px; letter-spacing: 4px; }
.lc-stars .st { font-size: 2.2rem; }
.learn-btns { display: flex; gap: 8px; }
.learn-btns button:first-child { flex: 1.4; }
.learn-btns button:last-child { flex: 1; }
.ts-card { margin-bottom: 18px; }
.ts-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 2px; }
.learn-sec { font-weight: 800; margin: 4px 0 8px; }
.ts-sum { text-align: center; padding: 14px 0 6px; }
.ts-sum .big-n { font-size: 2.4rem; font-weight: 800; }
.ts-dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.ts-dots span { width: 18px; height: 18px; border-radius: 50%; background: var(--panel2); }
.ts-dots span.ok { background: var(--best); }
.ts-dots span.no { background: var(--blun); }

/* ─── 친구 대국 ─── */
.pv-list { display: flex; flex-direction: column; gap: 8px; }
.pv-row { background: var(--panel2); border-radius: 12px; padding: 10px 12px; border: 2px solid transparent; }
.pv-row.sel { border-color: var(--accent2); }
.pv-head { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.pv-dot { width: 9px; height: 9px; border-radius: 50%; background: #59616b; flex: none; display: inline-block; margin-left: 4px; }
.pv-dot.on { background: #6fdc5a; box-shadow: 0 0 6px rgba(111,220,90,0.7); }
.pv-name { font-weight: 800; }
.pv-tier { font-size: 0.78rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--tier); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.4); }
.pv-rec { font-size: 0.8rem; color: var(--text); }
.pv-st { margin-left: auto; font-size: 0.8rem; }
.pv-body { margin-top: 10px; }
.pv-size { margin-bottom: 8px; }
.pv-pre { font-weight: 700; margin-bottom: 8px; }
.pv-hc { display: flex; align-items: center; gap: 10px; }
.pv-hc .pv-pre { flex: 1; margin-bottom: 0; text-align: center; }
.pv-adj:not(.linkish) { width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; padding: 0; flex: none;
  background: var(--panel2); border: 1px solid #4b545e; color: var(--text); cursor: pointer; }
.pv-adj:not(.linkish):disabled { opacity: .35; cursor: default; }
.pv-hc .pv-pre { font-size: 15px; word-break: keep-all; }
.pv-hc-note { margin: 6px 0 10px; text-align: center; font-size: 13px; }
.pv-wait { color: #ffd97a; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pv-wait button { padding: 6px 12px; }
.pv-pl { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; color: var(--text); }
.pv-pl.turn { background: rgba(134,192,95,0.18); }
.pv-stone { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.pv-stone.B { background: radial-gradient(circle at 35% 30%, #666, #0a0a0a); }
.pv-stone.W { background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf); }
.pv-undo { border: 1px solid #ffd97a; line-height: 1.5; }
.pv-ub { display: flex; gap: 8px; margin-top: 8px; }
.pv-ub button { flex: 1; }
.pv-res { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.pv-res.w { color: #9be07a; }
.pv-res.l { color: #ff9b98; }
.pv-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: #14171a; color: var(--text);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 10px 16px; font-size: 0.92rem; box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  max-width: calc(100% - 32px); }

.pv-resume { margin-top: -4px; }
.pv-resume button { background: #3f7fbf; }
.pv-resume button:hover { background: #4b8fd2; }
.pv-hot { color: #ffd97a; }
.linkish { background: none; border: none; padding: 0 2px; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }

/* 배우기: 부 머리말·이어질 이야기 (v2.4) */
.lpart { margin: 20px 2px 8px; }
.lpart:first-child { margin-top: 4px; }
.lpart-title { font-weight: 800; font-size: 0.98rem; color: var(--accent2); }
.lpart-title .dim { font-weight: 400; font-size: 0.85rem; }
.lpart-story { color: var(--dim); font-size: 0.85rem; line-height: 1.45; margin-top: 3px; }
.lpart.cur .lpart-title { color: #ffd97a; }
.lpart.soon { background: var(--panel); border-radius: 14px; padding: 12px 14px; opacity: 0.75; border: 1px dashed #4b545e; }
.lpart.soon .lpart-title { color: var(--text); }
.lsoon { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lsoon span { font-size: 0.8rem; background: var(--panel2); border-radius: 999px; padding: 3px 10px; color: var(--dim); }
.lch.ts .lch-num { font-size: 0.72rem; background: #3a4a3a; }
.lch-ok { font-size: 0.8rem; color: var(--accent2); font-weight: 700; }
.lc-bridge { margin-top: 16px; padding: 12px 14px; background: var(--panel2); border-radius: 12px; text-align: left; line-height: 1.5; }
.lc-bridge-title { font-weight: 800; color: #ffd97a; margin-bottom: 2px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.85rem; color: var(--dim);
  background: var(--panel); border: 1px dashed #4b545e; border-radius: 12px; padding: 8px 12px; margin: 0 0 12px; }
.admin-tag { font-size: 0.72rem; background: #5a4a1a; color: #ffd97a; border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
/* 포석 도우미 (v2.4, guide.js) */
.guide { width: 100%; margin-top: 10px; background: var(--panel); border-radius: 12px; padding: 10px 12px; font-size: 0.92rem; line-height: 1.45; border-left: 4px solid #ffce54; }
.guide .gd-head { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 4px; }
.guide .gd-head .linkish { margin-left: auto; font-size: 0.85rem; font-weight: 400; color: var(--dim); }
.guide .gd-verdict { margin: 2px 0 6px; padding: 6px 8px; border-radius: 8px; background: var(--panel2); }
.guide .gd-verdict.good { color: #a5d6a7; }
.guide .gd-verdict.ok { color: #e8e6e3; }
.guide .gd-verdict.bad { color: #ffcc80; }
.guide .gd-now b { color: #ffd97a; }
.guide.off { border-left-color: var(--panel2); padding: 6px 12px; }

/* 로그인·프로필 신청·관리자 (v2.5, account.js) */
.req-entry { margin-top: 26px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 0.9rem; }
.auth-box h2 { margin-bottom: 6px; }
.auth-input { width: 100%; margin-top: 12px; background: var(--panel2); color: var(--text); border: 1px solid #4b545e; border-radius: 10px;
  padding: 12px; font-size: 1rem; font-family: inherit; box-sizing: border-box; }
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-err { color: #ff8a80; min-height: 1.2em; margin-top: 8px; font-size: 0.9rem; }
.profile-card .pc-note { font-size: 0.75rem; color: var(--dim); margin-top: 2px; }
.profile-card.off { opacity: 0.4; }
.profile-current a + a, .profile-current #btnLogout { color: var(--dim); }
.adm-badge { margin-left: 8px; background: #5a4a1a; color: #ffd97a; border: none; border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; cursor: pointer; }
.admin-card .adm-sec { margin: 14px 0 6px; font-size: 0.85rem; color: var(--dim); font-weight: 700; }
.admin-card .adm-sec:first-of-type { margin-top: 6px; }
.adm-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.adm-row .adm-main { flex: 1; min-width: 0; line-height: 1.4; }
.adm-row .adm-main .dim { font-size: 0.8rem; }
.adm-btn { padding: 6px 10px; font-size: 0.82rem; border-radius: 8px; flex: none; }
.admin-tag.off { background: #5a2a2a; color: #ffab91; }
.admin-card .admin-row { margin: 0; }

/* 관리자 페이지 (v2.6, admin.js) */
.adm-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 12px; }
.adm-top h2 { margin: 0; font-size: 1.15rem; }
.adm-h { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 8px; font-weight: 800; color: var(--accent2); }
.adm-pad { padding: 2px 2px; }
.adm-sub { font-size: 0.85rem; color: var(--dim); font-weight: 700; margin-bottom: 6px; }
.adm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.adm-tile { background: var(--panel); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.adm-tile-l { font-size: 0.78rem; color: var(--dim); }
.adm-tile-v { font-size: 1.35rem; font-weight: 700; margin: 2px 0; }
.adm-tile-s { font-size: 0.75rem; overflow-wrap: anywhere; }
.adm-checks { background: var(--panel); border-radius: 12px; padding: 6px 12px; }
.adm-check { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,0.06); line-height: 1.4; font-size: 0.9rem; }
.adm-check:first-child { border-top: none; }
.adm-check .dim { font-size: 0.8rem; }
.adm-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; }
.adm-check.ok .adm-ic { background: #23432a; color: #a5d6a7; }
.adm-check.warn .adm-ic { background: #4a3d16; color: #ffd97a; }
.adm-check.bad .adm-ic { background: #4a1f1f; color: #ff8a80; }
.adm-switch { font-size: 0.85rem; font-weight: 400; color: var(--text); display: flex; align-items: center; gap: 6px; }
.adm-prof { background: var(--panel); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.adm-prof-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-right { margin-left: auto; font-size: 0.8rem; }
.adm-prof-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--dim); margin: 6px 0; }
.adm-prof-stats b { color: var(--text); }
.adm-limit { font-size: 0.85rem; margin: 4px 0 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-limit input { width: 110px; background: var(--panel2); color: var(--text); border: 1px solid #4b545e; border-radius: 8px; padding: 5px 8px; font: inherit; }
.adm-prof-b { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.adm-sess { margin-top: 6px; }
.adm-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.82rem; color: var(--text); margin: 0 2px 8px; }
.adm-legend i, .adm-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.adm-chart { position: relative; background: var(--panel); border-radius: 12px; padding: 10px 10px 0 42px; box-sizing: content-box; }
.adm-grid { position: absolute; left: 42px; right: 10px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 10px; }
.adm-grid span { position: absolute; left: -38px; top: -8px; font-size: 0.7rem; color: var(--dim); width: 34px; text-align: right; }
.adm-cols { position: relative; display: flex; align-items: flex-end; height: 100%; gap: 2px; }
.adm-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: calc(100% - 22px); cursor: pointer; position: relative; }
.adm-stack { width: min(24px, 70%); display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.adm-seg { min-height: 2px; }
.adm-x { position: absolute; bottom: -18px; font-size: 0.68rem; color: var(--dim); white-space: nowrap; }
.adm-tip { position: absolute; top: 4px; width: 150px; background: #1b1f23; border: 1px solid #4b545e; border-radius: 8px; padding: 6px 8px; font-size: 0.78rem; line-height: 1.5; pointer-events: none; z-index: 2; }
.adm-table-wrap { overflow-x: auto; margin-top: 30px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.adm-table th { color: var(--dim); font-weight: 400; text-align: right; padding: 4px 6px; white-space: nowrap; }
.adm-table td { text-align: right; padding: 5px 6px; border-top: 1px solid rgba(255,255,255,0.06); white-space: nowrap; }
.adm-table th:first-child, .adm-table td:first-child { text-align: left; }
.adm-events { background: var(--panel); border-radius: 12px; padding: 4px 10px; max-height: 360px; overflow-y: auto; }
.adm-ev { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 0.8rem; line-height: 1.4; }
.adm-ev:first-child { border-top: none; }
.adm-ev-t { color: var(--dim); flex: none; width: 72px; }
.adm-ev-k { flex: none; width: 96px; }
.adm-ev.bad .adm-ev-k { color: #ffab91; }
.adm-ev-d { min-width: 0; overflow-wrap: anywhere; }
.adm-blocked { margin-bottom: 8px; }
