:root {
  --bg: #faf7f2; --surface: #ffffff; --surface2: #f3efe7;
  --text: #1c1a17; --muted: #6f6a5e; --line: #e3ddd0;
  --accent: #1c1a17;
}
.dark {
  --bg: #131311; --surface: #1d1d1a; --surface2: #26261f;
  --text: #f0ead9; --muted: #a09a89; --line: #35352c; --accent: #f0ead9;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
}
.mono { font-family: "Space Mono", ui-monospace, monospace; }
a { color: inherit; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.logo { font-weight: 700; letter-spacing: .25em; text-decoration: none; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
.topbar nav a:hover { color: var(--text); }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  width: 30px; height: 30px; cursor: pointer; }
main { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.muted { color: var(--muted); }

/* game */
.stats-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { flex: 1 1 120px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 700; }
.level-progress { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.level-progress > div { height: 100%; background: var(--accent); width: 0%; transition: width .8s ease; }

.number-card {
  background: var(--surface); border: 2px solid var(--line); border-radius: 20px;
  padding: 22px; text-align: center; transition: border-color .4s, box-shadow .4s;
}
.number-card.tier-trash   { border-color: #b45309; }
.number-card.tier-common  { border-color: #9ca3af; }
.number-card.tier-uncommon{ border-color: #10b981; box-shadow: 0 0 22px rgba(16,185,129,.25); }
.number-card.tier-rare    { border-color: #3b82f6; box-shadow: 0 0 22px rgba(59,130,246,.35); }
.number-card.tier-epic    { border-color: #a855f7; box-shadow: 0 0 26px rgba(168,85,247,.4); }
.number-card.tier-anomaly { border-color: #f97316; box-shadow: 0 0 26px rgba(249,115,22,.45); }
.number-card.tier-mythic  { border-color: #ec4899; box-shadow: 0 0 32px rgba(236,72,153,.5), 0 0 48px rgba(168,85,247,.25); }
.rarity-row { display: flex; justify-content: space-between; align-items: center; min-height: 26px; }
.top-pct { color: var(--muted); font-size: 14px; }
.pill { font-size: 11px; font-weight: 700; letter-spacing: .14em; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); }
.pill.tier-trash   { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.pill.tier-common  { background: #f3f4f6; color: #374151; border-color: #9ca3af; }
.pill.tier-uncommon{ background: #d1fae5; color: #065f46; border-color: #10b981; }
.pill.tier-rare    { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }
.pill.tier-epic    { background: #f3e8ff; color: #6b21a8; border-color: #a855f7; }
.pill.tier-anomaly { background: #ffedd5; color: #9a3412; border-color: #f97316; }
.pill.tier-mythic  { background: #fce7f3; color: #9d174d; border-color: #ec4899; }
.dark .pill { filter: brightness(.85); }
.digits { display: flex; justify-content: center; gap: 8px; margin: 18px 0 8px; }
.slot {
  width: 52px; height: 68px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; background: var(--surface2);
  border: 1px solid var(--line); border-radius: 12px;
}
.slot.blank { opacity: .25; }
.slot.lit { border-color: var(--accent); }
.slot.contrib { background: #fde68a; color: #92400e; border-color: #f59e0b; }
.roll-meta { color: var(--muted); font-size: 14px; min-height: 20px; }

.roll-actions { display: flex; gap: 10px; justify-content: center; margin: 18px 0 6px; flex-wrap: wrap; }
.roll-btn {
  font: inherit; font-weight: 700; letter-spacing: .08em; font-size: 18px;
  padding: 12px 42px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--bg); cursor: pointer;
}
.roll-btn:disabled { opacity: .45; cursor: default; }
.roll-btn:not(:disabled):hover { transform: translateY(-1px); }
.ghost-btn {
  font: inherit; padding: 12px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.ghost-btn:disabled { opacity: .45; cursor: default; }
.daily-note { text-align: center; color: var(--muted); font-size: 14px; min-height: 20px; }

.ep-row { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 10px; }
.ep-earned { font-size: 22px; font-weight: 700; }
.badge-list { display: flex; flex-direction: column; gap: 8px; }
.badge-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; cursor: default;
}
.badge-card.pending { opacity: 0; visibility: hidden; }
.badge-card.pop-in { animation: badge-pop .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes badge-pop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.badge-card.subsidiary { opacity: .6; margin-left: 24px; }
.badge-head { display: flex; gap: 10px; align-items: center; }
.badge-emoji { font-size: 22px; }
.badge-main { flex: 1; min-width: 0; }
.badge-label { font-weight: 700; font-size: 14px; }
.badge-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-score { font-weight: 700; font-size: 14px; }
.new-tag { font-size: 10px; font-weight: 700; color: #b45309; letter-spacing: .1em; }
.shadow-list { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* evidence strip: the rolled number inside each badge card;
   contributing digits light up in the badge's rarity colour */
.evidence { display: flex; gap: 3px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ev-digit {
  width: 20px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; border-radius: 5px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
}
.ev-digit.ev-hit { transition: background-color .4s ease, color .4s ease, border-color .4s ease, transform .4s ease; }
.ev-digit.ev-hit.lit { color: #000; transform: scale(1.12); }
.ev-digit.tier-bg-common.lit { background: #e5e7eb; border-color: #9ca3af; }
.ev-digit.tier-bg-uncommon.lit { background: #6ee7b7; border-color: #10b981; }
.ev-digit.tier-bg-rare.lit { background: #93c5fd; border-color: #3b82f6; }
.ev-digit.tier-bg-epic.lit { background: #d8b4fe; border-color: #a855f7; }
.ev-digit.tier-bg-anomaly.lit { background: #fdba74; border-color: #f97316; }
.ev-digit.tier-bg-mythic.lit { background: #f9a8d4; border-color: #ec4899; }
.slot.settle-pop { animation: slot-pop .25s ease; }
@keyframes slot-pop { 0% { transform: scale(1.25); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .badge-card.pop-in, .slot.settle-pop { animation: none; }
  .ev-digit.ev-hit { transition: none; }
}

.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-row { display: flex; justify-content: space-between; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }

/* catalogue */
.catalogue { margin-top: 56px; }
.catalogue-controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.catalogue-controls input[type="search"], .catalogue-controls select {
  font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
.owned-toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.catalogue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.cat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cat-card.owned { border-color: #10b981; }
.cat-top { display: flex; justify-content: space-between; align-items: center; }
.cat-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cat-meta { font-size: 11px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }

/* about */
.about { margin-top: 56px; line-height: 1.55; }
.rarity-table { border-collapse: collapse; margin: 10px 0; }
.rarity-table th, .rarity-table td { border: 1px solid var(--line); padding: 6px 14px; text-align: left; }
footer { border-top: 1px solid var(--line); padding: 18px 20px; color: var(--muted);
  font-size: 13px; text-align: center; }
@media (max-width: 560px) { .slot { width: 42px; height: 56px; font-size: 30px; } }
