:root {
  color-scheme: dark;
  --page: #111411;
  --panel: #171b17;
  --panel-raised: #1b201b;
  --line: #30382f;
  --text: #eceee5;
  --muted: #9da99c;
  --subtle: #788575;
  --accent: #d5e99b;
  --focus: #e3f5ab;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--page); color: var(--text); font-size: 14px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.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; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; color: #121811; background: var(--accent); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.topbar { position: sticky; top: 0; z-index: 30; height: 72px; display: flex; align-items: center; padding: 0 32px; gap: 21px; background: #141814; border-bottom: 1px solid var(--line); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #c9d2c5; cursor: pointer; }
.icon-button:hover { background: #252c24; border-color: #3b4738; color: white; }
.menu-toggle { margin-left: -8px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand strong, .brand small { display: block; line-height: 1; }
.brand strong { font-size: 12px; letter-spacing: .115em; font-weight: 760; }
.brand small { margin-top: 5px; font-size: 9px; letter-spacing: .2em; color: var(--muted); }
.brand-mark { width: 24px; height: 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(-6deg); }
.brand-mark span { border: 1.5px solid var(--accent); }
.brand-mark span:nth-child(2) { background: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .12em; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #b9d982; }
.top-count { padding-left: 15px; margin-left: 7px; border-left: 1px solid var(--line); color: #d4ddcf; letter-spacing: .02em; }

.layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.layout.sidebar-closed { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar { position: sticky; top: 72px; z-index: 20; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; height: calc(100vh - 72px); padding: 31px 18px 22px; background: #171b17; border-right: 1px solid var(--line); scrollbar-color: #485348 transparent; scrollbar-width: thin; }
.sidebar-closed .sidebar { visibility: hidden; padding-left: 0; padding-right: 0; border: 0; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: var(--subtle); font-size: 10px; font-weight: 750; letter-spacing: .14em; }
.category-nav { display: grid; gap: 4px; margin-top: 15px; }
.category-button, .group-button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; cursor: pointer; }
.category-button { position: relative; min-height: 44px; padding: 0 12px; border-radius: 5px; background: transparent; color: #b7c2b4; font-weight: 600; }
.category-button:hover, .group-button:hover { background: #252d24; color: white; }
.category-button[aria-current="page"] { background: #2a3327; color: #eef6e3; }
.category-button[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; background: var(--accent); border-radius: 2px; }
.category-button svg { width: 18px; height: 18px; flex: 0 0 auto; color: #9eaf98; }
.category-button[aria-current="page"] svg { color: var(--accent); }
.category-button .count { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.sidebar-divider { margin: 26px 12px 23px; border-top: 1px solid var(--line); }
.group-heading { padding-bottom: 10px; }
.group-nav { display: grid; gap: 1px; }
.group-button { min-height: 34px; padding: 7px 12px; background: transparent; color: #a4b0a2; border-radius: 4px; line-height: 1.35; font-size: 12px; }
.group-button .group-name { flex: 1; overflow-wrap: anywhere; }
.group-button .group-count { color: var(--subtle); font-size: 11px; }
.group-button[aria-current="true"] { background: #262e24; color: #e8f1df; }
.group-button[aria-current="true"] .group-count { color: var(--accent); }
.sidebar-footer { margin: auto 12px 0; padding-top: 32px; color: #95a291; font-size: 11px; line-height: 1.65; }
.footer-rule { display: block; width: 24px; height: 1px; background: #a3ba80; }
.sidebar-footer p { margin: 13px 0 14px; }
.sidebar-footer small { color: var(--subtle); font-size: 9px; letter-spacing: .07em; }

.main { min-width: 0; width: 100%; padding: 48px clamp(24px, 4vw, 68px) 24px; }
.page-heading, .catalog, .main-footer { max-width: 1660px; margin-left: auto; margin-right: auto; }
.page-heading { padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 9px; color: #a7b7a0; font-size: 10px; font-weight: 700; letter-spacing: .15em; }
.eyebrow-marker { width: 20px; height: 2px; background: var(--accent); }
.eyebrow-separator { color: #5e6b5d; }
.heading-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-top: 17px; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 48px); line-height: 1.2; letter-spacing: -.055em; font-weight: 720; }
.page-description { margin: 12px 0 0; color: #a7b3a3; line-height: 1.6; font-size: 14px; }
.archive-button, .primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 11px; text-decoration: none; border: 1px solid transparent; border-radius: 5px; transition: background .15s ease, border-color .15s ease; }
.archive-button { padding: 11px 15px; min-width: 196px; min-height: 52px; background: var(--accent); color: #172013; }
.archive-button:hover, .primary-button:hover { background: #e5f5b2; }
.archive-button svg { flex: 0 0 auto; }
.archive-button strong, .archive-button small { display: block; }
.archive-button strong { font-size: 12px; font-weight: 750; }
.archive-button small { margin-top: 3px; font-size: 10px; color: #3f5137; }

.catalog { padding-top: 28px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.results-label { display: flex; align-items: center; gap: 14px; min-width: 0; }
.section-index { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid #52624c; border-radius: 50%; color: var(--accent); font-size: 10px; letter-spacing: .03em; }
.results-label h2 { margin: 0; font-size: 15px; line-height: 1.35; letter-spacing: -.02em; }
.results-label p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.search-box { display: flex; align-items: center; gap: 9px; width: min(100%, 300px); height: 42px; padding: 0 12px; background: #191e19; border: 1px solid #353e34; border-radius: 5px; color: #9dab9a; }
.search-box:focus-within { border-color: #9fb590; }
.search-box svg { width: 17px; height: 17px; flex: 0 0 auto; }
.search-box input { width: 100%; min-width: 0; padding: 0; background: transparent; color: var(--text); border: 0; outline: 0; font-size: 12px; }
.search-box input::placeholder { color: #96a292; }
.search-shortcut { display: grid; place-items: center; width: 19px; height: 20px; flex: 0 0 auto; border: 1px solid #445044; border-radius: 3px; font-size: 10px; }
.active-filter { display: flex; align-items: center; gap: 10px; margin: -4px 0 20px; color: #dce9d4; font-size: 12px; }
.active-filter > span { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 9px; border: 1px solid #52624c; border-radius: 3px; }
.active-filter button { padding: 6px; border: 0; background: transparent; color: #adbba8; cursor: pointer; }
.active-filter button:hover { color: white; }
.catalog-status { margin: 24px 0; padding: 32px; background: #191e19; border: 1px solid var(--line); color: #bfcbb9; line-height: 1.6; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 25px 18px; }
.gallery-card { min-width: 0; }
.card-preview { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; padding: 0; border: 1px solid #354034; border-radius: 3px; background: #262d25; color: #d6ded2; cursor: zoom-in; }
.card-preview:hover { border-color: #96b37f; }
.card-preview img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.card-preview:hover img { transform: scale(1.025); }
.card-number { position: absolute; left: 10px; top: 10px; padding: 4px 6px; background: rgba(16, 20, 16, .78); color: #d5e0cf; border: 1px solid rgba(198, 216, 185, .22); font-size: 10px; letter-spacing: .05em; }
.card-missing { display: grid; place-items: center; height: 100%; color: #aebba8; font-size: 12px; }
.card-details { display: flex; align-items: start; gap: 8px; margin-top: 10px; }
.card-copy { min-width: 0; flex: 1; }
.card-name { margin: 0; overflow-wrap: anywhere; color: #e7ece1; font-size: 12px; line-height: 1.45; font-weight: 650; }
.card-group { margin: 5px 0 0; color: #9eac99; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.card-download { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border: 1px solid #3d483b; border-radius: 4px; color: #d8e6d2; text-decoration: none; }
.card-download:hover { background: #2a3528; border-color: #91ac7e; }
.card-download svg { width: 16px; height: 16px; }
.more-wrap { padding: 39px 0 20px; text-align: center; }
.more-button { min-width: 180px; padding: 12px 18px; border: 1px solid #61715a; border-radius: 4px; background: #222b21; color: #e0ecd7; cursor: pointer; }
.more-button:hover { background: #303c2c; }
.more-button span { padding-left: 9px; }
.more-wrap p { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.main-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 68px; padding-top: 18px; border-top: 1px solid var(--line); color: #899888; font-size: 9px; font-weight: 650; letter-spacing: .1em; }

.preview-dialog { width: min(1120px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 1px solid #52604e; border-radius: 5px; background: #181d18; color: var(--text); }
.preview-dialog::backdrop { background: rgba(5, 8, 5, .84); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; }
.dialog-overline { margin: 0 0 7px; color: #a9bba2; font-size: 10px; letter-spacing: .06em; overflow-wrap: anywhere; }
.dialog-header h2 { margin: 0; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.dialog-close { flex: 0 0 auto; }
.dialog-image-wrap { display: grid; place-items: center; min-height: 180px; max-height: 65dvh; overflow: auto; background: #101410; }
.dialog-image-wrap img { display: block; max-width: 100%; max-height: 65dvh; object-fit: contain; }
.dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 24px 20px; }
.dialog-footer p { margin: 0; color: #aab7a6; font-size: 11px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.primary-button, .secondary-button { min-height: 40px; padding: 9px 13px; font-size: 12px; font-weight: 650; }
.primary-button { background: var(--accent); color: #172013; }
.secondary-button { border-color: #52614e; color: #e1e8dc; }
.secondary-button:hover { background: #293328; }

@media (max-width: 800px) {
  .topbar { height: 64px; padding: 0 18px; gap: 14px; }
  .topbar-right > span:not(.top-count) { display: none; }
  .top-count { border: 0; padding: 0; margin: 0; }
  .layout, .layout.sidebar-closed { display: block; min-height: calc(100vh - 64px); }
  .sidebar { position: fixed; top: 64px; left: 0; z-index: 25; width: min(300px, 85vw); height: calc(100dvh - 64px); transform: translateX(-105%); transition: transform .2s ease, visibility .2s; box-shadow: 14px 0 35px rgba(0,0,0,.24); }
  .sidebar-closed .sidebar { visibility: hidden; padding: 31px 18px 22px; border-right: 1px solid var(--line); }
  .layout.sidebar-open .sidebar { visibility: visible; transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 64px 0 0; z-index: 24; background: rgba(0,0,0,.62); }
  .main { padding: 36px 18px 24px; }
  .page-heading { padding-bottom: 28px; }
  .heading-row { align-items: flex-start; flex-direction: column; margin-top: 15px; }
  .archive-button { min-height: 44px; min-width: 185px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 17px; }
  .search-box { max-width: none; width: 100%; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 12px; }
  .main-footer { flex-wrap: wrap; }
  .dialog-footer { align-items: stretch; flex-direction: column; gap: 12px; }
  .dialog-actions { justify-content: flex-end; }
}

@media (max-width: 380px) {
  .brand strong { font-size: 10px; }
  .brand small { font-size: 8px; }
  .top-count { font-size: 9px; }
  .card-name { font-size: 11px; }
  .card-group { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
