:root {
  --ink: #17202a;
  --navy: #17324d;
  --navy-soft: #294f70;
  --paper: #f8f4ea;
  --paper-deep: #eee6d5;
  --white: #fffdf8;
  --gold: #b58a39;
  --gold-pale: #ead8ad;
  --muted: #617080;
  --line: #d9d1c3;
  --success: #2d6a4f;
  --surface: #fbfaf6;
  --body-end: #f4f0e8;
  --radius: 20px;
  --shadow: 0 18px 48px rgba(23, 50, 77, .1);
  --max: 1180px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf2f5;
  --navy: #d8e7f2;
  --navy-soft: #a9cbe0;
  --paper: #101b25;
  --paper-deep: #253541;
  --white: #172632;
  --gold: #d2a94f;
  --gold-pale: #8d7135;
  --muted: #afbdc7;
  --line: #3a4c59;
  --success: #80c7a4;
  --surface: #172632;
  --body-end: #0b151e;
  --shadow: 0 18px 48px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 7%, rgba(181,138,57,.13), transparent 25rem),
    linear-gradient(180deg, var(--paper) 0, var(--surface) 42rem, var(--body-end) 100%);
  font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
}
a { color: inherit; }
button, input, select { font: inherit; }
button, .button { min-height: 44px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .75rem 1rem; background: var(--navy); color: white; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 76px; padding: .75rem max(1rem, calc((100vw - var(--max)) / 2));
  background: rgba(248,244,234,.92); backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(23,50,77,.1);
}
.brand-group { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; color: white; background: var(--navy); border-radius: 50% 50% 45% 45%; font-family: serif; font-size: 1.2rem; box-shadow: inset 0 0 0 2px rgba(255,255,255,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Noto Serif KR", serif; font-size: 1.08rem; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.youtube-brand { display: grid; place-items: center; width: 88px; height: 50px; overflow: hidden; border-radius: 10px; background: #050505; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.youtube-brand img { display: block; width: 82px; height: 48px; object-fit: contain; }
.header-controls { display: flex; align-items: center; gap: .5rem; order: 3; }
.theme-control { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 750; }
.theme-control select { min-height: 40px; padding: .35rem .65rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 10px; }
.main-nav { display: flex; align-items: center; gap: .15rem; }
.main-nav a { padding: .6rem .8rem; border-radius: 999px; text-decoration: none; font-size: .92rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: white; background: var(--navy); }
.menu-toggle { display: none; border: 1px solid var(--line); border-radius: 12px; background: var(--white); padding: .4rem .8rem; }

#app { min-height: calc(100vh - 230px); }
.page { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 5rem; }
.hero { position: relative; overflow: hidden; padding: clamp(2rem, 6vw, 5.5rem); color: white; background: var(--navy); border-radius: 0 0 38px 38px; }
.hero::after { content: "대한민국헌법"; position: absolute; right: -1rem; bottom: -2.5rem; color: rgba(255,255,255,.045); font: 700 clamp(4rem, 12vw, 10rem)/1 serif; white-space: nowrap; }
.hero-inner { position: relative; z-index: 1; width: min(920px, 100%); margin: 0 auto; }
.eyebrow { margin: 0 0 .5rem; color: var(--gold-pale); font-size: .82rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { max-width: 760px; margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(2rem, 5.5vw, 4rem); line-height: 1.22; letter-spacing: -.035em; }
.hero .lead { max-width: 700px; margin: 1rem 0 1.6rem; color: #dce7ef; font-size: clamp(1rem, 2vw, 1.2rem); }
.search-form { display: flex; gap: .6rem; max-width: 820px; padding: .5rem; background: white; border-radius: 18px; box-shadow: 0 18px 45px rgba(0,0,0,.22); }
.search-form input { flex: 1; min-width: 0; border: 0; outline: 0; padding: .75rem 1rem; color: var(--ink); background: transparent; font-size: 1.03rem; }
.button, .search-form button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; padding: .7rem 1.1rem; color: white; background: var(--navy); text-decoration: none; cursor: pointer; font-weight: 750; }
.search-form button { background: var(--gold); }
.button.secondary { color: var(--navy); background: var(--paper-deep); }
.button.ghost { color: var(--navy); background: transparent; border: 1px solid var(--line); }
.button.small { min-height: 38px; padding: .45rem .75rem; font-size: .88rem; }
.button:hover, button:hover { filter: brightness(.96); }

.section { margin-top: 3.2rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section h2, .page-title { margin: 0; font-family: Georgia, "Noto Serif KR", serif; color: var(--navy); line-height: 1.3; }
.section-note, .muted { color: var(--muted); }
.question-grid, .card-grid, .episode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.question-card, .card, .episode-card { position: relative; padding: 1.35rem; background: color-mix(in srgb, var(--white) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(23,50,77,.055); }
.question-card { display: flex; min-height: 142px; flex-direction: column; justify-content: space-between; text-align: left; cursor: pointer; }
.question-card span { color: var(--gold); font-size: .78rem; font-weight: 800; }
.question-card strong { color: var(--navy); font: 700 1.08rem/1.5 Georgia, "Noto Serif KR", serif; }
.question-card:hover, .card:hover { transform: translateY(-2px); border-color: var(--gold); transition: .2s ease; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.stat { padding: 1.2rem; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border: 0; }
.stat strong { display: block; color: var(--navy); font: 700 1.7rem/1 Georgia, serif; }
.stat span { color: var(--muted); font-size: .84rem; }

.breadcrumbs { margin-bottom: 1rem; color: var(--muted); font-size: .88rem; }
.breadcrumbs a { text-decoration: none; }
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.article-reader { padding: clamp(1.4rem, 4vw, 2.5rem); background: var(--white); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.article-number { color: var(--gold); font-size: .82rem; font-weight: 850; letter-spacing: .12em; }
.article-reader h1 { margin: .25rem 0 1rem; color: var(--navy); font: 700 clamp(1.7rem, 4vw, 2.6rem)/1.3 Georgia, "Noto Serif KR", serif; }
.article-reader[data-font-size="small"] .article-text { font-size: 1rem; }
.article-reader[data-font-size="normal"] .article-text { font-size: 1.16rem; }
.article-reader[data-font-size="large"] .article-text { font-size: 1.38rem; }
.article-text { padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); line-height: 1.95; }
.article-text p { margin: 0 0 1rem; }
.article-text p:last-child { margin-bottom: 0; }
.reader-tools, .action-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
.tool-label { color: var(--muted); font-size: .86rem; font-weight: 700; }
.info-block { margin-top: 1.25rem; padding: 1.15rem 1.25rem; border-radius: 16px; background: var(--paper); }
.info-block h2, .info-block h3 { margin: 0 0 .35rem; color: var(--navy); font-size: 1rem; }
.info-block p { margin: 0; }
.reflection { border-left: 4px solid var(--gold); }
.speech-panel { margin-top: 1.25rem; padding: 1.2rem; border: 1px solid var(--gold-pale); border-radius: 18px; background: #fffaf0; }
:root[data-theme="dark"] .speech-panel { background: #202d35; }
:root[data-theme="dark"] .hero { color: #fff; background: #142c43; }
:root[data-theme="dark"] .hero .lead { color: #cfdae4; }
:root[data-theme="dark"] .search-form { background: #f5f5f3; }
:root[data-theme="dark"] .search-form input { color: #17202a; }
:root[data-theme="dark"] .site-header { background: rgba(16,27,37,.94); }
:root[data-theme="dark"] .main-nav a:hover,
:root[data-theme="dark"] .main-nav a[aria-current="page"] { color: #122638; background: #d8e7f2; }
:root[data-theme="dark"] .button:not(.ghost),
:root[data-theme="dark"] .side-card { color: #122638; }
:root[data-theme="dark"] .side-card a { color: #17324d; }
:root[data-theme="dark"] .brand-mark { color: #122638; }
.speech-panel h2 { margin: .15rem 0 .4rem; color: var(--navy); font: 700 1.15rem Georgia, serif; }
.paragraph-speech { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.speech-status { margin: .65rem 0 0; color: var(--success); font-size: .88rem; font-weight: 750; }
.listen-page > .muted { max-width: 760px; }
.guide-form { margin-top: 1.5rem; padding: clamp(1.1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.guide-form label { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; color: var(--navy); }
.guide-form label span { color: var(--muted); font-size: .86rem; font-weight: 500; }
.guide-input-row { display: flex; gap: .6rem; }
.guide-input-row input { flex: 1; min-width: 0; padding: .8rem 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.guide-examples { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .85rem; }
.guide-examples > span { margin-right: .25rem; color: var(--muted); font-size: .82rem; font-weight: 750; }
.guide-example { border: 0; cursor: pointer; }
.guide-result { margin-top: 2rem; padding: clamp(1.3rem, 4vw, 2.2rem); border: 1px solid var(--gold-pale); border-top: 6px solid var(--gold); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); }
.guide-result h2 { margin: .25rem 0 1rem; color: var(--navy); font: 700 clamp(1.6rem, 4vw, 2.3rem)/1.3 Georgia, "Noto Serif KR", serif; }
.guide-keywords { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; color: var(--muted); font-size: .8rem; }
.guide-keywords strong { padding: .2rem .55rem; color: var(--navy); background: var(--paper-deep); border-radius: 999px; }
.guide-explanation { padding: 1.2rem; border-radius: 16px; background: var(--paper); }
.guide-explanation h3, .guide-transcript h3, .guide-transcript h4, .guide-related h3 { margin: 0 0 .4rem; color: var(--navy); }
.guide-explanation p, .guide-transcript p { margin: 0; }
.guide-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.1rem; }
.guide-choice { min-height: 58px; font-size: 1rem; }
.guide-choice span { margin-right: .35rem; }
.guide-transcript { margin-top: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.guide-transcript h4 { margin-top: 1rem; }
.guide-related { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.guide-related a { display: inline-block; margin: .25rem .7rem .25rem 0; color: var(--navy-soft); }
.guide-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.guide-list .result-item { margin: 0; }
.guide-empty { margin-top: 2rem; }
.recording-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.recording-card { padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.recording-card > span { color: var(--gold); font-size: .78rem; font-weight: 800; }
.recording-card h3 { margin: .2rem 0 .75rem; color: var(--navy); font-family: Georgia, "Noto Serif KR", serif; }
.recording-card audio { display: block; width: 100%; }
.side-card { padding: 1.2rem; background: var(--navy); color: white; border-radius: var(--radius); }
.side-card h2 { margin-top: 0; font: 700 1.12rem Georgia, serif; }
.side-card a { display: block; margin: .5rem 0; color: #eaf2f8; }
.tag-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag { display: inline-flex; padding: .3rem .65rem; border-radius: 999px; color: var(--navy); background: var(--paper-deep); text-decoration: none; font-size: .84rem; }
.result-group { margin-top: 2rem; }
.result-group h2 { color: var(--navy); font-family: Georgia, serif; }
.result-item { display: block; margin: .7rem 0; padding: 1rem 1.2rem; background: var(--white); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.result-item small { color: var(--gold); font-weight: 800; }
.result-item strong { display: block; color: var(--navy); }

.episode-card { display: flex; flex-direction: column; }
.episode-card .episode-kicker { color: var(--gold); font-weight: 850; font-size: .8rem; }
.episode-card h2 { margin: .4rem 0; color: var(--navy); font: 700 1.15rem/1.45 Georgia, serif; }
.episode-card p { flex: 1; color: var(--muted); }
.episode-status { display: inline-flex; align-self: flex-start; padding: .25rem .55rem; border-radius: 99px; color: #7d5a14; background: #f8edcf; font-size: .78rem; font-weight: 800; }
.episode-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.bookmark-button { align-self: flex-start; margin-top: .8rem; }
.empty-state { padding: 3rem 1.5rem; text-align: center; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); }
.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.map-node { min-height: 180px; padding: 1.2rem; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius); background: var(--white); }
.map-node strong { display: block; color: var(--navy); font: 700 1.15rem Georgia, serif; }
.map-node a { display: inline-block; margin: .25rem .35rem .25rem 0; color: var(--navy-soft); }

.site-footer { padding: 2rem max(1rem, calc((100vw - var(--max)) / 2)); color: #cfdae4; background: #102538; font-size: .82rem; }
.site-footer p { max-width: 900px; margin: .35rem 0; }

@media (max-width: 900px) {
  .question-grid, .card-grid, .episode-grid, .map-grid { grid-template-columns: repeat(2, 1fr); }
  .results-layout { grid-template-columns: 1fr; }
  .youtube-brand { width: 72px; }
  .youtube-brand img { width: 68px; }
  .theme-control span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
}
@media (max-width: 720px) {
  .site-header { min-height: 68px; flex-wrap: wrap; }
  .brand small { display: none; }
  .youtube-brand { width: 58px; height: 42px; }
  .youtube-brand img { width: 55px; height: 40px; }
  .header-controls { margin-left: auto; }
  .menu-toggle { display: block; }
  .main-nav { position: absolute; top: 68px; left: 0; right: 0; display: none; padding: .8rem 1rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 15px 30px rgba(23,50,77,.1); }
  .main-nav.open { display: grid; }
  .main-nav a { padding: .7rem 1rem; }
  .hero { padding: 3.5rem 1rem; border-radius: 0 0 26px 26px; }
  .search-form { display: grid; }
  .search-form button { width: 100%; }
  .question-grid, .card-grid, .episode-grid, .map-grid { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .stat-strip { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .page { padding-top: 2rem; }
  .guide-form label { align-items: start; flex-direction: column; gap: .15rem; }
  .guide-input-row, .guide-actions { grid-template-columns: 1fr; display: grid; }
  .guide-list { grid-template-columns: 1fr; }
  .recording-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
