:root {
  --bg: #0c1117;
  --surface: #151c24;
  --surface-2: #1a232d;
  --line: #2b3743;
  --text: #f1f5f8;
  --muted: #8f9ba7;
  --blue: #6daaff;
  --blue-strong: #357efa;
  --green: #aee976;
  --red: #ff969d;
  --yellow: #efd083;
  --radius: 14px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at 10% 0%, #17283c 0, transparent 32rem), var(--bg); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.muted { color: var(--muted); }

.notice {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 9px 16px;
  border-bottom: 1px solid #254160;
  background: #18283a;
  color: #bfd5ee;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: grid;
  min-height: 82px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.brand-mark {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  border: 1px solid #6aa8ef;
  border-radius: 13px;
  background: radial-gradient(circle at 30% 25%, #fff 0 2px, transparent 3px),
              radial-gradient(circle at 73% 70%, var(--green) 0 3px, transparent 4px),
              linear-gradient(145deg, #387df0, #173253);
  box-shadow: 0 8px 24px #2c70da38;
}
.brand-mark::after {
  position: absolute;
  left: 8px;
  top: 20px;
  width: 28px;
  height: 8px;
  border: 1px solid #ffffff33;
  border-radius: 50%;
  transform: rotate(-25deg);
  content: "";
}
.brand strong { display: block; font-size: 18px; }
.brand small { color: #7e8c99; font-size: 9px; letter-spacing: .14em; }

nav { display: flex; gap: 5px; }
nav button {
  min-height: 40px;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a4b0bc;
  cursor: pointer;
}
nav button:hover, nav button.active { background: #ffffff0d; color: white; }

.header-actions { display: flex; gap: 8px; }
.search-box {
  display: flex;
  width: 230px;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111820;
  color: #7f8c99;
}
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
}
.search-box input::placeholder { color: #65727e; }
.upload-entry {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid #426487;
  border-radius: 9px;
  background: #1b2b3a;
  color: #d5e6f5;
  cursor: pointer;
}

.hero {
  position: relative;
  display: grid;
  min-height: 360px;
  grid-template-columns: 1.08fr .92fr;
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid #344352;
  border-radius: 18px;
  background: linear-gradient(100deg, #121922 0%, #152233 64%, #16283b 100%);
}
.hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #11171eee 0%, #11171eaa 45%, transparent 75%);
  pointer-events: none;
  content: "";
}
.hero-copy { position: relative; z-index: 2; align-self: center; padding: 36px 38px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 600; letter-spacing: .13em; }
.hero h1 { margin: 13px 0 0; font-size: clamp(34px, 5vw, 52px); font-weight: 600; letter-spacing: -.04em; }
.hero-en { margin: 6px 0 0; color: #a8b9c9; font-size: 12px; letter-spacing: .08em; }
.hero-desc { max-width: 520px; margin: 17px 0 0; color: #afbac5; font-size: 14px; line-height: 1.8; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.chip { padding: 6px 9px; border: 1px solid #ffffff18; border-radius: 6px; background: #ffffff08; color: #c6cfd7; font-size: 11px; }
.hero-actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--blue-strong); color: white; }
.btn.primary:hover { background: #4a8ef9; }
.btn.secondary { border-color: #3d4c5b; background: #ffffff07; color: #d7e0e8; }
.hero-art { position: relative; min-height: 320px; background: radial-gradient(circle at 60% 40%, #5a9ce630, transparent 27%), #132237; }
.hero-art::before {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #cbe6ff38 0 1px, transparent 1.5px);
  background-size: 64px 55px;
  opacity: .6;
  content: "";
}
.planet {
  position: absolute;
  left: 52%;
  top: 52%;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #a9dcff 0 2%, #4f90ce 25%, #274e76 56%, #142d47 78%);
  box-shadow: inset -25px -20px 40px #02080dcc, 0 0 55px #60b5ff38;
  transform: translate(-50%, -50%);
}
.planet.small { width: 250px; height: 250px; }
.ring {
  position: absolute;
  left: 52%;
  top: 52%;
  width: 300px;
  height: 80px;
  border: 8px solid #c8eaff66;
  border-top-color: transparent;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-16deg);
}
.hero-stamp {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  padding: 7px 9px;
  border: 1px solid #ffffff20;
  border-radius: 6px;
  background: #0b131dbd;
  color: #d9e4ee;
  font-size: 10px;
}

.section { margin-top: 42px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 24px; font-weight: 600; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.section-head > span { color: var(--muted); font-size: 11px; }
.platform-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.platform-filter button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: #9baab8;
  cursor: pointer;
}
.platform-filter button.active { border-color: #5280b6; background: #397ff522; color: #cbe0ff; }

.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.game-card {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform .18s, border-color .18s;
}
.game-card:hover { transform: translateY(-3px); border-color: #526578; }
.card-cover { position: relative; width: 100%; aspect-ratio: 16/10; overflow: hidden; background: linear-gradient(145deg,#234b71,#152431); }
.card-cover img, .detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-badges { position: absolute; top: 9px; left: 9px; display: flex; gap: 5px; }
.badge { padding: 4px 6px; border-radius: 5px; background: #0c141dd4; color: #dce6ef; font-size: 10px; }
.badge.source { background: #315d39d9; color: #d4f3d9; }
.badge.source.resource { background: #64583cd9; color: #f5e2ae; }
.card-body { padding: 12px 13px 13px; }
.card-body h3 { min-height: 40px; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.card-meta, .card-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.card-stats { justify-content: flex-start; }
.card-systems { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px solid #ffffff0c; color: #a6b4c1; font-size: 10px; }
.empty { padding: 60px 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.empty h3 { color: var(--text); }

.ranking-list { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rank-row {
  display: grid;
  min-height: 64px;
  grid-template-columns: 34px 58px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border: 0;
  border-bottom: 1px solid #ffffff0b;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: #ffffff05; }
.rank-number { color: var(--blue); font-size: 13px; }
.rank-cover { width: 58px; aspect-ratio: 16/10; overflow: hidden; border-radius: 5px; background: #24394d; }
.rank-cover img { width: 100%; height: 100%; object-fit: cover; }
.rank-title { display: grid; min-width: 0; gap: 6px; }
.rank-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rank-bar { width: 100%; height: 5px; overflow: hidden; border-radius: 99px; background: #ffffff0d; }
.rank-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#4c8fe8,#9ac8ff); }
.rank-count { color: #b8cadc; font-size: 11px; white-space: nowrap; }

.about-panel { margin: 42px 0 70px; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(circle at 100% 0%, #b7ef7320, transparent 35%), var(--surface); }
.about-panel > span { color: var(--green); font-size: 10px; letter-spacing: .12em; }
.about-panel h2 { max-width: 650px; margin: 12px 0 0; font-size: 24px; line-height: 1.5; }
.about-panel p { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 34px; border-top: 1px solid #ffffff0b; color: #74808c; font-size: 11px; }

dialog { color: var(--text); }
.detail-dialog { width: min(920px, calc(100% - 28px)); max-height: 90vh; padding: 0; border: 1px solid #4b5865; border-radius: 16px; background: #151c24; box-shadow: 0 30px 120px #000a; }
.detail-dialog::backdrop { background: #030609c9; backdrop-filter: blur(5px); }
.dialog-close { position: absolute; z-index: 2; right: 14px; top: 14px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #161f29; font-size: 20px; cursor: pointer; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 22px; padding: 22px; }
.detail-cover { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 12px; background: linear-gradient(145deg,#234b71,#142432); }
.detail-cover .planet { width: 220px; height: 220px; }
.detail-cover .ring { width: 300px; }
.detail-layout h2 { margin: 18px 0 0; font-size: 28px; }
.detail-copy { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #111820; }
.detail-copy h3 { margin: 0; font-size: 14px; }
.detail-copy p { margin: 10px 0 0; color: #b6c1cb; font-size: 13px; line-height: 1.9; white-space: pre-line; }
.runtime-box, .download-box { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #111820; }
.runtime-box + .download-box { margin-top: 12px; }
.runtime-box h3, .download-box h3 { margin: 0; font-size: 14px; }
.runtime-box > span { display: inline-block; margin-top: 10px; padding: 5px 8px; border: 1px solid #6ba57a; border-radius: 5px; color: #b9e7c2; }
.runtime-box p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.box-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.box-title small { color: var(--muted); }
.download-channel { margin-top: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #0f151c; }
.download-channel-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 11px; }
.download-channel-head small { color: var(--muted); }
.download-channel .btn { width: 100%; min-height: 36px; }

.admin-shell { width: min(1080px, calc(100% - 48px)); margin: 42px auto 70px; }
.login-card { width: min(430px,100%); margin: 40px auto; padding: 28px; border: 1px solid #3c4b5a; border-radius: 15px; background: var(--surface); }
.login-icon { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid #476b93; border-radius: 12px; background: #1b3046; color: #add2ff; font-size: 22px; }
.login-card h1 { margin: 17px 0 0; font-size: 26px; }
.login-card > p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-card label, .upload-form label { display: grid; gap: 7px; margin-top: 15px; color: #afbac5; font-size: 12px; }
.login-card input, .upload-form input, .upload-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #3a4857;
  border-radius: 7px;
  background: #0f151c;
  color: white;
}
.upload-form textarea { resize: vertical; line-height: 1.7; }
.form-error { min-height: 18px; color: var(--red) !important; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.admin-heading h1 { margin: 7px 0 0; font-size: 30px; }
.admin-heading p { color: var(--muted); font-size: 12px; }
.admin-tabs { display: flex; gap: 5px; width: fit-content; margin: 18px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #0e151c; }
.admin-tabs button { padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: #95a2ae; cursor: pointer; }
.admin-tabs button.active { background: #26384c; color: #d8eaff; }
.upload-form { display: grid; gap: 13px; }
.form-panel { padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.form-title { display: flex; justify-content: space-between; gap: 12px; }
.form-title h2 { margin: 0; font-size: 15px; }
.form-title span { color: var(--muted); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cover-picker { padding: 20px; border: 1px dashed #44586b; border-radius: 9px; background: #10171f; text-align: center; cursor: pointer; }
.cover-picker input { min-height: 0; padding: 0; }
.cover-picker small { color: var(--muted); }
.choice-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.choice-grid label { display: flex; width: auto; min-height: 34px; align-items: center; gap: 6px; margin: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #10171f; }
.choice-grid input { width: auto; min-height: auto; margin: 0; }
.download-editor { display: grid; gap: 8px; margin-top: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #10171f; }
.download-editor-top { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; }
.remove-link { width: 38px; height: 42px; border: 1px solid #5c3f44; border-radius: 7px; background: #40292d; color: #ffadb4; cursor: pointer; }
.add-link { width: 100%; min-height: 40px; margin-top: 8px; border: 1px dashed #455b70; border-radius: 8px; background: #ffffff04; color: #a9c4de; cursor: pointer; }
.check-row { display: flex !important; align-items: center; gap: 7px !important; }
.check-row input { width: auto; min-height: auto; }
.form-submit { display: flex; align-items: center; gap: 12px; }
.form-submit span { color: var(--muted); font-size: 11px; }
.admin-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.admin-metrics > div { padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.admin-metrics small { color: var(--muted); font-size: 10px; }
.admin-metrics strong { display: block; overflow: hidden; margin-top: 7px; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.manage-list { display: grid; margin-top: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.manage-row { display: grid; grid-template-columns: minmax(0,1fr) 110px auto; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #ffffff0b; }
.manage-row:last-child { border-bottom: 0; }
.manage-name { min-width: 0; }
.manage-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-name small { color: var(--muted); font-size: 10px; }
.manage-row .danger { border: 1px solid #653f46; border-radius: 6px; background: transparent; color: #e7a4aa; padding: 7px 9px; cursor: pointer; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: 340px; padding: 11px 14px; border: 1px solid #4c6d92; border-radius: 8px; background: #24384d; color: #e2edf8; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  nav { order: 3; grid-column: 1/-1; padding-bottom: 8px; }
  .search-box { width: 190px; }
  .game-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr .75fr; }
  .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header, main, footer, .admin-shell { width: calc(100% - 28px); }
  .notice { display: grid; gap: 2px; font-size: 10px; }
  .site-header { gap: 8px; padding: 12px 0 0; }
  .brand strong { font-size: 15px; }
  .brand small { font-size: 7px; }
  .brand-mark { width: 38px; height: 38px; }
  nav { gap: 18px; }
  nav button { padding: 8px 0; font-size: 12px; }
  .search-box { display: none; }
  .upload-entry { width: 38px; justify-content: center; padding: 0; }
  .upload-entry-text { display: none; }
  .hero { display: block; min-height: 390px; }
  .hero-copy { z-index: 2; min-height: 390px; display: flex; flex-direction: column; justify-content: end; padding: 26px 22px 72px; }
  .hero::after { background: linear-gradient(0deg,#10171ef5 5%,#10171ec4 55%,#10171e50); }
  .hero-art { position: absolute; inset: 0; opacity: .72; }
  .hero h1 { font-size: 34px; }
  .hero-desc { font-size: 12px; }
  .game-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .card-body h3 { font-size: 12px; }
  .card-meta, .card-stats, .card-systems { font-size: 9px; }
  .section { margin-top: 30px; }
  .section-head h2 { font-size: 21px; }
  footer { display: grid; font-size: 10px; }
  .admin-heading { display: block; }
  .admin-heading .actions { margin-top: 12px; }
  .form-grid, .admin-metrics { grid-template-columns: 1fr; }
  .manage-row { grid-template-columns: minmax(0,1fr) auto; }
  .manage-row > :nth-child(2) { grid-column: 1/-1; }
  .rank-row { grid-template-columns: 24px 46px minmax(0,1fr) auto; padding-inline: 10px; gap: 8px; }
  .rank-cover { width: 46px; }
}
