:root {
  --bg: #0b0a08;
  --panel: rgba(255, 250, 240, .035);
  --line: rgba(255, 245, 230, .09);
  --ink: #f4efe6;
  --ink-muted: #b5ab99;
  --ink-dim: #776f60;
  --acid: #d4a843;      /* ember gold — the realm's one accent */
  --acid-hot: #e2b44d;
  --cyan: #d4a843;
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px;
  --common: #98928a;    /* footman iron */
  --rare: #6f9bd1;      /* knight steel-blue */
  --epic: #a678d4;      /* highlord amethyst */
  --legendary: #e0a63c; /* sovereign gold */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1000px 640px at 85% -12%, rgba(212, 168, 67, .05), transparent 62%),
    radial-gradient(820px 520px at -8% 108%, rgba(212, 168, 67, .035), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: 'Outfit', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.mono { font-family: 'Fragment Mono', ui-monospace, monospace; }

.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .3;
  background-image:
    linear-gradient(rgba(212, 168, 67, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 168, 67, .045) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
}
.glow { position: fixed; z-index: 0; pointer-events: none; filter: blur(90px); border-radius: 50%; }
.glow.a { top: -140px; left: -100px; width: 420px; height: 420px; background: #1a140c; opacity: .75; }
.glow.b { bottom: -180px; right: -140px; width: 480px; height: 480px; background: #33230f; opacity: .28; }

main { position: relative; z-index: 1; max-width: 1020px; margin: 0 auto; padding: 34px 26px 90px; }

/* header */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.brand .mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  filter: drop-shadow(0 6px 18px rgba(212, 168, 67, .35));
}
.wordmark { font-family: 'Cinzel', serif; font-size: 21px; letter-spacing: .12em; }
.netline { font-size: 11.5px; color: var(--ink-dim); letter-spacing: .04em; margin-top: 2px; }
.wallet-chip {
  display: flex; align-items: center; gap: 9px; min-width: 0; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 8px 16px; font-family: 'Fragment Mono', monospace; font-size: 12.5px; color: var(--ink-muted);
}
.wallet-chip #walletAddr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wallet-chip .dot, .wallet-chip .htr, .wallet-chip .hint { flex-shrink: 0; }
.wallet-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acid-hot); box-shadow: 0 0 10px var(--acid-hot); }
.wallet-chip .htr { color: var(--acid); font-weight: 600; }

/* machine panel */
.machine-panel {
  margin-top: 46px; display: grid; grid-template-columns: 280px 1fr; gap: 36px; align-items: center;
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-lg); padding: 40px 36px 44px;
}
@media (max-width: 760px) { .machine-panel { grid-template-columns: 1fr; text-align: center; } .machine { margin: 0 auto; } }
.machine { width: 100%; max-width: 300px; position: relative; }
.machine img {
  display: block; width: 100%; height: 440px; object-fit: cover; object-position: center 74%;
  border-radius: var(--r-md);
  border: 1px solid rgba(212, 168, 67, .22);
}
.machine::after {
  content: ''; position: absolute; inset: 0; border-radius: var(--r-md);
  pointer-events: none;
  background: radial-gradient(120% 90% at 62% 40%, transparent 45%, rgba(11, 10, 8, .55) 100%);
  box-shadow: inset 0 0 0 1px rgba(212, 168, 67, .12), inset 0 -40px 60px -30px rgba(11, 10, 8, .8);
}
.machine.shaking { animation: shake .5s ease-in-out infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2.4deg); }
  75% { transform: rotate(2.4deg); }
}
.cap { opacity: .95; }
.cap.c0 { fill: var(--common); } .cap.c0b { fill: #c3cad4; }
.cap.c1 { fill: var(--rare); } .cap.c1b { fill: #7fb0ff; }
.cap.c2 { fill: var(--epic); }
.cap.c3 { fill: var(--legendary); }
#capsules circle { animation: bob 3.4s ease-in-out infinite; transform-origin: center; }
#capsules circle:nth-child(2) { animation-delay: .6s; }
#capsules circle:nth-child(3) { animation-delay: 1.2s; }
#capsules circle:nth-child(4) { animation-delay: 1.8s; }
#capsules circle:nth-child(5) { animation-delay: 2.4s; }
#capsules circle:nth-child(6) { animation-delay: 3s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.pull-col h1 { font-size: 42px; line-height: 1.04; margin: 0 0 14px; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
.pull-col .accent { color: var(--acid); text-shadow: 0 0 30px rgba(212, 168, 67, .32); }
.sub { color: var(--ink-muted); font-size: 14.5px; line-height: 1.7; margin: 0 0 22px; max-width: 56ch; text-wrap: pretty; }

.odds { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 24px; }
.odd {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 13px;
  font-size: 12px; display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .25);
}
.odd b { font-size: 13px; }
.odd .pct { color: var(--ink-dim); }
.odd .left { font-family: 'Fragment Mono', monospace; font-size: 11px; color: var(--ink-dim); }
.odd .swatch { width: 9px; height: 9px; border-radius: 3px; }

.pull-btn {
  display: inline-flex; align-items: baseline; gap: 14px; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 26px; letter-spacing: .14em;
  color: #241703; background: linear-gradient(135deg, #caa03f, #e6bd5e);
  border: none; border-radius: 14px; padding: 18px 40px;
  box-shadow: 0 14px 45px -12px rgba(212, 168, 67, .5);
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
}
.pull-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 20px 55px -12px rgba(226, 180, 77, .6); }
.pull-btn:active:not(:disabled) { transform: translateY(1px); }
.pull-btn:disabled { filter: grayscale(.75) brightness(.6); cursor: not-allowed; box-shadow: none; }
.pull-cost { font-family: 'Fragment Mono', monospace; font-size: 14px; letter-spacing: 0; opacity: .8; }
.pull-note { margin-top: 12px; font-size: 12.5px; color: var(--ink-dim); }
.pull-note a { color: var(--cyan); }

