:root {
  color-scheme: dark;
  --bg: #07111e;
  --panel: #0b192a;
  --gold: #f3d37e;
  --line: rgba(255, 255, 255, .1);
  --muted: rgba(255, 255, 255, .52);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
body {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: #fff;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  padding: 0 max(16px, calc((100vw - 1216px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 30, .9);
  backdrop-filter: blur(18px);
}
.brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
.logo-box { width: 102px; height: 40px; padding: 4px; border-radius: 9px; background: #fff; overflow: hidden; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .15em; color: var(--gold); }
.brand small { margin-top: 3px; font-size: 11px; color: rgba(255, 255, 255, .42); }

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: .2s;
}
.button-outline { border: 1px solid rgba(243, 211, 126, .25); background: rgba(243, 211, 126, .08); color: var(--gold); }
.button-outline:hover { background: rgba(243, 211, 126, .16); }
.button-gold { background: var(--gold); color: var(--bg); }

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 18% 0, rgba(44, 134, 216, .25), transparent 35%), radial-gradient(circle at 84% 18%, rgba(243, 211, 126, .13), transparent 27%);
}
.hero-inner, .library, .notice-inner, footer {
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: auto;
  padding-left: 32px;
  padding-right: 32px;
}
.hero-inner {
  padding-top: 52px;
  padding-bottom: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: 32px;
  align-items: end;
}
.hero-inner > * { min-width: 0; }
.intro .eyebrow { margin-bottom: 14px; }
.eyebrow { margin: 0; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.intro h1 { margin: 0; font-size: 48px; line-height: 1.15; letter-spacing: -.035em; }
.lead { max-width: 720px; margin: 18px 0 0; color: rgba(255, 255, 255, .6); font-size: 16px; line-height: 1.8; }

.stats {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .045);
}
.stats div { min-width: 0; padding: 17px 8px; text-align: center; border-radius: 13px; background: rgba(0, 0, 0, .15); }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 24px; color: var(--gold); }
.stats span { margin-top: 6px; color: rgba(255, 255, 255, .42); font-size: 11px; }

.finder {
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 24, 41, .93);
  box-shadow: 0 22px 55px rgba(0, 0, 0, .22);
}
.search { width: 100%; min-width: 0; height: 48px; position: relative; display: flex; align-items: center; }
.search span { position: absolute; left: 16px; color: rgba(255, 255, 255, .4); font-size: 22px; }
.search input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 18px 0 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, .055);
  color: #fff;
}
.search input:focus { border-color: rgba(243, 211, 126, .5); box-shadow: 0 0 0 3px rgba(243, 211, 126, .08); }
.search input::placeholder { color: rgba(255, 255, 255, .34); }

