/* Trove Admin. Brand: the Trove Prisons blackstone prison, here in dark crimson and gold (the website's display and
   body fonts, its notched block corners). Mobile first; the sidebar becomes a drawer under 900px. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo-var-wdth-latin.woff2") format("woff2"); font-weight: 500 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-hyperlegible-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-hyperlegible-700-latin.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #0b0809; --bg-2: #100b0c; --surface: #161011; --surface-2: #1e1517; --surface-3: #281c1f; --raise: #2f2125;
  --line: #34242a; --line-strong: #4b333a;
  --text: #f5ede7; --muted: #bba9a2; --dim: #8b7972;
  --crimson: #c8172f; --crimson-2: #e5384f; --crimson-deep: #5e0c18; --crimson-glow: rgba(200, 23, 47, .28);
  --gold: #e9b949; --gold-2: #f6d27e; --gold-ink: #1e1503; --gold-soft: rgba(233, 185, 73, .14);
  --soul: #48d3ff; --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .13); --warn: #f6a623; --warn-soft: rgba(246, 166, 35, .14); --danger: #ff5d6c; --danger-soft: rgba(255, 93, 108, .13);
  --common: #9aa4b2; --rare: #48a8ff; --epic: #b46bff; --legendary: #f2b83b;
  --display: "Archivo", "Arial Narrow", Impact, sans-serif; --body: "Atkinson", "Segoe UI", system-ui, sans-serif; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --notch: 10px; --radius: 6px; --side: 248px; --gutter: 16px;
}
@media (min-width: 900px) { :root { --gutter: 28px; } }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--body); overflow-x: hidden;
  background-image: radial-gradient(1200px 500px at 85% -10%, rgba(200, 23, 47, .10), transparent 60%), radial-gradient(900px 400px at -10% 110%, rgba(233, 185, 73, .05), transparent 60%); background-attachment: fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--gold-2); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; font-stretch: 85%; letter-spacing: .01em; line-height: 1.1; margin: 0; }
.noscript { padding: 24px; }
[hidden] { display: none !important; } /* .field / .row set display, which would beat the hidden attribute */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- boot + login ---- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { display: grid; justify-items: center; gap: 12px; color: var(--muted); }
.boot-mark img { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.login-card { width: min(440px, 100%); background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-strong); padding: 32px 28px; display: grid; gap: 18px; justify-items: center; text-align: center;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch)); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.login-card img { width: 96px; height: 96px; filter: drop-shadow(0 6px 24px var(--crimson-glow)); }
.login-card h1 { font-size: 30px; text-transform: uppercase; }
.login-card h1 span { color: var(--gold); }
.login-card p { margin: 0; color: var(--muted); }
.login-note { font-size: 13px; color: var(--dim); }
.personas { display: grid; gap: 8px; width: 100%; }
.alert { width: 100%; padding: 10px 12px; border: 1px solid; border-radius: var(--radius); font-size: 14px; text-align: left; }
.alert.err { border-color: rgba(255, 93, 108, .45); background: var(--danger-soft); color: #ffc4ca; }
.alert.dev { border-color: rgba(246, 166, 35, .45); background: var(--warn-soft); color: #ffd99a; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #120c0e, #0d090a); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; text-decoration: none; color: var(--text); }
.brand img { width: 42px; height: 42px; filter: drop-shadow(0 4px 14px var(--crimson-glow)); }
.brand b { display: block; font-family: var(--display); font-weight: 900; font-stretch: 80%; font-size: 21px; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
.brand small { color: var(--gold); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: grid; align-content: start; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-weight: 700; position: relative; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(200, 23, 47, .22), rgba(200, 23, 47, .04)); color: var(--text); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; background: var(--gold); border-radius: 0 3px 3px 0; }
.nav a[aria-current="page"] svg { color: var(--gold); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.me { margin: 10px; padding: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--crimson-deep); display: grid; place-items: center; font-weight: 700; color: var(--gold-2); overflow: hidden; }
.avatar img { width: 100%; height: 100%; }
.me b { display: block; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .role { font-size: 12px; color: var(--gold); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px var(--gutter); background: rgba(11, 8, 9, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 24px; text-transform: uppercase; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 22px var(--gutter) 60px; display: grid; gap: 18px; align-content: start; max-width: 1480px; width: 100%; }
.dev-banner { margin: 0; padding: 7px var(--gutter); background: repeating-linear-gradient(135deg, rgba(246,166,35,.16) 0 12px, rgba(246,166,35,.08) 12px 24px); color: #ffd99a; font-size: 13px; border-bottom: 1px solid rgba(246,166,35,.3); }
.scrim { display: none; }

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 25; }
  .menu-btn { display: grid; }
  .top h1 { font-size: 20px; }
  .status-pills .pill.opt { display: none; }
}

/* ---- building blocks ---- */
.card { position: relative; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); padding: 18px; min-width: 0;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch)); }
.card > h2, .card-head h2 { font-size: 17px; text-transform: uppercase; letter-spacing: .05em; color: var(--text); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { flex: 1; min-width: 0; }
.card > h2 { margin-bottom: 14px; }
.card-sub { color: var(--muted); font-size: 13px; margin: -8px 0 14px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: minmax(0, 1fr); }
.cols-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .cols-2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } .cols-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 700px) and (max-width: 1099px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.gold { color: var(--gold); }
.empty { color: var(--dim); padding: 18px 4px; text-align: center; font-size: 14px; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1250px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; min-width: 0; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent, var(--line-strong)); }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kpi .value { font-family: var(--display); font-weight: 800; font-stretch: 85%; font-size: 28px; line-height: 1.15; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 700; }
.kpi .sub { font-size: 12px; color: var(--dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.ok { --accent: var(--ok); } .kpi.bad { --accent: var(--danger); } .kpi.gold { --accent: var(--gold); } .kpi.crimson { --accent: var(--crimson); } .kpi.soul { --accent: var(--soul); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--crimson), var(--gold)); width: 0; }

