/* AI 학습도구 큐레이션 — 프로토타입 스타일 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1d21;
  --text-muted: #5c6470;
  --border: #e2e5ea;
  --brand: #2f6f4f;
  --brand-ink: #1d4a34;
  --brand-soft: #e5f2ea;
  --accent: #2563a8;
  --shadow: 0 1px 2px rgba(20, 25, 35, .06), 0 4px 14px rgba(20, 25, 35, .05);
  --radius: 14px;
  /* 안전(연령제한) 색상 */
  --safe-ok: #1f7a4d;    --safe-ok-bg: #e4f4ea;
  --safe-warn: #9a6b12;  --safe-warn-bg: #fbf0d8;
  --safe-danger: #a83232;--safe-danger-bg: #fbe4e4;
  --safe-teacher: #3a5a8a;--safe-teacher-bg: #e5edf8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1c2026; --surface-2: #232830;
    --text: #eceef1; --text-muted: #9aa3b0; --border: #2c323b;
    --brand: #5ec48d; --brand-ink: #a7e3c3; --brand-soft: #1e2f27;
    --accent: #6ea8e6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.28);
    --safe-ok:#7fd3a5; --safe-ok-bg:#183226;
    --safe-warn:#e0b666; --safe-warn-bg:#33290f;
    --safe-danger:#e88b8b; --safe-danger-bg:#361c1c;
    --safe-teacher:#8fb4e6; --safe-teacher-bg:#1b2635;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.55; font-size: 15px;
}
.wrap { width: min(1180px, 92vw); margin-inline: auto; }
a { color: var(--accent); }

/* Header */
.site-header {
  background: linear-gradient(180deg, var(--brand-soft), transparent);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 28px;
}
.eyebrow { margin: 0 0 6px; color: var(--brand-ink); font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.site-header h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.02em; }
.lede { margin: 0; color: var(--text-muted); font-size: 16px; max-width: 60ch; }
.lede strong { color: var(--text); }

