/* GATE RUSH LiveOps — race-control console. Cool slate panels, one signal colour (the start-gate yellow) for
   "now" and the primary action. System fonts only (no CDN): Bahnschrift gives the condensed signage voice on
   Windows, with condensed fallbacks elsewhere. */

:root {
  --bg: #e7ebf0;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --ink: #16202c;
  --ink-2: #4b5969;
  --ink-3: #6f7c8b;
  --line: #d2d9e2;
  --line-2: #e3e8ee;
  --gate: #f2b705;
  --gate-ink: #1a1400;
  --gate-soft: #fdf0c2;
  --live: #11845a;
  --live-soft: #dcf3e9;
  --sched: #2a5fd3;
  --sched-soft: #e0e9fb;
  --ended: #6f7c8b;
  --ended-soft: #e9edf1;
  --off: #b0452a;
  --off-soft: #f8e3dc;
  --danger: #c0352b;
  --focus: #2a5fd3;
  --shadow: 0 1px 0 rgba(22, 32, 44, .04), 0 8px 24px -12px rgba(22, 32, 44, .25);

  --display: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "DIN Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --ui: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1620;
    --panel: #16202c;
    --panel-2: #1b2735;
    --ink: #e4eaf1;
    --ink-2: #a3b0bf;
    --ink-3: #7f8d9d;
    --line: #2b3949;
    --line-2: #223040;
    --gate: #f5c02a;
    --gate-ink: #1a1400;
    --gate-soft: #3a3113;
    --live: #3cc48f;
    --live-soft: #14362a;
    --sched: #79a2ff;
    --sched-soft: #1c2c4d;
    --ended: #8a97a6;
    --ended-soft: #222e3b;
    --off: #ef8a6f;
    --off-soft: #3d241d;
    --danger: #f06a5d;
    --focus: #79a2ff;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -14px rgba(0, 0, 0, .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--ui);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: .01em; margin: 0; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
a { color: var(--sched); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.sub { color: var(--ink-2); font-size: 13px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.num { text-align: right; white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gate); color: var(--gate-ink); padding: 8px 12px; z-index: 100; border-radius: var(--r); }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------ brand mark: a start gate */
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.gate { position: relative; width: 26px; height: 24px; flex: none; }
.gate::before, .gate::after { content: ""; position: absolute; top: 0; bottom: 0; width: 5px; background: var(--gate); }
.gate::before { left: 2px; box-shadow: 17px 0 0 var(--gate); }
.gate::after { left: 0; right: 0; width: auto; height: 5px; bottom: auto; background: repeating-linear-gradient(90deg, var(--gate) 0 5px, var(--ink) 5px 10px); }
.brand-text { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .04em; line-height: 1; display: flex; flex-direction: column; }
.brand-text small { font-weight: 400; font-size: 12px; color: var(--ink-2); letter-spacing: .02em; margin-top: 3px; }
.brand.big .gate { width: 52px; height: 46px; }
.brand.big .gate::before { width: 9px; left: 4px; box-shadow: 35px 0 0 var(--gate); }
.brand.big .gate::after { height: 9px; background: repeating-linear-gradient(90deg, var(--gate) 0 9px, var(--ink) 9px 18px); }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.login-card h1 { font-size: 30px; letter-spacing: .03em; margin-top: 8px; }
.login-card h1 span { font-weight: 400; color: var(--ink-2); }
.login-card label { font-weight: 600; margin-top: 12px; }
.login-card .btn { margin-top: 8px; }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.rail { grid-row: 1 / span 2; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.nav { display: grid; gap: 2px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 9px 12px; border-radius: var(--r); font-weight: 500; position: relative; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--panel-2); font-weight: 650; }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--gate); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 26px; }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
main { padding: 22px 28px 64px; min-width: 0; }
main:focus { outline: none; }
.view-inner { display: grid; gap: 18px; max-width: 1480px; }

.health { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 6px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ended); }
.health.ok .health-dot { background: var(--live); box-shadow: 0 0 0 3px var(--live-soft); }
.health.bad .health-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--off-soft); }
.health.bad { color: var(--danger); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .rail { grid-row: auto; position: static; height: auto; flex-direction: row; align-items: center; gap: 16px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; }
  .nav a.on::before { left: 10px; right: 10px; top: auto; bottom: 0; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .brand-text small { display: none; }
  .top { padding: 12px 16px; }
  main { padding: 16px 16px 48px; }
}

/* ------------------------------------------------------------ controls */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: var(--r); cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--gate); border-color: var(--gate); color: var(--gate-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); border-color: var(--gate); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.danger-text { color: var(--danger); }
.btn.icon-btn, .icon-btn { font: inherit; width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 16px; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }

