/* 생활 한국어 회화 폰북 — 375px first, light/dark (prefers-color-scheme + manual data-theme). */
:root {
  --bg: #f3f6f8; --card: #ffffff; --fg: #12202b; --muted: #5a6b78; --line: #dbe3e9;
  --accent: #0f766e; --accent-fg: #ffffff; --accent-soft: #ccfbf1; --sos: #b91c1c; --sos-soft: #fee2e2;
  --good: #15803d; --ok: #b45309; --bad: #b91c1c; --shadow: 0 1px 3px rgba(15, 30, 45, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1418; --card: #16212a; --fg: #e6eef3; --muted: #9fb0bd; --line: #26343f;
    --accent: #2dd4bf; --accent-fg: #062925; --accent-soft: #123b37; --sos: #f87171; --sos-soft: #3b1515;
    --good: #4ade80; --ok: #fbbf24; --bad: #f87171; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1418; --card: #16212a; --fg: #e6eef3; --muted: #9fb0bd; --line: #26343f;
  --accent: #2dd4bf; --accent-fg: #062925; --accent-soft: #123b37; --sos: #f87171; --sos-soft: #3b1515;
  --good: #4ade80; --ok: #fbbf24; --bad: #f87171; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Noto Sans", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; line-height: 1.3; margin: .4rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
.muted { color: var(--muted); }
.sub { color: var(--muted); margin: -.3rem 0 .8rem; }
[hidden] { display: none !important; }

header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); text-decoration: none; min-width: 0; flex: 1; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
header select, .iconbtn { height: 36px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 8px; font: inherit; font-size: .9rem; }
header select { max-width: 7.5rem; padding: 0 4px; }
.iconbtn { width: 36px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#saved-link { width: auto; padding: 0 8px; white-space: nowrap; }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.hero h1 { font-size: 1.6rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 12px; box-shadow: var(--shadow); }
.back { margin: 4px 0; }
.back a { text-decoration: none; }

.btn { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); font: inherit; font-size: .92rem; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.icon { min-width: 40px; justify-content: center; }
.btn[aria-pressed="true"].fav { background: var(--accent-soft); }
.btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.search { display: flex; gap: 8px; margin: 12px 0; }
.search input, .typed input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: .9rem; min-width: 0; }
.tile span:first-child { font-size: 1.3rem; }
.tile small { color: var(--muted); overflow-wrap: anywhere; }
.tile.sos { border-color: var(--sos); background: var(--sos-soft); }
.tile.sos small { color: var(--sos); font-weight: 700; }

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sit { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; min-height: 118px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); }
.sit .emoji { font-size: 1.8rem; }
.sit .name { font-weight: 700; line-height: 1.3; }
.sit .sub { margin: 0; font-size: .85rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.phrase .ko-link { color: inherit; text-decoration: none; display: block; }
.ko { font-size: 1.3rem; font-weight: 700; margin: 0; word-break: keep-all; overflow-wrap: anywhere; }
.ko.small { font-size: 1.05rem; }
.rom { color: var(--muted); margin: 2px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.tr { margin: 6px 0 0; overflow-wrap: anywhere; }
.big .ko { font-size: 1.8rem; }
.note { margin: 12px 0 0; padding: 10px; border-radius: 10px; background: var(--accent-soft); font-size: .93rem; }
.prompt { font-size: 1.25rem; font-weight: 600; }

.practice .live { min-height: 1.5em; margin: 8px 0 0; }
.typed { display: flex; gap: 8px; margin-top: 12px; }
.result { margin-top: 10px; }
.meter { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter .bar { display: block; height: 100%; }
.bar.great { background: var(--good); } .bar.good { background: var(--ok); } .bar.retry { background: var(--bad); }
.score { font-weight: 700; margin: 6px 0 2px; }
.score.great { color: var(--good); } .score.good { color: var(--ok); } .score.retry { color: var(--bad); }
.warn { color: var(--bad); }

.replies { list-style: none; padding: 0; margin: 0; }
.replies li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.replies li:first-child { border-top: 0; }
.replies p { margin: 0; }
.pager { display: flex; justify-content: space-between; margin: 8px 0; }

.numbers { list-style: none; padding: 0; margin: 0; }
.num { display: flex; gap: 12px; align-items: flex-start; padding: 12px; margin-bottom: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.num.emergency { border-color: var(--sos); }
.num p { margin: 2px 0 0; font-size: .9rem; }
.tel { flex: none; min-width: 84px; text-align: center; font-size: 1.6rem; font-weight: 800; padding: 6px 10px; border-radius: 10px; background: var(--sos); color: #fff; text-decoration: none; }
.num.help .tel { background: var(--accent); color: var(--accent-fg); }
.numbers.compact .num { padding: 8px; margin-bottom: 6px; }
.numbers.compact .tel { font-size: 1.25rem; min-width: 70px; }
.src { overflow-wrap: anywhere; }
.sosbox { border-color: var(--sos); }

.show { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; cursor: pointer; }
.show-ko { font-size: clamp(2rem, 11vw, 4.5rem); font-weight: 800; line-height: 1.25; margin: 0; word-break: keep-all; overflow-wrap: anywhere; }
.show-tr { font-size: 1.2rem; color: #cbd5e1; margin: 16px 0 0; }
.show-close { position: absolute; bottom: 20px; left: 16px; right: 16px; text-align: center; color: #94a3b8; font-size: .9rem; margin: 0; }

#toast { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 520px; margin: 0 auto; padding: 12px 14px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: .92rem; }
footer { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; color: var(--muted); font-size: .85rem; }
footer p { margin: 4px 0; }

/* Static landing pages (s/<slug>.html) */
.landing .lead { font-size: 1.05rem; }
.landing ol { padding-left: 1.3rem; }
.landing li { margin-bottom: 12px; }
.landing .cta { margin: 16px 0; }
.landing nav ul { padding-left: 1.2rem; }

/* Static intro on the home page (#intro, generated by tools/build.js) — visible without JavaScript, home route only */
.intro { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.intro h2 { font-size: 1.15rem; margin: 0 0 8px; }
.intro h3 { font-size: 1rem; margin: 14px 0 6px; }
.intro ul { padding-left: 1.2rem; margin: 6px 0 10px; }
.intro li { margin-bottom: 6px; }
.intro p, .intro li { overflow-wrap: anywhere; }
.intro-sit { border-top: 1px solid var(--line); padding-top: 4px; }
.intro-sit ul { list-style: none; padding-left: 0; }
.intro-sit .ko { font-weight: 600; }
.intro-sit .rom { color: var(--muted); font-style: italic; }
.intro-sit .more { font-size: .9rem; }
.landing .replies { font-size: .92rem; }