/* Toolbar */
.toolbar {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin: 22px 0 18px;
}
.search { flex: 1 1 320px; }
.search input {
  width: 100%; padding: 12px 16px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sort-label { font-size: 13px; color: var(--text-muted); }
#sort {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px;
}
.count { color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.count strong { color: var(--text); }
.btn-reset {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.btn-reset:hover { color: var(--text); border-color: var(--text-muted); }
.btn-reset svg { width: 14px; height: 14px; flex: 0 0 auto; }
.btn-reset:disabled { cursor: not-allowed; opacity: .48; }

/* Layout */
.layout { display: grid; grid-template-columns: 264px 1fr; gap: 26px; align-items: start; padding-bottom: 60px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

/* Filters */
.filters {
  position: sticky; top: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 18px;
}
@media (max-width: 860px) { .filters { position: static; } }
.filter-group h2 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.filter-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 6px 11px; border-radius: 999px; font-size: 12.5px; cursor: pointer; user-select: none;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #0d1512; } }
.checks { display: flex; flex-direction: column; gap: 7px; }
.checks-wrap { flex-flow: row wrap; gap: 6px 14px; }
.checks label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.checks input { accent-color: var(--brand); width: 15px; height: 15px; }
.toggles { flex-direction: row; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; }
.toggle { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.toggle input { accent-color: var(--brand); width: 15px; height: 15px; }
.decision-filter { background: var(--brand-soft); border-radius: 10px; padding: 12px; }
.decision-filter h2 { color: var(--brand-ink); }
.filter-note { margin: 9px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--brand); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card h3 { margin: 0; font-size: 16.5px; letter-spacing: -.01em; }
.card h3 .alt { color: var(--text-muted); font-weight: 500; font-size: 13px; }
.cat-badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; font-weight: 600; }
.one-liner { margin: 0; color: var(--text); font-size: 13.5px; }
.classroom { margin: 0; font-size: 12.5px; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 9px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.tag { font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); }
.tag.free { background: var(--safe-ok-bg); color: var(--safe-ok); font-weight: 600; }
.tag.paid { background: var(--surface-2); color: var(--text-muted); }
.tag.dom { background: var(--safe-teacher-bg); color: var(--safe-teacher); }
.tag.s2b { background: #f3e8d2; color: #7b5312; font-weight: 700; }
.tag.stale { background: var(--safe-warn-bg); color: var(--safe-warn); font-weight: 700; }
@media (prefers-color-scheme: dark) { .tag.s2b { background: #392b15; color: #e2bd72; } }
.readiness { display: inline-flex; align-items: center; width: fit-content; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.readiness.recommended { background: var(--safe-ok-bg); color: var(--safe-ok); }
.readiness.conditional { background: var(--safe-warn-bg); color: var(--safe-warn); }
.readiness.reference { background: var(--surface-2); color: var(--text-muted); }
/* 연령제한 안전 배지 */
.age { font-weight: 700; }
.age.ok { background: var(--safe-ok-bg); color: var(--safe-ok); }
.age.warn { background: var(--safe-warn-bg); color: var(--safe-warn); }
.age.danger { background: var(--safe-danger-bg); color: var(--safe-danger); }
.age.teacher { background: var(--safe-teacher-bg); color: var(--safe-teacher); }
.age.unknown { background: var(--surface-2); color: var(--text-muted); }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.btn-detail {
  border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 7px;
  padding: 6px 9px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-detail:hover { background: var(--brand-ink); }
.btn-detail:focus-visible, .compare-choice input:focus-visible, .btn-reset:focus-visible, .visit:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.compare-choice { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.compare-choice input { accent-color: var(--brand); width: 15px; height: 15px; }
.visit { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--brand); }
.visit:hover { text-decoration: underline; }
.meta-mini { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; }
.meta-mini .lock::before { content: "🔒 "; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty p { margin: 0 0 14px; }

/* Detail modal */
dialog#detail {
  border: none; border-radius: var(--radius); padding: 0;
  width: min(560px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog#detail::backdrop, dialog#compare::backdrop { background: rgba(10, 12, 16, .5); }
.detail-close {
  position: sticky; top: 10px; float: right; margin: 10px 10px 0 0;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 14px;
}
.detail-close:hover { color: var(--text); }
#detail-body { padding: 8px 26px 26px; clear: both; }
#detail-body h3 { margin: 0 0 4px; font-size: 20px; }
#detail-body .alt { color: var(--text-muted); font-weight: 500; font-size: 14px; }
#detail-body .cat-badge { margin: 6px 0 14px; display: inline-block; }
#detail-body dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 14px 0; }
#detail-body dt { color: var(--text-muted); }
#detail-body dd { margin: 0; }
#detail-body .notes { font-size: 12.5px; color: var(--text-muted); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
#detail-body .visit { display: inline-block; margin-top: 16px; font-size: 14px; font-weight: 700; }
.detail-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 18px; }
.detail-section h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: .02em; color: var(--brand-ink); }
.detail-line { margin: 7px 0; font-size: 13px; color: var(--text-muted); }
.detail-line strong { color: var(--text); }
.detail-section > .readiness { margin-bottom: 4px; }
.source-list { margin: 0; padding-left: 18px; }
.source-list li { margin: 6px 0; font-size: 12.5px; }
.source-link { display: block; width: fit-content; font-size: 12.5px; line-height: 1.45; }

/* Comparison dialog */
dialog#compare {
  border: none; border-radius: var(--radius); padding: 0; width: min(1040px, 94vw);
  max-height: 86vh; overflow: auto; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.compare-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 22px 24px 12px; }
.compare-head .eyebrow { margin-bottom: 3px; }
.compare-head h2 { margin: 0; font-size: 20px; }
.compare-head .detail-close { position: static; float: none; flex: 0 0 auto; margin: 0; }
#compare-body { padding: 4px 24px 0; overflow-x: auto; }
.compare-table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13px; }
.compare-table th, .compare-table td { border: 1px solid var(--border); text-align: left; vertical-align: top; padding: 10px; }
.compare-table thead th { background: var(--brand-soft); color: var(--brand-ink); }
.compare-table tbody th { width: 132px; background: var(--surface-2); color: var(--text-muted); font-weight: 700; }
.compare-actions { display: flex; justify-content: end; padding: 16px 24px 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0 36px; }
.site-footer p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-muted); max-width: 80ch; }
.site-footer .muted { opacity: .8; }

@media (max-width: 520px) {
  .wrap { width: min(100% - 24px, 1180px); }
  .site-header { padding: 28px 0 22px; }
  .toolbar-right { gap: 8px; }
  .btn-reset { padding: 8px 10px; }
  .filter-cols { grid-template-columns: 1fr; gap: 14px; }
  .grid { grid-template-columns: 1fr; }
  .card-foot { align-items: flex-start; flex-direction: column; }
  #detail-body { padding-inline: 18px; }
  #detail-body dl { grid-template-columns: 1fr; gap: 2px; }
  #detail-body dd { margin-bottom: 8px; }
  .compare-head, #compare-body, .compare-actions { padding-inline: 16px; }
}

/* Quiet library redesign: information-first, low-density exploration */
:root {
  --bg: #f6f4ef;
  --surface: #fffefa;
  --surface-2: #efede6;
  --text: #1d2722;
  --text-muted: #68716b;
  --border: #dedbd2;
  --brand: #315b49;
  --brand-ink: #203e31;
  --brand-soft: #e5eee8;
  --accent: #315b49;
  --shadow: 0 1px 0 rgba(29, 39, 34, .04), 0 8px 24px rgba(29, 39, 34, .045);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17201c; --surface: #202a24; --surface-2: #2a352e;
    --text: #f0f1ea; --text-muted: #b2bbb4; --border: #3a453e;
    --brand: #a9cfb7; --brand-ink: #c7ead2; --brand-soft: #26392d; --accent: #b9ddc5;
    --shadow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.16);
  }
}
body { font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; letter-spacing: -.012em; }
.wrap { width: min(1220px, calc(100% - 40px)); }
.site-header { background: var(--bg); border: 0; padding: 28px 0 12px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: end; gap: 3px; padding: 6px; background: var(--brand); border-radius: 9px 9px 9px 2px; }
.brand-mark i { display: block; width: 5px; background: #f7f3e9; border-radius: 999px; }
.brand-mark i:nth-child(1) { height: 11px; opacity: .68; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 8px; opacity: .86; }
.eyebrow { color: var(--brand); font-size: 11px; margin: 0 0 1px; letter-spacing: .08em; }
.site-header h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; word-break: keep-all; }
.lede { max-width: none; font-size: 14px; margin: 12px 0 0 46px; }
.toolbar { position: sticky; top: 0; z-index: 4; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); padding: 12px 0; margin: 4px 0 10px; gap: 10px; }
.search { flex: 1 1 420px; }
.search input { border-radius: 9px; box-shadow: none; padding: 11px 14px; border-color: var(--border); }
.toolbar-right { gap: 7px; }
.btn-reset, #sort { border-radius: 7px; box-shadow: none; background: var(--surface); }
#compare-mode[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.layout { display: block; padding-bottom: 52px; }
.filters { position: static; display: block; padding: 0; background: transparent; border: 0; box-shadow: none; margin-bottom: 14px; }
.filter-drawer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-drawer summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: var(--brand-ink); font-size: 13px; font-weight: 700; }
.filter-drawer summary::-webkit-details-marker { display: none; }
.filter-summary-label, .filter-summary-action { display: inline-flex; align-items: center; gap: 7px; }
.filter-summary-label svg { width: 15px; height: 15px; color: var(--brand); }
.filter-summary-action { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.filter-summary-action svg { width: 14px; height: 14px; transition: transform .18s ease; }
.filter-drawer[open] .filter-summary-action svg { transform: rotate(180deg); }
.filter-drawer[open] summary { border-bottom: 1px solid var(--border); }
.filter-content { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 16px; }
.filter-content > .filter-group:first-child, .filter-content > .toggles { grid-column: 1 / -1; }
.filter-cols { display: contents; }
.filter-cols .filter-group { min-width: 0; }
.filter-group h2 { font-size: 11px; margin-bottom: 7px; }
.checks { gap: 5px; }
.checks label, .toggle { font-size: 12.5px; }
.decision-filter, .lesson-filter { padding: 10px; border-radius: 8px; }
.toggles { border-top: 1px solid var(--border); padding-top: 12px; gap: 10px 16px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { border-radius: 9px; padding: 14px; gap: 12px; min-height: 142px; box-shadow: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-top { align-items: flex-start; }
.card h3 { font-size: 15px; line-height: 1.32; }
.card h3 .alt { display: none; }
.cat-badge { padding: 3px 6px; font-size: 10px; border-radius: 5px; white-space: normal; text-align: right; }
.chips-row { gap: 4px; }
.tag { font-size: 10.5px; padding: 3px 6px; border-radius: 999px; }
.card-foot { padding: 0; margin-top: auto; }
.card-actions { width: 100%; justify-content: space-between; }
.btn-detail { background: transparent; border-color: var(--border); color: var(--brand-ink); border-radius: 6px; padding: 5px 7px; font-size: 11px; }
.btn-detail:hover { background: var(--brand-soft); color: var(--brand-ink); }
.visit { font-size: 11px; }
.meta-mini { display: none; }
.compare-choice { border-top: 1px dashed var(--border); padding-top: 9px; }
.compare-choice[hidden] { display: none; }
.site-footer { background: transparent; padding-top: 18px; }
@media (max-width: 780px) {
  .filter-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .wrap { width: min(100% - 24px, 1220px); }
  .site-header { padding-top: 20px; }
  .toolbar { align-items: stretch; }
  .toolbar-right { width: 100%; }
  .toolbar-right .btn-reset, #sort { flex: 1 1 auto; }
  .filter-content { grid-template-columns: 1fr; padding: 14px; }
  .filter-content > .filter-group:first-child, .filter-content > .toggles { grid-column: auto; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 11px; min-height: 130px; }
  .card-top { display: block; }
  .card-top .cat-badge { display: inline-block; margin-top: 6px; text-align: left; }
  .card-actions { align-items: start; flex-direction: column; gap: 7px; }
}
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }

/* Landing-first catalogue flow */
#landing[hidden], #catalog[hidden] { display: none; }
.landing { padding: clamp(26px, 5vw, 64px) 0 54px; }
.landing-intro { max-width: 680px; }
.landing-kicker { margin: 0 0 10px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.landing h2 { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: 1.16; letter-spacing: -.03em; word-break: keep-all; }
.landing-intro > p:not(.landing-kicker) { max-width: 48ch; margin: 15px 0 0; color: var(--text-muted); font-size: 15px; }
.landing-search { width: min(100%, 560px); display: flex; align-items: center; gap: 10px; margin-top: 26px; padding: 4px 12px 4px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.landing-search input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 10px 0; background: transparent; color: var(--text); font: inherit; }
.landing-search > span:last-child { color: var(--brand); font-size: 24px; line-height: 1; transform: rotate(-18deg); }
.landing-guide { display: flex; gap: 10px; flex-wrap: wrap; margin: 44px 0 14px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.landing-guide span + span::before { content: "→"; margin-right: 10px; color: var(--brand); }
.landing-categories { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.landing-category { min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 16px; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; transition: background .16s ease, color .16s ease; }
.landing-category strong { font-size: 15px; letter-spacing: -.035em; }
.landing-category span { color: var(--text-muted); font-size: 11px; }
.landing-category::after { content: "↗"; position: absolute; opacity: 0; }
.landing-category:hover, .landing-category:focus-visible { background: var(--brand); color: #fff; outline: 0; }
.landing-category:hover span, .landing-category:focus-visible span { color: #dcece1; }
#catalog { padding-top: 4px; }
#catalog .toolbar { margin-top: 0; }
.card { min-height: 124px; padding: 13px 14px; border-radius: 7px; gap: 11px; }
.card-top { gap: 10px; }
.card h3 { font-size: 16px; }
.card .cat-badge { background: transparent; color: var(--text-muted); padding: 0; font-size: 10px; font-weight: 650; }
.card .chips-row { min-height: 21px; align-content: flex-start; }
.card .tag:nth-child(n+5) { display: none; }
.card-foot { border-top: 1px solid var(--surface-2); padding-top: 9px; }
.card-actions { justify-content: flex-start; gap: 8px; }
.card .visit { display: none; }
.card .btn-detail { border: 0; padding: 0; font-size: 12px; font-weight: 750; }
.card .btn-detail::after { content: " →"; }
.card .btn-detail:hover { background: transparent; text-decoration: underline; }
@media (max-width: 760px) {
  .landing-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-category { min-height: 92px; }
}
@media (max-width: 520px) {
  .landing { padding-top: 28px; }
  .landing h2 { font-size: 34px; }
  .landing-guide { margin-top: 32px; }
  .landing-guide span { font-size: 10px; }
  .landing-category { padding: 13px; }
  .card .chips-row { min-height: 0; }
  .card .tag:nth-child(n+4) { display: none; }
}

/* Icon system, landing information, and richer item design */
.brand-lockup { width: fit-content; color: inherit; text-decoration: none; border-radius: 9px; }
.brand-lockup:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: end; gap: clamp(36px, 8vw, 110px); }
.landing-aside { position: relative; min-height: 218px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding: 24px; border-radius: 10px 10px 10px 2px; background: var(--brand); color: #f7f3e9; box-shadow: var(--shadow); }
.landing-aside::before, .landing-aside::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; transform: rotate(-9deg); }
.landing-aside::before { width: 150px; height: 104px; right: -32px; top: -25px; }
.landing-aside::after { width: 104px; height: 150px; right: 22px; top: -54px; transform: rotate(14deg); }
.landing-aside .aside-icon { position: absolute; top: 22px; left: 22px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); }
.landing-aside .aside-icon svg { width: 24px; height: 24px; }
.landing-aside p { margin: 0 0 6px; font-size: 9px; letter-spacing: .16em; opacity: .72; }
.landing-aside strong { font-size: 23px; letter-spacing: -.045em; }
.landing-aside > span { margin-top: 4px; font-size: 11px; opacity: .76; }
.landing-aside .aside-spark { position: absolute; right: 20px; bottom: 20px; width: 22px; height: 22px; opacity: .65; }
.landing-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.meta-card { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text); text-align: left; font: inherit; }
button.meta-card { cursor: pointer; }
button.meta-card:hover, button.meta-card:focus-visible { background: var(--brand-soft); border-color: var(--brand); outline: 0; }
.meta-card > svg { width: 17px; height: 17px; color: var(--brand); }
.meta-card > svg:last-child { width: 14px; height: 14px; color: var(--text-muted); }
.meta-card span { display: flex; flex-direction: column; min-width: 0; }
.meta-card strong { font-size: 11px; }
.meta-card small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.landing-category { position: relative; min-height: 118px; justify-content: flex-start; }
.landing-category .category-icon { width: 20px; height: 20px; margin-bottom: auto; color: var(--brand); }
.landing-category:hover .category-icon, .landing-category:focus-visible .category-icon { color: #fff; }
.grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { min-height: 234px; padding: 10px; }
.tool-visual { position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; min-height: 82px; padding: 12px; border-radius: 6px; color: #284737; background: #dfeadf; }
.tool-visual::after { content: ""; position: absolute; width: 74px; height: 74px; right: -22px; top: -27px; border: 1px solid currentColor; border-radius: 50%; opacity: .16; }
.tool-visual svg { width: 27px; height: 27px; }
.tool-visual > .tool-visual-label { max-width: 62%; font-size: 9px; font-weight: 750; letter-spacing: .04em; text-align: right; opacity: .72; }
.tool-mark { position: relative; z-index: 1; display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; overflow: hidden; border: 1px solid rgba(255,255,255,.72); border-radius: 13px; background: rgba(255,255,255,.46); box-shadow: 0 3px 12px rgba(31,45,38,.08); }
.tool-logo { position: absolute; inset: 0; width: 100%; height: 100%; padding: 7px; object-fit: contain; background: #fff; opacity: 0; transform: scale(.88); transition: opacity .18s ease, transform .24s ease; }
.tool-logo.is-ready { opacity: 1; transform: scale(1); }
.tool-visual[data-tone="1"] { color: #5a4728; background: #eee5cf; }
.tool-visual[data-tone="2"] { color: #39516b; background: #dfe8ef; }
.tool-visual[data-tone="3"] { color: #6b3f3b; background: #efe1df; }
.tool-visual[data-tone="4"] { color: #504568; background: #e7e2ef; }
.tool-visual[data-tone="5"] { color: #31555a; background: #dcebed; }
.card-top .cat-badge { display: none; }
.card h3 { min-height: 42px; display: flex; align-items: flex-start; font-size: 16px; }
.card .chips-row { min-height: 22px; }
.card-foot { margin-top: auto; }
.card-actions { align-items: center; }
.card-share { width: 30px; height: 30px; display: grid; place-items: center; margin-left: auto; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; }
.card-share:hover, .card-share:focus-visible { background: var(--brand-soft); color: var(--brand-ink); outline: 2px solid transparent; }
.card-share svg { width: 14px; height: 14px; }
.detail-visual { min-height: 128px; margin: 0 0 18px; border-radius: 9px; }
.detail-visual svg { width: 40px; height: 40px; }
.detail-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.detail-actions .visit { margin: 0 !important; }
.detail-share { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; background: var(--surface); color: var(--brand-ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.detail-share svg { width: 14px; height: 14px; }
dialog#help { border: 0; width: min(520px, 92vw); padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog#help::backdrop { background: rgba(10, 12, 16, .5); }
.help-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px 8px; }
.help-head h2 { margin: 0; font-size: 20px; }
.help-head .detail-close { position: static; float: none; margin: 0; }
.help-body { padding: 8px 24px 24px; }
.help-body ol { list-style: none; margin: 0; padding: 0; counter-reset: help; }
.help-body li { counter-increment: help; display: grid; grid-template-columns: 30px 1fr; gap: 2px 10px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.help-body li::before { content: "0" counter(help); grid-row: 1 / 3; color: var(--brand); font-size: 11px; font-weight: 800; }
.help-body li strong, .help-body li span { grid-column: 2; }
.help-body li strong { font-size: 13px; }
.help-body li span { color: var(--text-muted); font-size: 12px; }
.help-body > p { margin: 16px 0 0; padding: 11px; border-radius: 7px; background: var(--safe-warn-bg); color: var(--safe-warn); font-size: 11px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 14px); padding: 10px 14px; border-radius: 999px; background: var(--text); color: var(--surface); box-shadow: var(--shadow); font-size: 12px; opacity: 0; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }
@media (max-width: 820px) {
  .landing-hero { grid-template-columns: 1fr 250px; gap: 28px; }
  .landing-aside { min-height: 190px; }
  .landing-meta { grid-template-columns: 1fr 1fr; }
  .landing-meta .meta-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .site-header .lede { display: none; }
  .landing-hero { grid-template-columns: 1fr; }
  .landing-aside { min-height: 164px; }
  .landing-meta { grid-template-columns: 1fr; }
  .landing-meta .meta-card:last-child { grid-column: auto; }
  .grid { grid-template-columns: 1fr; }
  .card { min-height: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 8px 12px; padding: 9px; }
  .card .card-visual { grid-row: 1 / 4; min-height: 128px; padding: 10px; }
  .card .card-visual > .tool-visual-label { display: none; }
  .card .card-top, .card .chips-row, .card .card-foot, .card .compare-choice { grid-column: 2; }
  .card h3 { min-height: 0; font-size: 15px; }
  .card .chips-row { margin: 0; }
  .card-foot { border: 0; padding-top: 0; }
  .toolbar { position: static; }
  .toolbar-right { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .toolbar-right .sort-label { display: none; }
  .toolbar-right > * { min-width: 0; }
  .toolbar-right .count { align-self: center; text-align: center; }
  .toolbar-right .btn-reset, #sort { padding: 8px 6px; font-size: 11px; }
}

/* Clickable filtered cards with structured facts */
.grid { grid-template-columns: repeat(auto-fill, minmax(286px, 1fr)); gap: 12px; }
.card { position: relative; min-height: 360px; padding: 11px; gap: 12px; }
.card:hover, .card:focus-within { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-open { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.card-open:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.card-lesson { padding: 3px 2px 1px; }
.card-lesson > span { display: block; margin-bottom: 5px; color: var(--brand); font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.card-lesson > strong { display: -webkit-box; overflow: hidden; min-height: 48px; color: var(--text); font-size: 16px; font-weight: 720; line-height: 1.48; letter-spacing: -.035em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.card-fact { min-width: 0; min-height: 72px; display: flex; flex-direction: column; gap: 7px; padding: 9px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text-muted); }
.card-fact > svg { width: 14px; height: 14px; color: var(--brand); }
.card-fact > span { display: flex; flex-direction: column; min-width: 0; }
.card-fact small { color: var(--text-muted); font-size: 8.5px; font-weight: 700; letter-spacing: .04em; }
.card-fact strong { overflow: hidden; margin-top: 2px; color: var(--text); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.card-fact.fact-safe > svg, .card-fact.ok > svg { color: var(--safe-ok); }
.card-fact.warn > svg { color: var(--safe-warn); }
.card-fact.danger > svg { color: var(--safe-danger); }
.card-foot { position: relative; margin-top: auto; padding: 4px 2px 0; border: 0; }
.card-actions { width: 100%; justify-content: space-between; }
.card-open-hint { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink); font-size: 11px; font-weight: 800; }
.card-open-hint svg { width: 13px; height: 13px; }
.card-share { position: relative; z-index: 2; }
.compare-choice { position: relative; z-index: 2; }
.detail-lesson { margin: 16px 0 8px; padding: 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-lesson span { display: block; margin-bottom: 7px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .05em; }
.detail-lesson strong { display: block; font-size: clamp(20px, 4vw, 28px); line-height: 1.34; letter-spacing: -.045em; }
@media (max-width: 620px) {
  .card { display: flex; min-height: 0; padding: 10px; gap: 10px; }
  .card .card-visual { min-height: 108px; padding: 11px; }
  .card .card-visual > .tool-visual-label { display: block; }
  .card .card-top, .card .card-lesson, .card .card-facts, .card .card-foot, .card .compare-choice { width: 100%; }
  .card h3 { font-size: 17px; }
  .card-lesson > strong { min-height: 0; font-size: 15px; -webkit-line-clamp: 2; }
  .card-fact { min-height: 64px; }
  .card-fact strong { font-size: 9.5px; }
}

/* Viewport-fit detail: keep the visual summary still and scroll only the facts. */
dialog#detail {
  width: min(560px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}

dialog#detail .detail-close {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
  float: none;
  margin: 0;
}

#detail-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  clear: none;
}

.detail-summary {
  flex: 0 0 auto;
  padding: 12px 26px 0;
}

.detail-summary .detail-visual {
  min-height: 82px;
  margin-bottom: 12px;
}

.detail-summary .detail-visual svg {
  width: 32px;
  height: 32px;
}

.detail-summary .one-liner {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.detail-summary .detail-lesson {
  margin: 10px 0 0;
  padding: 12px 0 14px;
  border-bottom: 0;
}

.detail-summary .detail-lesson strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(18px, 3vw, 24px);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 26px 26px;
  border-top: 1px solid var(--border);
  scrollbar-gutter: stable;
}

#detail-body .detail-scroll dl {
  margin-top: 16px;
}

/* 상세 하단 동작 줄: 스크롤 영역 밖에 고정 (왼쪽 공식 페이지 방문 / 오른쪽 공유하기) */
#detail-body > .detail-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 12px 26px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.detail-actions .btn-visit {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 7px;
  border: 1px solid var(--brand); background: var(--brand);
  color: #fff; font-size: 12.5px; font-weight: 700; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .detail-actions .btn-visit { color: #10241a; } }
.detail-actions .btn-visit:hover { background: var(--brand-ink); border-color: var(--brand-ink); text-decoration: none; }
.detail-actions .btn-visit svg { width: 14px; height: 14px; }
.detail-actions .detail-share { margin-left: auto; }

/* 분야 바로 바꾸기 드롭다운 */
.category-menu-wrap { position: relative; display: inline-flex; }
.category-menu-wrap #home i[data-lucide="chevron-down"] svg,
.category-menu-wrap #home svg:last-child { transition: transform .18s ease; }
.category-menu-wrap.is-open #home svg:last-child { transform: rotate(180deg); }
.category-menu {
  position: absolute; z-index: 12; top: calc(100% + 6px); left: 0;
  display: none; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 2px;
  width: max-content; max-width: min(420px, 88vw); padding: 6px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow);
}
.category-menu-wrap.is-open .category-menu { display: grid; }
.category-menu-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
}
.category-menu-item:hover, .category-menu-item:focus-visible { background: var(--brand-soft); color: var(--brand-ink); outline: 0; }
.category-menu-item svg { width: 15px; height: 15px; color: var(--brand); }
.category-menu-item strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.category-menu-item span { color: var(--text-muted); font-size: 11px; }
.category-menu-item.is-all { grid-column: 1 / -1; margin-top: 2px; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; }
@media (max-width: 620px) { .category-menu { grid-template-columns: 1fr; max-height: 60vh; overflow-y: auto; } }

/* 설문 플로팅 버튼 (edu-kit 패턴 계승) */
.survey-fab {
  position: fixed; z-index: 15; right: 22px; bottom: 22px;
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 50%; background: var(--brand); color: #fff;
  box-shadow: 0 6px 18px rgba(29, 39, 34, .22); text-decoration: none;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
@media (prefers-color-scheme: dark) { .survey-fab { color: #10241a; } }
.survey-fab:hover { background: var(--brand-ink); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(29, 39, 34, .3); }
.survey-fab:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.survey-fab svg { width: 21px; height: 21px; }
.survey-fab__tip {
  position: absolute; right: calc(100% + 10px); top: 50%;
  transform: translateY(-50%) translateX(4px);
  white-space: nowrap; background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 4px 14px rgba(29, 39, 34, .22);
}
.survey-fab:hover .survey-fab__tip, .survey-fab:focus-visible .survey-fab__tip { opacity: 1; transform: translateY(-50%) translateX(0); }
@media (max-width: 620px) { .survey-fab { right: 14px; bottom: 14px; width: 44px; height: 44px; } }

@media (max-width: 620px) {
  dialog#detail {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .detail-summary {
    padding: 8px 18px 0;
  }

  .detail-scroll {
    padding: 0 18px 22px;
  }

  .detail-summary .detail-visual {
    min-height: 64px;
    margin-bottom: 9px;
  }

  .detail-summary .detail-lesson {
    padding: 10px 0 12px;
  }
}

/* ── dgedu.link 공유 디자인 토큰(edu-kit 계승) + nav 앱 시그니처 ──
   중립·시맨틱은 dgedu.link 패밀리 공유 어휘, 브랜드 그린은 이 앱(nav)의 시그니처 램프.
   값은 현재 '조용한 도서관' 색과 동일 — 어휘 통일이 목적이라 시각 변화 없음.
   edu-kit(kit.dgedu.link)은 Codeit 블루, nav(nav.dgedu.link)는 파인그린으로 앱을 구분. */
:root {
  /* 폰트 (edu-kit과 동일) */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;

  /* 시맨틱 램프 (성공/주의/위험/정보) — edu-kit 값 공유 */
  --color-success-50:#ecfdf5; --color-success-500:#10b981; --color-success-600:#059669; --color-success-700:#047857; --color-success:#059669;
  --color-warning-50:#fffbeb; --color-warning-500:#f59e0b; --color-warning-600:#d97706; --color-warning-700:#b45309; --color-warning:#d97706;
  --color-danger-50:#fff1f2;  --color-danger-500:#f43f5e;  --color-danger-600:#e11d48;  --color-danger-700:#be123c;  --color-danger:#e11d48;
  --color-info-50:#f0f9ff;    --color-info-500:#0ea5e9;    --color-info-600:#0284c7;    --color-info-700:#0369a1;    --color-info:#0284c7;

  /* nav 시그니처 그린 램프 (나침반·조용한 도서관) */
  --color-nav-50:#eef5f1; --color-nav-100:#c7ead2; --color-nav-200:#a9cfb7; --color-nav-300:#7dab90;
  --color-nav-400:#4f8467; --color-nav-500:#315b49; --color-nav-600:#275d42; --color-nav-700:#203e31;
  --color-nav-800:#26392d; --color-nav-900:#18271e;

  /* 앱 브랜드 alias → nav 램프 (값은 기존과 동일, 어휘만 램프로 통일) */
  --brand: var(--color-nav-600);
  --brand-ink: var(--color-nav-700);
  --brand-soft: var(--color-nav-50);
  --accent: var(--color-nav-600);
}

/* GPT-Image north-pointing compass brand, flattened to the exact two-color palette. */
.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 0;
  /* 로고 배경이 불투명한 밝은 색이라 타일처럼 라운드 처리 */
  border-radius: 8px;
  background: transparent;
}
.site-header h1 { font-weight: 700; }
.landing-guide > span { display: inline-flex; align-items: center; gap: 5px; }
.landing-guide > span > svg { width: 14px; height: 14px; color: var(--color-nav-600); stroke-width: 1.8; }
@media (prefers-color-scheme: dark) {
  :root {
    --brand: var(--color-nav-200);
    --brand-ink: var(--color-nav-100);
    --brand-soft: var(--color-nav-800);
    --accent: #b9ddc5;
  }
}

/* 모바일 접근성: 필터 옵션 탭 타깃 확대 (WCAG 2.5.8 최소 24px 충족) */
.checks label, .toggle { min-height: 30px; }
