:root {
  --bg: #0b1220;
  --bg2: #0e1626;
  --panel: #111c30;
  --line: #1f2937;
  --line2: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --gold: #e8c46a;
  --accent: #38bdf8;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Segoe UI', Inter, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #16233f 0%, var(--bg) 60%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- brand / header --- */
.brandbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: #0b1220e6; backdrop-filter: blur(6px);
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand .eyebrow {
  font-size: 10.5px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
}
.brand .wordmark { font-size: 19px; font-weight: 800; letter-spacing: .01em; }
.brand .wordmark span { color: var(--gold); }
.navlinks { display: flex; gap: 18px; font-size: 13px; }
.navlinks a { color: var(--muted); }

/* --- hero / loot --- */
.hero { max-width: 1080px; margin: 0 auto; padding: 46px 22px 18px; text-align: center; }
.hero h1 { font-size: 38px; margin: 0 0 10px; line-height: 1.05; }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--gold), #f0a, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { color: var(--muted); font-size: 15.5px; max-width: 680px; margin: 0 auto 26px; line-height: 1.55; }

.loot-btn {
  appearance: none; border: 0; cursor: pointer;
  font-size: 19px; font-weight: 800; letter-spacing: .04em;
  color: #0b1220; padding: 16px 42px; border-radius: 14px;
  background: linear-gradient(180deg, #ffe9a8, var(--gold));
  box-shadow: 0 10px 30px #e8c46a44, inset 0 1px 0 #fff8;
  transition: transform .12s ease, box-shadow .12s ease;
}
.loot-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px #e8c46a66, inset 0 1px 0 #fff8; }
.loot-btn:active { transform: translateY(0); }
.loot-btn:disabled { opacity: .6; cursor: progress; transform: none; }
.loot-sub { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.loot-sub b { color: var(--text); }

/* --- generic panel --- */
.section { max-width: 1080px; margin: 0 auto; padding: 22px; }
.section h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: .02em; }
.section h2 .hint { font-weight: 400; font-size: 12.5px; color: var(--muted); margin-left: 8px; }

/* --- odds table --- */
.odds { width: 100%; border-collapse: collapse; font-size: 13px; }
.odds th, .odds td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.odds th { color: var(--muted); font-weight: 600; }
.odds td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tier-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 24px; padding: 0 8px; border-radius: 7px; font-weight: 800; color: #fff; font-size: 12.5px; }

/* --- hidden vault grid (face-down) --- */
.tier-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.tier-tag { flex: 0 0 46px; height: 46px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: #fff; position: sticky; left: 4px; }
.cards { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; }

/* --- card (shared) --- */
.card { width: 212px; border-radius: 12px; padding: 6px; background: linear-gradient(160deg, var(--tc), #0b1220 145%); box-shadow: 0 4px 10px #0009; position: relative; }
.frame { background: #fbfbf3; border-radius: 8px; height: 100%; display: flex; flex-direction: column; overflow: hidden; color: #1f2937; position: relative; }
.titlebar { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 8px; background: linear-gradient(90deg, var(--tc), #ffffff00); }
.titlebar .name { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #0b1220; text-shadow: 0 1px 2px #fff6; }
.titlebar .cost { flex: 0 0 auto; padding: 2px 7px; border-radius: 11px; background: #0b1220; color: #fff; font-weight: 800; font-size: 11px; line-height: 1.35; }
.art { display: flex; align-items: center; justify-content: space-around; gap: 4px; padding: 6px; background: #eef2f7; }
.art img { width: 66px; height: 66px; object-fit: contain; }
.art .noimg { width: 66px; height: 66px; border-radius: 8px; background: #cbd5e1; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #475569; text-transform: uppercase; font-size: 20px; }
.radar-svg { width: 94px; height: 94px; }
.ring { fill: none; stroke: #cbd5e1; stroke-width: .5; }
.spoke { stroke: #e2e8f0; stroke-width: .5; }
.rlab { font-size: 7px; fill: #64748b; text-anchor: middle; dominant-baseline: middle; }
.type { font-size: 9.5px; padding: 3px 8px; background: #e8eef5; color: #334155; text-align: center; }
.text { padding: 5px 7px; font-size: 10px; flex: 1; }
.text table { width: 100%; border-collapse: collapse; text-align: center; }
.text th { font-weight: 700; color: #475569; padding: 2px 0; }
.text td { padding: 2px 0; border-top: 1px solid #eef2f7; }
.text td.na { color: #cbd5e1; }

.card.big { width: 460px; padding: 10px; }
.card.big .titlebar .name { font-size: 19px; }
.card.big .titlebar .cost { font-size: 15px; padding: 3px 10px; border-radius: 14px; }
.card.big .art img, .card.big .art .noimg { width: 128px; height: 128px; }
.card.big .radar-svg { width: 210px; height: 210px; }
.card.big .type { font-size: 14px; padding: 7px; }
.card.big .text { font-size: 13px; padding: 8px 12px; }

/* unclaimed-preview watermark — diagonal, repeating, see-through (a stamped
   sample). Sits above the card content but lets it read through; a claimed card
   has no watermark at all. .frame is overflow:hidden so it's clipped to the card. */
.watermark {
  position: absolute; inset: -50%;
  z-index: 5; pointer-events: none; user-select: none; overflow: hidden;
  transform: rotate(-30deg);
  text-align: center; word-spacing: 2px;
  font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  font-size: 11px; line-height: 2.1; color: rgba(15, 23, 42, .13);
}
.card.big .watermark { font-size: 19px; letter-spacing: .26em; }

/* face-down back */
.card.back { width: 96px; cursor: default; }
.back-frame { background: linear-gradient(160deg, #16233f, #0b1220); align-items: center; justify-content: center; min-height: 132px; color: #fff; }
.back .rune { position: absolute; top: 6px; left: 8px; font-size: 13px; color: var(--tc); opacity: .8; }
.back .back-tier { position: absolute; bottom: 6px; right: 8px; font-size: 11px; font-weight: 800; color: var(--tc); }
.back .back-q { font-size: 34px; font-weight: 800; color: #2a3a5c; text-shadow: 0 0 18px #0008; }

/* compact face-up tile for an owned card — unsealed in place, same size as a back */
.card.mini { width: 96px; cursor: pointer; transition: transform .12s ease; }
.card.mini:hover, .card.mini:focus-visible { transform: translateY(-4px) scale(1.05); z-index: 3; outline: none; }
.mini-frame { min-height: 132px; justify-content: space-between; }
.mini-logo { flex: 1; display: flex; align-items: center; justify-content: center; background: #eef2f7; padding: 6px; }
.mini-logo img { width: 56px; height: 56px; object-fit: contain; }
.mini-logo .noimg { width: 56px; height: 56px; border-radius: 8px; background: #cbd5e1; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #475569; text-transform: uppercase; font-size: 17px; }
.mini-foot { display: flex; align-items: center; justify-content: space-between; padding: 5px 7px; background: linear-gradient(90deg, var(--tc), #ffffff00); }
.mini-foot .mini-tier { font-weight: 800; font-size: 12px; color: #0b1220; text-shadow: 0 1px 2px #fff6; }
.mini-foot .mini-score { font-size: 10px; font-weight: 800; background: #0b1220; color: #fff; padding: 1px 6px; border-radius: 9px; }

/* --- modal / reveal --- */
.modal { position: fixed; inset: 0; background: #000c; display: flex; align-items: center; justify-content: center; z-index: 30; padding: 18px; }
.modal.hidden { display: none; }
.reveal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; max-width: 540px; width: 100%; text-align: center; box-shadow: 0 30px 80px #000a; }
.reveal .roll-state { font-size: 13px; color: var(--muted); min-height: 18px; margin-bottom: 8px; letter-spacing: .04em; }
.reveal .card-slot { display: flex; justify-content: center; margin: 6px 0 14px; min-height: 220px; align-items: center; }
.reveal .rollnote { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.reveal .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { appearance: none; cursor: pointer; border-radius: 11px; font-weight: 700; font-size: 14px; padding: 12px 20px; border: 1px solid var(--line2); background: #18243c; color: var(--text); transition: transform .1s ease, background .1s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { border: 0; color: #0b1220; background: linear-gradient(180deg, #ffe9a8, var(--gold)); }
.btn:disabled { opacity: .6; cursor: progress; }
.rolling-anim { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; transform: scale(.98); } to { opacity: 1; transform: scale(1.02); } }

.err { color: #fca5a5; font-size: 13px; margin-top: 8px; min-height: 16px; }

/* --- explainer / footer --- */
.explain { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.explain .step { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.explain .step .n { color: var(--gold); font-weight: 800; font-size: 13px; letter-spacing: .1em; }
.explain .step h3 { margin: 6px 0; font-size: 15px; }
.explain .step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

footer { max-width: 1080px; margin: 30px auto 60px; padding: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

.mono { font-variant-numeric: tabular-nums; }
