:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #171b25;
  --border: #232837;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --gold: #ffc93c;
  --gold-dim: #b8860b;
  --green: #3ddc84;
  --red: #ff5470;
  --accent: #6c8cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Header ── */
header { text-align: center; padding: 28px 0 8px; }
.logo { font-size: 2.6rem; font-weight: 900; letter-spacing: -1px; }
.logo .lol { color: var(--gold); }
.logo a, .logo .logo-in { position: relative; display: inline-block; color: inherit; }
.logo a:hover { text-decoration: none; }
.logo .crown { position: absolute; top: -30px; left: 1px; width: 48px; height: auto; }
.tagline { color: var(--muted); margin-top: 6px; font-size: 1.05rem; }

.countdown {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 8px 18px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.countdown .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.countdown span.t { color: var(--gold); }

/* ── Nav ── */
.nav { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.nav a { color: var(--muted); font-weight: 600; font-size: .9rem; }
.nav a:hover { color: var(--gold); text-decoration: none; }
.nav a.active { color: var(--gold); }

/* ── Prose pages (About, Rules) ── */
.prose { max-width: 620px; margin: 0 auto; line-height: 1.7; }
.prose p { margin-bottom: 16px; color: var(--text); }
.prose .stat-line { color: var(--muted); }
.rule-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 10px; color: var(--muted); line-height: 1.6;
}
.rule-card b { color: var(--text); display: block; margin-bottom: 3px; }

/* ── Yesterday's champion banner ── */
.champ {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 -8px; padding: 12px 18px;
  background: linear-gradient(90deg, #1c1706, var(--panel) 70%);
  border: 1px solid var(--gold-dim); border-radius: 12px;
  color: var(--text); font-size: .92rem;
}
.champ:hover { text-decoration: none; border-color: var(--gold); }
.champ-crown { font-size: 1.4rem; }
.champ-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ-text b { color: var(--gold); font-weight: 700; }
.champ-amt { color: var(--green); font-weight: 800; margin-left: 6px; }
.champ-link { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.champ:hover .champ-link { color: var(--gold); }

/* ── Rules strip ── */
.rules {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 26px 0 18px;
}
.rules div {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: .86rem; color: var(--muted); text-align: center;
}
.rules b { color: var(--text); display: block; margin-bottom: 3px; font-size: .95rem; }
@media (max-width: 560px) { .rules { grid-template-columns: 1fr; } }

/* ── CTA ── */
.cta-row { text-align: center; margin: 8px 0 26px; }
.btn {
  display: inline-block; border: 0; cursor: pointer; font-weight: 700;
  border-radius: 10px; font-size: 1rem; padding: 13px 30px;
  background: linear-gradient(135deg, var(--gold), #ff9f1c);
  color: #1a1200; transition: transform .1s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: .75; cursor: wait; transform: none; }

.spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px;
  border: 2px solid rgba(26, 18, 0, .3); border-top-color: #1a1200; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-sm {
  padding: 6px 14px; font-size: .82rem; border-radius: 8px;
  background: var(--panel-2); color: var(--gold); border: 1px solid var(--gold-dim);
}
.btn-sm:hover { background: var(--gold); color: #1a1200; }

/* ── Board ── */
.board { display: flex; flex-direction: column; gap: 5px; }
.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 14px;
}
.row.top1 {
  background: linear-gradient(135deg, #1c1706, #12151d 60%);
  border-color: var(--gold-dim);
  box-shadow: 0 0 24px rgba(255, 201, 60, .12);
}
.rank-stack { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; flex-shrink: 0; }
.rank { font-weight: 900; font-size: 1rem; color: var(--muted); text-align: center; line-height: 1; }
.fav { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; background: var(--panel-2); }
.row.top1 .rank { color: var(--gold); font-size: 1.4rem; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-url { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row-bid { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--green); white-space: nowrap; }
.row.top1 .row-bid { color: var(--gold); font-size: 1.1rem; }

/* ── King's decree ── */
.decree {
  margin: -4px 0 4px; padding: 10px 16px 10px 58px;
  background: linear-gradient(90deg, #1c1706, transparent 80%);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  color: var(--gold); font-style: italic; font-size: .92rem;
  overflow-wrap: break-word;
}
.decree-label { color: var(--muted); font-style: normal; font-size: .78rem; letter-spacing: 1px; text-transform: uppercase; }
.label-hint { color: var(--muted); font-weight: 400; text-transform: none; font-size: .76rem; }

/* Compact rows on mobile so the domain gets the space */
@media (max-width: 480px) {
  .row { gap: 8px; padding: 8px 10px; }
  .rank-stack { min-width: 34px; }
  .rank { font-size: .88rem; }
  .row.top1 .rank { font-size: 1.2rem; }
  .fav { width: 30px; height: 30px; }
  .row-bid { font-size: .88rem; }
  .btn-sm { padding: 5px 8px; font-size: .74rem; }
  .decree { padding-left: 42px; }
}

.empty {
  text-align: center; padding: 60px 20px; background: var(--panel);
  border: 1px dashed var(--border); border-radius: 16px; color: var(--muted);
}
.empty b { color: var(--gold); }

/* ── Stats bar ── */
.stats { display: flex; justify-content: center; gap: 28px; margin: 18px 0 6px; color: var(--muted); font-size: .88rem; }
.stats b { color: var(--text); }

/* ── Modal ── */
.overlay {
  position: fixed; inset: 0; background: rgba(4, 6, 10, .78);
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50;
  overflow-y: auto;
}
.overlay.open { display: flex; }
.modal {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 460px; padding: 26px;
}
.modal h2 { margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: .88rem; margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; font-size: 1rem;
}
.field input:focus { outline: none; border-color: var(--gold-dim); }
.amount-wrap { position: relative; }
.amount-wrap .dollar { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.amount-wrap input { padding-left: 26px; }

.calc {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: .88rem; margin-bottom: 16px; line-height: 1.65;
}
.calc .good { color: var(--green); font-weight: 700; }
.calc .warn { color: var(--gold); font-weight: 700; }
.calc .info { color: var(--muted); }

.quick { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.quick button {
  flex: 1; min-width: 90px; cursor: pointer; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 6px; font-size: .8rem; font-weight: 600;
}
.quick button:hover { border-color: var(--gold-dim); color: var(--gold); }
.modal .btn { width: 100%; }
.modal .close {
  float: right; background: none; border: 0; color: var(--muted);
  font-size: 1.4rem; cursor: pointer; line-height: 1; margin: -6px -6px 0 0;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px; border-radius: 10px; font-weight: 700; z-index: 99;
  animation: fadeout .5s 4.5s forwards;
}
.toast.ok { background: #10391f; color: var(--green); border: 1px solid var(--green); }
.toast.err { background: #3a1220; color: var(--red); border: 1px solid var(--red); }
@keyframes fadeout { to { opacity: 0; visibility: hidden; } }

/* ── Battle log ── */
.log {
  margin-top: 26px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 18px;
}
.log-title { font-weight: 800; font-size: .82rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.log-row { display: flex; gap: 12px; padding: 6px 0; font-size: .88rem; border-top: 1px solid var(--border); align-items: baseline; }
.log-row:first-of-type { border-top: 0; }
.log-time { color: var(--muted); font-size: .76rem; min-width: 64px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-msg { color: var(--muted); min-width: 0; }
.log-msg b { color: var(--text); font-weight: 700; }
.log-amt { color: var(--green); font-weight: 700; }

/* ── Final Hour ── */
.final-hour .countdown {
  border-color: var(--red); color: var(--text);
  background: #2a0d16;
  animation: fh-pulse 1.1s infinite;
}
.final-hour .countdown .t { color: var(--red); }
.final-hour .countdown .dot { background: var(--red); }
@keyframes fh-pulse {
  50% { box-shadow: 0 0 22px rgba(255, 84, 112, .45); }
}

footer { text-align: center; margin-top: 46px; color: var(--muted); font-size: .84rem; }
footer a { color: var(--muted); text-decoration: underline; }

.devbadge {
  position: fixed; bottom: 12px; right: 12px; background: #3a2b06; color: var(--gold);
  border: 1px solid var(--gold-dim); padding: 5px 12px; border-radius: 8px; font-size: .74rem; font-weight: 700;
}

/* ── Champion badge box ── */
.badge-box {
  margin-top: 22px; padding: 18px 20px; text-align: center;
  background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 14px;
}
.badge-box h2 { font-size: 1.05rem; margin-bottom: 6px; }
.badge-box p { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.badge-preview { margin-bottom: 14px; }
.badge-code {
  display: block; width: 100%; resize: none; cursor: pointer;
  background: var(--bg); color: var(--green); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; font-family: Consolas, monospace; font-size: .78rem;
}
.badge-hint { color: var(--muted); font-size: .76rem; }

/* ── Archive ── */
.arch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1.page { font-size: 1.6rem; margin: 10px 0 20px; text-align: center; }
