:root {
  --bg: #0a0a0a;
  --panel: #121212;
  --panel-2: #1a1a1a;
  --border: #2e2e2e;
  --text: #fff8d6;
  --muted: #b39b2e;
  --accent: #ffd60a;
  --accent-soft: #ffffff14;
  --danger: #ff4d4d;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Nunito, system-ui, sans-serif;
  min-height: 100vh;
  padding: 0 16px;
}

h1, h2, h3, .logo { font-family: Fredoka, Nunito, sans-serif; margin: 0; }
a { color: var(--accent); }
code {
  background: var(--panel-2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.top, .howto, .grid, .page-title, .page-sub, .hero, .sections, footer { max-width: 1100px; margin-inline: auto; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 28px 0 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: clamp(52px, 12vw, 72px); height: auto; aspect-ratio: 1; object-fit: contain; }
.logo { font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 700; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}
.nav a:hover { color: var(--accent); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--panel); border: 1px solid var(--border); }

.page-title { font-size: 1.8rem; margin-bottom: 14px; }
.page-sub { color: var(--muted); margin-top: -10px; margin-bottom: 16px; }

/* Landing page */
.hero { padding: 32px 0 28px; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.15; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 10px 0 0; max-width: 36em; }

.brand-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.snark { display: flex; flex-direction: column; line-height: 1.25; }
.snark-count { font-family: Fredoka, Nunito, sans-serif; font-weight: 600; font-size: 1.05rem; }
.snark-count b { color: var(--accent); display: inline-block; font-variant-numeric: tabular-nums; }
.snark-count b.bump { animation: bump 0.35s ease-out; }
.snark-hint { color: var(--muted); font-size: 0.78rem; }
.snark-hint code { padding: 0 5px; font-size: 0.78rem; }
.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted); text-decoration: none;
  font-family: Fredoka, Nunito, sans-serif; font-weight: 600; font-size: 0.95rem;
}
.live-badge[hidden] { display: none; }
.live-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.live-badge.on { color: var(--text); border-color: var(--danger); }
.live-badge.on b { color: var(--danger); }
.live-badge.on .dot { background: var(--danger); animation: pulse 1.6s ease-in-out infinite; }
.live-badge .time { font-variant-numeric: tabular-nums; }
a.live-badge:hover { border-color: var(--accent); }

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.section-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
a.section-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.section-card h3 { font-size: 1.4rem; color: var(--accent); }
.section-card p { margin: 0; color: var(--text); }
.section-card .stats { color: var(--muted); font-size: 0.9rem; font-weight: 700; margin-top: auto; padding-top: 8px; }
.section-card .go { color: var(--accent); font-weight: 700; }
.section-card.soon { border-style: dashed; }
.section-card.soon h3 { color: var(--muted); }
.section-card.soon p { color: var(--muted); }


.howto {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
}
.howto p { margin: 0 0 6px; color: var(--muted); }
.howto ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.couples-panel { grid-column: 1 / -1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel h2 { font-size: 1.25rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.count {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  padding: 1px 10px;
  border-radius: 999px;
}

.couples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.couple {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
}
.couple.new { animation: pop 0.5s ease-out; }
.couple .names {
  font-family: Fredoka, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.couple .and { color: var(--muted); margin: 0 8px; font-weight: 500; }
.couple .since { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 8px 12px;
  overflow-wrap: anywhere;
}
.list .sub { display: block; color: var(--muted); font-size: 0.82rem; }
.list b { color: var(--accent); }

.board { counter-reset: rank; }
.board li { display: flex; justify-content: space-between; gap: 8px; counter-increment: rank; }
.board li::before { content: counter(rank) "."; color: var(--muted); width: 1.6em; flex: none; }
.board li.empty::before { content: none; }
.board li .who { flex: 1; font-weight: 700; }
.board li .num { color: var(--muted); font-weight: 700; white-space: nowrap; }

.feed { max-height: 420px; overflow-y: auto; }
.feed li.new { animation: pop 0.4s ease-out; }

.empty { color: var(--muted); font-style: italic; background: none !important; padding: 4px 0 !important; }

footer { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 32px 0; }

/* Deathroll */
.stage-panel { grid-column: 1 / -1; text-align: center; padding: 32px 20px; }
.stage-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  font-size: 0.85rem;
}
.big {
  font-family: Fredoka, Nunito, sans-serif;
  font-weight: 700;
  font-size: clamp(3.2rem, 13vw, 6.5rem);
  line-height: 1.05;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.stage-sub { color: var(--text); margin-top: 8px; }
.stage-sub b { color: var(--accent); }
.meter {
  height: 8px;
  max-width: 420px;
  margin: 14px auto 4px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.meter span { display: block; height: 100%; background: var(--accent); transition: width 0.4s ease-out; }
.countdown { margin-top: 14px; color: var(--muted); }
.countdown b { color: var(--text); font-variant-numeric: tabular-nums; }
.stage-panel.dead { border-color: var(--danger); box-shadow: 0 0 40px #ff4d4d22 inset; }
.stage-panel.dead .stage-label, .stage-panel.dead .big { color: var(--danger); }
.stage-panel.dead.new { animation: pop 0.5s ease-out; }

.rolls { max-height: 420px; overflow-y: auto; }
.rolls li { display: flex; align-items: baseline; gap: 8px; }
.rolls li .who { flex: 1; font-weight: 700; }
.rolls li .roll { color: var(--accent); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rolls li .of { color: var(--muted); font-size: 0.85rem; width: 3.2em; }
.rolls li.died { outline: 1px solid var(--danger); }
.rolls li.died .roll, .rolls li.died .who { color: var(--danger); }
.rolls li.new { animation: pop 0.4s ease-out; }
.tng-recent li .roll { width: 4.6em; text-align: right; }
.tng-recent li .roll.minus { color: var(--danger); }
.tng-recent li .of { width: auto; }
.board li .num.minus { color: var(--danger); }

/* Emotes */
.span-all { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin-bottom: 0; }
.filter {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  width: min(260px, 100%);
}
.filter:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--muted); margin: -4px 0 12px; font-size: 0.9rem; }

.claims {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.claim {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.claim.new { animation: pop 0.4s ease-out; }
.claim .emote { width: 44px; height: 44px; flex: none; }
.claim-text { min-width: 0; }
.claim-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim-emote { color: var(--accent); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emote { object-fit: contain; }
.emote-inline { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }

.available {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.grab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 4px;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  min-width: 0;
}
.grab:hover { border-color: var(--accent); }
.grab .emote { width: 36px; height: 36px; }
.grab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pagi Lore */
.article { display: flex; gap: 24px; align-items: flex-start; }
.article-img {
  width: min(320px, 40%);
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  flex: none;
}
.article-body { min-width: 0; }
.article-title { font-size: clamp(1.6rem, 4vw, 2.2rem); color: var(--accent); margin-bottom: 2px; }
.article-desc { color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.article-text { margin: 0 0 16px; font-size: 1.05rem; line-height: 1.6; }
.article-link { font-weight: 700; }
.article-next { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }
.previous { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.previous a { color: var(--text); font-weight: 700; text-decoration: none; }
.previous a:hover { color: var(--accent); }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes bump { 40% { transform: scale(1.15); } }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 640px) {
  .article { flex-direction: column; }
  .article-img { width: 100%; }
}
@media (max-width: 520px) {
  .nav { width: 100%; gap: 2px; }
  .nav a { padding: 5px 10px; font-size: 0.92rem; }
}
@media (max-width: 420px) {
  .nav { gap: 0; }
  .nav a { padding: 5px 5px; font-size: 0.8rem; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
