:root {
  --bg: #07090f;
  --bg-2: #0b0e17;
  --panel: #0e121d;
  --panel-2: #131828;
  --line: #1e2740;
  --line-2: #2a3550;
  --ink: #e8ecf6;
  --ink-dim: #8d97b0;
  --ink-faint: #5c6685;
  --gold: #ffc247;
  --red: #ff4d5e;
  --green: #2fe08a;
  --land: #141b2c;
  --land-hover: #1d2740;
  --land-line: #27324e;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

/* Several elements below set `display`, which would otherwise beat the
   user-agent rule for [hidden]. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, #16203a 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.014) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
}

/* ---------------------------------------------------------- topbar -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 3vw, 32px);
  background: rgba(7, 9, 15, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 20px;
  color: #0b0e17;
  background: linear-gradient(150deg, var(--gold), #ff8f3f);
  box-shadow: 0 6px 22px rgba(255, 160, 60, 0.28);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--ink-dim);
}

.stats {
  display: flex;
  gap: 10px;
  margin: 0;
}

.stats > div {
  min-width: 96px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.stats dt {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stats dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#stat-value {
  color: var(--gold);
}

.live dd {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-dim);
}

.live dd::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.live dd.on {
  color: var(--green);
}

.live dd.on::before {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(47, 224, 138, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(47, 224, 138, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 224, 138, 0);
  }
}

/* --------------------------------------------------- sales closed -- */

.closed-banner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 18px clamp(16px, 3vw, 32px) 0;
  padding: 13px 16px;
  border: 1px solid rgba(255, 194, 71, 0.4);
  border-left: 3px solid var(--gold);
  border-radius: 11px;
  background: rgba(255, 194, 71, 0.07);
  font-size: 13.5px;
  color: var(--ink-dim);
}

.closed-banner strong {
  color: var(--gold);
}

/* The map stays fully browsable while closed — states still open their
   dialog so the offer is visible; only the purchase itself is off. */

/* ------------------------------------------------------------ main -- */

main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 32px) 28px;
  align-items: start;
}

.map-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), #0a0d16);
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.search input {
  width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.search input:focus {
  outline: none;
  border-color: #3b4a72;
  box-shadow: 0 0 0 3px rgba(59, 74, 114, 0.35);
}

.rule {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-dim);
}

.rule strong {
  color: var(--ink);
  font-family: var(--mono);
}

/* -------------------------------------------------------- conquest -- */

.conquest-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 77, 94, 0.09), rgba(255, 194, 71, 0.07) 60%, transparent),
    var(--bg);
}