/* stats */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0;
  margin-top: 18px; border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--r-md); overflow: hidden;
}
.stats-row .stat { border: none; border-left: 1px solid var(--line); border-radius: 0; padding: 16px 18px; background: none; }
.stats-row .stat:first-child { border-left: none; }
.farm-summary .stat { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-md); padding: 16px 18px; }
.stat .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.stat .v { font-family: 'Fragment Mono', monospace; font-variant-numeric: tabular-nums; font-size: 22px; margin-top: 6px; color: var(--ink); }
.stat .v small { font-size: 12px; color: var(--ink-dim); }

/* shelves */
.shelf { margin-top: 44px; }
.shelf h2 { font-size: 16px; letter-spacing: .06em; margin: 0 0 16px; color: var(--ink-muted); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.empty { color: var(--ink-dim); font-size: 14px; border: 1px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; }

.card {
  position: relative; border-radius: var(--r-md); padding: 20px 18px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 44px -18px var(--rc, rgba(0,0,0,.6)); }
.card .row-btns, .card .claim-mini { margin-top: auto; }
.card .row-btns { padding-top: 12px; }
.card .claim-mini { margin-top: auto; }
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--rc, var(--common));
}
.card .emoji { font-size: 40px; line-height: 1; filter: drop-shadow(0 0 14px var(--rc)); }
.card .name { font-weight: 700; font-size: 15.5px; margin-top: 12px; }
.card .tier { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--rc); margin-top: 3px; font-weight: 700; }
.card .uid { font-family: 'Fragment Mono', monospace; font-size: 10px; color: var(--ink-dim); margin: 10px 0 12px; word-break: break-all; }
.card .claim-mini {
  margin-top: auto; width: 100%; cursor: pointer;
  font-family: 'Cinzel', serif; letter-spacing: .1em; font-size: 13px;
  color: #241703; background: linear-gradient(135deg, #caa03f, #e6bd5e);
  border: none; border-radius: 9px; padding: 9px 0;
}
.card .claim-mini:disabled { filter: grayscale(.7) brightness(.65); cursor: wait; }

footer { margin-top: 60px; font-size: 11px; color: var(--ink-dim); }
footer a { color: var(--cyan); text-decoration: none; }

/* overlay */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(2, 5, 18, .88); backdrop-filter: blur(8px);
}
.overlay[hidden], .stage[hidden] { display: none; }
.overlay-inner { text-align: center; padding: 24px; }

