:root {
  --bg: #0b0f16; --panel: #121923; --panel-2: #18212e; --line: #243044; --text: #e7edf5; --muted: #8d9bb0;
  --accent: #5eead4; --accent-ink: #052e29; --violet: #a78bfa; --good: #34d399; --bad: #f87171; --warn: #fbbf24; --info: #60a5fa;
  --radius: 14px; --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); line-height: 1.5; font-size: 15px; min-height: 100vh;
  background: radial-gradient(1200px 500px at 85% -10%, rgb(94 234 212 / 0.08), transparent 60%), radial-gradient(900px 500px at -10% 0%, rgb(167 139 250 / 0.08), transparent 55%), var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; } .nowrap { white-space: nowrap; }
.container { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: rgb(11 15 22 / 0.85); border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; gap: 20px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--violet)); display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; font-size: 0.9rem; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); }
.userbox { display: flex; align-items: center; gap: 10px; }
.banner { background: linear-gradient(90deg, rgb(96 165 250 / 0.14), rgb(167 139 250 / 0.14)); border-bottom: 1px solid var(--line); font-size: 0.85rem; color: #c9d6ea; }
.banner .container { padding: 8px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner b { color: var(--text); }
main { padding: 26px 0 60px; }

/* controls */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; transition: 0.15s; }
.btn:hover:not(:disabled) { border-color: #3a4a66; background: #1e2a3b; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: #7ff0dd; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 0.82rem; border-radius: 8px; }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input, .select, textarea { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 9px 12px; border-radius: 10px; font: inherit; min-width: 0; }
.input::placeholder { color: #5d6b82; }
label.field { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }

/* cards & lists */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.toolbar .grow { flex: 1 1 240px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s, border-color 0.15s; }
a.card { color: inherit; } a.card:hover { text-decoration: none; transform: translateY(-3px); border-color: #3a4a66; box-shadow: var(--shadow); }
.cover { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #1b2a40, #261c3d); display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; color: rgb(255 255 255 / 0.22); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.card-title { font-weight: 700; font-size: 1.02rem; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h2, .panel h3 { margin-bottom: 10px; }

/* chips & scores */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: #c3cee0; }
.chip.good { color: var(--good); border-color: rgb(52 211 153 / 0.4); background: rgb(52 211 153 / 0.08); }
.chip.bad { color: var(--bad); border-color: rgb(248 113 113 / 0.4); background: rgb(248 113 113 / 0.08); }
.chip.warn { color: var(--warn); border-color: rgb(251 191 36 / 0.4); background: rgb(251 191 36 / 0.08); }
.chip.info { color: var(--info); border-color: rgb(96 165 250 / 0.4); background: rgb(96 165 250 / 0.08); }
.plat { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 0.78rem; font-weight: 700; color: #c3cee0; }
.score { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: 0.82rem; color: #04130d; background: #475569; }
.score.high { background: #34d399; } .score.mid { background: #fbbf24; } .score.low { background: #f87171; } .score.none { background: #2a3547; color: var(--muted); font-weight: 600; }
.score.user { background: transparent; border: 2px solid currentColor; }
.score.user.high { color: #34d399; } .score.user.mid { color: #fbbf24; } .score.user.low { color: #f87171; } .score.user.none { color: #566278; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid #1b2535; vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* game page */
.hero { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
.hero .cover { border-radius: var(--radius); border: 1px solid var(--line); aspect-ratio: 4 / 3; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.points { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.points li { padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border-left: 3px solid var(--good); }
.points.neg li { border-left-color: var(--bad); }
.points details summary { cursor: pointer; list-style: none; }
.points details summary::-webkit-details-marker { display: none; }
.points blockquote { margin: 8px 0 2px; padding: 8px 10px; border-left: 2px solid var(--line); color: var(--muted); font-size: 0.85rem; font-style: italic; }
.spark { width: 100%; height: 90px; display: block; }
.spark .grid-line { stroke: #223046; stroke-width: 1; }
.spark .l-critic { stroke: var(--accent); fill: none; stroke-width: 2; } .spark .l-user { stroke: var(--violet); fill: none; stroke-width: 2; }
.video-box { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: 12px; background: #000; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); min-height: 260px; }
@keyframes sk { to { background-position: -200% 0; } }

/* monitor/admin */
.dash .wide { grid-column: 1 / -1; }
.chip { white-space: nowrap; }
.check { display: flex; gap: 8px; align-items: center; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #566278; margin-right: 6px; }
.dot.green { background: var(--good); box-shadow: 0 0 8px var(--good); } .dot.yellow { background: var(--warn); } .dot.red { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--violet)); transition: width 0.4s; }
.log { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; max-height: 320px; overflow: auto; display: grid; gap: 2px; }
.log div { padding: 2px 6px; border-radius: 4px; } .log .warn { color: var(--warn); } .log .error { color: var(--bad); } .log .time { color: #5d6b82; margin-right: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.active { color: var(--text); background: var(--panel-2); border-color: #3a4a66; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.toast-host { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { border-color: var(--bad); } .toast.ok { border-color: var(--good); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 24px; }
.mb { margin-bottom: 14px; } .block { width: 100%; } .err { color: var(--bad); min-height: 1.4em; } .form-grid.one { grid-template-columns: 1fr; }
.hidden { display: none !important; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); }
.prose p { max-width: 70ch; } .prose ol, .prose ul { max-width: 70ch; padding-left: 22px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; counter-reset: step; }
.flow > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; counter-increment: step; }
.flow > div::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 0.8rem; margin-bottom: 6px; }

@media (max-width: 860px) {
  .hero, .two { grid-template-columns: 1fr; }
  .topbar .container { gap: 8px; height: auto; padding: 8px 0; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  h1 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