.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.warn { background: var(--warn); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.crimson { background: rgba(200, 23, 47, .18); border-color: rgba(229, 56, 79, .45); color: #ffb3bd; }
.badge.gold { background: var(--gold-soft); border-color: rgba(233, 185, 73, .45); color: var(--gold-2); }
.badge.ok { background: var(--ok-soft); border-color: rgba(74, 222, 128, .4); color: #9ff0bf; }
.badge.warn { background: var(--warn-soft); border-color: rgba(246, 166, 35, .4); color: #ffd28a; }
.badge.soul { background: rgba(72, 211, 255, .12); border-color: rgba(72, 211, 255, .4); color: #a8e9ff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--raise); border-color: #5d4048; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: linear-gradient(180deg, var(--crimson-2), var(--crimson)); border-color: #f0566b; color: #fff; box-shadow: 0 6px 18px -6px var(--crimson-glow); }
.btn.primary:hover { background: linear-gradient(180deg, #ef4c62, #d81f38); }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: #ffe29a; color: var(--gold-ink); }
.btn.gold:hover { background: linear-gradient(180deg, #ffe08f, #f0c35a); }
.btn.danger { background: transparent; border-color: rgba(255, 93, 108, .55); color: #ff9aa5; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.discord { background: #5865f2; border-color: #7d87ff; color: #fff; min-height: 50px; font-size: 16px; }
.btn.discord:hover { background: #4752c4; }
.btn.busy { pointer-events: none; opacity: .7; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); }
.textarea { padding: 10px 12px; min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .full { grid-column: 1 / -1; } }
.hint { font-size: 12px; color: var(--dim); }
.counter { font-size: 12px; color: var(--dim); text-align: right; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--crimson); color: #fff; }
.seg.gold button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; margin-bottom: 14px; }
.tabs button { min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--gold-2); border-bottom-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-2); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; width: 20px; height: 20px; top: 2px; left: 2px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked { background: var(--crimson); border-color: var(--crimson-2); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700; }
td { padding: 10px; border-bottom: 1px solid rgba(52, 36, 42, .6); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(200, 23, 47, .06); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.name-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.feed { display: grid; gap: 2px; max-height: 470px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.feed-line { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 6px 8px; border-radius: 4px; font-size: 14px; }
.feed-line:hover { background: rgba(255,255,255,.025); }
.feed-line time { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.feed-line b { color: var(--gold-2); }
.feed-line.sys { color: var(--muted); font-size: 13px; }
.feed-line.web b { color: #a8e9ff; }
.feed-line .msg { overflow-wrap: anywhere; }
.list { display: grid; gap: 0; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid rgba(52, 36, 42, .6); }
.list-item:last-child { border-bottom: 0; }
.list-item .t { font-size: 14px; overflow-wrap: anywhere; }
.list-item .s { font-size: 12px; color: var(--dim); }
.player-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.lockbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.lockbar .lk { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.lockbar svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.lockbar.held { border-color: rgba(233, 185, 73, .5); background: linear-gradient(90deg, var(--gold-soft), transparent); }
.lockbar.held svg { color: var(--gold); }
.lockbar.mine { border-color: rgba(74, 222, 128, .45); background: linear-gradient(90deg, var(--ok-soft), transparent); }
.lockbar.mine svg { color: var(--ok); }

/* player sheet */
.sheet-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.sheet-head .ph { width: 64px; height: 64px; border-radius: 8px; background: linear-gradient(135deg, var(--crimson-deep), #2a1015); display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 30px; color: var(--gold-2); border: 1px solid var(--line-strong); }
.sheet-head h2 { font-size: 30px; text-transform: none; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); padding: 12px 14px; min-width: 0; }
.stat span { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.stat b { display: block; font-size: 18px; margin-top: 2px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.keybox { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; background: var(--surface); }
.keybox b { display: block; font-family: var(--display); font-size: 24px; font-weight: 800; }
.keybox span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.edit-list { display: grid; gap: 12px; }
.edit { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.edit h3 { font-family: var(--body); font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.edit .row > .input, .edit .row > .select { flex: 1; min-width: 100px; }

/* tuning */
.tune-rows { display: grid; gap: 0; }
.tune-row { display: grid; gap: 8px 14px; grid-template-columns: minmax(0, 1fr); padding: 14px 2px; border-bottom: 1px solid rgba(52, 36, 42, .6); align-items: center; }
@media (min-width: 900px) { .tune-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) auto; } }
.tune-row .lbl b { display: block; font-size: 14px; }
.tune-row .lbl span { display: block; font-size: 12px; color: var(--dim); }
.tune-row .ctl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tune-row .ctl input[type=range] { flex: 1; min-width: 80px; }
.tune-row .ctl .input { width: 96px; flex: none; min-height: 40px; }
.tune-row.dirty { background: linear-gradient(90deg, var(--gold-soft), transparent 60%); }
.tune-row .now { font-variant-numeric: tabular-nums; color: var(--gold-2); font-weight: 700; }
input[type=range] { accent-color: var(--crimson-2); height: 28px; }
.styles { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .styles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.style-card { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; display: grid; gap: 4px; min-height: 44px; color: var(--text); }
.style-card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.style-card.now { border-color: var(--gold); background: var(--gold-soft); }
.style-card b { font-size: 14px; }
.style-card span { font-size: 12px; color: var(--muted); }

/* economy */
.odds { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.odds i { display: block; height: 100%; }
.odds .common, .tier-dot.common { background: var(--common); } .odds .rare, .tier-dot.rare { background: var(--rare); } .odds .epic, .tier-dot.epic { background: var(--epic); } .odds .legendary, .tier-dot.legendary { background: var(--legendary); }
.tier-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.crate-card { cursor: pointer; display: grid; gap: 10px; text-align: left; width: 100%; color: var(--text); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; }
.crate-card:hover, .crate-card[aria-pressed="true"] { border-color: var(--gold); }
.crate-card h3 { font-size: 18px; text-transform: uppercase; }
.sum { font-weight: 700; font-variant-numeric: tabular-nums; }
.sum.ok { color: var(--ok); } .sum.bad { color: var(--danger); }
.price-input { width: 110px; min-height: 38px; }

/* toasts + dialog */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 10px; width: min(420px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 12px 12px 0; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: rise .18s ease-out; overflow: hidden; }
.toast::before { content: ""; align-self: stretch; background: var(--muted); }
.toast.ok::before { background: var(--ok); } .toast.err::before { background: var(--crimson-2); } .toast.info::before { background: var(--gold); }
.toast b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.toast p { margin: 2px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.toast button { background: none; border: 0; color: var(--dim); cursor: pointer; width: 32px; height: 32px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0; width: min(480px, calc(100vw - 32px)); border-radius: 10px; box-shadow: 0 40px 100px rgba(0,0,0,.7); }
dialog::backdrop { background: rgba(5, 3, 4, .72); backdrop-filter: blur(3px); }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg h2 { font-size: 20px; text-transform: uppercase; }
.dlg p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.dlg .code { font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); padding: 10px; border-radius: 6px; word-break: break-all; max-height: 200px; overflow: auto; color: var(--gold-2); }
.danger-note { color: #ffb3bd !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.chip { text-decoration: none; }
.row.nowrap { flex-wrap: nowrap; }
.select.auto { width: auto; min-width: 84px; }
.select.tier-select { width: 128px; min-height: 38px; }
.list-item.one { grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 900px) { .shell { background: linear-gradient(90deg, #0f0a0b var(--side), transparent var(--side)); } }

/* ---- data health, page bar, notices (2026-11-13) ---- */
.pagebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; min-width: 0; }
.pagebar .updated { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.pagebar .switch.small { min-height: 36px; gap: 8px; font-size: 13px; color: var(--muted); }
.switch.small input { width: 36px; height: 22px; }
.switch.small input::after { width: 16px; height: 16px; }
.switch.small input:checked::after { transform: translateX(14px); }
.health { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.health .src { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--muted); max-width: 100%; }
.health .src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health .src em { font-style: normal; font-weight: 700; color: var(--text); }
.health .src.ok { color: var(--muted); }
.health .src.timeout, .health .src.waiting, .health .src.stale { border-color: rgba(246, 166, 35, .45); background: var(--warn-soft); }
.health .src.timeout em, .health .src.waiting em, .health .src.stale em { color: #ffd28a; }
.health .src.offline, .health .src.refused { border-color: rgba(255, 93, 108, .45); background: var(--danger-soft); }
.health .src.offline em, .health .src.refused em { color: #ffc4ca; }
.health .src.missing { border-color: rgba(72, 211, 255, .4); background: rgba(72, 211, 255, .10); }
.health .src.missing em { color: #a8e9ff; }
.health .src.off em { color: var(--dim); }
.notice { border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: var(--radius); padding: 12px 14px; background: var(--surface); margin-bottom: 14px; }
.notice b { font-family: var(--display); font-stretch: 85%; text-transform: uppercase; letter-spacing: .05em; font-size: 14px; }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.notice.missing { border-color: rgba(72, 211, 255, .45); background: rgba(72, 211, 255, .07); } .notice.missing b { color: #a8e9ff; }
.notice.timeout, .notice.waiting, .notice.stale { border-color: rgba(246, 166, 35, .5); background: var(--warn-soft); } .notice.timeout b, .notice.waiting b, .notice.stale b { color: #ffd28a; }
.notice.offline, .notice.refused { border-color: rgba(255, 93, 108, .5); background: var(--danger-soft); } .notice.offline b, .notice.refused b { color: #ffc4ca; }
.notice.off b { color: var(--muted); }
.pill.bridge { cursor: help; }
@media (max-width: 520px) { .pill.bridge { padding: 0 10px; } .pill.bridge .lbl { display: none; } .pagebar .updated { width: 100%; order: 3; } }
/* loading skeleton */
.sk i { display: block; height: 12px; border-radius: 4px; margin: 8px 0; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; }
.sk i:first-child { width: 40%; } .sk i:nth-child(2) { width: 70%; height: 22px; } .card.sk { min-height: 220px; } .card.sk i:nth-child(3) { width: 85%; } .card.sk i:nth-child(4) { width: 55%; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk i { animation: none; } }
/* live chat history */
.feed.chat { min-height: 280px; align-content: start; }
.feed-more { padding: 4px 0 8px; }
.feed-start { color: var(--dim); font-size: 12px; text-align: center; padding: 6px 0 10px; }
.feed-day { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; color: var(--gold-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 8px 4px 4px; background: linear-gradient(180deg, var(--surface-2) 70%, transparent); }
.feed-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.feed-line .tag { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(72, 211, 255, .12); color: #a8e9ff; vertical-align: 1px; }
.feed-line.discord .tag { background: rgba(88, 101, 242, .2); color: #c3c9ff; }
.feed-line.discord b { color: #c3c9ff; }
.feed-line.sys.join .msg { color: #9ff0bf; } .feed-line.sys.leave .msg { color: var(--muted); } .feed-line.sys.stopping .msg { color: #ffb3bd; } .feed-line.sys.started .msg { color: #9ff0bf; font-weight: 700; }
.countdown { font-variant-numeric: tabular-nums; }
/* players: quick actions */
.btn.xs { min-height: 32px; padding: 0 9px; font-size: 12px; }
.quick { gap: 6px; }
.stack.tight { gap: 12px; }
@media (max-width: 699px) { table.players th:nth-child(4), table.players td:nth-child(4), table.players th:nth-child(5), table.players td:nth-child(5) { display: none; } }
@media (pointer: coarse) { .btn.xs { min-height: 44px; padding: 0 12px; } }
/* ---- Stats charts (2026-11-13; charts.js). Categorical slots validated for the dark surface (dataviz validate_palette:
   lightness band, chroma, adjacent CVD and normal-vision separation, >= 3:1 contrast): gold, blue, crimson, violet, aqua,
   orange. Money in / out = blue / crimson (diverging). Peak hours = one gold hue, brighter = more. ---- */
:root { --series-1: #c98500; --series-2: #3987e5; --series-3: #e04a5e; --series-4: #9085e9; --series-5: #199e70; --series-6: #d95926;
  --flow-in: #3987e5; --flow-out: #e04a5e; --seq-rgb: 233, 185, 73; }
.c1 { --c: var(--series-1); } .c2 { --c: var(--series-2); } .c3 { --c: var(--series-3); } .c4 { --c: var(--series-4); } .c5 { --c: var(--series-5); } .c6 { --c: var(--series-6); }
.cin { --c: var(--flow-in); } .cout { --c: var(--flow-out); }
.stats-controls { min-width: 0; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; border-bottom: 1px solid var(--line); }
.stats-controls .tabs { border-bottom: 0; margin-bottom: 0; max-width: 100%; min-width: 0; }
.stats-controls .seg { margin-bottom: 8px; }
.stats-meta { margin: -6px 0 0; }
.chart-card .card-head { margin-bottom: 6px; }
.chart-card .card-sub { margin: 0 0 12px; }
.chart-tools { gap: 6px; }
.btn.xs svg { width: 14px; height: 14px; }
.btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-2); background: var(--gold-soft); }
.chart-body { min-width: 0; }
.chart { position: relative; width: 100%; min-height: 120px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid.zero { stroke: var(--line-strong); }
.chart .axis { fill: var(--dim); font: 11px var(--body); font-variant-numeric: tabular-nums; }
.chart .ref { stroke: var(--muted); stroke-width: 1; opacity: .55; shape-rendering: crispEdges; }
.chart .ref-t { fill: var(--muted); }
.chart .ln { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { fill: var(--c); opacity: .1; }
.chart .bar { fill: var(--c); }
.chart .dot { fill: var(--c); stroke: var(--surface-2); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band-hl { fill: rgba(255, 255, 255, .045); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:focus-visible { outline: none; stroke: var(--gold); stroke-width: 2; }
.ctip { position: absolute; z-index: 6; pointer-events: none; min-width: 150px; max-width: 280px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.55); font-size: 12px; }
.ctip b { display: block; font-size: 12px; color: var(--text); margin-bottom: 4px; white-space: nowrap; }
.ctip .tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; color: var(--muted); line-height: 1.6; }
.ctip .tr:not(:has(.sw)) { grid-template-columns: minmax(0, 1fr) auto; }
.ctip .v { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.clegend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.clegend .lg { display: inline-flex; align-items: center; gap: 6px; }
.hbars { display: grid; gap: 8px; }
.hb { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.hb-l { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb-bar { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--c); flex: none; max-width: calc(100% - 64px); }
.hb-v { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.heat-wrap { position: relative; overflow-x: auto; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(10px, 1fr)); gap: 2px; min-width: 330px; }
.heat .hh { font-size: 10px; color: var(--dim); text-align: left; height: 14px; }
.heat .hd { font-size: 11px; color: var(--muted); align-self: center; }
.heat .hc { height: 22px; border-radius: 3px; background: rgba(var(--seq-rgb), var(--v, 0)); }
.heat .hc.none { background: var(--surface-3); opacity: .5; }
.heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-scale .ramp { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(var(--seq-rgb), .1), rgba(var(--seq-rgb), 1)); }
.ctable-wrap { max-height: 360px; overflow: auto; }
.ctable td, .ctable th { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
@media (max-width: 520px) { .stats-controls .seg { width: 100%; } .stats-controls .seg button { flex: 1; } .hb { grid-template-columns: minmax(70px, 38%) minmax(0, 1fr); } }
