:root {
  --bg: #0b0d12;
  --panel: #151923;
  --panel-2: #1d2230;
  --line: #2a3140;
  --ink: #eef2f8;
  --muted: #98a3b6;
  --accent: #f5b83d;
  --accent-ink: #1a1405;
  --green: #35c98a;
  --red: #ef5b5b;
  --blue: #5aa9ff;
  --radius: 14px;
  /* CJK faces appended so Chinese renders natively rather than as boxes on
     devices whose Latin-first stack has no Han coverage. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial,
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
          "Source Han Sans SC", "Heiti SC", sans-serif;
}

* { box-sizing: border-box; }

/* `hidden` must beat any inline display we set on flex panes */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

a { color: var(--blue); }

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
p { line-height: 1.5; }

.wrap { max-width: 560px; margin: 0 auto; padding: 18px 16px 64px; }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* ---------- brand header ---------- */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand .box {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, #262c3a, #10131a);
  border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 18px;
}
.brand h1 { font-size: 1.15rem; margin: 0; }
.brand .sub { font-size: .75rem; color: var(--muted); }

/* ---------- buttons ---------- */
button, .btn {
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 650;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
button:hover:not(:disabled), .btn:hover { background: #262d3d; border-color: #3c4557; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .38; cursor: not-allowed; }

button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #ffc85a; border-color: #ffc85a; }
button.green { background: var(--green); color: #04241a; border-color: var(--green); }
button.green:hover:not(:disabled) { background: #4ee0a0; border-color: #4ee0a0; }
button.danger { background: transparent; color: var(--red); border-color: #52303a; }
button.danger:hover:not(:disabled) { background: #2a1a20; }
button.wide { width: 100%; }
button.big { font-size: 1.05rem; padding: 15px 18px; }
button.slim { padding: 7px 11px; font-size: .8rem; font-weight: 600; }

/* ---------- inputs ---------- */
input[type="text"], input[type="number"], select {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: #0e1119;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.field { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.bid-input-row { display: flex; align-items: stretch; gap: 0; }
.bid-input-row .dollar {
  display: grid; place-items: center;
  background: #0e1119; border: 1px solid var(--line); border-right: none;
  border-radius: 10px 0 0 10px; padding: 0 14px; font-size: 1.5rem; color: var(--muted);
}
.bid-input-row input {
  border-radius: 0 10px 10px 0;
  font-size: 2rem; font-weight: 700; text-align: left;
  font-variant-numeric: tabular-nums;
}

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.pill.open { background: rgba(53,201,138,.14); border-color: rgba(53,201,138,.4); color: var(--green); }
.pill.closed { background: rgba(239,91,91,.12); border-color: rgba(239,91,91,.35); color: var(--red); }
.pill.wait { background: rgba(245,184,61,.12); border-color: rgba(245,184,61,.35); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- info list ---------- */
ol.info, ul.rules { margin: 0; padding-left: 1.15em; }
ol.info li, ul.rules li { margin: 0 0 9px; line-height: 1.45; }
ol.info li { padding-left: 3px; }
ol.info li.fresh { animation: reveal .5s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
ol.info li.pending { color: #4a5468; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
td { padding: 8px; border-bottom: 1px solid #1f2532; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.top td { color: var(--accent); font-weight: 700; }

/* ---------- big numbers ---------- */
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; flex: 1; min-width: 96px; }
.stat .k { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #232a38; border: 1px solid var(--line); color: var(--ink);
  padding: 11px 16px; border-radius: 10px; font-size: .88rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 50; max-width: 92vw;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: #3a1f26; border-color: #5c2f39; color: #ffd7d7; }
.toast.ok { background: #12352a; border-color: #1f5b45; color: #c6f5e2; }

.offline {
  position: fixed; top: 0; left: 0; right: 0; background: var(--red); color: #fff;
  font-size: .78rem; font-weight: 700; text-align: center; padding: 5px; z-index: 60; display: none;
}
body.disconnected .offline { display: block; }