.capsule-drop { animation: drop-bounce 1.6s ease-in-out infinite; margin-bottom: 30px; }
.capsule { width: 92px; height: 92px; margin: 0 auto; position: relative; }
.capsule-top, .capsule-bottom { position: absolute; left: 0; width: 92px; height: 46px; }
.capsule-top { top: 0; border-radius: 92px 92px 0 0; background: linear-gradient(180deg, #ff5977, #d63c5e); }
.capsule-bottom { bottom: 0; border-radius: 0 0 92px 92px; background: linear-gradient(180deg, #eef2f7, #c6cede); }
@keyframes drop-bounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-16px) rotate(4deg); } }
.wait-title { font-family: 'Cinzel', serif; font-size: 21px; letter-spacing: .05em; }
.wait-sub { color: var(--ink-muted); font-size: 13.5px; margin-top: 8px; }
.wait-timer { color: var(--ink-dim); font-size: 12px; margin-top: 16px; }

.prize-card {
  width: 270px; margin: 0 auto 24px; border-radius: 20px; padding: 34px 24px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1.5px solid var(--rc, var(--common));
  box-shadow: 0 0 70px -12px var(--rc, var(--common));
  animation: card-in .55s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes card-in { 0% { transform: scale(.35) rotateY(90deg); opacity: 0; } 100% { transform: scale(1) rotateY(0); opacity: 1; } }
.prize-emoji { font-size: 74px; line-height: 1; filter: drop-shadow(0 0 26px var(--rc)); }
.prize-tier { margin-top: 16px; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--rc); font-weight: 800; }
.prize-name { font-size: 24px; font-weight: 800; margin-top: 6px; }
.prize-uid { font-size: 10px; color: var(--ink-dim); margin-top: 12px; word-break: break-all; }

.claim-btn {
  display: block; margin: 0 auto; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 16px; letter-spacing: .12em;
  color: #241703; background: linear-gradient(135deg, #caa03f, #e6bd5e);
  border: none; border-radius: 12px; padding: 14px 34px;
  box-shadow: 0 12px 40px -10px rgba(212, 168, 67, .45);
}
.ghost-btn {
  display: block; margin: 14px auto 0; cursor: pointer; background: none;
  border: none; color: var(--ink-dim); font-size: 13px; text-decoration: underline;
}
.err-emoji { font-size: 54px; margin-bottom: 18px; }

/* v2: tabs, arena, farm, connect */
.wallet-chip.as-btn { cursor: pointer; transition: border-color .15s; }
.wallet-chip.as-btn:hover { border-color: var(--acid); }
.wallet-chip .dot.off { background: var(--ink-dim); box-shadow: none; }

.tabs { display: flex; gap: 8px; margin-top: 44px; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; cursor: pointer; color: var(--ink-dim);
  font-family: 'Cinzel', serif; font-size: 14px; letter-spacing: .1em;
  padding: 12px 18px; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--acid); border-bottom-color: var(--acid); }
.tabpane { margin-top: 26px; }
.mt { margin-top: 34px !important; }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mini-btn {
  cursor: pointer; font-family: 'Cinzel', serif; letter-spacing: .08em; font-size: 12px;
  color: #241703; background: linear-gradient(135deg, #caa03f, #e6bd5e);
  border: none; border-radius: 8px; padding: 8px 14px;
}
.mini-btn.alt { background: none; color: var(--ink-muted); border: 1px solid var(--line); }
.mini-btn:disabled { filter: grayscale(.75) brightness(.6); cursor: not-allowed; }
.row-btns { display: flex; gap: 8px; margin-top: 12px; }
.row-btns .mini-btn { flex: 1; }

.card.selected { outline: 2px solid var(--acid); outline-offset: 2px; }
.fuse-bar { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-muted); }
.pending-gems { margin-top: 10px; font-family: 'Fragment Mono', monospace; font-size: 12px; color: var(--acid); }

.farm-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 26px; }
.farm-summary .row-btns { margin-top: 12px; }

.duels { display: flex; flex-direction: column; gap: 12px; }
.duel {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-md); padding: 14px 18px;
}
.duel.closed { opacity: .45; }
.duel-emoji { font-size: 30px; }
.duel-info { flex: 1; font-size: 14px; }
.duel-meta { font-size: 11.5px; color: var(--ink-dim); margin-top: 3px; }
.duel-done { font-size: 11px; letter-spacing: .12em; color: var(--ink-dim); text-transform: uppercase; }

