:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --bg: #181716;
  --surface: #242220;
  --raised: #2d2925;
  --line: #443d35;
  --text: #f7efe3;
  --muted: #c4b8a7;
  --accent: #ffd18b;
  --primary: #ffbd65;
  --primary-hover: #ffd496;
  --on-accent: #322013;
  --danger: #ffc1b0;
  --paper: #f8f0e3;
  --ink: #2b2219;
  --gutter: clamp(13px, 3.6vw, 44px);
  color: var(--text);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled, [aria-disabled='true'] { opacity: .52; cursor: not-allowed; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.site-width { width: min(100%, 1450px); padding-inline: var(--gutter); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--line); background: var(--bg); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 59px; }
.wordmark { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: .025em; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; width: 25px; height: 24px; border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); }
.brand-icon::before { content: ''; margin-left: 2px; border-block: 4px solid transparent; border-left: 7px solid currentColor; }
.brand-task, .text-link { color: var(--accent); font-size: 14px; font-weight: 650; text-underline-offset: 5px; }
.brand-task { padding: 6px 0; text-decoration-color: #aa8555; }
.brand-task:hover, .text-link:hover { text-decoration-color: currentColor; }

.category-bar { position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); background: #1d1a18; }
.categories {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-inline: contain; max-width: 825px;
}
.categories::-webkit-scrollbar { display: none; }
.category {
  display: flex; align-items: center; justify-content: center; white-space: nowrap;
  min-height: 47px; padding: 7px 3px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font-size: 15px;
}
.category[aria-pressed='true'] { border-bottom-color: var(--primary); color: var(--accent); font-weight: 750; }
.category:hover { color: var(--text); }
.category:focus-visible { outline-offset: -4px; }

.main { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.search {
  display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  margin: 14px 0 21px; padding: 3px 3px 3px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
.search:focus-within { border-color: #b09062; }
.search-icon { position: relative; width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 50%; }
.search-icon::after { content: ''; position: absolute; top: 9px; left: 8px; width: 6px; height: 1.5px; background: var(--muted); rotate: 43deg; transform-origin: left; }
.search input { width: 100%; min-width: 0; padding: 7px 3px; border: 0; background: transparent; color: var(--text); outline: none; }
.search input::placeholder { color: var(--muted); }
.action, .search button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 8px 17px;
  border: 1px solid transparent; border-radius: 5px; background: var(--primary); color: var(--on-accent);
  font-weight: 750; line-height: 1.35; text-decoration: none;
}
.action:hover, .search button:hover { background: var(--primary-hover); }
.search button { min-height: 36px; }

.collection-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 14px; margin-bottom: 12px; }
.collection-header h1 { margin: 0; font-size: clamp(23px, 2.5vw, 33px); line-height: 1.25; }
.collection-header p { margin: 0; color: var(--muted); font-size: 14px; white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.1vw, 28px) clamp(9px, 1.4vw, 21px); }
.card { position: relative; min-width: 0; cursor: pointer; }
.card-open { display: block; width: 100%; padding: 0 0 1px; border: 0; border-radius: 5px; background: transparent; color: inherit; text-align: left; }
.poster { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 5px; background: var(--raised); }
.poster img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.poster-mosaic { position: absolute; inset: auto 0 0; width: 100%; height: 25%; opacity: .72; image-rendering: pixelated; pointer-events: none; }
.poster-placeholder { display: grid; place-items: center; height: 100%; border: 1px solid var(--line); border-radius: inherit; color: var(--muted); font-size: 14px; }
.card-title { display: block; padding: 7px 0 2px; font-size: clamp(15px, 1.4vw, 18px); font-weight: 700; line-height: 1.4; }
.card:hover .card-title { color: var(--accent); }
.card-status { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.card-lock { position: relative; flex: 0 0 10px; height: 7px; margin-top: 4px; border-radius: 2px; background: var(--accent); }
.card-lock::before { position: absolute; inset: -4px 2px auto; height: 5px; border: 1px solid var(--accent); border-radius: 4px 4px 0 0; content: ''; }
.card-lock::after { position: absolute; top: 2px; left: 4px; width: 2px; height: 3px; border-radius: 1px; background: var(--on-accent); content: ''; }
.genre-badge { position: absolute; top: 6px; left: 6px; padding: 4px 6px; border: 0; border-radius: 3px; background: #211a15e8; color: #fff1dc; font-size: 12px; font-weight: 650; }
.genre-badge:hover { background: #633d27; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 24px; }
.page-button, .secondary { min-height: 40px; min-width: 38px; padding: 6px 11px; border: 1px solid #74604a; border-radius: 5px; background: var(--surface); color: var(--text); text-decoration: none; }
.page-button[aria-current='page'] { background: var(--accent); color: var(--on-accent); font-weight: 750; }
.page-button:hover, .secondary:hover { border-color: var(--accent); }

.quick-nav { position: fixed; inset: auto 0 0; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; border-top: 1px solid var(--line); background: #1d1a17fa; padding: 6px var(--gutter) max(6px, env(safe-area-inset-bottom)); }
.quick-nav button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 39px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 14px; }
.quick-nav button span { font-size: 18px; }
.quick-nav .quick-current, .quick-nav button:hover { color: var(--accent); }

.modal { color-scheme: light; width: min(410px, calc(100% - 28px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid #eddae4; border-radius: 19px; background: #fffafc; color: #2f222b; box-shadow: 0 20px 55px #0e0c14a6; }
.modal::backdrop { background: #13111cd1; }
.modal-panel { position: relative; padding: clamp(18px, 5.4vw, 28px); }
.modal :focus-visible { outline-color: #a32a60; }
.modal-close { position: absolute; top: 8px; right: 8px; width: 35px; height: 35px; border: 0; border-radius: 8px; background: transparent; color: #704c60; padding: 0; font-size: 23px; }
.modal-close:hover { background: #f8e8ef; }
.resource-offer { padding-top: 27px; text-align: center; }
.resource-offer h2 { margin: 2px 15px 8px; font-size: clamp(20px, 5.6vw, 25px); line-height: 1.35; }
.offer-mark { color: #b84778; margin-inline-end: 4px; }
.resource-offer p { margin: 0; color: #604d59; font-size: 14px; line-height: 1.55; }
.resource-offer .offer-attendance { margin-top: 14px; padding: 7px 12px; border: 1px solid #f0d5cf; border-radius: 11px; background: #fff0e8; color: #70423c; }
.offer-attendance strong { margin-inline-end: 3px; color: #99354d; font-size: 19px; font-variant-numeric: tabular-nums; }
.resource-offer .offer-action { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 76px; margin-top: 14px; padding: 9px 10px; border-radius: 12px; background: linear-gradient(112deg, #bb145e, #ca337b); color: #fff; }
.resource-offer .offer-action:hover { background: #a9155a; }
.offer-action strong { font-size: 20px; }
.offer-action span { font-size: 13px; font-weight: 650; }
.welcome-modal { width: min(360px, calc(100% - 28px)); color-scheme: dark; border-color: #494150; background: #2a2430; color: #fff6ed; }
.welcome-panel { text-align: center; padding-top: 25px; }
.welcome-panel .modal-close { color: #e5cbd0; }
.welcome-panel .modal-close:hover { background: #4c3944; }
.welcome-panel :focus-visible { outline-color: #ffc374; }
.welcome-mark { display: block; margin: 0 auto 9px; font-size: 38px; line-height: 1.15; }
.welcome-panel h2 { margin: 0 8px; font-size: clamp(20px, 5.6vw, 24px); line-height: 1.3; }
.welcome-list { display: grid; gap: 8px; padding: 0; margin: 16px 0 18px; list-style: none; text-align: left; }
.welcome-list li { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 7px 10px; border-radius: 8px; background: #393240; color: #eadbe0; font-size: 13px; line-height: 1.45; }
.welcome-list li span { flex: 0 0 23px; text-align: center; }
.welcome-panel .welcome-action { width: 100%; min-height: 46px; border-radius: 8px; background: #ffae59; color: #331b13; }
.welcome-panel .welcome-action:hover { background: #ffc383; }

@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .brand-row { min-height: 49px; }
  .wordmark { font-size: 17px; }
  .category { min-height: 43px; font-size: 13px; }
  .search { margin-block: 10px 14px; }
  .collection-header { margin-bottom: 9px; }
}
@media (max-width: 350px) { .categories { gap: 1px; grid-template-columns: repeat(6, minmax(46px, 1fr)); } .category { padding-inline: 2px; font-size: 12px; } }
