:root {
  --bg: #0b0d12; --surface: #11141b; --surface-2: #161a23; --raised: #1b2029;
  --border: #232834; --border-strong: #2f3644;
  --text: #e6e8ee; --muted: #8a93a6; --faint: #5d6576;
  --accent: #7c8cff; --accent-ink: #0b0d12; --accent-soft: rgba(124, 140, 255, .14);
  --ok: #3fb950; --ok-soft: rgba(63, 185, 80, .14);
  --warn: #d29922; --warn-soft: rgba(210, 153, 34, .14);
  --bad: #f85149; --bad-soft: rgba(248, 81, 73, .14);
  --violet: #a371f7; --violet-soft: rgba(163, 113, 247, .14);
  --grey-soft: rgba(138, 147, 166, .14);
  --radius: 10px; --radius-sm: 7px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 14px; font-weight: 600; margin: 0; }
h3 { font-size: 12px; font-weight: 600; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
[hidden] { display: none !important; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-mark, .brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.boot-mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-name { font-weight: 700; letter-spacing: .04em; }
.env { font-size: 10.5px; padding: 2px 6px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.env.production { background: var(--bad-soft); color: var(--bad); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav .sub { padding-left: 28px; font-size: 13px; }
.nav-group { margin: 14px 10px 4px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.nav .count { margin-left: auto; font-size: 11px; background: var(--bad-soft); color: var(--bad); border-radius: 99px; padding: 0 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--raised); object-fit: cover; flex: none; }
.who { min-width: 0; }
.who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards & stats ---------- */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.shell > div { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.card-body { padding: 14px; }
.card-head a { font-size: 12.5px; }
.stat { padding: 14px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.ok .value { color: var(--ok); } .stat.warn .value { color: var(--warn); } .stat.bad .value { color: var(--bad); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--surface); position: sticky; top: 0; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th .arrow { opacity: .6; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
td.wrap { white-space: normal; min-width: 220px; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 550; background: var(--grey-soft); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); padding: 7px 12px; border-radius: var(--radius-sm); font: 500 13px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--raised); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad-soft); border-color: rgba(248, 81, 73, .35); color: var(--bad); }
.btn.ok { background: var(--ok-soft); border-color: rgba(63, 185, 80, .35); color: var(--ok); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 10px 18px; font-size: 14px; }
input, select, textarea { background: var(--bg); border: 1px solid var(--border-strong); color: var(--text); border-radius: var(--radius-sm); padding: 7px 10px; font: 13.5px var(--sans); width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 5px; }
.field { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.toolbar input { max-width: 300px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 5px 11px; border-radius: 99px; color: var(--muted); font-size: 13px; font-weight: 500; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active { background: var(--accent-soft); color: var(--text); }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }

/* ---------- bars ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.bad > i { background: var(--bad); } .bar.ok > i { background: var(--ok); }

/* ---------- modal & toast ---------- */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(5, 6, 9, .72); }
.modal-head { padding: 16px 18px 0; }
.modal-head p { color: var(--muted); margin: 6px 0 0; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.danger-note { background: var(--bad-soft); color: #ffb3ae; border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; margin-bottom: 12px; }
.codebox { background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px; font: 12px/1.5 var(--mono); word-break: break-all; user-select: all; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--raised); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: var(--radius-sm); max-width: 360px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.error { border-left-color: var(--bad); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 30px 28px; text-align: center; }
.login-card .brand-mark { margin: 0 auto 16px; width: 44px; height: 44px; font-size: 20px; border-radius: 11px; }
.login-card p { color: var(--muted); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 10px; }
.login-card ul { text-align: left; color: var(--muted); font-size: 12.5px; padding-left: 18px; margin: 18px 0 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.row-actions { display: flex; gap: 6px; }
.notice { background: var(--warn-soft); color: #f0cf8a; border: 1px solid rgba(210, 153, 34, .3); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .18s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(5, 6, 9, .6); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; }
  .main { padding: 16px 16px 60px; }
  .cols-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .value { font-size: 21px; }
  .page-head .actions { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .bar-row { grid-template-columns: 100px 1fr 36px; }
  th, td { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.error-text { color: var(--bad); }
.search-form { margin-left: auto; display: flex; gap: 8px; flex: 1; justify-content: flex-end; }
.m0 { margin: 0; }
@media (max-width: 860px) { .search-form { margin-left: 0; justify-content: flex-start; } }

/* ---------- licensing notice editor ---------- */
.notice-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mode-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; color: var(--text); margin: 0; }
.mode-card input { width: auto; margin-top: 3px; }
.mode-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.dim { opacity: .45; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.colors input[type=color] { height: 36px; padding: 3px; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.check input { width: auto; }
.preview-tabs { margin-bottom: 10px; }
.game { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); container-type: inline-size; }
.game-sky { position: absolute; inset: 0 0 38% 0; background: linear-gradient(#7fb6e8, #cfe6f7); }
.game-ground { position: absolute; inset: 62% 0 0 0; background: linear-gradient(#5f9e4a, #3f7a32); }
.game-hud { position: absolute; left: 3%; bottom: 4%; color: #fff; font: 700 3cqw var(--sans); text-shadow: 0 1px 2px #0008; }
.notice-layer { position: absolute; inset: 0; display: flex; justify-content: center; font-family: "Gotham", var(--sans); }
.notice-layer.standard { align-items: flex-start; padding-top: 7cqw; }
.notice-layer.standard .nbox { width: 92%; max-width: 80cqw; border: 2px solid; border-radius: 1.4cqw; padding: 2.2cqw; text-align: left; }
.notice-layer.fullscreen { align-items: center; }
.notice-layer.fullscreen .nbox { width: 86%; max-width: 90cqw; text-align: center; display: flex; flex-direction: column; gap: 1.9cqw; }
.nbox > div { overflow-wrap: anywhere; }
.ntitle { font-weight: 800; font-size: 2.8cqw; }
.notice-layer.fullscreen .ntitle { font-size: 4.4cqw; }
.nprod { font-weight: 600; font-size: 2.1cqw; margin-top: .8cqw; }
.nmsg { font-size: 2.1cqw; margin-top: .8cqw; }
.notice-layer.fullscreen .nprod, .notice-layer.fullscreen .nmsg { font-size: 2.6cqw; margin: 0; }
.nfoot, .nsup { font-size: 1.95cqw; margin-top: .8cqw; }
@media (max-width: 1100px) { .notice-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .mode-pick { grid-template-columns: 1fr; } }

/* Website editor */
.upload-row { display: flex; gap: 12px; align-items: center; }
.thumb { width: 88px; height: 56px; flex: none; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px;
  background: repeating-conic-gradient(#ffffff0d 0 25%, transparent 0 50%) 0 0 / 12px 12px; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-btn { cursor: pointer; }
.colors .span2 { grid-column: span 2; }
.colors.four { grid-template-columns: repeat(4, 1fr); }
input[type=range] { padding: 0; accent-color: var(--accent); }
.site-pv { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); container-type: inline-size; display: grid; place-items: center; isolation: isolate; }
.site-pv.unpublished::after { content: 'Not public — visitors see “Coming soon”'; position: absolute; inset: auto 0 0 0; padding: 6px; text-align: center; font-size: 12px; background: #000a; color: #fff; }
.spv-banner { position: absolute; inset: 0 0 auto 0; background: center / cover no-repeat; z-index: -1; }
.spv-content { display: flex; flex-direction: column; align-items: center; gap: 2.2cqw; text-align: center; padding: 0 6%; }
.spv-logo { width: 13cqw; height: 13cqw; display: grid; place-items: center; }
.spv-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.spv-logo.default { border-radius: 22%; font: 800 7.5cqw var(--sans); }
.spv-h1 { font: 800 5.6cqw/1.05 var(--sans); letter-spacing: -.02em; overflow-wrap: anywhere; }
.spv-tag { font-size: 2cqw; opacity: .82; max-width: 52cqw; overflow-wrap: anywhere; }
.spv-cta { margin-top: 1cqw; padding: 1.4cqw 2.8cqw; border-radius: 999px; font: 700 1.7cqw var(--sans); }
.spv-cta.off { opacity: .5; }
@media (max-width: 640px) { .colors.four { grid-template-columns: repeat(2, 1fr); } .colors .span2 { grid-column: auto; } }
