:root {
  --bg: #f4f3f0;
  --card: #ffffff;
  --ink: #1c2333;
  --ink-soft: #6b7280;
  --accent: #e8552e;
  --accent-dark: #c8431f;
  --gold: #f5b301;
  --line: #e7e5e0;
  --radius: 16px;
}

/**
 * The UA stylesheet's `[hidden] { display: none }` loses to any class rule that sets a
 * display (our flex rows, forms and badges all do), so toggling `el.hidden` from JS would
 * silently leave those elements on screen. Every hide in this app goes through `hidden`,
 * so make it win everywhere.
 */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 20px;
}

.logo {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}


.logo span {
  color: var(--accent);
}

.logo-badge {
  font-style: normal;
  font-size: 0.7rem;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 3px 7px;
  vertical-align: 2px;
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: 18px;
}

.nav a:hover {
  color: var(--ink);
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: 44px 0 30px;
}

.live-chip {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px 9px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.hero-countdown {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.live-chip.hot {
  border-color: rgb(232 85 46 / 55%);
  animation: chip-shake 1s ease-in-out infinite;
}

.live-chip.hot .hero-countdown {
  animation: pulse 0.8s infinite;
}

@keyframes chip-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  92% {
    transform: translateX(-1.5px);
  }

  96% {
    transform: translateX(1.5px);
  }
}

.hero-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgb(232 85 46 / 12%);
  font-style: normal;
}

.hero-progress i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transition: width 1s linear;
  font-style: normal;
}

.live-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fb344;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 22px 0 14px;
}

.accent {
  color: var(--accent);
}

.hero-sub {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto 28px;
}

.domain-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 18px;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 6px 20px rgb(28 35 51 / 7%);
}

.domain-bar-icon {
  opacity: 0.5;
}

.domain-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 1rem;
  background: transparent;
  color: var(--ink);
}

.domain-bar button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 12px 22px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.domain-bar button:hover {
  background: var(--accent-dark);
}

.domain-bar button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/*
 * A compact confirmation that the typed domain resolved: icon, name, and listing status.
 * It is a button, so clicking it continues into the same flow as Enlist.
 */
.site-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 10px auto 0;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgb(28 35 51 / 6%);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  animation: preview-in 0.2s ease-out;
}

.site-preview:hover {
  border-color: rgb(232 85 46 / 55%);
  box-shadow: 0 6px 18px rgb(28 35 51 / 10%);
}

.site-preview:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes preview-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.site-preview-logo {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: contain;
  background: var(--bg);
  flex-shrink: 0;
}

.site-preview-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.35;
  /* Show the whole name across two lines rather than cutting it off at one. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.site-preview-status {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: #fdeee9;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.site-preview-status.listed {
  color: #1f7a33;
  background: #e7f6ea;
}

.hero-note {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-top: 12px;
  min-height: 1.2em;
}

.hero-note.error {
  color: var(--accent-dark);
  font-weight: 600;
}

/* ---------- listing modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(28 35 51 / 45%);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgb(28 35 51 / 22%);
  padding: 22px;
  text-align: left;
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--ink);
}

.modal-site {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-right: 28px;
}

.modal-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-site-body {
  min-width: 0;
}

.modal-name {
  margin: 0;
  font-weight: 800;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-domain {
  margin: 1px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.modal-label {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.modal-input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  /* Two full lines of the description, without a drag handle changing the card's shape. */
  resize: none;
}

.modal-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--card);
}

.modal-continue {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.modal-continue:hover {
  background: var(--accent-dark);
}

.modal-continue:disabled {
  opacity: 0.6;
  cursor: wait;
}

.modal-feedback {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ---------- puzzle ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgb(28 35 51 / 5%);
}

.puzzle {
  margin-top: 22px;
}

.puzzle-card {
  padding: 24px 26px;
}

.puzzle-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.puzzle-head .chip {
  margin-left: auto;
}

.puzzle-card.urgent {
  border-color: rgb(232 85 46 / 45%);
  box-shadow:
    0 2px 10px rgb(28 35 51 / 5%),
    0 0 0 4px rgb(232 85 46 / 8%);
  animation: urgent-glow 2s ease-in-out infinite;
}

@keyframes urgent-glow {
  50% {
    box-shadow:
      0 2px 10px rgb(28 35 51 / 5%),
      0 0 0 7px rgb(232 85 46 / 14%);
  }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #c8102e;
  background: #fdecec;
  border-radius: 999px;
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}

.live-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8102e;
  animation: pulse 1s infinite;
}

.round-closed-top {
  text-align: center;
  padding: 6px 0 14px;
}

.round-closed-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.round-closed-winner {
  font-size: 1.05rem;
  margin: 12px 0 2px;
}

.round-closed-answer {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
}

.next-drop {
  text-align: center;
  border: 2px dashed rgb(232 85 46 / 45%);
  background: #fdf1ec;
  border-radius: 14px;
  padding: 18px 16px;
}

.next-drop-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
}

.next-drop-timer {
  margin: 6px 0 4px;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.next-drop-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.next-drop.imminent {
  animation: imminent-pulse 0.9s ease-in-out infinite;
}

.next-drop.imminent .next-drop-timer {
  font-size: 1.9rem;
  animation: pulse 0.9s infinite;
}

@keyframes imminent-pulse {
  50% {
    border-color: var(--accent);
    background: #fbe4da;
  }
}

.puzzle-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.chip {
  font-size: 0.72rem;
  font-weight: 700;
  background: #fdeee9;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 4px 10px;
  text-transform: capitalize;
}

.chip:empty {
  display: none;
}

.puzzle-question {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 14px 0 6px;
}

.puzzle-meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin: 0 0 14px;
}

.answer-bar {
  display: flex;
  gap: 8px;
}

.answer-bar input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.answer-bar input:focus {
  border-color: var(--accent);
}

.answer-bar button {
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  white-space: nowrap;
}

.answer-bar button:hover {
  background: #000;
}

.answer-bar button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.puzzle-feedback {
  min-height: 1.3em;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 10px 0 0;
}

.puzzle-feedback.ok {
  color: #1f7a33;
}

.puzzle-feedback.bad {
  color: var(--accent-dark);
}

.claim-box {
  margin-top: 16px;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  padding: 16px;
  background: #fffaf0;
}

.claim-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.claim-sub {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.solved-banner {
  font-weight: 700;
}

.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

/* ---------- leaderboard ---------- */
.board {
  margin-top: 48px;
}

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.board h2,
.rules h2 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.board-count {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
}

.board-item.top {
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgb(245 179 1 / 18%);
}

.rank {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--ink-soft);
  min-width: 2.2em;
}

.board-item.top .rank {
  color: var(--gold);
  font-size: 1.4rem;
}

.board-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.board-item.top .board-logo {
  width: 48px;
  height: 48px;
}

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

.board-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.board-name {
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.board-name:hover {
  color: var(--accent);
}

.board-domain {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.crown {
  font-size: 1rem;
}

.board-desc {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 6px 0 8px;
  overflow-wrap: anywhere;
}

.board-stats {
  display: flex;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.board-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 30px 0;
}

/* ---------- rules / footer ---------- */
.rules {
  margin-top: 48px;
}

.rules ol {
  color: var(--ink-soft);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 30px 20px 40px;
  border-top: 1px solid var(--line);
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 560px) {
  .nav a {
    margin-left: 12px;
  }

  .domain-bar {
    flex-wrap: wrap;
    border-radius: var(--radius);
  }

  .domain-bar button {
    width: 100%;
  }

  .answer-bar {
    flex-direction: column;
  }

  .board-item {
    flex-direction: column;
    gap: 6px;
  }
}
