:root {
  --bg: #0b0b0d;
  --bg-2: #111013;
  --card: #141317;
  --line: rgba(203, 161, 53, 0.22);
  --line-soft: rgba(255, 255, 255, 0.07);
  --gold: #cba135;
  --gold-bright: #e6cf8b;
  --ink: #ece7dd;
  --muted: #8f897d;
  --danger: #c8695f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 50% -200px, rgba(203, 161, 53, 0.10), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 620px; margin: 0 auto; padding: 56px 22px 72px; }

/* Header */
.site-head { text-align: center; margin-bottom: 40px; }
.mark { width: 46px; height: auto; color: var(--gold); display: block; margin: 0 auto 14px; }
.site-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: 0.01em;
  margin: 0;
}
.tagline { color: var(--muted); margin: 10px 0 0; font-size: 1rem; }

/* Throne card */
.throne-card {
  background: linear-gradient(180deg, var(--card), #0f0e12);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 44px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.throne-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 160px at 50% 0, rgba(203, 161, 53, 0.10), transparent 70%);
  opacity: 0; transition: opacity 0.4s ease;
  pointer-events: none;
}
.throne-card:not(.empty)::before { opacity: 1; }
.throne-card.empty { border-color: var(--line-soft); }

.reign-label {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.ruler-name {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  font-weight: 600; line-height: 1.15;
  word-break: break-word;
}
.throne-card.empty .ruler-name { color: var(--muted); font-weight: 500; }
.ruler-message {
  margin: 16px auto 0; max-width: 34ch;
  font-size: 1.08rem; color: var(--ink); font-style: italic;
  border: 0; padding: 0;
}
.ruler-message::before { content: "\201C"; } .ruler-message::after { content: "\201D"; }
.ruler-link {
  display: inline-block; margin-top: 16px;
  color: var(--gold-bright); text-decoration: none; font-size: 0.92rem;
  word-break: break-all; border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.ruler-link:hover { border-bottom-color: var(--gold-bright); }
.reign-meta {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 0.85rem; letter-spacing: 0.01em;
}

/* Takeover flash */
@keyframes throne-flash {
  0% { box-shadow: 0 0 0 0 rgba(203, 161, 53, 0.5); border-color: var(--gold-bright); }
  100% { box-shadow: 0 0 0 14px rgba(203, 161, 53, 0); border-color: var(--line); }
}
.throne-card.just-changed { animation: throne-flash 0.9s ease-out; }

/* CTA */
.cta-row { text-align: center; margin: 30px 0 4px; }
.cta-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.share-btn { padding: 14px 20px; }
.seize-btn {
  appearance: none;
  background: var(--gold); color: #1a1508;
  border: 0; font-family: var(--sans); font-weight: 700; font-size: 1rem;
  letter-spacing: 0.01em; padding: 14px 30px; border-radius: 10px; cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s ease, transform 0.05s ease;
}
.seize-btn:hover { background: var(--gold-bright); }
.seize-btn:active { transform: translateY(1px); }
.seize-btn:disabled { opacity: 0.55; cursor: default; }

.price-hint { color: var(--muted); margin: 14px 0 0; font-size: 0.92rem; }
.record {
  text-align: center; margin: 18px 0 0; color: var(--gold-bright);
  font-size: 0.85rem; letter-spacing: 0.02em;
}
.micro { text-align: center; color: var(--muted); font-size: 0.78rem; margin: 6px 0 0; opacity: 0.8; }


.report-btn {
  margin-top: 18px;
  background: none; border: 0; color: var(--muted);
  font-size: 0.8rem; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--line-soft);
}
.report-btn:hover { color: var(--danger); }

/* Hall of fame */
.hall { margin-top: 56px; }
.hall h2 {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 14px; text-align: center;
}
.history { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.history li {
  display: grid; grid-template-columns: 1.6em 1fr auto; align-items: center; gap: 14px;
  padding: 15px 6px; border-bottom: 1px solid var(--line-soft);
}
.history li:first-child { border-top: 1px solid var(--line-soft); }
.history li::before {
  counter-increment: rank; content: counter(rank);
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem;
  text-align: right; opacity: 0.6;
}
.history .h-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.history .h-name { font-family: var(--serif); font-size: 1.08rem; line-height: 1.2; }
.history .h-msg {
  color: var(--muted); font-size: 0.84rem; font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history .h-side { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.history .h-amt { color: var(--gold); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 1rem; }
.history .h-dur { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.02em; }
.history-empty { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }

/* Footer */
.site-foot { margin-top: 56px; text-align: center; }
.foot-stat {
  color: var(--ink); font-size: 0.9rem; margin: 0 0 20px;
  padding-bottom: 20px; border-bottom: 1px solid var(--line-soft);
}
.foot-links { margin-bottom: 14px; }
.foot-links a { color: var(--muted); font-size: 0.85rem; text-decoration: none; border-bottom: 1px solid var(--line-soft); padding-bottom: 1px; }
.foot-links a:hover { color: var(--ink); border-bottom-color: var(--muted); }
.fine-print { color: var(--muted); font-size: 0.76rem; line-height: 1.6; margin: 0; opacity: 0.85; }

/* Dialog */
.seize-dialog {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink);
  max-width: 420px; width: 92%; padding: 0;
}
.seize-dialog::backdrop { background: rgba(5, 4, 8, 0.72); backdrop-filter: blur(4px); }
.seize-dialog form { padding: 28px; }
.seize-dialog h2 { font-family: var(--serif); font-weight: 600; margin: 0 0 20px; font-size: 1.5rem; }
.seize-dialog label { display: block; margin-bottom: 16px; font-size: 0.82rem; color: var(--muted); letter-spacing: 0.02em; }
.seize-dialog .opt { color: var(--muted); opacity: 0.65; font-style: italic; }
.seize-dialog input[type="text"],
.seize-dialog input[name="name"],
.seize-dialog input[name="message"],
.seize-dialog input[name="url"],
.seize-dialog input[name="amount"] {
  width: 100%; margin-top: 7px; padding: 12px 13px; border-radius: 9px;
  border: 1px solid var(--line-soft); background: #0e0d11; color: var(--ink);
  font-size: 1rem; font-family: var(--sans);
}
.seize-dialog input:focus { outline: none; border-color: var(--gold); }
.bid-input { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.bid-input .cur { font-size: 1.1rem; color: var(--gold); }
.bid-input input { margin-top: 0; }
.bid-note { color: var(--gold-bright); font-size: 0.82rem; margin: -8px 0 12px; }
.notify-label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.82rem; margin-bottom: 4px; }
.notify-label input { width: auto; margin: 0; accent-color: var(--gold); }
.form-error { color: var(--danger); font-size: 0.88rem; margin: 10px 0 0; }
.seize-dialog menu { display: flex; gap: 10px; justify-content: flex-end; padding: 0; margin: 20px 0 0; }
.ghost {
  background: none; color: var(--muted); border: 1px solid var(--line-soft);
  padding: 14px 22px; border-radius: 10px; cursor: pointer; font-size: 1rem; font-family: var(--sans);
  line-height: 1.2;
}
.ghost:hover { color: var(--ink); border-color: var(--muted); }
.fine { color: var(--muted); font-size: 0.76rem; margin: 16px 0 0; line-height: 1.45; }

/* Demo-mode banner (only injected when ?demo=1) */
.demo-banner {
  position: sticky; top: 0; z-index: 10;
  background: var(--gold); color: #1a1508;
  text-align: center; font-size: 0.8rem; font-weight: 600;
  padding: 8px 14px; letter-spacing: 0.01em;
}

/* ── Polish pass ──────────────────────────────────────────────────────────── */

/* Gold-foil wordmark */
.site-head h1 {
  background: linear-gradient(180deg, #f4e6b0 0%, var(--gold) 70%, #a9822f 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold);
  letter-spacing: -0.01em;
}
.mark { filter: drop-shadow(0 3px 12px rgba(203, 161, 53, 0.35)); }

/* Entrance: sections rise in with a light stagger */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.site-head, .throne-card, .cta-row, .hall, .site-foot { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.throne-card { animation-delay: 0.06s; }
.cta-row { animation-delay: 0.12s; }
.hall { animation-delay: 0.18s; }
.site-foot { animation-delay: 0.24s; }

/* Card: smooth state transitions + a touch more depth */
.throne-card {
  transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.2s ease;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}
.throne-card:not(.empty) {
  box-shadow: 0 24px 70px -22px rgba(203, 161, 53, 0.18), 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}

/* The reigning name gets the gold treatment; the vacant state stays quiet */
.throne-card:not(.empty) .ruler-name {
  background: linear-gradient(180deg, #f4e6b0, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Buttons: lift + glow */
.seize-btn { box-shadow: 0 6px 20px -6px rgba(203, 161, 53, 0.5); }
.seize-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -8px rgba(203, 161, 53, 0.6); }
.ghost { transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
.ghost:hover { background: rgba(255, 255, 255, 0.03); }

/* Softer, richer takeover flash */
@keyframes throne-flash {
  0% { box-shadow: 0 0 0 0 rgba(203, 161, 53, 0.55), 0 24px 70px -22px rgba(203, 161, 53, 0.3); }
  100% { box-shadow: 0 0 0 16px rgba(203, 161, 53, 0), 0 24px 70px -22px rgba(203, 161, 53, 0.18); }
}

@media (prefers-reduced-motion: reduce) {
  .site-head, .throne-card, .cta-row, .hall, .site-foot { animation: none; }
  .throne-card.just-changed { animation: none; }
}

/* Hall tabs */
.hall-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.hall-tab {
  background: none; border: 1px solid var(--line-soft); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 0.82rem;
  font-family: var(--sans); letter-spacing: 0.02em; transition: all 0.15s ease;
}
.hall-tab:hover { color: var(--ink); }
.hall-tab.active { color: #1a1508; background: var(--gold); border-color: var(--gold); font-weight: 700; }

/* Crowned confirmation toast */
.crowned-toast {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: linear-gradient(180deg, #17140c, #0f0e12);
  border-bottom: 1px solid var(--gold);
  padding: 14px 18px; color: var(--ink); font-size: 0.92rem;
}
.crowned-toast .seize-btn { padding: 10px 18px; font-size: 0.9rem; }
.toast-close {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px;
}
.toast-close:hover { color: var(--ink); }

/* Rules / legal page */
.legal { text-align: left; }
.legal h2 { font-family: var(--serif); font-weight: 600; margin: 22px 0 8px; font-size: 1.15rem; }
.legal ul { margin: 0; padding-left: 20px; }
.legal li { margin-bottom: 8px; color: var(--ink); }
.legal code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.legal-back { margin-top: 24px; }
