/* 어흥서당 — 한지 바탕 · 먹 글씨 · 낙관 붉은색
   큰 글씨·큰 버튼은 취향이 아니라 조건이다 (시니어·복지사). 본문 18px, 누르는 곳 46px 이상
   휴대폰이 기본이다 — 넓은 화면은 @media (min-width) 로 늘린다 */
:root {
  --bg: #f6f0e6;
  --surface: #fffdf8;
  --surface-2: #efe7da;
  --line: rgba(60, 40, 30, .12);
  --line-strong: rgba(60, 40, 30, .24);
  --ink: #2a211d;
  --muted: #6a5b50;
  --seal: #8f1d1f;           /* 낙관에서 뽑은 색(#7a1618)을 화면용으로 조금 밝힘 */
  --seal-strong: #741517;
  --seal-soft: rgba(143, 29, 31, .09);
  --on-seal: #fffdf8;
  --shadow: 0 8px 28px rgba(60, 40, 30, .12);
  --lv1: #2f6b3a; --lv2: #a0621b; --lv3: #8f1d1f;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f;
    --surface: #211a16;
    --surface-2: #2b231e;
    --line: rgba(255, 240, 225, .1);
    --line-strong: rgba(255, 240, 225, .2);
    --ink: #f3ebe1;
    --muted: #b5a597;
    --seal: #e07a6f;
    --seal-strong: #f09a90;
    --seal-soft: rgba(224, 122, 111, .13);
    --on-seal: #1b0f0d;
    --shadow: 0 8px 28px rgba(0, 0, 0, .45);
    --lv1: #7cc98a; --lv2: #e3a55a; --lv3: #e07a6f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  font-family: Pretendard, -apple-system, "Malgun Gothic", sans-serif;
  font-size: 17px; line-height: 1.65;
  background: var(--bg); color: var(--ink);
  word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
/* hidden 속성이 .row{display:grid} 같은 규칙에 지지 않게 — 「더 보기」가 안 먹던 원인 (2026-09-29) */
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.hanja { font-family: "Noto Serif KR", "Batang", serif; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 10px 14px; border-radius: 8px; }
.yt-icon { width: 30px; height: auto; flex: none; }

/* ─────────────── 머리: 휴대폰에서는 로고 한 줄 + 메뉴 한 줄(네 칸 꽉 차게) */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: grid; gap: 8px; padding-top: 10px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 48px; }
.brand img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--seal-soft); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { font-size: 13.5px; font-weight: 600; color: var(--seal); letter-spacing: -.01em; }
.nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 6px; border-radius: 10px;
  text-decoration: none; font-weight: 700; font-size: 15.5px; color: var(--muted); white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--seal); background: var(--seal-soft); }
.nav .yt-icon { width: 24px; }

/* ─────────────── 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 22px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--seal); }
.btn-seal { background: var(--seal); border-color: var(--seal); color: var(--on-seal); }
.btn-seal:hover { background: var(--seal-strong); border-color: var(--seal-strong); }
.btn-sm { min-height: 48px; padding: 0 16px; font-size: 16px; }
.btn[aria-disabled="true"] { opacity: .55; cursor: default; pointer-events: none; background: var(--surface-2); border-color: var(--line); color: var(--muted); }

/* ─────────────── 첫 화면 */
.hero { padding: 28px 0 32px; }
.hero .wrap { display: grid; gap: 24px; }
.hero-img { width: 100%; justify-self: center; border-radius: 18px; box-shadow: var(--shadow); order: -1; }
.hero-img.is-seal { max-width: 220px; border-radius: 50%; box-shadow: 0 10px 24px rgba(120, 30, 30, .15); }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .06em; color: var(--seal); }
.hero h1 { margin-top: 10px; font-size: clamp(32px, 8vw, 52px); line-height: 1.25; font-weight: 800; letter-spacing: -.03em; }
.hero p.lead { margin-top: 14px; font-size: 18px; color: var(--muted); }
.hero .ctas { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ─────────────── 구역 */
section.block { padding: 36px 0; }
section.block + section.block { border-top: 1px solid var(--line); }
.block h2 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.35; }
.sub { margin-top: 6px; color: var(--muted); }
.sub a { color: var(--seal); font-weight: 600; }
.page-head { padding-top: 28px; padding-bottom: 4px; }
.page-head h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 800; letter-spacing: -.02em; line-height: 1.3; margin-top: 6px; }
.page-head p { margin-top: 10px; color: var(--muted); max-width: 720px; }
.page-head p a { color: var(--seal); font-weight: 600; }
.page-head.with-art { display: grid; gap: 8px; }
.head-art { order: -1; justify-self: center; width: auto; max-height: 230px; }
.series-art { display: none; }

