:root {
  --bg: #08162b;
  --panel: #0e2240;
  --panel-2: #142c52;
  --line: #22406e;
  --text: #eef2f8;
  --muted: #9fb0c9;
  --gold: #fec524;
  --gold-ink: #1b1400;
  --red: #e0475c;
  --green: #3ccf8e;
  --blue: #5aa2ff;
  --radius: 14px;
  --tabs-h: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
[hidden] { display: none !important; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: linear-gradient(180deg, var(--panel) 0%, #0b1d38 100%); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ball { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd75a, var(--gold) 55%, #c99400); box-shadow: inset 0 0 0 2px #0e2240; flex: none; }
h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); color: var(--muted); }
.badge.live { background: #12432f; color: var(--green); }
.badge.paused { background: #4a3a06; color: var(--gold); }
.badge.closed { background: #3d1620; color: #ff9aa8; }
.me-chip { font-size: 12px; text-align: right; color: var(--muted); }
.me-chip b { color: var(--text); display: block; font-size: 14px; }
.budget-bar { max-width: 1100px; margin: 8px auto 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.budget-bar div { background: var(--panel-2); border-radius: 10px; padding: 6px 8px; }
.budget-bar small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.budget-bar b { font-size: 16px; }
.budget-bar .hl b { color: var(--gold); }

.banner { max-width: 1100px; margin: 10px auto 0; padding: 10px 14px; border-radius: 12px; background: #2a2207; border: 1px solid #6b5410; color: #ffe08a; font-size: 14px; margin-left: 16px; margin-right: 16px; }
@media (min-width: 1132px) { .banner { margin-left: auto; margin-right: auto; } }

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px; }

/* tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; height: var(--tabs-h); background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; }
.tabs .i { font-size: 20px; filter: grayscale(1) opacity(.7); }
.tabs button.on { color: var(--gold); }
.tabs button.on .i { filter: none; }
#notif-dot { position: absolute; top: 10px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); }

/* controls */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; position: sticky; top: var(--hdr, 96px); z-index: 10; background: var(--bg); padding: 4px 0 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=datetime-local], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
select { width: auto; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.danger { background: #4a1420; border-color: #7a2234; color: #ffc2cc; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.count { font-size: 12px; color: var(--muted); margin: 0 2px 6px; }

/* player list */
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; text-align: left; width: 100%; }
.prow:active { background: var(--panel-2); }
.prow.lead { border-color: #1f6b4a; box-shadow: inset 3px 0 0 var(--green); }
.prow.outbid { border-color: #6b2232; box-shadow: inset 3px 0 0 var(--red); }
.prow.sold { opacity: .62; }
.rk { font-size: 12px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.pn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr { text-align: right; font-variant-numeric: tabular-nums; }
.pr .price { font-weight: 800; font-size: 17px; }
.pr .price.none { color: var(--muted); font-weight: 600; font-size: 13px; }
.pr .who { font-size: 12px; color: var(--muted); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; vertical-align: 1px; }
.tag.lead { background: #12432f; color: var(--green); }
.tag.out { background: #4a1420; color: #ff9aa8; }
.tag.sold { background: var(--panel-2); color: var(--muted); }
.tag.soon { background: #4a3a06; color: var(--gold); }
.timer { font-variant-numeric: tabular-nums; }
.timer.urgent { color: var(--gold); font-weight: 700; }
.more { margin: 12px auto; display: block; }

/* cards */
.card { background: var(--panel); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h3 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.kv .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--line); padding-top: 6px; color: var(--gold); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #1a335c; font-size: 14px; }
.li:last-child { border-bottom: 0; }
.li .l { min-width: 0; flex: 1; }
.li .l div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .r { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.grid2 .card { margin: 0; }
.meter { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.meter i { display: block; height: 100%; background: var(--gold); }
.feed .li { align-items: flex-start; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.notif.unseen { color: var(--text); }
.notif.unseen::before { content: "● "; color: var(--red); }
.form { display: grid; gap: 10px; }
.form label { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.linkbox { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--bg); border-radius: 8px; padding: 6px 8px; word-break: break-all; color: var(--muted); }

/* bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(2, 8, 20, .66); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--panel); border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); animation: up .18s ease-out; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--muted); }
.sheet h2 { margin: 0 40px 2px 0; font-size: 21px; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat3 div { background: var(--panel-2); border-radius: 12px; padding: 8px 10px; }
.stat3 small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat3 b { font-size: 18px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bidbox { background: var(--bg); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
.bidbox .amt { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; }
.bidbox .amt button { border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 20px; font-weight: 700; }
.bidbox .amt input { text-align: center; font-size: 22px; font-weight: 800; }
.quick { display: flex; gap: 6px; }
.quick button { flex: 1; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.status-line { padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.status-line.lead { background: #12432f; color: var(--green); }
.status-line.out { background: #4a1420; color: #ffc2cc; }
.status-line.info { background: var(--panel-2); color: var(--muted); }
.hist { font-size: 13px; }
.hist .li { padding: 6px 0; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }

/* toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 10px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; padding: 12px 14px; border-radius: 12px; background: #1b3763; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.4); font-size: 14px; animation: up .18s ease-out; }
.toast.ok { background: #0f3d2a; border-color: #1f6b4a; }
.toast.err { background: #4a1420; border-color: #7a2234; }

@media (min-width: 900px) {
  .prow { grid-template-columns: 40px 1.4fr 1fr auto; }
  .prow .wide { display: block !important; }
}
.wide { display: none; font-size: 13px; color: var(--muted); }
