:root {
  color-scheme: light;
  --canvas: #f8f9f5;
  --surface: #fff;
  --ink: #1c2a25;
  --muted: #576660;
  --line: #e0e6de;
  --soft: #eff4ed;
  --forest: #1e4d3e;
  --deep: #173c32;
  --accent: #c33e57;
  --accent-hover: #ac2e47;
  --radius: 14px;
  --shadow: 0 10px 26px rgb(23 60 50 / 9%);
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
body.has-dialog { overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid #27785d; outline-offset: 3px; }
h1[tabindex]:focus, main[tabindex]:focus { outline: none; }
[hidden] { display: none !important; }
svg { display: block; flex: none; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 12px; background: white; border-radius: 8px; }

.shell { width: min(1320px, calc(100% - 88px)); margin-inline: auto; }
.masthead { position: relative; z-index: 4; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 77px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; position: relative; }
.brand { display: inline-flex; justify-self: start; align-items: center; gap: 10px; white-space: nowrap; font-size: 1.39rem; font-weight: 800; letter-spacing: -.085em; line-height: 1.2; }
.brand-symbol { width: 41px; height: 41px; border-radius: 12px; background: var(--forest); color: #fff; display: grid; place-items: center; }
.primary-nav { display: flex; align-items: center; gap: 8px; }
.nav-item, .my-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; }
.nav-item { padding: 0 13px; background: transparent; color: var(--ink); font-size: .94rem; font-weight: 700; }
.nav-item svg { color: #526d60; }
.nav-item svg:last-child { opacity: .75; }
.nav-item:hover, .nav-item[aria-expanded="true"], .nav-item.selected { background: var(--soft); color: var(--forest); }
.nav-item[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.my-link { justify-self: end; padding: 0 16px; border-color: var(--line); color: var(--forest); font-size: .87rem; font-weight: 750; }
.my-link:hover, .my-link[aria-current] { background: var(--soft); border-color: #cddacd; }

.category-panel { position: absolute; z-index: 5; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: min(670px, 100%); padding: 22px; border-radius: 20px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; gap: 11px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.panel-heading strong { font-size: 1.15rem; }
.panel-heading a { margin-left: auto; color: var(--forest); font-size: .875rem; font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.panel-groups { display: grid; gap: 15px; padding-top: 17px; }
.panel-section { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: baseline; }
.panel-section p { margin: 0; font-size: .875rem; color: var(--muted); font-weight: 650; }
.panel-links { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-links a { display: inline-flex; min-height: 36px; align-items: center; padding: 5px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: .875rem; }
.panel-links a:hover { background: var(--soft); border-color: #cddacd; }

.hero { position: relative; isolation: isolate; min-height: 281px; display: grid; align-items: center; overflow: hidden; background: var(--deep); border-radius: 24px; margin-top: 27px; color: white; }
.hero-art { position: absolute; inset: 0 0 0 41%; z-index: -1; background: #214638 url("assets/library-hero.png") center 53% / cover no-repeat; }
.hero-art::after { position: absolute; content: ""; inset: 0; background: linear-gradient(90deg, var(--deep) 0, rgb(23 60 50 / 60%) 23%, transparent 56%); }
.hero-copy { padding: 32px 42px 36px; }
.hero-label { color: #c3ddc9; font-size: .9rem; font-weight: 650; letter-spacing: -.014em; }
.hero h1 { margin: 9px 0 9px; font-size: clamp(2.25rem, 4.2vw, 3.2rem); font-weight: 780; line-height: 1.2; letter-spacing: -.085em; }
.hero p { margin: 0 0 22px; font-size: 1rem; line-height: 1.55; color: #e0ede3; letter-spacing: -.03em; }
.search { width: min(100%, 419px); min-height: 52px; display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 999px; background: white; color: var(--ink); box-shadow: 0 3px 12px rgb(0 0 0 / 10%); }
.search:focus-within { outline: 2px solid #849d84; outline-offset: 3px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0 4px 0 15px; background: transparent; color: var(--ink); font-size: 1rem; }
.search input::placeholder { color: #606d65; opacity: 1; }
.search-button { width: 43px; height: 43px; display: grid; place-items: center; flex: none; border: 0; border-radius: 50%; color: white; background: var(--accent); }
.search-button:hover { background: var(--accent-hover); }
.search-light { border: 1px solid #d3dcd1; box-shadow: none; margin-bottom: 23px; }

.library-layout { display: grid; grid-template-columns: 221px minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 32px; margin-bottom: 66px; }
.view { min-width: 0; }
.sidebar { border: 1px solid var(--line); background: var(--surface); border-radius: 17px; padding: 20px 16px 15px; }
.mobile-sidebar { display: none; }
.side-group { border-bottom: 1px solid #edf0eb; padding: 15px 0 13px; }
.side-group:first-child { padding-top: 0; }
.side-group h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--forest); font-size: .89rem; white-space: nowrap; letter-spacing: -.045em; font-weight: 770; }
.side-group h2 svg { color: #547162; }
.side-group ul { display: flex; flex-wrap: wrap; gap: 1px 3px; margin: 0; padding: 0; list-style: none; }
.side-group li { display: flex; }
.side-group li a { display: flex; align-items: center; min-height: 33px; border-radius: 6px; padding: 3px 6px; color: var(--muted); font-size: .875rem; line-height: 1.4; letter-spacing: -.04em; }
.side-group li a:hover, .side-group li a[aria-current] { background: var(--soft); color: var(--forest); }
.original-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; min-height: 37px; padding: 0 5px; font-size: .84rem; font-weight: 700; color: var(--forest); }
.original-link:hover { text-decoration: underline; }

.shelf { margin-bottom: 33px; }
.shelf + .shelf { border-top: 1px solid var(--line); padding-top: 23px; }
.shelf-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 16px; }
.section-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: .855rem; font-weight: 760; color: #326047; letter-spacing: -.03em; }
.section-kicker.en { color: #805325; }
.section-kicker.video { color: #345975; }
.shelf-heading h2 { margin: 5px 0 0; font-size: clamp(1.45rem, 2.25vw, 1.82rem); font-weight: 780; letter-spacing: -.055em; line-height: 1.26; }
.shelf-actions { display: flex; align-items: center; white-space: nowrap; gap: 7px; }
.plain-link { display: inline-flex; align-items: center; min-height: 36px; margin-right: 6px; color: var(--forest); font-weight: 750; font-size: .875rem; }
.plain-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.round-button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid #d7ded6; border-radius: 50%; color: var(--ink); background: white; }
.round-button:hover:not(:disabled) { background: var(--soft); border-color: #b5c9b9; }
.round-button:disabled { color: #819087; opacity: .58; }

.card-grid { --columns: 6; --shelf-gap: 15px; display: grid; gap: 19px var(--shelf-gap); grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); }
.shelf-track { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--columns) - 1) * var(--shelf-gap)) / var(--columns)); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px; margin: -4px; scroll-padding-inline: 4px; overscroll-behavior-x: contain; }
.shelf-track::-webkit-scrollbar { display: none; }
.card { position: relative; min-width: 0; scroll-snap-align: start; }
.card-open { width: 100%; display: grid; gap: 7px; text-align: start; color: var(--ink); background: none; padding: 0; border: 0; border-radius: var(--radius); }
.cover { width: 100%; aspect-ratio: 95 / 105; display: block; border: 1px solid rgb(24 42 34 / 10%); border-radius: var(--radius); background-color: var(--soft); }
.photo-cover { background-image: url("assets/cover-reference.png"); background-position: var(--sheet-x) var(--sheet-y); background-size: var(--sheet-width) var(--sheet-height); background-repeat: no-repeat; background-origin: border-box; }
.placeholder-cover { display: grid; place-items: center; color: var(--forest); background: linear-gradient(145deg, #e6efe0, #f1f5ed); }
.placeholder-cover.en { color: #805325; background: linear-gradient(145deg, #fcf0d9, #fffaf0); }
.placeholder-cover.video { color: #345975; background: linear-gradient(145deg, #deebf3, #f1f7fb); }
.placeholder-cover.tools { color: #654974; background: linear-gradient(145deg, #ede4f0, #f8f3fa); }
.card-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .925rem; font-weight: 760; letter-spacing: -.025em; line-height: 1.45; }
.card-open:hover .card-title { color: #215c47; text-decoration: underline; text-underline-offset: 3px; }
.card-meta { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.card-meta > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.level { display: inline-flex; align-items: center; width: max-content; max-width: 100%; min-height: 22px; padding: 2px 7px; border-radius: 5px; background: #e9f0e8; color: #345b49; font-size: .76rem; font-weight: 800; letter-spacing: .02em; overflow-wrap: anywhere; }
.favorite { position: absolute; top: 7px; right: 7px; width: 35px; height: 35px; display: grid; place-items: center; padding: 0; border: 1px solid rgb(23 60 50 / 11%); border-radius: 50%; background: rgb(255 255 255 / 95%); color: #354b40; box-shadow: 0 2px 8px rgb(0 0 0 / 10%); }
.favorite:hover { background: #fff0f3; color: var(--accent); }
.favorite[aria-pressed="true"], .detail-save[aria-pressed="true"] { color: var(--accent); }
.favorite[aria-pressed="true"] svg, .detail-save[aria-pressed="true"] svg { fill: currentColor; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 11px; border: 1px solid #dce3da; border-radius: 999px; color: #465950; background: white; white-space: nowrap; font-size: .875rem; font-weight: 600; letter-spacing: -.03em; }
.chip:hover, .chip.active { background: #e9f1e8; color: var(--forest); border-color: #b8cdbc; }
.chip.active { font-weight: 800; }
.shelf-chips { margin: -3px 0 14px; }

.resource { display: grid; gap: 11px; padding: 16px 18px; margin: 16px 0 28px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); }
.resource h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 1.07rem; color: var(--forest); letter-spacing: -.03em; }
.resource p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.55; }
.resource-levels { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.resource-levels a { display: inline-flex; min-width: 37px; min-height: 35px; align-items: center; justify-content: center; color: #355d48; font-weight: 750; font-size: .9rem; border-radius: 6px; }
.resource-levels a:hover { background: var(--soft); }
.resource-youtube { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 11px; border-top: 1px solid var(--line); }
.resource-youtube strong { font-size: .9rem; }

.inner-page .library-layout { margin-top: 34px; min-height: calc(100vh - 250px); }
.page-intro { margin-bottom: 22px; }
.breadcrumb { display: inline-flex; align-items: center; min-height: 34px; color: var(--forest); font-weight: 730; font-size: .86rem; }
.breadcrumb:hover { text-decoration: underline; }
.page-intro h1 { margin: 6px 0 5px; font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.25; letter-spacing: -.064em; }
.page-intro p { margin: 9px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.browse-filters { display: grid; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.level-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); font-size: .875rem; }
.result-count { margin: 17px 0 10px; font-size: .925rem; color: #4e6357; font-weight: 700; }
.empty-state { min-height: 214px; padding: 24px 15px; display: grid; place-content: center; justify-items: center; gap: 9px; text-align: center; background: #fff; border: 1px dashed #c6d5c8; border-radius: var(--radius); }
.tile-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--forest); background: var(--soft); border-radius: 12px; }
.empty-state h2 { margin: 4px 0 0; font-size: 1.08rem; letter-spacing: -.03em; }
.empty-state p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.text-action { display: inline-flex; align-items: center; gap: 6px; min-height: 37px; color: var(--forest); font-size: .94rem; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.data-actions button, .detail-save { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; width: max-content; max-width: 100%; border: 1px solid #cbd9cc; border-radius: 9px; background: #fff; padding: 7px 13px; color: var(--forest); font-weight: 750; font-size: .92rem; }
.data-actions button:first-child, .data-actions button:hover, .detail-save:hover { background: var(--soft); }
.guide-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.guide-options a { min-height: 50px; padding: 12px 14px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 700; }
.guide-options a:hover { background: var(--soft); border-color: #cbd9cc; }

.site-footer { background: #fff; border-top: 1px solid var(--line); }
.footer-inner { min-height: 70px; display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); }
.footer-inner a { color: var(--forest); font-size: 1rem; font-weight: 800; }

dialog { position: fixed; width: min(595px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow-y: auto; margin: auto; border: 1px solid var(--line); border-radius: 21px; padding: 23px; background: #fff; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(11 27 21 / 56%); }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr); gap: 22px; align-items: start; }
.detail-grid .cover { margin-top: 3px; }
.detail-body { padding-top: 7px; }
.detail-body h2 { margin: 4px 19px 7px 0; font-size: 1.48rem; line-height: 1.26; overflow-wrap: anywhere; letter-spacing: -.045em; }
.detail-body p { margin: 8px 0 10px; }
.detail-body .detail-note { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.detail-save { margin-top: 3px; }
.toast { position: fixed; z-index: 10; bottom: 22px; left: 50%; transform: translate(-50%, 8px); opacity: 0; max-width: calc(100% - 24px); width: max-content; padding: 12px 17px; border-radius: 10px; background: #173c32; color: #fff; box-shadow: var(--shadow); font-size: .875rem; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 1550px) {
  .hero { min-height: 309px; }
  .hero-copy { padding-inline: 48px; }
}

@media (max-width: 1160px) {
  .shell { width: calc(100% - 56px); }
  .library-layout { grid-template-columns: 203px minmax(0, 1fr); gap: 24px; }
  .card-grid { --columns: 5; --shelf-gap: 12px; }
  .nav-item { padding-inline: 10px; }
}

@media (max-width: 960px) {
  .header-inner { gap: 10px; }
  .shell { width: calc(100% - 40px); }
  .primary-nav { gap: 2px; }
  .nav-item { gap: 5px; padding-inline: 8px; font-size: .87rem; }
  .nav-item svg:first-child { display: none; }
  .card-grid { --columns: 4; }
  .library-layout { grid-template-columns: 195px minmax(0, 1fr); gap: 18px; }
}

@media (max-width: 740px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { grid-template-columns: 1fr 1fr; grid-template-rows: 54px auto; gap: 0 8px; padding-top: 3px; }
  .brand { font-size: 1.25rem; }
  .brand-symbol { width: 36px; height: 36px; border-radius: 10px; }
  .my-link { min-height: 39px; padding-inline: 11px; }
  .primary-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; width: 100%; gap: 3px; margin-bottom: 4px; }
  .nav-item { min-height: 43px; padding-inline: clamp(4px, 1.5vw, 12px); }
  .category-panel { padding: 16px; }
  .panel-section { grid-template-columns: 1fr; gap: 7px; }
  .hero { min-height: 250px; margin-top: 17px; border-radius: 19px; }
  .hero-art { inset-inline-start: 24%; opacity: .82; }
  .hero-art::after { background: linear-gradient(90deg, var(--deep), rgb(23 60 50 / 76%) 32%, rgb(23 60 50 / 17%) 100%); }
  .hero-copy { padding: 22px 23px; }
  .hero p { max-width: 320px; margin-bottom: 15px; }
  .search { width: min(100%, 405px); }
  .library-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 16px; margin-bottom: 38px; }
  .inner-page .library-layout { margin-top: 16px; }
  .sidebar { padding: 0 13px; }
  .mobile-sidebar { display: flex; width: 100%; min-height: 45px; gap: 8px; align-items: center; padding: 0 3px; background: transparent; color: var(--forest); border: 0; font-weight: 750; font-size: .9rem; }
  .mobile-sidebar svg:last-child { margin-left: auto; }
  .mobile-sidebar[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
  .mobile-sidebar[aria-expanded="false"] + .guide-groups { display: none; }
  .guide-groups { display: grid; grid-template-columns: 1fr 1fr; column-gap: 11px; padding: 5px 0 8px; border-top: 1px solid var(--line); }
  .side-group:first-child { padding-top: 15px; }
  .side-group h2 { white-space: normal; }
  .shelf { margin-bottom: 25px; }
  .shelf + .shelf { padding-top: 18px; }
  .shelf-heading { margin-bottom: 12px; }
  .shelf-chips { margin-top: 0; }
  .favorite { width: 36px; height: 36px; }
}

@media (max-width: 515px) {
  .card-grid { --columns: 3; --shelf-gap: 9px; }
  .hero-copy { padding-inline: 17px; }
  .hero p { font-size: .94rem; }
  .shelf-actions { gap: 4px; }
  .round-button { width: 34px; height: 34px; }
  .plain-link { margin-right: 1px; font-size: .82rem; }
  .cover { border-radius: 12px; }
  .detail-grid { grid-template-columns: 85px minmax(0, 1fr); gap: 13px; }
  dialog { padding: 17px 13px; }
  .detail-body h2 { font-size: 1.16rem; margin-right: 30px; }
  .detail-save { font-size: .84rem; }
}

@media (max-width: 375px) {
  .shell { width: calc(100% - 24px); }
  .nav-item { font-size: .8rem; }
  .nav-item svg:last-child { width: 10px; }
  .favorite { top: 4px; right: 4px; }
  .card-meta { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