.conquest-copy strong {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.conquest-copy span {
  font-size: 12.5px;
  color: var(--ink-dim);
}

.conquest-bar.owned {
  background:
    linear-gradient(90deg, rgba(47, 224, 138, 0.1), transparent 60%),
    var(--bg);
}

.conquest-bar.owned .conquest-copy strong {
  color: var(--green);
}

.conquest-btn {
  padding: 10px 16px;
  border: 1px solid rgba(255, 194, 71, 0.45);
  border-radius: 10px;
  background: rgba(255, 194, 71, 0.09);
  color: var(--gold);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.conquest-btn b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.conquest-btn:hover {
  background: rgba(255, 194, 71, 0.18);
}

.map-wrap {
  position: relative;
  padding: 8px 10px 14px;
}

#map {
  display: block;
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------------- map -- */

.state {
  fill: var(--land);
  stroke: var(--land-line);
  stroke-width: 0.9;
  stroke-linejoin: round;
  cursor: pointer;
  transition:
    fill 0.16s ease,
    stroke 0.16s ease;
}

.state:hover {
  fill: var(--land-hover);
  stroke: #4b5a86;
}

.state.owned {
  fill: var(--owner-fill);
  stroke: var(--owner-line);
  stroke-width: 1.1;
}

.state.owned:hover {
  fill: var(--owner-fill-hi);
}

.state.dim {
  opacity: 0.22;
}

.state.hit {
  animation: hit 1.1s ease-out;
}

@keyframes hit {
  0% {
    fill: #fff;
  }
  100% {
    fill: var(--owner-fill);
  }
}

.leader {
  stroke: #46557f;
  stroke-width: 0.9;
  fill: none;
}

.badge {
  cursor: pointer;
}

.badge circle {
  fill: #0b0f19;
  stroke: var(--owner-line, #46557f);
  stroke-width: 1.4;
}

.badge image {
  clip-path: inset(0 round 50%);
}

.badge text {
  font-family: var(--mono);
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}

.state-label {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  fill: #6f7ba0;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.state-label.owned {
  fill: #aab4d0;
}

.tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 13, 22, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  white-space: nowrap;
  transform: translate(-50%, -125%);
}

.tooltip b {
  display: block;
  font-size: 14px;
}

.tooltip .price {
  font-family: var(--mono);
  color: var(--gold);
}

.tooltip .held {
  color: var(--ink-dim);
}

/* ------------------------------------------------------------ rail -- */

.rail {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  max-height: calc(100vh - 112px);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tab {
  flex: 1;
  padding: 12px 8px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  background: rgba(255, 194, 71, 0.05);
}

.tab-panel {
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tab-panel.is-active {
  display: block;
}

.feed,
.board {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed li,
.board li {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(30, 39, 64, 0.55);
}

.feed li.empty,
.board li.empty {
  display: block;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
  padding: 28px 18px;
}

.feed li.fresh {
  animation: flash 1.6s ease-out;
}

@keyframes flash {
  0% {
    background: rgba(255, 194, 71, 0.16);
  }
  100% {
    background: transparent;
  }
}

.avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.avatar.fallback {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.feed .body,
.board .body {
  flex: 1;
  min-width: 0;
}

.feed .line {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed .line a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.feed .line a:hover {
  text-decoration: underline;
}

.feed .verb {
  color: var(--ink-dim);
}

.feed .verb.invasion {
  color: var(--red);
  font-weight: 600;
}

.feed .meta {
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* The domain is the part of a listing that cannot lie about who it is. */
.host {
  font-family: var(--mono);
  color: var(--ink-dim);
}

.board .held .host {
  font-size: 11px;
}

.feed .amt,
.board .amt {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.board .rank {
  width: 22px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-faint);
  text-align: right;
}

.board .name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board .held {
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ----------------------------------------------------------- modal -- */

.claim {
  width: min(460px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
}

.claim::backdrop {
  background: rgba(4, 6, 11, 0.72);
  backdrop-filter: blur(3px);
}

.claim-close {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
}

.claim-close button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 13px;
}

.claim-close button:hover {
  color: var(--ink);
}

.claim-head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.claim-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.claim-kicker.occupied {
  color: var(--red);
}

.claim-head h2 {
  margin: 4px 0 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.claim-holder {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}

.claim-holder img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-2);
}

.claim-holder .muted {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.claim-holder strong {
  font-size: 15px;
}

.claim-form {
  padding: 18px 22px 22px;
  display: grid;
  gap: 13px;
}

.claim-form label {
  display: grid;
  gap: 5px;
}

.claim-form label > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
}

.claim-form label em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-faint);
}

.claim-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.claim-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 194, 71, 0.16);
}

/* ------------------------------------------------------ logo preview -- */

.preview {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}

.preview[data-status="ok"] {
  border-color: rgba(47, 224, 138, 0.4);
}

.preview[data-status="failed"] {
  border-color: rgba(255, 194, 71, 0.45);
}

/* Mirrors the circular badge the map draws, so this is a true preview. */
.preview-badge {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #0b0f19;
  border: 1.5px solid var(--line-2);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.preview-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview[data-status="loading"] .preview-badge {
  animation: throb 1.1s ease-in-out infinite;
}

@keyframes throb {
  50% {
    opacity: 0.45;
  }
}

.preview-copy {
  min-width: 0;
}

.preview-copy strong {
  display: block;
  font-size: 13px;
}

.preview-copy span {
  display: block;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

.preview[data-status="ok"] .preview-copy span {
  color: var(--green);
}

.preview[data-status="failed"] .preview-copy span {
  color: var(--gold);
}

.amount-input {
  position: relative;
}

.amount-input i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--gold);
}

.amount-input input {
  padding-left: 26px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick button {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.quick button:hover {
  color: var(--ink);
  border-color: var(--gold);
}

.error {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(255, 77, 94, 0.4);
  border-radius: 10px;
  background: rgba(255, 77, 94, 0.1);
  color: #ffb3ba;
  font-size: 13px;
}

.cta {
  margin-top: 2px;
  padding: 13px 16px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--gold), #ff9331);
  color: #10121a;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 150, 55, 0.25);
}

.cta:hover {
  filter: brightness(1.06);
}

/* In flight — the request is running. */
.cta:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* Closed — nothing to wait for, so don't imply progress. */
.is-closed .cta:disabled {
  background: var(--panel-2);
  color: var(--ink-faint);
  box-shadow: none;
  cursor: not-allowed;
}

/* Consent is a contractual record, not a formality — give it room. */
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

.consent input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.consent span {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-dim);
  font-weight: 400;
}

.consent a {
  color: var(--gold);
}

.consent:has(input:focus-visible) {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 194, 71, 0.16);
}

.claim-notice {
  margin: 0;
  padding: 10px 13px;
  border: 1px solid rgba(255, 194, 71, 0.35);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  background: rgba(255, 194, 71, 0.07);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-dim);
}

.fineprint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------------------------------------------------------- toasts -- */

.toasts {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 11px;
  background: rgba(14, 18, 29, 0.97);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  font-size: 13.5px;
  animation: slide 0.28s ease-out;
}

.toast.claim {
  border-left-color: var(--green);
}

.toast.conquest-bar {
  border-left-color: var(--gold);
  border-color: rgba(255, 194, 71, 0.5);
  background: rgba(28, 22, 12, 0.97);
}

.feed .verb.conquest-bar {
  color: var(--gold);
  font-weight: 700;
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* ---------------------------------------------------------- footer -- */

footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 32px) 30px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-faint);
}

footer a {
  color: var(--ink-dim);
}

.mode {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
}

.mode.dev {
  color: var(--gold);
}

/* -------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: static;
    max-height: 460px;
  }
}

@media (max-width: 720px) {
  .topbar {
    gap: 12px;
  }

  .stats {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .stats::-webkit-scrollbar {
    display: none;
  }

  /* Size each tile to its number instead of clipping it. */
  .stats > div {
    min-width: 0;
    flex: 0 0 auto;
    padding: 7px 12px;
  }

  .stats dt,
  .stats dd {
    white-space: nowrap;
  }

  .brand p {
    display: none;
  }

  .search input {
    width: 100%;
  }

  .map-toolbar .rule {
    order: 3;
  }
}
