:root {
  color-scheme: dark;
  --bg: #070b13;
  --panel: #0e1727;
  --panel-2: #121e31;
  --line: rgba(148, 163, 184, 0.14);
  --line-accent: rgba(96, 165, 250, 0.4);
  --text: #eef5ff;
  --text-2: #aebed4;
  --text-3: #71829a;
  --accent: #60a5fa;
  --accent-2: #2563eb;
  --pink: #f472b6;
  --green: #34d399;
  --orange: #fbbf24;
  --red: #fb7185;
  --radius: 16px;
  --sans: "Segoe UI Variable", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 84% -10%, rgba(37, 99, 235, 0.18), transparent 62%),
    radial-gradient(700px 420px at 2% 100%, rgba(34, 211, 238, 0.08), transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -0.02em; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #09111f;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--line-accent); box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 15px; border: 1px solid var(--line);
  border-radius: 10px; background: rgba(255, 255, 255, 0.04);
  color: var(--text-2); font-weight: 700; white-space: nowrap;
}
.btn:hover { border-color: var(--line-accent); color: var(--text); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, #06b6d4, #2563eb 68%, #1d4ed8); color: #fff; box-shadow: 0 8px 24px rgba(37, 99, 235, 0.24); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.text-btn, .icon-btn { border: 0; background: transparent; color: var(--text-3); }
.text-btn:hover { color: var(--accent); }
.icon-btn { font-size: 22px; line-height: 1; }

/* login */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card {
  width: min(420px, 100%); padding: 30px;
  border: 1px solid var(--line); border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 55%), var(--panel);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.admin-brand { display: flex; align-items: center; gap: 11px; }
.brand-dot { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #06b6d4, #2563eb); box-shadow: 0 8px 20px rgba(37,99,235,.3); }
.admin-brand b { display: block; font-size: 16px; letter-spacing: .02em; }
.admin-brand small { display: block; color: var(--text-3); font-family: var(--mono); font-size: 9px; letter-spacing: .16em; }
.login-card h1 { margin: 28px 0 5px; font-size: 28px; }
.login-desc { margin-bottom: 22px; color: var(--text-3); }
#login-form { display: flex; flex-direction: column; gap: 13px; }
#login-form .btn { margin-top: 5px; height: 44px; }
.form-error { min-height: 20px; color: var(--red); font-size: 12px; }
.login-foot { margin-top: 22px; color: var(--text-3); font-size: 11px; text-align: center; }

/* shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px;
  border-right: 1px solid var(--line); background: rgba(7, 12, 22, .82);
  display: flex; flex-direction: column; gap: 26px;
}
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  display: flex; align-items: center; min-height: 40px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--text-2); text-align: left; font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.is-active { border-color: var(--line-accent); background: rgba(96,165,250,.12); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.site-select { gap: 5px; font-size: 11px; }
.site-select select { padding: 7px 9px; }
.main { min-width: 0; padding: 0 32px 60px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 28px 0 18px; }
.topbar-kicker { color: var(--text-3); font-family: var(--mono); font-size: 10px; letter-spacing: .16em; }
.topbar h1 { margin-top: 4px; font-size: 30px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.build-state { color: var(--text-3); font-size: 12px; }
.must-change { margin-bottom: 14px; padding: 10px 13px; border: 1px solid rgba(251,191,36,.25); border-radius: 10px; background: rgba(251,191,36,.08); color: var(--orange); font-size: 12px; }
.view { display: none; }
.view.is-active { display: block; }
.section-lead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-lead h2 { font-size: 20px; }
.section-lead p { margin-top: 4px; color: var(--text-3); font-size: 12px; }
.hint { color: var(--text-3); font-size: 12px; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 55%), var(--panel); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.panel-head span { color: var(--text-3); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.stat-card span { color: var(--text-3); font-size: 11px; }
.stat-card b { display: block; margin: 4px 0 2px; font-size: 26px; line-height: 1.15; letter-spacing: -.03em; }
.stat-card small { color: var(--text-3); font-size: 10px; }
.panel-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.panel-grid.two { grid-template-columns: 1fr 1fr; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.mini-stats div { padding: 16px 18px; background: var(--panel); }
.mini-stats b { display: block; font-size: 21px; }
.mini-stats span { color: var(--text-3); font-size: 11px; }
.mini-list { padding: 8px 18px 14px; }
.mini-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.mini-item:last-child { border-bottom: 0; }
.mini-item b { font-weight: 600; }
.mini-item span { color: var(--text-3); }
.data-list { padding: 6px 18px 15px; }
.data-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.data-row:last-child { border-bottom: 0; }
.data-row .rank { width: 24px; color: var(--text-3); font-family: var(--mono); font-size: 11px; }
.data-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row .value { color: var(--accent); font-family: var(--mono); font-weight: 600; }

/* editor */
.editor-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.editor-list-panel { position: sticky; top: 16px; }
.editor-list-panel .search-input { margin: 12px; width: calc(100% - 24px); }
.editor-list { max-height: calc(100vh - 245px); overflow-y: auto; padding: 0 8px 10px; }
.game-pick { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.game-pick:hover, .game-pick.is-active { background: rgba(96,165,250,.1); }
.game-pick img { width: 30px; height: 40px; border-radius: 5px; object-fit: cover; background: var(--panel-2); }
.game-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.editor-form-panel { min-height: 520px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.empty-editor { display: grid; place-items: center; min-height: 420px; color: var(--text-3); font-size: 13px; }
#user-list .empty-editor,
#comment-list .empty-editor { min-height: 180px; }

/* recommendations */
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.slot { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.slot-head { display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.slot-head b { font-size: 14px; }
.slot-head small { color: var(--text-3); font-size: 10px; }
.slot-body { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.slot-item { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.slot-item img { width: 30px; height: 40px; border-radius: 5px; object-fit: cover; background: #0a1220; }
.slot-item .slot-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.slot-tools { display: flex; gap: 2px; }
.slot-tools button { width: 24px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text-3); font-size: 12px; }
.slot-tools button:hover { color: var(--accent); border-color: var(--line-accent); }
.slot-add { display: flex; gap: 6px; padding: 0 10px 12px; }
.slot-add select { min-width: 0; padding: 7px 8px; font-size: 11px; }
.slot-add .btn { min-height: 32px; padding: 0 9px; font-size: 12px; }

/* users */
.user-admin-list { padding: 8px 18px 14px; }
.user-admin {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.user-admin:last-child { border-bottom: 0; }
.user-avatar {
  display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto;
  border-radius: 50%; background: rgba(96,165,250,.16); color: var(--accent);
  font-weight: 800;
}
.user-main { flex: 1; min-width: 0; }
.user-name { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.user-name span { color: var(--text-3); font-family: var(--mono); font-size: 10px; font-weight: 400; }
.user-contact { overflow: hidden; color: var(--text-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-meta { min-width: 95px; text-align: right; }
.user-meta b { display: block; color: var(--text-2); font-size: 12px; font-weight: 600; }
.user-meta span { color: var(--text-3); font-size: 10px; }

/* comments */
.toolbar { display: flex; gap: 9px; margin-bottom: 14px; }
.toolbar .search-input { flex: 1; }
.toolbar .select { width: 140px; }
.comment-admin-list { display: flex; flex-direction: column; gap: 10px; }
.comment-admin { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.comment-admin-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 7px; }
.comment-admin-head b { font-size: 13px; }
.comment-admin-head span { color: var(--text-3); font-size: 11px; }
.status-pill { padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-pending { background: rgba(251,191,36,.12); color: var(--orange); }
.status-approved { background: rgba(52,211,153,.12); color: var(--green); }
.status-rejected { background: rgba(251,113,133,.12); color: var(--red); }
.comment-admin-body { color: var(--text-2); font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.comment-admin-actions { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.comment-admin-actions button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text-2); font-size: 11px; }
.comment-admin-actions button:hover { border-color: var(--line-accent); color: var(--accent); }

/* settings / dialog */
.settings-panel { max-width: 620px; }
.modal {
  width: min(520px, 92vw); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.modal::backdrop { background: rgba(2,6,12,.72); backdrop-filter: blur(4px); }
.modal form { display: flex; flex-direction: column; gap: 13px; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 999;
  max-width: min(520px, 88vw); padding: 10px 16px; border: 1px solid var(--line-accent);
  border-radius: 10px; background: #0b1a2c; color: var(--text); font-size: 12px;
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: .2s;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(251,113,133,.45); color: #fecdd3; }

@media (max-width: 1020px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slot-grid { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-list-panel { position: static; }
  .editor-list { max-height: 240px; }
}
@media (max-width: 720px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; padding: 14px; gap: 14px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .main { padding: 0 16px 40px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar h1 { font-size: 24px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid.two { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .section-lead { align-items: flex-start; flex-direction: column; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .select { width: 100%; }
}

/* collection */
.collection-type-tabs { margin-bottom: 14px; }
.collection-config { margin-bottom: 14px; }
.collection-config-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.collection-source-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; align-items: end; }
.check-label { flex-direction: row; align-items: center; gap: 7px; min-height: 36px; }
.check-label input { width: auto; }
.time-grid { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); gap: 8px; align-items: end; }
.time-grid > span { padding-bottom: 9px; color: var(--text-3); text-align: center; }
.collection-config-body .hint { margin: 0; }
.collection-list-panel { margin-bottom: 14px; }
.collection-list { padding: 6px 18px 14px; }
.collection-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.collection-item:last-child { border-bottom: 0; }
.collection-item-main { flex: 1; min-width: 0; }
.collection-item-title { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.collection-item-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; color: var(--text-3); font-size: 10px; }
.collection-item-meta b { color: var(--accent); font-weight: 600; }
.collection-item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.collection-item-actions button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text-2); font-size: 11px; }
.collection-item-actions button:hover { border-color: var(--line-accent); color: var(--accent); }
.collection-empty { padding: 24px 0; color: var(--text-3); text-align: center; font-size: 12px; }
.collection-modal textarea { font-family: var(--mono); font-size: 12px; line-height: 1.6; }
@media (max-width: 720px) {
  .collection-source-row { grid-template-columns: 1fr; }
  .collection-item { align-items: flex-start; flex-wrap: wrap; }
  .collection-item-actions { margin-left: 0; }
}