.categories {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.categories::-webkit-scrollbar { display: none; }
.category { flex: 0 0 auto; white-space: nowrap; border: 0; border-radius: 10px; padding: 10px 16px; background: transparent; color: rgba(255, 255, 255, .58); cursor: pointer; }
.category:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.category.active { background: var(--gold); color: var(--bg); font-weight: 700; }

.library { padding-top: 50px; padding-bottom: 56px; }
.section-heading { margin-bottom: 24px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 7px 0 0; font-size: 27px; }
.section-heading > span { color: rgba(255, 255, 255, .4); font-size: 14px; }
.cards { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .045); transition: .25s; }
.card:hover { transform: translateY(-4px); border-color: rgba(243, 211, 126, .3); background: rgba(255, 255, 255, .065); box-shadow: 0 24px 50px rgba(0, 0, 0, .23); }
.thumb { position: relative; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; display: block; overflow: hidden; background: linear-gradient(145deg, #102b4a, #07111e); cursor: pointer; color: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: .45s; }
.card:hover .thumb img { transform: scale(1.035); }
.fallback { height: 100%; display: grid; place-items: center; color: var(--gold); font-size: 50px; background: radial-gradient(circle at 50% 0, rgba(243, 211, 126, .18), transparent 45%); }
.pill { position: absolute; left: 12px; top: 12px; padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 99px; background: rgba(7, 17, 30, .84); font-size: 11px; }
.featured { left: auto; right: 12px; border: 0; background: var(--gold); color: var(--bg); font-weight: 700; }
.card-body { min-width: 0; padding: 16px; }
.card-copy { min-width: 0; min-height: 84px; }
.card-copy small { color: rgba(243, 211, 126, .78); }
.card-copy h3 { margin: 6px 0 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.card-copy p { margin: 5px 0 0; color: rgba(255, 255, 255, .38); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { margin-top: 15px; padding-top: 13px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: space-between; }
.card-foot span { color: rgba(255, 255, 255, .38); font-size: 12px; }
.download { padding: 7px 9px; border-radius: 8px; color: var(--gold); font-size: 12px; }
.download:hover { background: rgba(243, 211, 126, .1); }

.empty { min-height: 280px; border: 1px dashed rgba(255, 255, 255, .14); border-radius: 18px; display: grid; place-content: center; text-align: center; }
.empty span { font-size: 42px; color: rgba(255, 255, 255, .24); }
.empty strong { margin-top: 12px; }
.empty p { margin: 7px 0 0; color: rgba(255, 255, 255, .4); font-size: 14px; }
.notice { border-top: 1px solid var(--line); background: #091522; }
.notice-inner { padding-top: 34px; padding-bottom: 34px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.notice-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: rgba(243, 211, 126, .1); color: var(--gold); font-weight: 800; }
.notice h2 { margin: 0; font-size: 16px; }
.notice p { margin: 6px 0 0; color: rgba(255, 255, 255, .46); font-size: 14px; line-height: 1.65; }
footer { padding-top: 28px; padding-bottom: 28px; color: rgba(255, 255, 255, .3); font-size: 12px; line-height: 1.7; border-top: 1px solid rgba(255, 255, 255, .07); background: #050c15; }
footer p { margin: 0 0 5px; }

dialog { width: min(1200px, calc(100% - 24px)); height: min(94dvh, 960px); padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; background: #07111e; color: #fff; box-shadow: 0 35px 90px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.dialog-shell { height: 100%; padding: 16px; display: grid; grid-template-rows: auto 1fr; gap: 13px; }
.close { position: absolute; right: 14px; top: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .07); color: #fff; font-size: 23px; cursor: pointer; }
.dialog-head { padding-right: 45px; }
.dialog-head h2 { margin: 5px 0 10px; font-size: 20px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-body { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .35); }
.viewer-body iframe, .viewer-body img, .viewer-body video { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
#toast { position: fixed; z-index: 50; left: 50%; bottom: 30px; transform: translate(-50%, 20px); padding: 10px 15px; border-radius: 10px; background: var(--gold); color: var(--bg); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intro h1 { font-size: 42px; }
}

@media (max-width: 780px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-top: 38px; }
  .intro h1 { font-size: 34px; }
  .stats { grid-column: 1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notice-inner { grid-template-columns: auto 1fr; }
  .notice .button { grid-column: 2; }
  .brand > span:last-child { display: none; }
}

@media (max-width: 520px) {
  .topbar { height: 66px; padding-left: 16px; padding-right: 16px; }
  .logo-box { width: 90px; height: 36px; }
  .share-button { flex: 0 0 auto; min-height: 38px; padding: 0 11px; }
  .hero-inner, .library, .notice-inner, footer { padding-left: 16px; padding-right: 16px; }
  .hero-inner { padding-top: 30px; padding-bottom: 34px; gap: 22px; }
  .intro h1 { font-size: 30px; }
  .lead { font-size: 14px; }
  .stats { padding: 7px; gap: 6px; }
  .stats div { padding: 13px 2px; }
  .stats strong { font-size: 19px; }
  .stats span { font-size: 10px; }
  .finder { padding: 11px; }
  .categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .category { min-width: 0; width: 100%; padding: 10px 6px; white-space: normal; line-height: 1.35; }
  .category:first-child, .category:nth-child(8) { grid-column: 1 / -1; }
  .library { padding-top: 36px; padding-bottom: 42px; }
  .section-heading { align-items: flex-start; }
  .section-heading > span { flex: 0 0 auto; margin-top: 29px; }
  .section-heading h2 { font-size: 23px; }
  .cards { grid-template-columns: 1fr; gap: 16px; }
  .card { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 58%); min-height: 155px; }
  .thumb { height: 100%; aspect-ratio: auto; }
  .pill { left: 8px; top: 8px; padding: 4px 7px; }
  .featured { display: none; }
  .card-body { min-width: 0; padding: 13px; }
  .card-copy { min-height: 90px; }
  .card-copy h3 { font-size: 15px; }
  .dialog-shell { padding: 10px; }
  .dialog-head h2 { font-size: 17px; }
}