/* 카드 */
.cards { margin-top: 20px; display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; }
a.card:hover { border-color: var(--seal); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 20px; font-weight: 800; letter-spacing: -.015em; }
.card p { color: var(--muted); font-size: 16px; }
.card .more { margin-top: auto; padding-top: 6px; font-weight: 700; color: var(--seal); }
.thumb { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; background: var(--surface-2); }
.thumb.workbook { display: grid; place-items: center; padding-top: 14px; overflow: hidden; }
.thumb.workbook img { width: 46%; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); transform: translateY(12%); border-radius: 4px; }
.yt-thumb { display: flex; align-items: center; justify-content: center; gap: 6%; background: radial-gradient(circle at 30% 50%, #2c63b8 0%, #173a78 45%, #0f1f3f 100%); color: #fff; }
.yt-char { width: 42%; max-width: 190px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .35)); }
.yt-mark { display: grid; justify-items: center; gap: 8px; }
.yt-thumb .yt-icon { width: 84px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3)); }
.yt-thumb span { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

.badge { display: inline-block; font-size: 13.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: 2px; }
.badge.new { background: var(--seal); color: var(--on-seal); }
.badge.soon { background: var(--seal-soft); color: var(--seal); }

.note { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--seal-soft); font-size: 16px; }
.note b { color: var(--seal); margin-right: 4px; }
.steps { margin-top: 16px; display: grid; gap: 10px; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; padding: 16px 16px 16px 62px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 16px; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--seal); color: var(--on-seal); display: grid; place-items: center; font-weight: 800; }
.steps b { display: block; font-size: 17px; }

/* 칩 — 줄바꿈해서 전부 보이게 (좌우로 밀지 않는다) */
.chips { display: flex; gap: 6px; }
.wrap-chips { flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 15px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-size: 15.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: none;
}
.chip:hover { color: var(--ink); border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip span { font-size: 13px; font-weight: 800; color: var(--seal); }
.chip-label { flex: none; font-size: 14px; font-weight: 700; color: var(--muted); padding-top: 11px; width: 52px; }
.jump { margin-top: 16px; }

/* 회전 슬라이드 — 휴대폰 한 장, 태블릿 두 장, PC 세 장이 보이고 한 칸씩 넘어간다 */
.carousel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.carousel-nav { display: flex; gap: 6px; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 20px; font-weight: 800; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--seal); color: var(--seal); }
.carousel { margin-top: 18px; }
.track { display: flex !important; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-top: 0 !important; padding-bottom: 4px; }
.track::-webkit-scrollbar { display: none; }
.track > .card { flex: 0 0 88%; scroll-snap-align: start; }
.dots { margin-top: 14px; display: flex; justify-content: center; gap: 8px; }
.dots button { width: 10px; height: 10px; padding: 0; border-radius: 999px; border: 0; background: var(--line-strong); cursor: pointer; transition: width .2s, background .2s; }
.dots button[aria-current="true"] { width: 28px; background: var(--seal); }
.dots button::before { content: ""; display: block; margin: -17px; width: 44px; height: 44px; }
@media (prefers-reduced-motion: reduce) { .dots button { transition: none; } }

.more-btn { width: 100%; margin-top: 12px; }

/* ─────────────── 플레이어 */
.player { margin-top: 14px; position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#watch .chips { margin-top: 14px; }
.player-empty { margin-top: 16px; padding: 32px 20px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--line-strong); text-align: center; display: grid; justify-items: center; gap: 14px; }
.player-char { width: 140px; height: 140px; }
.player-empty p { color: var(--muted); }

/* ─────────────── 인쇄 자료 목록 */
.series-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.for { margin-top: 2px; font-size: 15px; font-weight: 700; color: var(--seal); }
.rows { margin-top: 16px; list-style: none; display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 112px 1fr; gap: 12px 14px; align-items: center;
  padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scroll-margin-top: 12px;
}
.row-thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.row.tall .row-thumb { width: 84px; aspect-ratio: 210 / 297; object-fit: cover; object-position: top; justify-self: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); border-radius: 3px; }
.row.tall { grid-template-columns: 96px 1fr; }
.row-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.4; }
.row-title .badge { margin-left: 4px; font-size: 12.5px; }
.row-sub { margin-top: 2px; font-size: 14.5px; color: var(--muted); line-height: 1.5; }
.row-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; gap: 8px; }
.row-actions:has(.btn + .btn) { grid-template-columns: 2fr 1fr; }

