/* 极简样式。想改外观，改这里就行；结构在 lib/views.js 里。 */

:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1b212b;
  --border: #262d39;
  --text: #e7eaf0;
  --muted: #8f99a8;
  --accent: #5b8cff;
  --accent-soft: #1d2a45;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, system-ui, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 17, 22, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 17px; }
.brand h1 a { color: var(--text); }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.brand .sub a { color: var(--muted); }

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  flex: none;
}
a.logo:hover { text-decoration: none; }

.toolbar { display: flex; align-items: center; gap: 10px; }

.search {
  width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-size: 14px;
}
.search:focus { border-color: var(--accent); }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.4;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { background: #b4373a; }

/* ---------- 布局 ---------- */

.wrap { max-width: 1040px; margin: 0 auto; padding: 26px 28px 60px; }

.stats {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}
.stats b { color: var(--text); font-size: 15px; }

.section-title { font-size: 16px; margin: 28px 0 12px; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 26px 0 40px;
}

/* ---------- 卡片 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
}

.cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}
.cover-fallback {
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 700;
  color: #4d6ea8;
  background: linear-gradient(135deg, #1b2333, #131a26);
}

.card-body { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { font-size: 15px; }
.summary {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #a8c0ff;
  border: 1px solid #24314d;
}
.chip.muted { background: transparent; color: var(--muted); border-color: var(--border); }

.card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #b9c2d0;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- 游戏详情 ---------- */

.hero {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.hero-cover {
  width: 150px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex: none;
  font-size: 42px;
}
.hero-text { min-width: 0; }
.hero-text h2 { font-size: 26px; margin-bottom: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.panel.latest { border-color: #2e4470; background: linear-gradient(180deg, #17202f, #151a22); }

.panel-title { font-size: 15px; margin-bottom: 10px; }

.game-video {
  width: 100%;
  max-height: 540px;
  border-radius: 10px;
  background: #000;
  display: block;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.shot {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  line-height: 0;
}
.shot:hover { border-color: var(--accent); }
.shot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.panel-head .ver { font-size: 18px; }

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.notes { font-size: 13px; color: #c3cbd8; white-space: pre-wrap; }

.desc p { white-space: pre-wrap; color: #c3cbd8; }

.dl-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.dl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid #2b3a58;
  background: #1a2436;
  color: var(--text);
  font-size: 14px;
}
.dl:hover { border-color: var(--accent); text-decoration: none; background: #1e2b43; }
.dl-plat { font-weight: 600; }
.dl-size { color: var(--muted); font-size: 12px; }
.dl-arrow { color: var(--accent); font-size: 16px; }

.center-page { text-align: center; padding-top: 90px; }
.center-page h2 { margin-bottom: 10px; }

@media (max-width: 620px) {
  .top { padding: 14px 16px; flex-wrap: wrap; }
  .wrap { padding: 18px 16px 50px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-cover { width: 100%; }
  .search { width: 100%; }
  .toolbar { flex: 1 1 100%; }
}

/* ---------- 管理后台 ---------- */

.admin .wrap { max-width: 900px; }

.card-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.gcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.gcard-head h3 { font-size: 16px; }
.gcard-head code { font-size: 11px; color: var(--muted); }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #10151c;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.rel-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--panel-2);
}
.rel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.asset-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.asset-line:last-child { border-bottom: none; }
.asset-line .name { flex: 1 1 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drop {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.drop.over { border-color: var(--accent); background: #141d2c; color: var(--text); }

.progress {
  height: 6px;
  border-radius: 3px;
  background: #10151c;
  overflow: hidden;
  margin-top: 8px;
}
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

/* ---------- 后台：宣传素材 ---------- */

.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.media-item { min-width: 0; }
.media-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.media-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #10151c;
  display: block;
  margin-bottom: 8px;
}
.media-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.shots-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.shot-cell {
  position: relative;
  width: 120px;
  line-height: 0;
}
.shot-cell img {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.shot-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #2a1a1c;
  color: #ff9a9a;
  cursor: pointer;
  line-height: 1;
  font-size: 13px;
}
.shot-add {
  width: 120px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.shot-add:hover { border-color: var(--accent); color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #232c3a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { border-color: #7c2f33; background: #2c1a1c; }

.login-box {
  max-width: 340px;
  margin: 90px auto;
}