input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 9px; min-width: 0; width: 100%; }
input[type="checkbox"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[readonly] { background: var(--panel-2); color: var(--ink-2); }
input[aria-invalid], select[aria-invalid], textarea[aria-invalid] { border-color: var(--danger); }
textarea { resize: vertical; }

.field { display: grid; gap: 4px; flex: 1 1 160px; min-width: 0; align-content: start; }
.field.wide { flex-basis: 100%; }
.field > label { font-weight: 600; font-size: 13px; }
.hint { color: var(--ink-3); font-size: 12px; }
.hint.warn { color: var(--off); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 500; }
.utc-echo { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-top: -2px; }
.field-group { display: grid; gap: 4px; flex: 1 1 160px; }
.field-action { display: flex; align-items: flex-end; padding-bottom: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-start; }
.row.quick { align-items: center; gap: 6px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .track { background: var(--live); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch.big .track { width: 58px; height: 32px; }
.switch.big .track::after { width: 24px; height: 24px; top: 4px; left: 4px; }
.switch.big input:checked + .track { background: var(--danger); }
.switch.big input:checked + .track::after { transform: translateX(26px); }
.switch.big .switch-label { font-family: var(--display); font-size: 20px; font-weight: 600; }

fieldset { border: 0; border-top: 1px solid var(--line-2); margin: 0; padding: 16px 0 4px; display: grid; gap: 12px; }
legend { font-family: var(--display); font-size: 15px; font-weight: 600; padding: 0 8px 0 0; color: var(--ink); }
.form { display: grid; gap: 6px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.soft { font-weight: 500; }
.chip.mono { font-family: var(--mono); font-weight: 500; }
.chip.st-live { background: var(--live-soft); color: var(--live); border-color: transparent; }
.chip.st-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.st-scheduled { background: var(--sched-soft); color: var(--sched); border-color: transparent; }
.chip.st-ended { background: var(--ended-soft); color: var(--ended); border-color: transparent; }
.chip.st-disabled { background: var(--off-soft); color: var(--off); border-color: transparent; }
.chip.tag { font-family: var(--mono); font-weight: 500; }
.chip.tag.unknown { border-style: dashed; color: var(--off); }
.chip.act-promotion { color: var(--sched); }
.chip.act-layout { color: var(--live); }
.chip.act-economy { color: var(--off); }
.chip.act-player { color: var(--danger); }
td .chip + .chip { margin-left: 4px; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { font: inherit; font-weight: 550; border: 0; background: none; color: var(--ink-2); padding: 6px 10px; border-radius: 6px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg-btn.on { background: var(--ink); color: var(--panel); }
.seg-btn .count { font-size: 11px; opacity: .7; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--ink-2); cursor: pointer; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tab.on { color: var(--ink); border-bottom-color: var(--gate); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gate); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-right input[type="search"] { width: 240px; }
.toolbar-right select { width: auto; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }

/* ------------------------------------------------------------ tables & panels */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.grid.compact td { padding: 8px 10px; }
.grid .row-actions { text-align: right; white-space: nowrap; }
.grid .row-actions .btn { margin-left: 2px; }
.row-active td:first-child { box-shadow: inset 4px 0 0 var(--live); }
.table-host { overflow-x: auto; }
.table-host > .grid { min-width: 960px; }
.table-host > .grid.audit { min-width: 760px; }
.grid.audit pre, details.json pre, pre.code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px; overflow: auto; max-height: 420px; margin: 8px 0 0; white-space: pre; }
pre.code { max-height: 62vh; }
details summary { cursor: pointer; color: var(--sched); font-weight: 600; }

.split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.version-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.version { font: inherit; color: inherit; width: 100%; text-align: left; display: grid; gap: 2px; grid-template-columns: 1fr auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.version .sub { grid-column: 1 / -1; }
.version.on { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--gate); }
.version-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.facts.inline { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.facts.inline dd { margin-right: 14px; font-weight: 600; }

.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 36px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--ink-2); }
.empty-title { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); }
.empty p { max-width: 60ch; }
.loading { display: flex; gap: 10px; align-items: center; color: var(--ink-2); padding: 20px 4px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gate); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-summary { background: var(--off-soft); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: var(--ink); border-radius: var(--r); padding: 10px 14px; }
.error-summary:focus { outline: 2px solid var(--danger); }
.error-summary ul, .warn-box ul { margin: 6px 0 0; padding-left: 18px; }
.summary-title { font-weight: 650; }
.warn-box { background: var(--gate-soft); border-radius: var(--r); padding: 10px 14px; font-size: 13px; }

/* ------------------------------------------------------------ the track (promotion timeline) — the signature */
.track { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 16px; }
.track-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.track-head h2 { font-size: 22px; letter-spacing: .03em; }
.track-body { position: relative; padding-top: 22px; }
.track-ticks { position: absolute; inset: 0; pointer-events: none; }
.tick { position: absolute; top: 0; bottom: 0; font-size: 11px; color: var(--ink-3); padding-left: 4px; border-left: 1px solid var(--line-2); white-space: nowrap; }
.track-lanes { position: relative; display: grid; gap: 5px; background: repeating-linear-gradient(0deg, transparent 0 27px, var(--line-2) 27px 28px); min-height: 40px; }
.lane { position: relative; height: 26px; }
.track-empty { color: var(--ink-3); font-size: 13px; padding: 8px 0; }
.bar { position: absolute; top: 0; height: 26px; min-width: 6px; border: 0; border-radius: 5px; padding: 0 8px; font: inherit; font-size: 12px; font-weight: 600; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; color: #fff; }
.bar span { position: sticky; left: 0; }
.bar.st-live { background: var(--live); }
.bar.st-scheduled { background: var(--sched); }
.bar.st-ended { background: var(--ended-soft); color: var(--ended); }
.bar.st-disabled { background: repeating-linear-gradient(135deg, var(--off-soft) 0 6px, transparent 6px 12px); color: var(--off); border: 1px dashed var(--off); }
.bar.open-end { border-top-right-radius: 0; border-bottom-right-radius: 0; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.track-now { position: absolute; top: 0; bottom: -6px; width: 0; border-left: 3px solid var(--gate); pointer-events: none; }
.track-now span { position: absolute; top: 0; left: -3px; transform: translateX(-50%); background: var(--gate); color: var(--gate-ink); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; font-family: var(--display); letter-spacing: .04em; }
.track-now::after { content: ""; position: absolute; bottom: 0; left: -8px; width: 13px; height: 5px; background: repeating-linear-gradient(90deg, var(--gate) 0 3px, var(--ink) 3px 6px); }

/* ------------------------------------------------------------ dialogs */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--ink); padding: 0; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
dialog.confirm { width: min(480px, calc(100vw - 32px)); padding: 22px; }
dialog.confirm h2 { font-size: 22px; margin-bottom: 10px; }
.confirm-body { color: var(--ink-2); display: grid; gap: 8px; margin-bottom: 16px; }
.confirm .field { margin-bottom: 14px; }
blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--gate); background: var(--panel-2); color: var(--ink); }
dialog.sheet { width: min(760px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: 0; border-width: 0 0 0 1px; display: none; flex-direction: column; }
dialog.sheet[open] { display: flex; animation: slide-in .2s ease-out; }
dialog.sheet.wide { width: min(1160px, 100vw); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 22px; }
.sheet-body { flex: 1; overflow: auto; padding: 6px 22px 22px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--panel-2); }

.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.editor-aside { position: sticky; top: 8px; display: grid; gap: 12px; padding-top: 16px; }
@media (max-width: 1000px) { .editor-split { grid-template-columns: 1fr; } .editor-aside { position: static; } }
.card-preview-host { background: linear-gradient(160deg, #22324a, #121c2a); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 8px; }
.card-preview-host .sub { color: #9fb0c4; }
.art-preview img { max-width: 100%; max-height: 180px; border-radius: var(--r); border: 1px solid var(--line); display: block; }

/* ------------------------------------------------------------ layout editor */
.editor { display: grid; gap: 12px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sec-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px 14px; display: grid; gap: 10px; }
.sec-card.has-error { border-color: var(--danger); }
.sec-head { display: flex; align-items: center; gap: 10px; }
.sec-num { font-family: var(--display); font-weight: 700; font-size: 18px; width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: var(--panel); border-radius: 6px; }
.sec-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sec-tools { display: flex; gap: 4px; }
details.more summary { font-size: 13px; }
details.more[open] { display: grid; gap: 10px; }
.kv { display: grid; gap: 6px; }
.kv-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; align-items: center; }
.kv-row.flag { grid-template-columns: 1.2fr 130px 1.2fr auto; }
.publish-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 10px; }
.chip-input { display: grid; gap: 6px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.chip.removable { font-family: var(--mono); font-weight: 500; padding-right: 3px; }
.chip.removable button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; width: 18px; height: 18px; border-radius: 50%; line-height: 1; }
.chip.removable button:hover { background: var(--line); }
.chips-empty { color: var(--ink-3); font-size: 12px; }
.chip-add { display: flex; gap: 6px; }

/* ------------------------------------------------------------ shop preview (phone) */
.preview-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .preview-wrap { grid-template-columns: 1fr; } }
.preview-controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 12px; position: sticky; top: 80px; }
.preview-info { display: grid; gap: 10px; }
.preview-stage { display: grid; justify-items: center; }
.phone { width: 390px; max-width: 100%; border-radius: 44px; background: #0b1119; padding: 12px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6), inset 0 0 0 2px #2b3a4d; position: relative; }
.phone-notch { position: absolute; top: 18px; left: 50%; width: 96px; height: 24px; transform: translateX(-50%); background: #0b1119; border-radius: 14px; z-index: 2; }
.phone-screen { border-radius: 34px; background: radial-gradient(120% 60% at 50% 0%, #2b4a7a 0%, #16243a 55%, #0f1929 100%); color: #eef3fa; min-height: 700px; max-height: 780px; overflow-y: auto; padding: 14px 12px 24px; display: grid; gap: 14px; align-content: start; font-size: 13px; scrollbar-width: thin; }
.phone-status { display: flex; justify-content: space-between; padding: 2px 14px 10px; font-weight: 600; font-size: 12px; }
.phone-status span:last-child { font-family: var(--display); font-size: 18px; letter-spacing: .06em; }
.phone-empty { padding: 30px 14px; text-align: center; color: #b7c5d8; }
.shop-sec { display: grid; gap: 8px; }
.shop-sec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px; }
.shop-sec-head h3 { font-size: 17px; letter-spacing: .03em; color: #fff; flex: 1; }
.tag-pill { font-family: var(--mono); font-size: 10px; background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 4px; color: #b7c5d8; }
.shop-sec-head .ends { font-size: 11px; color: var(--gate); width: 100%; }
.shop-sec.tag-unknown { opacity: .55; border: 1px dashed #7890ad; border-radius: 12px; padding: 8px; }
.unknown-note { font-size: 11.5px; color: #c9d4e3; }
.shop-items.layout-card { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.shop-items.layout-hero { display: grid; gap: 8px; }
.shop-items.layout-tile { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.offer { position: relative; background: linear-gradient(180deg, #33537f, #223a5c); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; overflow: hidden; display: grid; color: #f4f7fb; text-align: left; font-size: 12.5px; }
.offer.hero { background: linear-gradient(135deg, #6b3fd1 0%, #2d62d6 60%, #1e8fd0 100%); min-height: 150px; }
.offer.tile { text-align: center; }
.offer[data-currency="Gems"] { --price-bg: #3fb6ff; }
.offer[data-currency="Coins"] { --price-bg: #ffc93c; }
.offer[data-currency="RealMoney"] { --price-bg: #43d17f; }
.offer.owned { filter: grayscale(.7); opacity: .75; }
.offer-art { width: 100%; height: 110px; object-fit: cover; display: block; }
.offer-art.missing { height: 60px; display: grid; place-items: center; font-size: 11px; background: rgba(0,0,0,.25); color: #c9d4e3; }
.offer-body { padding: 10px 12px 6px; display: grid; gap: 3px; }
.offer.tile .offer-body { padding: 10px 6px 4px; }
.offer-type { font-size: 10.5px; color: rgba(255,255,255,.7); }
.offer-title { font-family: var(--display); font-size: 16px; line-height: 1.1; color: #fff; }
.offer.hero .offer-title { font-size: 22px; }
.offer.tile .offer-title { font-size: 13px; }
.offer-sub { color: rgba(255,255,255,.8); font-size: 12px; }
.grants { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.grants li { background: rgba(0,0,0,.22); border-radius: 6px; padding: 2px 6px; font-size: 11.5px; font-weight: 600; }
.grants .g-gem { color: #9fdcff; }
.grants .g-coin { color: #ffe08a; }
.grants .g-chest { color: #ffb88a; }
.grants .g-skin { color: #e5b8ff; }
.offer-foot { display: flex; align-items: center; gap: 6px; padding: 6px 12px 10px; flex-wrap: wrap; }
.offer.tile .offer-foot { justify-content: center; padding: 4px 6px 8px; }
.price { display: inline-flex; align-items: baseline; gap: 6px; }
.price b { background: var(--price-bg, #ffc93c); color: #10202f; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.price s { color: rgba(255,255,255,.65); font-size: 11.5px; }
.owned-label { background: rgba(255,255,255,.15); padding: 4px 10px; border-radius: 999px; font-weight: 700; }
.offer .ends { font-size: 11px; color: var(--gate); font-weight: 600; }
.offer .limit { font-size: 10.5px; color: rgba(255,255,255,.7); margin-left: auto; }
.ribbon { position: absolute; top: 10px; right: -30px; transform: rotate(35deg); background: var(--gate); color: var(--gate-ink); font-family: var(--display); font-weight: 700; font-size: 11px; padding: 2px 34px; letter-spacing: .04em; z-index: 1; }
.discount { background: #ff4d5e; color: #fff; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 6px; align-self: center; }
.offer.tile .ribbon { font-size: 9px; padding: 1px 30px; top: 6px; right: -34px; }

/* ------------------------------------------------------------ config */
.maint { border: 2px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 12px; background: var(--panel); }
.maint.on { border-color: var(--danger); background: linear-gradient(0deg, var(--panel), var(--panel)) padding-box, repeating-linear-gradient(135deg, var(--danger) 0 12px, var(--gate) 12px 24px) border-box; border: 4px solid transparent; }
.maint-head { display: grid; gap: 6px; }
.config fieldset { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 16px; margin-top: 12px; }
.config legend { padding: 0 6px; }

.json-status { font-size: 12.5px; font-weight: 600; }
.json-status.ok { color: var(--live); }
.json-status.bad { color: var(--danger); }
.code-edit { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; min-height: 420px; tab-size: 2; white-space: pre; }

/* ------------------------------------------------------------ players */
.table-host > .grid.players { min-width: 900px; }
.grid tr.clickable { cursor: pointer; }
.grid td .chip + .chip, .pl-head .chip + .chip { margin-left: 4px; }
.players-more { align-items: center; }
.pl-head { padding-top: 16px; }
.pl-head p + p { margin-top: 6px; }
.pl-sec { display: grid; gap: 10px; padding: 16px 0 4px; border-top: 1px solid var(--line-2); margin-top: 16px; min-width: 0; }
.pl-sec h4 { font-size: 14px; margin-bottom: 6px; }
.pl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pl-tile { display: grid; gap: 2px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }
.pl-tile-k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.pl-tile b { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.1; }
.pl-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pl-slot { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--panel); }
.pl-slot.empty { border-style: dashed; color: var(--ink-3); }
.pl-slot .chip { justify-self: start; }
.pl-equip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .pl-equip { grid-template-columns: 1fr; } }
.pl-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.table-host > .grid.pl-table { min-width: 560px; }
.table-host > .grid.pl-items { min-width: 0; }
.grid th.num { text-align: right; }
.grid td.num.neg { color: var(--danger); }
.grid td.num.pos { color: var(--live); }
.confirm textarea { resize: vertical; }
.pl-edit-note { color: var(--ink-3); font-size: 12.5px; }
.pl-edit-cards { display: grid; gap: 6px; }
.pl-edit-cards .kv-row { display: flex; gap: 6px; align-items: center; }
.pl-edit-cards .kv-row input { flex: 1 1 auto; min-width: 0; }
.pl-edit-cards .kv-row input[type="number"] { flex: 0 1 120px; }
.grant-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.grant-summary li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-2); padding: 4px 0; }
.grant-summary b { font-family: var(--mono); font-weight: 600; }

/* ------------------------------------------------------------ roles */
.role-badge { font-family: var(--mono); font-weight: 600; }
.role-badge.role-viewer { background: var(--ended-soft); color: var(--ended); border-color: transparent; }
.role-badge.role-operator { background: var(--sched-soft); color: var(--sched); border-color: transparent; }
.role-badge.role-master { background: var(--gate-soft); color: var(--ink); border-color: var(--gate); }
.btn.role-locked { cursor: not-allowed; }
@media (max-width: 560px) { .role-badge { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; } }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 1000; width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--ink); color: var(--panel); border-radius: var(--r); padding: 11px 12px 11px 14px; box-shadow: var(--shadow); border-left: 5px solid var(--live); animation: toast-in .18s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast-body { display: grid; gap: 2px; flex: 1; font-size: 13px; }
.toast-body span { opacity: .8; word-break: break-word; }
.toast-x { border: 0; background: none; color: inherit; font-size: 18px; cursor: pointer; line-height: 1; opacity: .7; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
