:root {
  --night: #0a0f17; --panel: #111a26ee; --line: #24324a; --text: #eef4f8; --muted: #8fa3b8;
  --ember: #ff6a2b; --live: #c9ff3d; --bad: #ff7a7a;
  --r0: #c9d4de; --r1: #8be0a9; --r2: #7ab8ff; --r3: #c79bff; --r4: #ffc65a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.lbl { position: absolute; left: 0; top: 0; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #0a0f17aa; color: var(--muted); white-space: nowrap; }
.lbl.up { color: var(--live); }
.lbl.you { color: var(--ember); font-weight: 600; }
button { font: inherit; color: var(--text); background: #1b2738; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--ember); border-color: var(--ember); color: #1a0d05; font-weight: 600; }
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(#0a0f17ee, #0a0f1700); }
.top .brand { font-weight: 700; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 6px; }
.top .stat { color: var(--muted); font-size: 12px; }
.top .stat b { color: var(--text); }
.top .grow { flex: 1; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 4px; }
.dot.on { background: var(--live); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #0a0f17ee; border-top: 1px solid var(--line); }
.tabs button { flex: 1; }
.tabs button.on { border-color: var(--ember); color: var(--ember); }
/* Plan 24: eight tabs. The row scrolls sideways if it doesn't fit; on phones the labels are smaller */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1 0 auto; }
@media (max-width: 480px) { .tabs { gap: 4px; padding-left: 8px; padding-right: 8px; } .tabs button { font-size: 12px; padding: 6px 7px; } }
.panel { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); max-height: 55vh; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 12px; backdrop-filter: blur(6px); }
.card { position: fixed; left: 12px; right: 12px; top: 56px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
@media (min-width: 900px) {
  .panel { top: 56px; bottom: 12px; left: 12px; right: auto; width: 360px; max-height: none; border: 1px solid var(--line); border-radius: 12px; }
  .card { left: auto; right: 12px; width: 320px; }
  .tabs { left: 12px; right: auto; bottom: auto; top: 50px; width: 360px; background: none; border: 0; padding: 0; }
  .panel { top: 92px; }
}
h3 { margin: 0 0 8px; font-size: 15px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #1a2536; }
.row > span:first-child, .row > div:first-child { min-width: 0; flex: 1 1 150px; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: 0 1 auto; }
.btns button { white-space: nowrap; }
.row.job { flex-wrap: wrap; } /* Plan 26: a creature's line on top, its job buttons below */
.row.job > span:first-child { flex-basis: 100%; }
.row.job .btns { flex: 1 1 100%; justify-content: flex-start; }
.row:last-child { border-bottom: 0; }
.tick { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.checkout { padding: 4px 0 8px; }
.muted { color: var(--muted); font-size: 12px; }
.bad { color: var(--bad); }
.hp { height: 4px; background: #1b2738; border-radius: 2px; overflow: hidden; margin-top: 3px; }
.hp i { display: block; height: 100%; background: var(--r1); }
.hp i.low { background: var(--bad); }
.r0 { color: var(--r0); } .r1 { color: var(--r1); } .r2 { color: var(--r2); } .r3 { color: var(--r3); } .r4 { color: var(--r4); }
.info { width: 18px; height: 18px; padding: 0; border-radius: 50%; font-size: 11px; line-height: 16px; margin-left: 4px; vertical-align: middle; }
.bubble { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #0a0f17; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.notice { position: fixed; left: 50%; transform: translateX(-50%); bottom: 110px; max-width: calc(100% - 32px); background: #2a1410; border: 1px solid var(--ember); border-radius: 10px; padding: 8px 12px; z-index: 27; } /* Plan 30: above the Card Hall layer (25) and the ship dialog (26), so a sale or a refusal there shows */
.ship-layer .start { z-index: 26; } /* Plan 30: the ship dialog (Your cards → Ship) opens above the Card Hall layer */
.start { position: fixed; inset: 0; display: grid; place-items: center; background: #0a0f17cc; padding: 16px; }
.start .box { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; }
.start h1 { margin: 0; font-size: 26px; letter-spacing: 0.04em; display: flex; align-items: center; gap: 10px; }
.hint.act { top: auto; bottom: calc(68px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .hint.act { bottom: 24px; } }
.hint.act { flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 32px); } /* Plan 24: Hit and two Catch buttons fit a phone; Plan 28: as wide as its line (shrink-to-fit from left: 50% wrapped it at half the screen), wrapping only past the phone width */
.hint .bar { display: inline-block; width: 96px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.hint .bar i { display: block; height: 100%; width: 0; background: var(--ember); animation: chopfill linear forwards; }
.xp { display: inline-block; width: 44px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; vertical-align: middle; } /* Plan 27: a hero's XP bar */
.xp i { display: block; height: 100%; background: var(--ember); }
@keyframes chopfill { to { width: 100%; } }
.hint { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--ember); border-radius: 10px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.log div { padding: 4px 0; border-bottom: 1px solid #1a2536; }
body.busy .panel button, body.busy .card button, body.busy .start button { opacity: 0.6; cursor: progress; }
input { font: inherit; color: var(--text); background: #0a0f17; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
.tick input { width: auto; padding: 0; margin-top: 3px; flex: none; accent-color: var(--accent, #ff7a3d); }
.stack { display: grid; gap: 12px; }
[hidden] { display: none !important; }
.lbl.claimed { color: var(--ember); }
.guide { position: fixed; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); width: min(300px, calc(100% - 24px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
@media (min-width: 900px) { .guide { bottom: 12px; } }
.guide > [data-a="hideguide"] { position: absolute; top: 8px; right: 8px; padding: 2px 8px; }

/* the closet (Plan 15): parts left, preview middle (drag to turn), items right; stacked on narrow screens */
.closet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 13, 0.55); }
.closet-box { width: min(1120px, 100%); height: min(700px, calc(100dvh - 32px)); display: grid; grid-template-columns: 170px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: 14px; background: #111a26; border: 1px solid var(--line); border-radius: 14px; }
.closet-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.closet-head h3 { margin: 0; }
.closet-parts { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.closet-parts button { text-align: left; padding: 10px 12px; }
.closet-parts button.on { border-color: var(--ember); color: var(--ember); }
.closet-stage { position: relative; min-height: 0; }
.closet-view { height: 100%; border-radius: 12px; overflow: hidden; background: linear-gradient(#1b2738, #c7d3dd 78%); cursor: grab; touch-action: none; }
.closet-view:active { cursor: grabbing; }
.closet-view canvas { width: 100%; height: 100%; display: block; }
.closet-drag { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); pointer-events: none; }
.closet-items { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.closet-items h4 { margin: 0; }
.closet-items .tiles { flex: 1; overflow: auto; align-content: start; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tiles { display: grid; gap: 6px; }
.tile { display: grid; gap: 2px; text-align: left; padding: 8px 10px; }
.tile.on { border-color: var(--ember); }
.tile.locked { opacity: 0.7; }
@media (max-width: 760px) {
  .closet { padding: 0; }
  .closet-box { height: 100dvh; border-radius: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 42% minmax(0, 1fr); }
  .closet-parts { flex-direction: row; flex-wrap: wrap; }
  .closet-parts button { padding: 6px 10px; }
}
/* gear in hand (Plan 17) */
/* one row above the tab bar on phones (it scrolls sideways); centred above the action hint on wide screens */
.hand { position: fixed; left: 12px; right: 12px; bottom: calc(60px + env(safe-area-inset-bottom)); display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; z-index: 5; scrollbar-width: none; }
.hand button { font-size: 12px; padding: 6px 10px; flex: none; white-space: nowrap; }
@media (min-width: 900px) { .hint.act.creature { bottom: 116px; } } /* Plan 24: Hit and two Catch buttons wrap upward; start above the gear bar so they never cover it */
@media (max-width: 899px) { .hint.act, .guide { bottom: calc(104px + env(safe-area-inset-bottom)); } }
@media (min-width: 900px) { .hand { left: 50%; right: auto; transform: translateX(-50%); bottom: 72px; max-width: calc(100vw - 680px); } }
.hand button.on { border-color: var(--accent, #ff7a3d); color: var(--text); }

.pull { text-align: center; padding: 8px 0; }
.cardimg { width: 140px; height: 196px; object-fit: contain; display: block; margin: 0 auto 6px; border-radius: 6px; }
.cardimg.frame { display: flex; align-items: center; justify-content: center; border: 2px solid #c9a227; color: #d8d2c4; padding: 8px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { border: 3px solid #d8d2c4; border-radius: 4px; padding: 4px; font-size: 12px; text-align: center; }
.tile img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; }
.tile.f-oak { border-color: #8a5a2b; } .tile.f-iron { border-color: #5d646e; } .tile.f-gold { border-color: #c9a227; } .tile.f-aurora { border-color: #6fe3c1; }
.addr { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; } /* Plan 23: full wallet addresses */
@media (max-width: 899px) { .panel ~ .hint.act.creature { display: none; } } /* Plan 24: an open tab panel (the Creatures list) is never covered by the creature hint on phones */
/* Plan 28: a wild mystic's label with its HP bar */
.lbl.mystic { color: var(--text); }
.lbl .hpbar { display: inline-block; width: 48px; height: 5px; margin-left: 6px; background: #1b2738; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.lbl .hpbar i { display: block; height: 100%; background: var(--ember); }
/* Plan 28: the hatch dialog (the closet's frame without the parts column), shape options and colour swatches, the feed picker */
.hatch-box { width: min(900px, 100%); grid-template-columns: minmax(0, 1fr) 340px; }
.hatch-box .closet-items { overflow: auto; padding: 4px; } /* room for the chosen swatch's outline inside the scroller */
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button.on { border-color: var(--ember); color: var(--ember); }
.swatch { width: 36px; height: 36px; padding: 0; }
.swatch.on { outline: 2px solid var(--ember); outline-offset: 2px; }
.feed { padding: 4px 0 8px 12px; border-left: 2px solid var(--line); }
@media (max-width: 760px) { .hatch-box { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 38% minmax(0, 1fr); } }
/* Plan 29: the pack demo's corner tag (shown only in the demo build) */
.demo-tag { position: fixed; top: max(2px, env(safe-area-inset-top)); left: 4px; z-index: 30; padding: 1px 7px; border-radius: 6px; background: var(--ember); color: #1a0d06; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; pointer-events: none; }
.top .demo-tag { position: static; }
body:has(.top) #demo-tag { display: none; } /* Plan 29: in the game the tag sits after the logo in the top bar; the corner one is for the start screen */
/* Plan 30: the Card Hall layer over the game (dimmed and blurred behind); full screen and one column on phones.
   Display type: Rajdhani when the device has it (the client loads no web fonts; its CSP allows only 'self'). */
.hall { --display: Rajdhani, system-ui, -apple-system, "Segoe UI", sans-serif; --frost: #e2ebf3; --rc: var(--r0);
  position: fixed; inset: 0; z-index: 25; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 40%, rgba(10, 15, 23, 0.55), rgba(3, 5, 9, 0.88)); backdrop-filter: blur(8px) saturate(0.8); -webkit-backdrop-filter: blur(8px) saturate(0.8); }
.hall-box { position: relative; min-width: 0; width: min(1040px, 100%); height: min(780px, calc(100dvh - 32px)); display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; overflow: hidden; color: var(--frost); border: 1px solid #2a3a54; border-radius: 18px;
  background: radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 106, 43, 0.13), transparent 70%), radial-gradient(ellipse 80% 50% at 50% 100%, rgba(122, 184, 255, 0.08), transparent 70%), linear-gradient(#0f1621, #0a0f17);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.hall-head { display: flex; align-items: center; gap: 12px; }
.hall-head h2 { margin: 0; flex: 1; min-width: 0; white-space: nowrap; font: 700 22px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.hall-embers { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255, 106, 43, 0.45); background: rgba(255, 106, 43, 0.1); font: 700 14px/1 var(--display); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.hall-embers::before { content: ""; width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px; background: linear-gradient(135deg, #ffb37a, var(--ember)); box-shadow: 0 0 8px var(--ember); }
.hall-head [data-a="hallclose"] { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; background: #141e2c; }
.hall-tabs { display: flex; gap: 2px; align-self: flex-start; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: #0a0f17; }
.hall-tabs button { border: 0; border-radius: 999px; padding: 6px 16px; background: none; color: var(--muted); font-weight: 600; }
.hall-tabs button.on { background: #1d2a3d; color: var(--frost); box-shadow: inset 0 -2px 0 var(--ember); }
.hall-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.hall .bad { margin: 4px 0 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255, 122, 122, 0.4); background: rgba(255, 122, 122, 0.08); }
.hall .hall-away { justify-content: center; gap: 14px; border: 0; padding: 4px 0 8px; }
.hall .hall-away > span:first-child { flex: 0 1 auto; }
.hall-away .muted { font-size: 13px; }
.hall-foot { text-align: center; padding: 6px 0; }
.hall-foot .bubble { max-width: 420px; margin: 6px auto; text-align: left; }
/* the pack shelf: foil packs on a lit stage */
.shelf { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 40px; padding: 34px 8px 20px; flex: 1; align-content: center;
  background: radial-gradient(ellipse 60% 26% at 50% 86%, rgba(255, 106, 43, 0.12), transparent 70%); }
.hall-body:has(> .shelf) { display: flex; flex-direction: column; }
.pack-tile { position: relative; display: grid; gap: 12px; justify-items: center; width: 214px; }
.pack-tile::before { content: ""; position: absolute; left: 12%; right: 12%; top: 290px; height: 18px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), transparent); }
.pack-tile button.primary { width: 100%; padding: 10px 8px; border-radius: 10px; font-weight: 700; white-space: nowrap; }
.pack-tile .muted { position: relative; justify-self: stretch; display: flex; align-items: center; justify-content: center; text-align: center; }
.pack-tile .bubble { position: absolute; z-index: 2; top: calc(100% + 2px); left: -12px; right: -12px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
.pack { --h: 20; position: relative; width: 196px; height: 288px; padding: 22px 12px 20px; border-radius: 6px 6px 8px 8px; display: grid; grid-template-rows: auto 1fr auto; text-align: center; color: #fff; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(circle at 50% 50%, hsl(var(--h) 100% 82% / 0.85) 0 6px, transparent 7px),
    radial-gradient(circle at 50% 50%, transparent 0 36px, rgba(255, 255, 255, 0.7) 37px 39px, transparent 40px),
    radial-gradient(circle at 50% 50%, hsl(var(--h) 100% 70% / 0.55), transparent 62px),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.09) 0 5deg, transparent 5deg 15deg),
    linear-gradient(160deg, hsl(var(--h) 75% 22%), hsl(calc(var(--h) + 35) 85% 50%) 48%, hsl(var(--h) 80% 18%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 40px hsl(var(--h) 90% 55% / 0.25);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.pack::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; /* the crimped seals, top and bottom */
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0 2px, rgba(255, 255, 255, 0.25) 2px 4px) top / 100% 12px no-repeat, repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0 2px, rgba(255, 255, 255, 0.25) 2px 4px) bottom / 100% 12px no-repeat; }
.pack::after { content: ""; position: absolute; inset: -40%; pointer-events: none; background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.42) 48%, rgba(255, 220, 255, 0.18) 52%, transparent 60%); animation: hallfoil 5s ease-in-out infinite; } /* foil */
.pack-name { align-self: start; padding: 6px 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.32); font: 700 15px/1.1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.pack-price { grid-row: 3; justify-self: center; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.4); font: 700 13px/1.2 var(--display); letter-spacing: 0.05em; }
.pack-tile:hover .pack { transform: translateY(-8px) rotate(-1.5deg); }
.pack .tear { position: absolute; left: 0; right: 0; top: 13%; height: 2px; background: #fff; box-shadow: 0 0 10px #fff, 0 0 20px var(--rc); opacity: 0; transform: scaleX(0); transform-origin: left; }
@keyframes hallfoil { 0%, 55% { transform: translateX(-35%); } 100% { transform: translateX(35%); } }
/* the opening: fly, shake (until the answer), rip with a burst in the rarity colour, the face-down card rises and glows */
.opening { position: relative; width: 100%; height: 100%; min-height: 380px; display: grid; place-items: center; cursor: pointer; overflow: hidden; border: 0; border-radius: 14px; padding: 0; color: inherit; text-align: center;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--rc) 10%, transparent), transparent 55%); }
.opening > * { grid-area: 1 / 1; }
.opening:focus-visible { outline: 2px solid var(--ember); outline-offset: -2px; }
.opening .burst, .opening .rays, .opening .sparks { position: absolute; inset: 0; margin: auto; pointer-events: none; }
.opening .pack.big { width: 210px; height: 310px; }
.opening .pack.big .pack-name { font-size: 18px; }
.opening .burst { width: 520px; height: 520px; border-radius: 50%; opacity: 0; background: radial-gradient(circle, #fff 0%, var(--rc) 22%, color-mix(in srgb, var(--rc) 40%, transparent) 40%, transparent 68%); }
.opening .rays { width: 900px; height: 900px; opacity: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 55%, transparent) 0 4deg, transparent 4deg 20deg); -webkit-mask: radial-gradient(closest-side, #000 15%, transparent 100%); mask: radial-gradient(closest-side, #000 15%, transparent 100%); }
.opening .sparks { width: 0; height: 0; }
.opening .sparks i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; opacity: 0; background: #fff; box-shadow: 0 0 10px 3px var(--rc); transform: rotate(var(--a)) translateY(0); }
.opening .back { position: relative; width: 196px; height: 290px; border-radius: 14px; opacity: 0; border: 6px solid #c9a227; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 50% 50%, rgba(255, 106, 43, 0.35), transparent 45%), repeating-linear-gradient(45deg, #13203a 0 8px, #1a2a46 8px 16px); }
.opening .back::before { content: ""; position: absolute; inset: 8px; border-radius: 6px; border: 1px solid rgba(201, 162, 39, 0.6); }
.back-mark { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%) rotate(45deg); border: 3px solid #c9a227; border-radius: 8px; background: radial-gradient(circle, var(--ember) 0 9px, #0a0f17 10px); box-shadow: 0 0 18px rgba(255, 106, 43, 0.6); }
.opening.r0 { --rc: #ffffff; } .opening.r1 { --rc: var(--r1); } .opening.r2 { --rc: var(--r2); } .opening.r3 { --rc: var(--r3); } .opening.r4 { --rc: var(--r4); }
.opening-note { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; letter-spacing: 0.2em; text-transform: uppercase; }
.step-rise .opening-note, .step-ready .opening-note { opacity: 0; }
.step-fly .pack { animation: hallfly 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.step-shake .pack { animation: hallshake 0.18s linear infinite; }
.step-shake .tear { animation: halltear 0.8s ease-in forwards; }
.step-rip .pack { animation: hallrip 0.3s ease-in forwards; }
.step-rip .burst { animation: hallburst 0.6s ease-out forwards; }
.step-rip .sparks i { animation: hallspark 0.7s ease-out forwards; }
.step-rip .rays, .step-rise .rays, .step-ready .rays { animation: hallrays 1.2s ease-out forwards, hallspin 14s linear infinite; }
.step-rise .pack, .step-ready .pack { opacity: 0; }
.step-rise .back { animation: hallrise 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1) forwards; }
.step-ready .back { opacity: 1; animation: hallfloat 1.6s ease-in-out infinite alternate, hallglow 0.9s ease-in-out infinite alternate; box-shadow: 0 0 34px var(--rc), 0 20px 50px rgba(0, 0, 0, 0.6); }
@keyframes hallfly { from { transform: translateY(160px) scale(0.55) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hallshake { 0%, 100% { transform: rotate(0) translateX(0); } 25% { transform: rotate(-2.5deg) translateX(-3px); } 75% { transform: rotate(2.5deg) translateX(3px); } }
@keyframes halltear { to { opacity: 1; transform: scaleX(1); } }
@keyframes hallrip { 40% { transform: scale(1.08); opacity: 1; filter: brightness(1.6); } to { transform: scale(1.2) translateY(-30px); opacity: 0; filter: brightness(2.5); } }
@keyframes hallburst { from { opacity: 1; transform: scale(0.2); } to { opacity: 0; transform: scale(1.5); } }
@keyframes hallspark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-230px) scale(0.3); } }
@keyframes hallrays { from { opacity: 0; } to { opacity: 0.55; } }
@keyframes hallspin { to { rotate: 360deg; } }
@keyframes hallrise { from { opacity: 0; transform: translateY(90px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes hallfloat { to { transform: translateY(-8px); } }
@keyframes hallglow { from { box-shadow: 0 0 24px var(--rc), 0 20px 50px rgba(0, 0, 0, 0.6); } to { box-shadow: 0 0 56px var(--rc), 0 20px 50px rgba(0, 0, 0, 0.6); } }
/* the card as a graded slab; rare and better tilt with the pointer (main.ts sets --rx/--ry/--sx) and get a holo sheen */
.slab.r0 { --rc: var(--r0); } .slab.r1 { --rc: var(--r1); } .slab.r2 { --rc: var(--r2); } .slab.r3 { --rc: var(--r3); } .slab.r4 { --rc: var(--r4); }
.card-view { --rc: var(--r0); display: grid; grid-template-columns: auto minmax(0, 430px); justify-content: center; align-items: center; gap: 44px; min-height: 100%; padding: 12px 0;
  background: radial-gradient(ellipse 30% 55% at 36% 50%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 72%); }
.card-view:has(.slab.r1) { --rc: var(--r1); } .card-view:has(.slab.r2) { --rc: var(--r2); } .card-view:has(.slab.r3) { --rc: var(--r3); } .card-view:has(.slab.r4) { --rc: var(--r4); }
.slab { --rx: 0deg; --ry: 0deg; --sx: 50%; position: relative; width: 290px; padding: 10px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.07) 38%, rgba(255, 255, 255, 0.04) 62%, rgba(255, 255, 255, 0.16));
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 30px color-mix(in srgb, var(--rc) 35%, transparent);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform 0.12s ease-out; }
.slab-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 10px; border-radius: 6px; border-left: 5px solid var(--rc); background: linear-gradient(#ffffff, #e6ebf0); color: #121821; font: 700 12px/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.slab.r3, .slab.r4 { box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 44px var(--rc); }
/* fix round 1: with CC's photo (already a graded slab with its label) the slab is a thin frame in the rarity colour */
.slab:has(> .slab-card img) { padding: 5px; border-color: color-mix(in srgb, var(--rc) 65%, transparent); background: linear-gradient(155deg, color-mix(in srgb, var(--rc) 55%, #ffffff), #1a2333 42%, #121a26 62%, color-mix(in srgb, var(--rc) 45%, #0a0f17)); }
.slab.small:has(> .slab-card img) { padding: 3px; }
.slab-card { display: grid; aspect-ratio: 7 / 12; border-radius: 8px; overflow: hidden; background: #070b11; } /* CC's images are photos of the graded slab (about 7:12) */
.slab-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slab .face { display: grid; align-content: center; justify-items: center; gap: 8px; padding: 16px; text-align: center; color: var(--frost); border: 3px solid #c9a227; border-radius: 8px;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 55%), repeating-linear-gradient(45deg, #121c2c 0 8px, #16233a 8px 16px); }
.slab .face b { font: 700 20px/1.1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.slab .face span { font-size: 12px; color: var(--muted); }
.slab.tilt::after { content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0.55;
  background: linear-gradient(115deg, transparent 18%, rgba(255, 80, 200, 0.28) calc(var(--sx) - 16%), rgba(80, 240, 255, 0.36) var(--sx), rgba(255, 240, 90, 0.28) calc(var(--sx) + 16%), transparent 82%);
  animation: hallholo 3.2s ease-in-out infinite alternate; }
@keyframes hallholo { from { opacity: 0.35; } to { opacity: 0.7; } }
.slab.flip { animation: hallflip 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes hallflip { from { transform: perspective(900px) rotateY(90deg) scale(0.92); filter: brightness(2.2); } 60% { filter: brightness(1.3); } to { transform: perspective(900px) rotateY(0); filter: none; } }
.slab.small { width: auto; padding: 4px; border-radius: 8px; transform: none; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); }
.slab.small .slab-card { border-radius: 5px; }
.slab.small .face { padding: 6px; border-width: 2px; } .slab.small .face b { font-size: 13px; } .slab.small .face span { font-size: 10px; }
.card-facts { display: grid; gap: 10px; }
.card-facts h3 { margin: 0; font: 700 34px/1.05 var(--display); letter-spacing: 0.02em; color: #fff; }
.card-facts > .muted { font-size: 14px; }
.card-facts a.small { justify-self: start; font-size: 12px; color: var(--muted); }
.card-facts .btns { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; margin-top: 6px; }
.card-facts .btns button { padding: 9px 14px; border-radius: 10px; }
.card-facts .btns .muted { flex-basis: 100%; order: 0; margin: -2px 0 4px; }
.card-facts .btns button.primary { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: #0a0f17; color: var(--frost); font-size: 12px; font-weight: 600; }
.chip.r0 { color: var(--r0); } .chip.r1 { color: var(--r1); } .chip.r2 { color: var(--r2); } .chip.r3 { color: var(--r3); } .chip.r4 { color: var(--r4); }
.chip.r0, .chip.r1, .chip.r2, .chip.r3, .chip.r4 { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, #0a0f17); }
.chips.bonus .chip { border-color: rgba(255, 106, 43, 0.4); }
.chips.bonus .chip.r0, .chips.bonus .chip.r1, .chips.bonus .chip.r2, .chips.bonus .chip.r3, .chips.bonus .chip.r4 { border-color: currentColor; }
button.chip { padding: 3px 10px; border-radius: 999px; } /* the egg chip (opens Mystics) */
/* Your cards and the Gallery */
.card-grid, .gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 8px 0 12px; }
.card-tile { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; align-content: start; gap: 5px; padding: 10px; border-radius: 12px; text-align: left; font-size: 13px; background: linear-gradient(#141e2c, #0f1621); transition: transform 0.15s ease-out, border-color 0.15s; }
.card-tile:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--ember); }
.card-tile > span:first-of-type { font-weight: 700; color: #fff; }
.card-tile .chip { justify-self: start; font-size: 11px; }
.gal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gal-head h3 { margin: 0; font: 700 20px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.gal-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; padding: 22px; border-radius: 14px; border: 1px solid #1e2a3c; background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 236, 200, 0.07), transparent 70%), linear-gradient(#151d29, #0e141d); }
.gal-slot { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; align-content: start; gap: 5px; padding: 8px; border: 6px solid #d8d2c4; border-radius: 4px; background: #0b1119; font-size: 12px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 14px 26px rgba(0, 0, 0, 0.55); }
.gal-slot::before { content: ""; position: absolute; left: 10%; right: 10%; top: -26px; height: 40px; pointer-events: none; background: radial-gradient(ellipse at 50% 0%, rgba(255, 240, 210, 0.22), transparent 70%); }
.gal-slot:not(.empty) > span:first-of-type { font-weight: 700; color: #fff; }
.gal-slot.empty { place-items: center; align-content: center; min-height: 220px; border: 2px dashed #2c3b52; background: rgba(10, 15, 23, 0.5); box-shadow: none; }
.gal-slot.f-oak { border-color: #8a5a2b; } .gal-slot.f-iron { border-color: #5d646e; } .gal-slot.f-gold { border-color: #c9a227; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 14px 26px rgba(0, 0, 0, 0.55), 0 0 16px rgba(201, 162, 39, 0.35); } .gal-slot.f-aurora { border-color: #6fe3c1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 14px 26px rgba(0, 0, 0, 0.55), 0 0 18px rgba(111, 227, 193, 0.4); }
.gal-slot select { width: 100%; min-width: 0; font: inherit; font-size: 12px; color: var(--frost); background: #0a0f17; border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
.gal-slot button { padding: 5px 8px; font-size: 12px; }
.hall-body > .row, .hall-body .gal-grid + .row { border-bottom: 0; }
@media (max-width: 760px) {
  .hall { padding: 0; }
  .hall-box { width: 100%; height: 100dvh; border-radius: 0; border: 0; padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom)); }
  .hall-head h2 { font-size: 17px; letter-spacing: 0.08em; }
  .hall-embers { padding: 5px 10px; font-size: 13px; }
  .hall-tabs { align-self: stretch; } .hall-tabs button { flex: 1; padding: 7px 8px; }
  .hall-away { flex-direction: column; gap: 8px; text-align: center; }
  .hall-body:has(> .shelf) { justify-content: center; }
  .shelf { flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; gap: 24px; padding: 20px calc(50% - 107px) 18px; scrollbar-width: none; background: none; }
  .pack-tile { flex: 0 0 auto; scroll-snap-align: center; }
  .card-view { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 18px; align-items: start;
    background: radial-gradient(ellipse 60% 30% at 50% 26%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 70%); }
  .card-view .slab { width: min(220px, 58vw); }
  .card-facts { justify-items: center; text-align: center; width: 100%; }
  .card-facts h3 { font-size: 28px; }
  .card-facts .chips, .card-facts .btns { justify-content: center; }
  .card-facts a.small { justify-self: center; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* fix round 1: on phones a Gallery slot is one row (the card beside its name, frame and Take down), so the frame's label fits */
  .gal-grid { grid-template-columns: minmax(0, 1fr); }
  .gal-slot:not(.empty) { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 10px; }
  .gal-slot:not(.empty) > .slab { grid-row: 1 / -1; align-self: start; }
  .gal-slot:not(.empty) > :not(.slab) { grid-column: 2; }
  .gal-slot.empty { min-height: 72px; }
  .gal-grid { padding: 14px; gap: 14px; }
  .opening .pack.big { width: 180px; height: 266px; }
}
@media (prefers-reduced-motion: reduce) { .hall *, .hall *::before, .hall *::after { animation: none !important; transition: none !important; } .hall .slab { transform: none; } }
/* Plan 30: on wide screens all eight tabs show, in a 4 × 2 grid above the panel (the row used to scroll behind a hidden scrollbar) */
@media (min-width: 900px) {
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; overflow: visible; }
  .tabs button { flex: none; }
  .panel { top: 128px; }
}
/* Plan 30: at 390 px the top bar keeps the logo, Heat, Packs, the balance (an ember dot) and the wallet in one row */
.top .embers::before { content: ""; display: none; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--ember); vertical-align: middle; }
@media (max-width: 480px) {
  .top { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .top .brand { font-size: 0; } /* the logo and the Demo tag stay */
  .top .stat.hour, .top .stat.season, .top .stat > .info, .top .stat > .bubble { display: none; }
  .top button { padding: 5px 8px; font-size: 12px; }
  .top .long { display: none; }
  .top .embers::before { display: inline-block; }
}