.connect-list { display: flex; flex-direction: column; gap: 10px; margin: 22px auto 14px; max-width: 360px; }
.connect-opt {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
  cursor: pointer; border: 1px solid var(--line); background: var(--panel);
  border-radius: 12px; padding: 13px 16px; color: var(--ink); font-family: 'Outfit', sans-serif;
}
.connect-opt:hover { border-color: var(--acid); }
.connect-opt b { font-size: 15px; }
.connect-opt span { font-size: 12px; color: var(--ink-dim); }
.wc-pair { margin-top: 14px; }
.wc-pair canvas { background: #fff; border-radius: 12px; padding: 6px; }
.wc-pair textarea {
  width: 100%; max-width: 360px; margin-top: 8px; background: rgba(0,0,0,.4);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink-muted);
  font-family: 'Fragment Mono', monospace; font-size: 10px; padding: 8px;
}
.pick-cards { max-width: 640px; margin: 22px auto; max-height: 46vh; overflow-y: auto; }
.pick-wager { color: var(--ink-muted); font-size: 14px; }
.pick-wager input {
  width: 90px; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink); font-family: 'Fragment Mono', monospace; padding: 6px 9px; margin-left: 8px;
}
.prize-power { margin-top: 8px; font-family: 'Fragment Mono', monospace; font-size: 15px; color: var(--ink); }
.duel-banner { font-family: 'Cinzel', serif; font-size: 40px; letter-spacing: .1em; margin-bottom: 14px; }
.duel-banner.win { color: var(--acid); text-shadow: 0 0 40px rgba(212,168,67,.5); }
.duel-banner.lose { color: var(--danger, #ff6b8a); }

/* background tx toasts */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: flex; flex-direction: column-reverse; gap: 10px; max-width: 340px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: #0d1430; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; box-shadow: 0 14px 40px -12px rgba(0,0,0,.7);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast .t-body { flex: 1; min-width: 0; }
.toast b { font-size: 13px; display: block; }
.toast .t-sub { font-size: 11px; color: var(--ink-dim); display: block; word-break: break-word; }
.toast .t-time { font-size: 11px; color: var(--ink-dim); }
.toast .t-spin {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(212,168,67,.25); border-top-color: var(--acid);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast.ok { border-color: rgba(212,168,67,.5); }
.toast.ok .t-spin { animation: none; border-color: var(--acid); background: var(--acid); }
.toast.fail { border-color: rgba(255,107,138,.6); }
.toast.fail .t-spin { animation: none; border-color: #ff6b8a; background: #ff6b8a; }
.toast .t-x { background: none; border: none; color: var(--ink-dim); cursor: pointer; font-size: 13px; }

/* taste pass: states, texture, focus */
button { transition: transform .18s ease, filter .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
button:active:not(:disabled) { transform: scale(.98); }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; border-radius: 4px; }
html { scroll-behavior: smooth; }

.mini-btn:hover:not(:disabled) { filter: brightness(1.1); }
.mini-btn.alt:hover:not(:disabled) { border-color: var(--acid); color: var(--ink); filter: none; }
.tab:hover { color: var(--ink-muted); }
.tab.active:hover { color: var(--acid); }
.claim-mini:hover:not(:disabled) { filter: brightness(1.08); }
.connect-opt:active { transform: scale(.99); }

/* fixed grain overlay: breaks digital flatness (pointer-events: none) */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* tinted shadows on primary actions (match background hue, not black) */
.pull-btn { box-shadow: 0 14px 45px -12px rgba(212, 168, 67, .38), 0 4px 14px -6px rgba(5, 8, 23, .8); }
.toast { box-shadow: 0 14px 40px -12px rgba(5, 8, 23, .85); }

/* learn page */
.guide { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: 64ch; }
.guide li { counter-increment: step; position: relative; padding: 0 0 30px 58px; }
.guide li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 1px;
  font-family: 'Fragment Mono', monospace; font-size: 13px; color: var(--acid);
  border: 1px solid rgba(212, 168, 67, .3); border-radius: var(--r-sm);
  padding: 6px 8px; background: rgba(212, 168, 67, .06);
}
.guide li:not(:last-child)::after {
  content: ''; position: absolute; left: 16px; top: 40px; bottom: 8px;
  width: 1px; background: var(--line);
}
.guide h3 { margin: 2px 0 7px; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.guide p { margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 1.7; text-wrap: pretty; }
.guide a, .faq a { color: var(--acid); text-decoration-color: rgba(212, 168, 67, .4); }

.faq { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px 34px; }
.faq .qa h4 { margin: 0 0 7px; font-size: 14.5px; font-weight: 700; letter-spacing: -.005em; }
.faq .qa p { margin: 0; color: var(--ink-muted); font-size: 13.5px; line-height: 1.65; text-wrap: pretty; }
@media (max-width: 700px) { .faq { grid-template-columns: 1fr; } }

/* codex chronicle */
.lore { max-width: 64ch; border-left: 2px solid rgba(212, 168, 67, .35); padding-left: 22px; margin-bottom: 8px; }
.lore p { color: var(--ink-muted); font-size: 14.5px; line-height: 1.75; margin: 0 0 14px; text-wrap: pretty; }
.lore b { color: var(--ink); font-weight: 600; }

/* guided tour */
.tour-btn { padding: 8px 12px; font-weight: 700; flex-shrink: 0; }
#tourDim { display: none; position: fixed; inset: 0; z-index: 90; }
#tourSpot {
  position: fixed; border-radius: 14px; pointer-events: none;
  border: 2px solid var(--acid);
  box-shadow: 0 0 0 9999px rgba(4, 3, 2, .62), 0 0 34px rgba(212, 168, 67, .45);
  transition: all .3s ease;
}
#tourTip {
  position: fixed; z-index: 91; width: min(400px, calc(100vw - 24px));
  background: linear-gradient(160deg, #1c160c, #120e08);
  border: 1px solid rgba(212, 168, 67, .5); border-radius: 16px;
  padding: 20px 22px 16px;
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, .9), 0 0 40px -10px rgba(212, 168, 67, .25);
  transition: left .3s ease, top .3s ease;
}
.tour-title { font-family: 'Cinzel', serif; font-size: 17px; letter-spacing: .06em; color: var(--acid); margin-bottom: 8px; padding-right: 24px; }
.tour-body { font-size: 13.5px; line-height: 1.65; color: var(--ink-muted); }
.tour-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; }
.tour-nav .mini-btn { margin-left: 8px; }
.tour-count { font-family: 'Fragment Mono', monospace; font-size: 11px; color: var(--ink-dim); }
.tour-x {
  position: absolute; top: 10px; right: 12px; cursor: pointer;
  background: none; border: none; color: var(--ink-dim); font-size: 15px;
}
.tour-x:hover { color: var(--ink); }

/* aspects (valor / bulwark / guile) */
.ac-aspects {
  font-family: 'Fragment Mono', monospace; font-size: 11px; color: #cfc6b4;
  letter-spacing: .02em; text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.card:not(.art-card) .ac-aspects { margin-top: 6px; color: var(--ink-muted); text-shadow: none; }
.prize-card .ac-aspects { font-size: 13px; }
.reveal-face.plain .ac-aspects { margin-top: 10px; }

/* the Rite of Tempering */
.temper-opts { display: flex; gap: 10px; justify-content: center; margin: 18px 0 14px; }
.favor-note { margin-top: 10px; }
.favor-note b { color: var(--acid); }
.favor-note .mini-btn { margin-left: 10px; }

/* ---------------- reveal theater ---------------- */
.prize-card { perspective: 1200px; }
.prize-card:not(.art-reveal) { min-height: 400px; }
.flip-inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.3, 1.35, .4, 1);
}
.prize-card { position: relative; }
.reveal-back, .reveal-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: inherit; overflow: hidden;
}
.reveal-face { transform: rotateY(180deg); }
.reveal-face.plain {
  display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: 34px 24px 26px;
}
#stageReveal.revealed .flip-inner { transform: rotateY(180deg); }
.reveal-back {
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 30%, #241d12, #0f0d0a 72%);
  border: 1px solid rgba(212, 168, 67, .3);
}
.reveal-back img {
  width: 42%; opacity: .92;
  animation: backPulse 1.1s ease-in-out infinite alternate;
}
@keyframes backPulse {
  from { transform: scale(.97); filter: drop-shadow(0 0 10px var(--rc, #d4a843)); }
  to { transform: scale(1.05); filter: drop-shadow(0 0 32px var(--rc, #d4a843)); }
}
#stageReveal.tier-2 .reveal-back img { animation-duration: .7s; }
#stageReveal.tier-3 .reveal-back img { animation-duration: .45s; width: 48%; }
#stageReveal.sequencing .claim-btn, #stageReveal.sequencing .ghost-btn { opacity: 0; pointer-events: none; }
#stageReveal .claim-btn, #stageReveal .ghost-btn { transition: opacity .4s ease .25s; }
.skip-hint {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-dim); margin: 0 0 14px; opacity: 0; transition: opacity .5s;
}
#stageReveal.sequencing .skip-hint { opacity: .65; }
#stageReveal.revealed .skip-hint { display: none; }

/* embers */
.embers { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.ember-p {
  position: absolute; bottom: 8%; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #ffd77a, #d4a843 70%);
  box-shadow: 0 0 8px rgba(255, 200, 100, .8); opacity: 0;
  animation: emberUp linear forwards;
}
.ember-p.big { width: 8px; height: 8px; }
@keyframes emberUp {
  0% { opacity: 0; transform: none; }
  12% { opacity: 1; }
  100% { transform: translate(var(--dx, 0), -240px) scale(.35); opacity: 0; }
}

/* epic quake + legendary flash */
.overlay.quake .overlay-inner { animation: quake .5s ease-in-out; }
@keyframes quake {
  0%, 100% { transform: none; }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(6px, -5px); }
  60% { transform: translate(-5px, -3px); }
  80% { transform: translate(4px, 5px); }
}
.overlay.goldflash::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 219, 120, .55), transparent 68%);
  animation: goldfade .95s ease-out forwards;
}
@keyframes goldfade { from { opacity: 1; } to { opacity: 0; } }

/* ribbons */
.ribbon {
  position: fixed; top: 78px; left: 50%; z-index: 70;
  transform: translate(-50%, -26px); opacity: 0;
  font-family: 'Cinzel', serif; font-size: 13.5px; letter-spacing: .08em;
  color: #e8d9ac; padding: 12px 26px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(32, 26, 15, .97), rgba(46, 37, 19, .97));
  border: 1px solid rgba(212, 168, 67, .5);
  box-shadow: 0 12px 44px -10px rgba(212, 168, 67, .4);
  transition: transform .45s cubic-bezier(.2, 1.25, .4, 1), opacity .45s;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.ribbon b { color: var(--acid); font-weight: 700; }
.ribbon.show { transform: translate(-50%, 0); opacity: 1; }
.ribbon.level { font-size: 16px; border-width: 2px; padding: 15px 34px; }

/* button micro-feel */
.pull-btn, .mini-btn, .claim-btn, .claim-mini, .ghost-btn { transition: transform .08s ease, filter .15s ease; }
.pull-btn:active:not(:disabled), .mini-btn:active:not(:disabled),
.claim-btn:active, .claim-mini:active:not(:disabled) { transform: scale(.965); }
.pull-btn:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 14px 44px -10px rgba(212, 168, 67, .55); }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .reveal-back img { animation: none; }
  .ember-p { display: none; }
  .overlay.quake .overlay-inner, .overlay.goldflash::after { animation: none; }
  .machine.shaking { animation: none; }
  .prize-card { animation: none; }
  .ribbon { transition: opacity .2s; }
}

/* codex collapsible sections */
.codex-sec {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(255, 255, 255, .015); margin-bottom: 14px;
}
.codex-sec summary {
  cursor: pointer; list-style: none; padding: 16px 18px; user-select: none;
  font-size: 16px; letter-spacing: .06em; color: var(--ink-muted); font-weight: 600;
}
.codex-sec summary::-webkit-details-marker { display: none; }
.codex-sec summary::before {
  content: '›'; display: inline-block; margin-right: 12px;
  color: var(--acid); transition: transform .18s ease;
}
.codex-sec[open] summary::before { transform: rotate(90deg); }
.codex-sec summary:hover { color: var(--ink); }
.codex-sec .sec-body { padding: 2px 18px 18px; }

/* deeds of renown */
.deeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.deed {
  display: flex; gap: 12px; align-items: baseline;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px;
  background: rgba(255, 255, 255, .015); opacity: .55;
}
.deed.done { opacity: 1; border-color: rgba(212, 168, 67, .35); background: rgba(212, 168, 67, .05); }
.deed b { font-family: 'Cinzel', serif; font-size: 13.5px; letter-spacing: .04em; }
.deed-mark { color: var(--ink-dim); font-size: 15px; }
.deed.done .deed-mark { color: var(--acid); text-shadow: 0 0 12px rgba(212, 168, 67, .6); }
.deed-desc { font-size: 12px; color: var(--ink-muted); margin-top: 3px; line-height: 1.5; }

.wallet-chip .hint { font-size: 10px; color: var(--ink-dim); letter-spacing: .04em; }

/* champion sigils */
.card-art { width: 46px; height: 46px; color: #e7dcc4; filter: drop-shadow(0 0 12px var(--rc, rgba(0,0,0,.4))); }
.duel-art { width: 30px; height: 30px; }
.prize-art { width: 96px; height: 96px; }

/* full-art trading cards */
.card.art-card {
  padding: 0; aspect-ratio: 7 / 10; background: #14100c;
  border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent);
}
.card.art-card::before { display: none; }
.art-card .ac-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art-card .ac-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,10,8,.25) 0%, transparent 22%, transparent 44%, rgba(11,10,8,.88) 68%, rgba(11,10,8,.96) 100%);
}
.art-card .ac-top {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.ac-name { font-family: 'Cinzel', serif; font-weight: 700; font-size: 15px; color: #f4efe6; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.ac-power { font-family: 'Fragment Mono', monospace; font-size: 13px; color: #e0a63c; text-shadow: 0 1px 4px rgba(0,0,0,.9); white-space: nowrap; }
.art-card .ac-bottom {
  position: absolute; left: 12px; right: 12px; bottom: 11px;
  display: flex; flex-direction: column; gap: 5px;
}
.ac-station { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; }
.ac-flavor {
  font-size: 11px; line-height: 1.45; color: #cfc6b4; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.art-card .row-btns, .art-card .claim-mini { margin-top: 3px; padding-top: 0; }
.art-card .row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.art-card .row-btns .mini-btn { padding: 7px 6px; }
.art-card .mini-btn.alt { background: rgba(11,10,8,.55); }
.art-card .pending-gems { margin-top: 2px; }

.row-thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; display: block; }

.prize-card.art-reveal {
  position: relative; width: 300px; aspect-ratio: 7 / 9.5; padding: 0; overflow: hidden;
  text-align: left; background: #14100c;
}
.art-reveal .ac-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art-reveal .ac-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,10,8,.25) 0%, transparent 22%, transparent 52%, rgba(11,10,8,.88) 76%, rgba(11,10,8,.96) 100%);
}
.art-reveal .ac-top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.art-reveal .ac-bottom { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.art-reveal .ac-name { font-size: 19px; }
.art-reveal .ac-power { font-size: 15px; }
.art-reveal .ac-station { font-size: 11px; }
.art-reveal .ac-flavor { font-size: 12.5px; -webkit-line-clamp: 3; }

/* promptless session */
.session-box {
  max-width: 360px; margin: 18px auto 4px; text-align: left;
  border: 1px solid rgba(212, 168, 67, .3); border-radius: var(--r-md);
  background: rgba(212, 168, 67, .05); padding: 14px 16px;
}
.session-box b { font-size: 14px; }
.session-box p { margin: 6px 0 12px; font-size: 12px; color: var(--ink-muted); line-height: 1.55; }
.session-box .mini-btn { margin-right: 8px; }

.wallet-area { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; justify-content: flex-end; }
.header-session { white-space: nowrap; flex-shrink: 0; }
.header-session.active { background: none; color: var(--acid); border: 1px solid rgba(212, 168, 67, .4); }
/* tighter widths: drop the advisory hint first (balance keeps its tooltip) */
@media (max-width: 820px) { .wallet-chip .hint { display: none; } }
/* below this the header genuinely can't fit one row — stack cleanly instead of clipping */
@media (max-width: 700px) {
  header.top { flex-wrap: wrap; }
  .wallet-area { flex-basis: 100%; justify-content: flex-start; }
}