/* ─────────────── 사자성어 목록 */
.filters { display: grid; gap: 10px; padding-top: 16px; padding-bottom: 6px; }
.filter-row { display: flex; gap: 8px; align-items: flex-start; }
.search { width: 100%; min-height: 56px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 18px; }
.search:focus { outline: none; border-color: var(--seal); box-shadow: 0 0 0 4px var(--seal-soft); }
.count { margin-top: 14px; color: var(--muted); font-size: 15px; }
.idioms { margin-top: 10px; list-style: none; display: grid; gap: 10px; }
.idiom a { display: block; height: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.idiom a:hover { border-color: var(--seal); }
.idiom .word { font-size: 23px; font-weight: 800; letter-spacing: .02em; }
.idiom .hj { font-size: 17px; color: var(--seal); margin-left: 6px; }
.idiom .mean { margin-top: 4px; font-size: 16px; color: var(--muted); line-height: 1.5; }
.idiom .tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.lv { font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.lv1 { --c: var(--lv1); } .lv2 { --c: var(--lv2); } .lv3 { --c: var(--lv3); }
.empty { margin-top: 20px; padding: 24px; text-align: center; color: var(--muted); background: var(--surface); border-radius: 14px; }

/* ─────────────── 사자성어 한 편 */
.crumb { padding-top: 18px; font-size: 16px; }
.crumb a { color: var(--muted); display: inline-flex; min-height: 44px; align-items: center; }
.idiom-page { padding: 6px 0 40px; }
.big-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 14px; text-align: center; box-shadow: var(--shadow); }
.big-hanja { font-size: clamp(48px, 15vw, 96px); line-height: 1.15; color: var(--seal); letter-spacing: .06em; }
.big-word { margin-top: 6px; font-size: clamp(28px, 7vw, 40px); font-weight: 800; letter-spacing: .12em; }
.chars { margin: 20px auto 0; max-width: 620px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chars.five { grid-template-columns: repeat(5, 1fr); }
.chars div { padding: 12px 4px; border-radius: 12px; background: var(--surface-2); }
.chars .c { font-size: 30px; line-height: 1.2; }
.chars .h { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.meaning { margin-top: 22px; font-size: 20px; font-weight: 600; line-height: 1.55; }
.detail { margin-top: 18px; display: grid; gap: 10px; }
.row-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.row-card b { display: block; font-size: 14.5px; color: var(--seal); margin-bottom: 4px; }
.row-card a { color: var(--seal); font-weight: 700; }
.pager { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pager .btn { padding: 0 12px; }

/* ─────────────── 바닥 */
.site-foot { margin-top: 20px; padding: 28px 0 calc(40px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; }
.site-foot .wrap { display: grid; gap: 6px; }

/* ─────────────── 태블릿 이상 */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  body { font-size: 18px; }
  .track > .card { flex-basis: calc(50% - 7px); }
  .rows { grid-template-columns: 1fr; }
  .idioms { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .row { grid-template-columns: 150px 1fr auto; padding: 14px 16px; }
  .row-thumb { width: 150px; }
  .row.tall { grid-template-columns: 96px 1fr auto; }
  .row-actions { grid-column: auto; grid-template-columns: auto; min-width: 150px; }
  .row-actions:has(.btn + .btn) { grid-template-columns: auto; }
  .hero .ctas { display: flex; flex-wrap: wrap; }
  .big-card { padding: 36px 28px; }
  .chars .c { font-size: 34px; }
  .chip-label { width: 60px; }
}
@media (min-width: 900px) {
  .site-head .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding-top: 0; padding-bottom: 0; }
  .nav { display: flex; }
  .nav a { padding: 0 14px; font-size: 16.5px; }
  .hero { padding: 56px 0 48px; }
  .hero .wrap { grid-template-columns: 1fr 1.25fr; gap: 40px; align-items: center; }
  .hero-img { order: 0; }
  .hero-img.is-seal { max-width: 320px; }
  .page-head.with-art { grid-template-columns: 1fr 250px; align-items: end; gap: 32px; }
  .head-art { order: 0; max-height: 360px; margin-bottom: -8px; }
  .series-art { display: block; height: 150px; width: auto; flex: none; }
  .series-head { align-items: center; }
  .idioms { grid-template-columns: repeat(3, 1fr); }
  .track > .card { flex-basis: calc((100% - 28px) / 3); }
  .rows { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: 120px 1fr; }
  .row .row-thumb { width: 120px; }
  .row.tall { grid-template-columns: 84px 1fr; }
  .row-actions { grid-column: 1 / -1; grid-template-columns: 1fr; min-width: 0; }
  .row-actions:has(.btn + .btn) { grid-template-columns: 2fr 1fr; }
  .more-btn { max-width: 360px; display: flex; margin-left: auto; margin-right: auto; }
  section.block { padding: 44px 0; }
  .block h2 { font-size: 28px; }
}
@media print {
  .site-head, .site-foot, .filters, .nav, .pager, .crumb, #watch { display: none; }
  body { background: #fff; color: #000; }
}
