/* =====================================================================
   Learn section (Kukkiwon / WT reference), search, progress, tab bar
   ===================================================================== */
.small-text { font-size: .85rem; }
.sub-head { font-size: 1.4rem; margin: 2.2rem 0 1.2rem; }
.icon-pill { width: 38px; padding: 0; }
.source-note { color: var(--muted); font-size: .82rem; margin: .6rem 0 1.4rem; }

/* tool cards */
.tool-card .pcard-media { height: 220px; }
.tools-grid .tool-card .pcard-media { height: 200px; }
.tool-card .pcard-desc { margin-top: .4rem; }

/* start steps */
.start-steps { background: var(--chip); border-radius: 18px; padding: 1.4rem 1.5rem; }
.start-steps h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.start-steps ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.start-steps li { counter-increment: step; }
.start-steps a { display: block; height: 100%; background: #fff; border-radius: 12px; padding: 1rem 1.1rem 1.1rem 3.2rem; position: relative; text-decoration: none; transition: transform .15s; }
.start-steps a:hover { transform: translateY(-1px); }
.start-steps a::before { content: counter(step); position: absolute; left: 1rem; top: 1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: .85rem; }
.start-steps strong { display: block; font-weight: 500; margin-bottom: .2rem; }
.start-steps span { color: var(--muted); font-size: .88rem; }

/* org / info boxes */
.org-grid, .poom-dan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.org { border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; }
.org h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.org p { color: #34373c; margin: 0 0 .9rem; font-size: .95rem; }
.org p:last-child { margin-bottom: 0; }

/* belts */
.belt-dot-lg { width: 1.4rem; height: 1.4rem; }
.belt-dot-xl { width: 3.2rem; height: 3.2rem; }
.belt-hero .lead { margin-top: 1rem; max-width: 65ch; }
.belt-hero-head { display: flex; align-items: center; gap: 1.1rem; margin-top: 1.4rem; }
.belt-hero-head h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.belt-hero-head p { margin: .2rem 0 0; }
.belt-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }
.rank-list { border-top: 1px solid var(--line); }
.rank-row { display: grid; grid-template-columns: auto minmax(0, 14rem) 1fr auto; align-items: center; gap: 1.1rem; padding: 1.05rem .3rem; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .15s; }
.rank-row:hover { background: #fafafb; }
.rank-main { display: flex; flex-direction: column; }
.rank-main strong { font-weight: 500; }
.rank-main .muted { font-size: .85rem; }
.rank-pz { color: var(--muted); font-size: .9rem; }
.rank-go { color: var(--muted); }
.table-title { font-size: 1.15rem; margin: 2rem 0 .8rem; }
.table-wrap { overflow-x: auto; }
.data-table, .prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td, .prose th, .prose td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
.data-table th, .prose th { font-weight: 500; color: var(--muted); font-size: .85rem; }
.data-table tbody tr:hover { background: #fafafb; }
.prose td:last-child, .prose th:last-child { text-align: right; }

/* poomsae art */
.pz-art { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; background: var(--pz-bg, #eef0f3); color: var(--pz-ink, var(--ink)); }
.pz-symbol { font-size: 5.5rem; line-height: 1; font-weight: 400; }
.pz-hangul { font-size: 1rem; letter-spacing: .05em; opacity: .75; }
.pz-black .pz-symbol { font-size: 3.4rem; letter-spacing: .05em; }
.pz-white  { --pz-bg: #f1f2f4; }
.pz-yellow { --pz-bg: #fbecb0; }
.pz-green  { --pz-bg: #cfe8d6; }
.pz-blue   { --pz-bg: #d3e1f6; }
.pz-red    { --pz-bg: #f6d0d4; }
.pz-black  { --pz-bg: #1b1c1f; --pz-ink: #f3f3f3; }
.pz-card .pcard-media { height: 220px; }
.learned-badge { display: inline-flex; align-items: center; gap: .2rem; font-size: .75rem; color: #1d5b31; background: #eaf6ee; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }

.pz-head { display: grid; grid-template-columns: 180px 1fr; gap: 1.6rem; align-items: center; margin-top: 1.4rem; }
.pz-art-big { height: 180px; border-radius: 14px; }
.pz-art-big .pz-symbol { font-size: 6rem; }
.pz-art-big.pz-black .pz-symbol { font-size: 3.8rem; }
.pz-head h1 { margin: 0 0 .3rem; }
.pz-hangul-line { display: flex; align-items: center; gap: .5rem; font-size: 1.2rem; margin: 0 0 .8rem; color: #34373c; }
.pz-detail h2 { margin-top: 2.2rem; }

.practice-box { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.8rem; padding: 1rem 1.2rem; background: var(--chip); border-radius: 14px; }
.learned-toggle { display: inline-flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.learned-toggle input { width: 1.25rem; height: 1.25rem; accent-color: var(--ink); }
.practice-count { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; font-size: .92rem; }

.tech-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.tech-list li { padding: .8rem .2rem; border-bottom: 1px solid var(--line); }
.term-link { color: var(--muted); font-style: italic; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.hangul-sm { color: var(--muted); font-size: .85rem; margin-left: .2rem; }

/* speaker button */
.speak { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--chip); color: var(--ink); cursor: pointer; flex: none; transition: background .15s; }
.speak:hover { background: var(--chip-hover); }

/* chips */
.chip-row { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1rem; padding-bottom: .2rem; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; height: 32px; padding: 0 .9rem; font: inherit; font-size: .85rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { border-color: #c9ccd1; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* terminology */
.term-group { margin-bottom: 2.2rem; }
.term-group h2 { font-size: 1.25rem; margin-bottom: .6rem; }
.term-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.term { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: center; padding: .75rem .2rem; border-bottom: 1px solid var(--line); }
.term-ko { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.term-ko strong { font-weight: 500; }
.hangul { color: var(--muted); }
.term-en { color: #2a2c30; }
.term-note { display: block; color: var(--muted); font-size: .82rem; margin-top: .15rem; }

/* quiz */
.quiz-setup button[type=submit] { flex: none; }
#quiz-area { max-width: 640px; margin-top: 1.4rem; }
.question { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: 1.6rem 0 1.2rem; }
.q-main { display: block; font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 500; letter-spacing: -0.02em; }
.q-hangul { display: block; color: var(--muted); font-size: 1.2rem; margin-top: .2rem; }
.q-note { display: block; color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.options { display: grid; gap: .55rem; }
.option { display: flex; align-items: center; gap: .9rem; text-align: left; width: 100%; padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.option:hover:not(:disabled) { border-color: var(--ink); }
.option:disabled { cursor: default; color: var(--ink); }
.opt-key { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 6px; background: var(--chip); font-size: .8rem; flex: none; }
.option.correct { border-color: #2e9e4f; background: #eaf6ee; }
.option.wrong { border-color: #c8102e; background: #fbeaec; }
.quiz-actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.quiz-feedback { margin-right: auto; font-weight: 500; }
.flashcard { width: 100%; min-height: 240px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1rem; padding: 2rem 1.5rem; border-radius: 18px; border: 1px solid var(--line); background: #fff; font: inherit; color: var(--ink); cursor: pointer; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.05); transition: background .2s; }
.flashcard.flipped { background: var(--chip); }
.fc-hint { color: var(--muted); font-size: .82rem; }
.quiz-end { text-align: center; padding: 1.5rem 0; }
.quiz-end .quiz-actions { justify-content: center; }
.quiz-score { font-size: 3.4rem; font-weight: 500; margin: 0; letter-spacing: -0.03em; }

/* progress page */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.stat { background: var(--chip); border-radius: 14px; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-num { font-size: 2.2rem; font-weight: 500; letter-spacing: -0.02em; }
.stat-num small { font-size: 1rem; color: var(--muted); }
.stat-label { color: var(--muted); font-size: .85rem; }
.pz-checklist, .plain-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.pz-checklist li, .plain-list li { display: flex; align-items: center; gap: 1rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); }
.pz-checklist label { display: flex; align-items: center; gap: .6rem; flex: 1; cursor: pointer; }
.pz-checklist input { width: 1.15rem; height: 1.15rem; accent-color: var(--ink); }
.plain-list li span:first-child { flex: 1; }

/* search */
.search-group { margin-top: 2.2rem; }
.search-group h2 { font-size: 1.3rem; margin-bottom: 1rem; }

/* rules */
.rules h2 { margin-top: 2.6rem; scroll-margin-top: 100px; }
.rules .chip-row { margin-top: 1.4rem; }
.source-list { padding-left: 1.2rem; }
.source-list li { margin: .4rem 0; }

/* bottom tab bar (phones) */
.tabbar { display: none; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-steps ol { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header .nav { display: none; }
  .header-inner { justify-content: flex-start; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; height: 60px; text-decoration: none; color: var(--muted); font-size: .7rem; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--ink); font-weight: 500; }
  .org-grid, .poom-dan { grid-template-columns: 1fr; }
  .pz-head { grid-template-columns: 1fr; }
  .pz-art-big { height: 150px; }
  .rank-row { grid-template-columns: auto 1fr auto; }
  .rank-pz { display: none; }
  .term { grid-template-columns: 1fr; gap: .25rem; }
  .data-table th, .data-table td { padding: .6rem .5rem; font-size: .88rem; }
}
@media print { .tabbar { display: none !important; } body { padding-bottom: 0; } }
