/* ============ Tokens ============ */
:root {
  --bg: #120d0a;
  --panel: #1e1611;
  --panel-2: #2a1f18;
  --panel-3: #33261d;
  --line: #3b2c22;
  --line-2: #52402f;
  --text: #f7efe7;
  --muted: #b8a698;
  --dim: #7f6d60;

  --accent: #ffb627;
  --accent-2: #ff8a1f;
  --accent-ink: #2a1800;
  --salsa: #ff4f3a;
  --logo-red: #e8432e;
  --guac: #43c66b;
  --bean: #3a2a44;
  --win: #3ddc84;
  --lose: #ff4d5e;

  --c-common: #a3adb8;
  --c-uncommon: #4ade80;
  --c-rare: #38bdf8;
  --c-epic: #c084fc;
  --c-legendary: #fbbf24;
  --c-mythic: #ff4d6d;

  --r: 16px;
  --font: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 138, 31, .18), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(67, 198, 107, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.win { color: var(--win); }
.lose { color: var(--lose); }
.hidden { display: none !important; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: rgba(18, 13, 10, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
/* Taco365 lockup: emoji + TACO + red 365 tag, slanted. Scales with font-size. */
.logo { display: inline-flex; align-items: center; gap: .16em; font-weight: 800; line-height: 1; transform: skewX(-8deg); white-space: nowrap; text-decoration: none; }
.logo-ico { font-size: 1.05em; display: inline-block; transition: transform .3s; }
.logo-word { letter-spacing: -.035em; color: var(--text); }
.logo-num { font-size: .8em; letter-spacing: -.03em; color: #fff4e6; background: var(--logo-red); padding: .06em .2em .12em; border-radius: .2em; }
.brand { font-size: 23px; }
.brand:hover .logo-ico { transform: rotate(-15deg) scale(1.1); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 13px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, color .15s; }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--accent-ink); background: var(--accent); }
.balance {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 16px; white-space: nowrap;
}
.balance b { min-width: 3ch; text-align: right; }
.balance.up { animation: flash-up .6s; }
.balance.down { animation: flash-down .6s; }
@keyframes flash-up { 30% { border-color: var(--win); box-shadow: 0 0 0 4px rgba(61, 220, 132, .2); transform: scale(1.05); } }
@keyframes flash-down { 30% { border-color: var(--lose); box-shadow: 0 0 0 4px rgba(255, 77, 94, .15); } }

/* ============ Layout ============ */
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 96px; }
.view { display: none; }
.view.active { display: block; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.game-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.game-head h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; }
.game-head p { margin: 6px 0 0; color: var(--muted); }
.game-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.controls { display: flex; flex-direction: column; gap: 16px; }
.stage { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; position: relative; overflow: hidden; }

/* ============ Form bits ============ */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bet-row { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px 4px 4px 12px; }
.bet-row:focus-within { border-color: var(--accent); }
.bet-row input, .input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-family: var(--mono); font-size: 16px; padding: 8px 0; }
.input-wrap { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px 12px; }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap span { color: var(--muted); font-family: var(--mono); }
.chip-btn { padding: 7px 10px; border-radius: 8px; background: var(--panel-3); font-size: 13px; font-weight: 700; }
.chip-btn:hover { background: var(--line-2); }
select.input { background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; }
.seg button { padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; font-weight: 700; transition: transform .08s, filter .15s, background .15s; text-decoration: none; }
a.btn { color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 6px 20px -8px rgba(255, 138, 31, .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.green { background: linear-gradient(180deg, #5fe39a, #2fbf6c); color: #052e16; box-shadow: 0 6px 20px -8px rgba(61, 220, 132, .7); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.big { padding: 16px 20px; font-size: 18px; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.stat-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.stat-line b { color: var(--text); font-family: var(--mono); }

.result { font-size: 22px; font-weight: 800; min-height: 1.4em; text-align: center; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.hchip { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.hchip.w { background: rgba(61, 220, 132, .14); color: var(--win); }
.hchip.l { background: rgba(255, 77, 94, .12); color: var(--lose); }

/* ============ Toasts / modal / confetti ============ */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-weight: 600; animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s; }
.toast.error { border-color: var(--lose); }
.toast.success { border-color: var(--win); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 5, 3, .78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; overflow-y: auto; animation: fadein .2s; }
.modal-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; padding: 28px; max-width: 920px; width: 100%; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); position: relative; }
.modal-box.narrow { max-width: 420px; }
.modal-box.bare { background: transparent; border: 0; box-shadow: none; padding: 0; }
.modal-box h2 { font-size: 24px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); font-size: 18px; }

.confetti { position: fixed; top: -40px; z-index: 200; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--spin)); } }

/* ============ Lobby ============ */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero-main { padding: 32px; background: linear-gradient(135deg, #3b1d0b 0%, #1e1611 70%); position: relative; overflow: hidden; }
.hero-main::after { content: '🌮'; position: absolute; right: -20px; bottom: -40px; font-size: 200px; opacity: .14; transform: rotate(-18deg); }
.hero-main h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; line-height: 1; }
.hero-main p { color: var(--muted); max-width: 46ch; }
.hero-bal { font-family: var(--mono); font-size: clamp(36px, 6vw, 60px); font-weight: 700; color: var(--accent); margin: 18px 0 6px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 14px; }
.stat span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat b { display: block; font-family: var(--mono); font-size: 22px; margin-top: 4px; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin: 28px 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s, background .15s; position: relative; overflow: hidden; }
.tile:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); }
.tile .t-ico { font-size: 38px; }
.tile b { font-size: 18px; }
.tile small { color: var(--muted); }
.tile .t-tag { position: absolute; top: 14px; right: 14px; font-size: 11px; font-family: var(--mono); padding: 3px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.tile.feature { background: linear-gradient(135deg, #2b1640, #1e1611); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .f-game { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-right: 8px; }
.feed b { font-family: var(--mono); white-space: nowrap; }

/* ============ Coin flip ============ */
.side-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border-radius: 12px; background: var(--bg); border: 2px solid var(--line-2); font-size: 32px; transition: border-color .15s, background .15s; }
.side span { font-size: 14px; font-weight: 700; color: var(--muted); }
.side.active { border-color: var(--accent); background: rgba(255, 182, 39, .08); }
.side.active span { color: var(--text); }
.coin-wrap { perspective: 900px; }
.coin { width: 200px; height: 200px; position: relative; transform-style: preserve-3d; transition: transform 1.7s cubic-bezier(.2, .75, .25, 1); }
.coin .face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-size: 96px; backface-visibility: hidden; }
.coin .front { background: radial-gradient(circle at 35% 30%, #ffe08a, #f2a516 55%, #b86f00); box-shadow: inset 0 0 0 10px rgba(255, 255, 255, .15), inset 0 -8px 20px rgba(0, 0, 0, .3), 0 20px 50px -10px rgba(255, 182, 39, .5); }
.coin .back { background: radial-gradient(circle at 35% 30%, #ffd7a8, #d9822b 55%, #8a4310); box-shadow: inset 0 0 0 10px rgba(255, 255, 255, .15), inset 0 -8px 20px rgba(0, 0, 0, .3), 0 20px 50px -10px rgba(217, 130, 43, .5); transform: rotateY(180deg); }
.coin.flipping { animation: coin-lift 1.7s cubic-bezier(.3, .6, .4, 1); }
@keyframes coin-lift { 40% { translate: 0 -60px; scale: 1.1; } }

/* ============ Crash ============ */
.crash-stage { padding: 0; min-height: 440px; justify-content: stretch; align-items: stretch; }
.crash-canvas-wrap { position: relative; flex: 1; min-height: 380px; }
.crash-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.crash-mult { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font-family: var(--mono); font-size: clamp(48px, 8vw, 84px); font-weight: 700; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); pointer-events: none; }
.crash-mult.crashed { color: var(--lose); }
.crash-mult.cashed { color: var(--win); }
.crash-sub { position: absolute; top: calc(38% + 52px); left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--muted); white-space: nowrap; pointer-events: none; }
.crash-hist { padding: 12px 16px; border-top: 1px solid var(--line); justify-content: flex-start; }

/* ============ Shared range input ============ */
.range-slider { width: 100%; accent-color: var(--accent); }

/* ============ Cards ============ */
.card {
  --rc: var(--c-common);
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  width: 220px; aspect-ratio: 5 / 7; border-radius: 14px; position: relative;
  padding: 7px; background: linear-gradient(145deg, color-mix(in srgb, var(--rc) 85%, #fff), var(--rc) 40%, color-mix(in srgb, var(--rc) 55%, #000));
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .4);
  transform: perspective(800px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .15s ease-out, box-shadow .2s;
  user-select: none; flex-shrink: 0;
}
.card.r-uncommon { --rc: var(--c-uncommon); }
.card.r-rare { --rc: var(--c-rare); }
.card.r-epic { --rc: var(--c-epic); }
.card.r-legendary { --rc: var(--c-legendary); box-shadow: 0 0 30px -4px rgba(251, 191, 36, .55), 0 12px 30px -10px rgba(0, 0, 0, .7); }
.card.r-mythic { --rc: var(--c-mythic); background: linear-gradient(120deg, #ff4d6d, #ffb627, #43c66b, #38bdf8, #c084fc, #ff4d6d); background-size: 300% 300%; animation: rainbow 4s linear infinite; box-shadow: 0 0 40px -4px rgba(255, 77, 109, .7), 0 12px 30px -10px rgba(0, 0, 0, .7); }
@keyframes rainbow { to { background-position: 300% 0; } }
.card-inner { height: 100%; border-radius: 9px; background: linear-gradient(180deg, #2b211a, #1a1310); display: flex; flex-direction: column; padding: 8px; gap: 6px; overflow: hidden; position: relative; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.c-name { font-weight: 800; font-size: 15px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-hp { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.c-hp i { font-style: normal; font-size: 13px; }
.card-art { flex: 1; border-radius: 7px; display: grid; place-items: center; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 40%, var(--t2), var(--t1) 75%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08), inset 0 -20px 40px rgba(0, 0, 0, .35); }
.card-art::before { content: ''; position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .06) 0 10deg, transparent 10deg 20deg); }
.r-legendary .card-art::before, .r-mythic .card-art::before { animation: spin 18s linear infinite; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .14) 0 8deg, transparent 8deg 16deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.card-art span { font-size: 78px; position: relative; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45)); }
.card-move { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; padding: 5px 7px; background: rgba(255, 255, 255, .05); border-radius: 6px; }
.card-move b { font-family: var(--mono); font-size: 14px; }
.card-flavor { margin: 0; font-size: 10.5px; line-height: 1.3; color: var(--muted); font-style: italic; min-height: 2.6em; }
.card-foot { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.rar-gem { color: var(--rc); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.r-mythic .rar-gem { color: #ff8fa3; }

.t-spicy { --t1: #4a0f0f; --t2: #d9432f; }
.t-cheesy { --t1: #4a3205; --t2: #f2c230; }
.t-guac { --t1: #0e3a1e; --t2: #49b86a; }
.t-crunchy { --t1: #4a2a08; --t2: #e39a35; }
.t-salsa { --t1: #4a1020; --t2: #f0607a; }
.t-bean { --t1: #26123a; --t2: #8d6bd6; }

.holo-layer { position: absolute; inset: 0; border-radius: 14px; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0; }
.card.holo .holo-layer {
  opacity: .55;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .55), transparent 40%),
    linear-gradient(115deg, transparent 20%, rgba(255, 0, 140, .35) 35%, rgba(0, 220, 255, .35) 50%, rgba(255, 230, 0, .35) 65%, transparent 80%);
  background-size: 100% 100%, 250% 250%;
  animation: holo-shift 5s ease-in-out infinite;
}
@keyframes holo-shift { 50% { background-position: 0 0, 100% 100%; } }
.holo-badge { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3; font-size: 9px; font-weight: 800; letter-spacing: .12em; padding: 3px 8px; border-radius: 999px; background: linear-gradient(90deg, #ff6ad5, #6ae3ff, #ffe66a); color: #1a0d1f; }

.card.sm { width: 160px; padding: 5px; border-radius: 11px; }
.card.sm .card-inner { padding: 6px; gap: 4px; border-radius: 7px; }
.card.sm .c-name { font-size: 12px; }
.card.sm .c-hp { font-size: 9px; }
.card.sm .card-art span { font-size: 54px; }
.card.sm .card-move { font-size: 10px; padding: 3px 5px; }
.card.sm .card-move b { font-size: 11px; }
.card.sm .card-flavor { display: none; }
.card.sm .card-foot { font-size: 8.5px; }
.card.lg { width: 300px; }
.card.lg .c-name { font-size: 20px; }
.card.lg .card-art span { font-size: 110px; }
.card.lg .card-flavor { font-size: 13px; }

/* Card back */
.card-back { width: 100%; height: 100%; border-radius: 14px; background: radial-gradient(circle at 50% 50%, #ff8a1f, #7a2b06 70%); border: 7px solid #2a1810; display: grid; place-items: center; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7); position: relative; overflow: hidden; }
.card-back::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 8px, transparent 8px 16px); }
.card-back span { font-size: 64px; position: relative; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.card-back b { position: absolute; bottom: 14px; font-size: 12px; letter-spacing: .3em; font-weight: 800; color: rgba(255, 255, 255, .7); }

/* Flip */
.flip { width: 200px; aspect-ratio: 5 / 7; perspective: 1000px; cursor: pointer; position: relative; }
.flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .9, .3, 1.1); }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; }
.flip-face.front { transform: rotateY(180deg); }
.flip-face .card { width: 100%; }
.flip:not(.open):hover .flip-inner { transform: translateY(-6px) rotate(-1deg); }
.flip.teaser-rare:not(.open) .card-back { box-shadow: 0 0 30px 4px rgba(56, 189, 248, .5); }
.flip.teaser-epic:not(.open) .card-back { box-shadow: 0 0 34px 6px rgba(192, 132, 252, .6); }
.flip.teaser-legendary:not(.open) .card-back { box-shadow: 0 0 40px 8px rgba(251, 191, 36, .7); animation: shake .5s infinite; }
.flip.teaser-mythic:not(.open) .card-back { box-shadow: 0 0 50px 12px rgba(255, 77, 109, .8); animation: shake .35s infinite; }
.new-badge { position: absolute; top: -10px; right: -10px; z-index: 5; background: var(--win); color: #052e16; font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px; opacity: 0; transform: scale(.5); transition: opacity .3s .5s, transform .3s .5s; }
.flip.open .new-badge { opacity: 1; transform: scale(1); }
.reveal-burst { position: absolute; inset: -30%; border-radius: 50%; pointer-events: none; opacity: 0; z-index: -1; }
.flip.open .reveal-burst { animation: burst 1s ease-out; }
@keyframes burst { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.4); } }

/* Real card scans */
.card.img-card { padding: 4px; }
.card.img-card img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.card.img-card .holo-layer { border-radius: 12px; }
.img-rarity { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); z-index: 3; font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: #1a1310; color: var(--rc); border: 1px solid var(--rc); white-space: nowrap; }
.card.sm .img-rarity { font-size: 8px; }
.slot .card.img-card + .count { bottom: -22px; }
.thumb { display: inline-block; width: 1.15em; height: 1.15em; border-radius: 50%; background-size: 125% auto; background-position: 50% 23%; background-repeat: no-repeat; vertical-align: middle; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); }
.minion .m-art .thumb { width: 64px; height: 64px; }
.hs-c-art .thumb { width: 58px; height: 58px; }
.missing-card b { font-size: 40px; color: var(--line-2); }

/* ============ Packs ============ */
.packs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.pack-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 20px 20px; text-align: center; }
.pack {
  --p1: #ff8a1f; --p2: #a83a06;
  width: 170px; height: 250px; border-radius: 10px; position: relative;
  background: linear-gradient(150deg, var(--p1), var(--p2));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .8), inset 0 0 0 2px rgba(255, 255, 255, .12);
  transition: transform .2s; overflow: hidden;
}
.pack::before, .pack::after { content: ''; position: absolute; left: 0; right: 0; height: 14px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .25) 0 4px, rgba(255, 255, 255, .15) 4px 8px); }
.pack::before { top: 0; }
.pack::after { bottom: 0; }
.pack .shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 45%, transparent 60%); background-size: 250% 100%; animation: shine 3.5s ease-in-out infinite; }
@keyframes shine { 0% { background-position: 150% 0; } 60%, 100% { background-position: -100% 0; } }
.pack .p-ico { font-size: 72px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); position: relative; }
.pack .p-name { font-weight: 800; font-size: 17px; line-height: 1.1; padding: 0 14px; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); position: relative; }
.pack .p-brand { position: absolute; top: 24px; font-size: 10px; font-weight: 800; letter-spacing: .3em; opacity: .75; }
.pack-card:hover .pack { transform: translateY(-6px) rotate(-2deg); }
.pack-card h3 { font-size: 20px; }
.pack-card p { margin: 0; color: var(--muted); font-size: 14px; }
.price { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.odds-link { font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.odds-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.odds-table th, .odds-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.odds-table th:first-child, .odds-table td:first-child { text-align: left; font-family: var(--font); }
.odds-table th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

.rpill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.rpill::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--rc); }
.rpill.r-common { --rc: var(--c-common); } .rpill.r-uncommon { --rc: var(--c-uncommon); } .rpill.r-rare { --rc: var(--c-rare); }
.rpill.r-epic { --rc: var(--c-epic); } .rpill.r-legendary { --rc: var(--c-legendary); } .rpill.r-mythic { --rc: var(--c-mythic); }

/* Opening sequence */
.opening { display: flex; flex-direction: column; align-items: center; gap: 24px; min-height: 70vh; justify-content: center; }
.opening .pack { width: 220px; height: 320px; cursor: pointer; }
.opening .pack .p-ico { font-size: 96px; }
.opening .pack.idle { animation: wobble 1.6s ease-in-out infinite; }
.opening .pack.tearing { animation: shake .12s 4; }
.opening .pack.torn { animation: pack-away .5s ease-in forwards; }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-6px); } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-3px, 1px) rotate(-1deg); } 75% { transform: translate(3px, -1px) rotate(1deg); } }
@keyframes pack-away { to { transform: translateY(-60px) scale(1.3); opacity: 0; filter: brightness(3); } }
.opening-hint { color: var(--muted); font-weight: 600; }
.reveal-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.reveal-row .flip { animation: deal .5s cubic-bezier(.2, .8, .3, 1.2) backwards; }
@keyframes deal { from { opacity: 0; transform: translateY(80px) scale(.7) rotate(8deg); } }
.opening-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.flash { position: fixed; inset: 0; z-index: 60; pointer-events: none; animation: flash-out .9s ease-out forwards; }
@keyframes flash-out { from { opacity: .85; } to { opacity: 0; } }

/* ============ Collection ============ */
.coll-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.progress { flex: 1; min-width: 240px; }
.progress-bar { height: 10px; border-radius: 999px; background: var(--panel-3); overflow: hidden; margin-top: 8px; }
.progress-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .5s; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.filter { padding: 7px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.binder { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; justify-items: center; }
.slot { position: relative; cursor: pointer; }
.slot .count { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); z-index: 4; font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--text); color: var(--bg); white-space: nowrap; }
.slot.missing { cursor: default; }
.missing-card { width: 160px; aspect-ratio: 5 / 7; border-radius: 11px; border: 2px dashed var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--dim); background: rgba(255, 255, 255, .015); }
.missing-card span { font-size: 54px; filter: grayscale(1) brightness(0); opacity: .35; }
.missing-card small { font-family: var(--mono); font-size: 11px; }
.card-detail { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center; }
.card-detail .meta { display: flex; flex-direction: column; gap: 12px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ============ Battle ============ */
.record { padding: 8px 14px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 14px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tier { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border-radius: var(--r); background: var(--panel); border: 2px solid var(--line); text-align: left; transition: border-color .15s, transform .15s; }
.tier:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tier.active { border-color: var(--accent); background: linear-gradient(160deg, rgba(255, 182, 39, .1), var(--panel) 60%); }
.tier-ico { font-size: 34px; }
.tier b { font-size: 17px; }
.tier small { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.tier-money { display: flex; justify-content: space-between; width: 100%; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.tier-power { font-size: 12px; color: var(--muted); }
.dmg-float { position: absolute; top: 30%; left: 50%; z-index: 6; font-family: var(--mono); font-weight: 700; font-size: 36px; color: #fff; text-shadow: 0 3px 0 var(--lose), 0 0 24px rgba(255, 77, 94, .8); animation: float-up 1.1s ease-out forwards; pointer-events: none; white-space: nowrap; }
.dmg-float.crit { font-size: 48px; color: var(--accent); }
.dmg-float.heal { color: var(--win); text-shadow: 0 3px 0 #146c3c, 0 0 24px rgba(61, 220, 132, .8); }
.dmg-float.miss { color: var(--muted); text-shadow: none; font-size: 28px; }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -60px); } }
.hs-setup { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hs-decklist { display: flex; flex-direction: column; gap: 4px; }
.hs-deckrow { display: grid; grid-template-columns: 30px 30px minmax(0, 1fr) auto 44px 30px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--rc, var(--c-common)); font-size: 14px; }
.hs-deckrow.r-uncommon, .hs-card.r-uncommon, .minion.r-uncommon { --rc: var(--c-uncommon); }
.hs-deckrow.r-rare, .hs-card.r-rare, .minion.r-rare { --rc: var(--c-rare); }
.hs-deckrow.r-epic, .hs-card.r-epic, .minion.r-epic { --rc: var(--c-epic); }
.hs-deckrow.r-legendary, .hs-card.r-legendary, .minion.r-legendary { --rc: var(--c-legendary); }
.hs-deckrow.r-mythic, .hs-card.r-mythic, .minion.r-mythic { --rc: var(--c-mythic); }
.hs-dl-art { font-size: 20px; text-align: center; }
.hs-dl-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-dl-kw { font-size: 12px; white-space: nowrap; }
.hs-dl-stats { text-align: right; }
.hs-rules ul { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.hs-kwlist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; color: var(--muted); }

.hs-cost { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #7cc4ff, #1f6fd1 70%); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 14px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

.hs-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.hs-table { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 18px; border-radius: 22px; background: radial-gradient(ellipse at 50% 50%, #5a3a22 0%, #3a2414 60%, #26170d 100%); border: 6px solid #6b4423; box-shadow: inset 0 0 60px rgba(0, 0, 0, .55), 0 20px 50px -20px rgba(0, 0, 0, .8); overflow: hidden; user-select: none; }
.hs-ehand { display: flex; justify-content: center; gap: 0; min-height: 44px; }
.hs-back { width: 32px; height: 44px; margin-left: -8px; border-radius: 5px; background: radial-gradient(circle, #ff8a1f, #7a2b06 75%); border: 2px solid #f3e6d6; display: grid; place-items: center; font-size: 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.hs-herorow { display: flex; align-items: center; justify-content: center; gap: 16px; position: relative; }
.hs-meta { display: flex; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .7); }
.hs-hero { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 30%, #6d4a30, #2a1a0e); border: 4px solid #c9a36a; box-shadow: 0 6px 16px rgba(0, 0, 0, .5); }
.hs-hero-face { font-size: 42px; }
.hs-hero-name { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .75); white-space: nowrap; }
.hs-hero .gem.hp { right: -6px; bottom: -4px; width: 30px; height: 30px; font-size: 15px; }
.hs-power { position: relative; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #ff7a4d, #a32a12); border: 3px solid #c9a36a; font-size: 24px; box-shadow: 0 4px 12px rgba(0, 0, 0, .5); transition: transform .15s, filter .15s; }
.hs-power b { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); }
.hs-power b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #1f6fd1; color: #fff; font-family: var(--mono); font-size: 12px; }
.hs-power:not(:disabled) { box-shadow: 0 0 0 3px var(--win), 0 0 18px rgba(61, 220, 132, .6); }
.hs-power:not(:disabled):hover { transform: scale(1.08); }
.hs-power.selected { box-shadow: 0 0 0 3px var(--accent), 0 0 22px rgba(255, 182, 39, .8); }
.hs-power:disabled { filter: grayscale(.8) brightness(.6); opacity: 1; }
.hs-mana { display: flex; align-items: center; gap: 3px; }
.crystal { width: 13px; height: 16px; clip-path: polygon(50% 0, 100% 35%, 80% 100%, 20% 100%, 0 35%); background: rgba(0, 0, 0, .35); }
.crystal.full { background: linear-gradient(180deg, #8fd0ff, #1f6fd1); }
.crystal.spent { background: rgba(80, 140, 220, .35); }
.hs-mana b { margin-left: 6px; color: #9ccfff; font-size: 14px; }

.hs-board { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 118px; padding: 8px; border-radius: 16px; background: rgba(0, 0, 0, .14); }
.hs-empty { color: rgba(255, 255, 255, .35); font-size: 13px; font-weight: 600; }
.hs-divider { position: relative; height: 0; border-top: 1px dashed rgba(255, 255, 255, .12); }
.hs-end { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 3; padding: 10px 16px; border-radius: 12px; font-weight: 800; font-size: 14px; background: linear-gradient(180deg, #ffd166, #e09b10); color: #3a2400; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.hs-end:disabled { background: #4a3b2e; color: rgba(255, 255, 255, .5); opacity: 1; }
.hs-end.nudge { background: linear-gradient(180deg, #7ef0a8, #2fbf6c); color: #052e16; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 4px rgba(61, 220, 132, .35), 0 4px 14px rgba(0, 0, 0, .5); } }

.minion { --rc: var(--c-common); position: relative; width: 78px; height: 98px; border-radius: 40px 40px 36px 36px; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #6a4b33, #2b1d12 80%); border: 3px solid var(--rc); box-shadow: 0 6px 14px rgba(0, 0, 0, .5); cursor: pointer; transition: transform .15s, box-shadow .2s; flex-shrink: 0; }
.minion .m-art { font-size: 40px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.minion.taunt { border-radius: 14px 14px 40px 40px; border-width: 5px; border-color: #b8b8b8; outline: 2px solid var(--rc); outline-offset: -9px; }
.minion.shield { box-shadow: 0 0 0 3px #ffe58a, 0 0 22px 6px rgba(255, 229, 138, .7); }
.minion.holo::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(115deg, transparent 25%, rgba(255, 0, 170, .25) 40%, rgba(0, 220, 255, .25) 55%, transparent 70%); background-size: 250% 250%; animation: holo-shift 4s ease-in-out infinite; pointer-events: none; mix-blend-mode: color-dodge; }
.minion.ready { box-shadow: 0 0 0 3px var(--win), 0 0 18px rgba(61, 220, 132, .7); }
.minion.ready:hover { transform: translateY(-4px); }
.minion.selected { box-shadow: 0 0 0 4px var(--accent), 0 0 26px rgba(255, 182, 39, .9); transform: translateY(-8px) scale(1.05); }
.minion.targetable, .hs-hero.targetable { animation: target-pulse 1s ease-in-out infinite; cursor: crosshair; }
@keyframes target-pulse { 50% { box-shadow: 0 0 0 4px var(--lose), 0 0 24px rgba(255, 77, 94, .8); } }
.minion.summon { animation: summon .4s cubic-bezier(.2, .8, .3, 1.3); }
@keyframes summon { from { transform: translateY(-40px) scale(1.4); opacity: 0; } }
.minion.hit, .hs-hero.hit { animation: hit .4s; }
.minion.dying { transition: transform .45s, opacity .45s, filter .45s; transform: scale(.6) rotate(-10deg); opacity: 0; filter: grayscale(1) brightness(2); }
.m-zzz { position: absolute; top: -6px; right: -4px; font-size: 16px; }
.m-icon { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-size: 14px; }
@keyframes hit { 15%, 55% { translate: -6px 0; } 35%, 75% { translate: 6px 0; } }

.gem { position: absolute; width: 26px; height: 26px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); box-shadow: 0 0 0 2px rgba(0, 0, 0, .4); z-index: 2; }
.gem.atk { left: -6px; bottom: -4px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd166, #c98a00); }
.gem.hp { right: -6px; bottom: -4px; border-radius: 6px 6px 50% 50%; background: radial-gradient(circle at 35% 30%, #ff7a7a, #b31d1d); }
.gem.hp.hurt { color: #ffb3b3; }

.hs-hand { display: flex; justify-content: center; align-items: flex-end; min-height: 140px; padding-top: 10px; }
.hs-card { --rc: var(--c-common); position: relative; width: 104px; height: 140px; margin-left: 4px; border-radius: 10px; padding: 18px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: linear-gradient(180deg, #3a2a1d, #20160e); border: 3px solid var(--rc); box-shadow: 0 6px 16px rgba(0, 0, 0, .5); cursor: pointer; transition: transform .15s, box-shadow .15s, margin .15s; text-align: center; }
.hs-card:first-child { margin-left: 0; }
.hs-card .hs-cost { position: absolute; top: -9px; left: -9px; }
.hs-card:hover { transform: translateY(-34px) scale(1.35); z-index: 10; }
.hs-card.playable { box-shadow: 0 0 0 3px var(--win), 0 0 18px rgba(61, 220, 132, .55); }
.hs-card:not(.playable) { filter: brightness(.75); }
.hs-card.holo { background: linear-gradient(135deg, #3a2a1d, #4a2f4f 50%, #20160e); }
.hs-c-art { font-size: 34px; line-height: 1.1; }
.hs-c-name { font-size: 11px; font-weight: 800; line-height: 1.1; }
.hs-c-text { font-size: 9px; line-height: 1.2; color: var(--muted); }
.hs-card .gem { width: 22px; height: 22px; font-size: 12px; }

.hs-banner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 20; padding: 14px 28px; border-radius: 14px; background: rgba(20, 12, 6, .88); border: 2px solid var(--accent); font-size: 26px; font-weight: 800; pointer-events: none; animation: banner 1.3s ease-out forwards; white-space: nowrap; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.hs-log { max-height: 640px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.hs-log div { color: var(--muted); }
.hs-log div.latest { color: var(--text); }
.hs-hero .dmg-float, .minion .dmg-float { font-size: 26px; }

/* ============ Blackjack ============ */
.bj-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bj-actions kbd { font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.bj-rules { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.bj-table { justify-content: space-between; gap: 20px; padding: 28px 16px; min-height: 520px; background: radial-gradient(ellipse at 50% 0%, #22603d, #0f2d1e 75%); border-color: #2d6a45; box-shadow: inset 0 0 0 6px rgba(0, 0, 0, .2), inset 0 0 60px rgba(0, 0, 0, .4); }
.bj-table .result { text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.bj-seat { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bj-label { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-weight: 700; color: rgba(255, 255, 255, .85); }
.bj-total { font-family: var(--mono); font-size: 14px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .35); }
.bj-total:empty { display: none; }
.bj-hand { display: flex; justify-content: center; min-height: 118px; perspective: 800px; }
.bj-hand .pcard + .pcard { margin-left: -38px; }
.bj-hands { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.bj-hand-wrap { padding: 12px; border-radius: 16px; border: 2px solid transparent; transition: border-color .2s, background .2s; }
.bj-hand-wrap.active { border-color: var(--accent); background: rgba(255, 182, 39, .08); }
.pcard { width: 84px; height: 118px; border-radius: 9px; background: linear-gradient(160deg, #fffdf8, #f3eadc); color: #1d1612; position: relative; flex-shrink: 0; box-shadow: -3px 4px 14px rgba(0, 0, 0, .35); font-weight: 800; }
.pcard.red { color: #d02a1c; }
.pc-tl, .pc-br { position: absolute; font-size: 15px; line-height: 1.05; text-align: center; }
.pc-tl { top: 6px; left: 7px; }
.pc-br { bottom: 6px; right: 7px; transform: rotate(180deg); }
.pc-mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; }
.pcard.back { background: radial-gradient(circle, #ff8a1f, #7a2b06 75%); border: 4px solid #fffaf2; display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.pcard.back::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 6px, transparent 6px 12px); }
.pcard.new { animation: deal-card .38s cubic-bezier(.2, .8, .3, 1.1) backwards; }
@keyframes deal-card { from { opacity: 0; transform: translate(220px, -160px) rotate(25deg); } }
.pcard.reveal { animation: reveal-card .45s ease-out; }
@keyframes reveal-card { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.bj-res { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 800; }
.bj-res.win { background: rgba(61, 220, 132, .25); color: #9cf5c2; }
.bj-res.lose { background: rgba(255, 77, 94, .25); color: #ffb0b8; }
.bj-res.push { background: rgba(255, 255, 255, .15); }

/* ============ Markets ============ */
.btn.red { background: linear-gradient(180deg, #ff7a86, #e23b4c); color: #3a0509; box-shadow: 0 6px 20px -8px rgba(255, 77, 94, .7); }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.mk-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.mk-metrics .stat b { font-size: 18px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mk-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; animation: fadein .25s; }
.mk-card:hover { border-color: var(--line-2); background: var(--panel-2); }
.mk-card.resolved { opacity: .75; }
.mk-top { display: flex; align-items: center; gap: 8px; }
.mk-ico { font-size: 22px; }
.mk-left { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mk-q { font-weight: 700; font-size: 15px; line-height: 1.3; min-height: 2.6em; }
.mk-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.mk-prob b { font-size: 28px; display: block; line-height: 1; }
.mk-prob small { color: var(--muted); font-size: 12px; }
.spark { width: 120px; height: 36px; flex-shrink: 0; }
.mk-outcome { font-weight: 800; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.mk-outcome.yes { background: rgba(61, 220, 132, .15); color: var(--win); }
.mk-outcome.no { background: rgba(255, 77, 94, .15); color: var(--lose); }
.mk-outcome.big { font-size: 22px; padding: 8px 14px; }
.mk-btns, .mk-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mk-yes, .mk-no { padding: 10px; border-radius: 10px; font-weight: 800; font-size: 14px; border: 2px solid transparent; transition: background .15s, border-color .15s; }
.mk-yes { background: rgba(61, 220, 132, .12); color: var(--win); }
.mk-no { background: rgba(255, 77, 94, .12); color: var(--lose); }
.mk-yes:hover, .mk-yes.active { background: rgba(61, 220, 132, .22); border-color: var(--win); }
.mk-no:hover, .mk-no.active { background: rgba(255, 77, 94, .22); border-color: var(--lose); }
.mk-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.mk-mine { color: var(--accent); font-weight: 700; }

.mk-back { margin-bottom: 14px; display: inline-block; }
.mk-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.mk-main, .mk-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mk-side { position: sticky; top: 76px; }
.mk-title { font-size: clamp(22px, 3vw, 30px); font-weight: 800; margin: 12px 0; line-height: 1.15; }
.mk-headline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mk-big { font-size: 40px; color: var(--accent); }
.mk-vol { margin-left: auto; font-size: 13px; }
.mk-chart-panel { padding: 14px 10px 8px 14px; }
.mk-chart-wrap { position: relative; height: 280px; }
.mk-chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.mk-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.mk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mk-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mk-table td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mk-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.mk-table tbody tr:hover { background: var(--panel-2); }
.mk-table tr.me td { background: rgba(255, 182, 39, .07); }
.side-pill { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.side-pill.yes { background: rgba(61, 220, 132, .14); color: var(--win); }
.side-pill.no { background: rgba(255, 77, 94, .14); color: var(--lose); }
#mk-trade { display: flex; flex-direction: column; gap: 14px; }
.mk-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.mk-quote { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.mk-towin { padding-top: 8px; border-top: 1px solid var(--line); }
.mk-towin small { font-size: 11px; }
.mk-posrow { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mk-posrow:last-child { border-bottom: 0; }
.mk-posrow .side-pill { align-self: flex-start; }
.mk-rules { font-size: 13px; line-height: 1.5; }

/* ============ Card Market ============ */
.cm-tabs { max-width: 520px; margin-bottom: 18px; }
.cm-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cm-search { flex: 1; min-width: 200px; gap: 8px; }
.cm-sort { min-width: 190px; }
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.cm-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); text-align: center; transition: border-color .15s, background .15s, transform .15s; }
.cm-item:hover { border-color: var(--accent); background: var(--panel-2); transform: translateY(-3px); }
.cm-item .card.sm { width: 130px; margin-bottom: 8px; }
.cm-name { font-weight: 700; font-size: 14px; line-height: 1.15; }
.cm-price { font-size: 17px; font-weight: 700; color: var(--accent); }
.cm-sub { display: flex; gap: 8px; justify-content: center; font-size: 12px; color: var(--muted); }
.cm-own { position: absolute; top: 8px; right: 8px; z-index: 4; font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.cm-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.cm-left { position: sticky; top: 76px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cm-left-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; text-align: center; }
.cm-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cm-stats .stat b { font-size: 17px; }
.cm-sellrow { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.cm-quote { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.cm-link { font-weight: 700; text-align: left; display: inline-flex; align-items: center; gap: 8px; }
.cm-link:hover { color: var(--accent); }
.cm-link .thumb { width: 28px; height: 28px; }
.cm-table td { vertical-align: middle; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .balance { margin-left: auto; }
  main { padding: 20px 16px 80px; }
  .game-layout, .hero { grid-template-columns: minmax(0, 1fr); }
  .stage { min-height: 340px; }
  .card-detail { grid-template-columns: 1fr; justify-items: center; }
  .mk-detail { grid-template-columns: minmax(0, 1fr); }
  .hs-wrap, .hs-setup { grid-template-columns: minmax(0, 1fr); }
  .cm-detail { grid-template-columns: minmax(0, 1fr); }
  .lb-podium { gap: 8px; }
  .loan-cols { grid-template-columns: minmax(0, 1fr); }
  .loan-reqs li { flex-wrap: wrap; }
  .lb-step { padding: 16px 6px; }
  .lb-av.big { width: 48px; height: 48px; }
  .lb-bal { font-size: 16px; }
  .cm-left { position: static; }
  .cm-stats { grid-template-columns: 1fr 1fr; }
  .cm-sellrow { grid-template-columns: minmax(0, 1fr); }
  .hs-log { max-height: 220px; }
  .mk-side { position: static; }
  .mk-metrics { grid-template-columns: 1fr 1fr; }
  .mk-chart-wrap { height: 220px; }
  #mk-feed { overflow-x: auto; }
}
@media (max-width: 560px) {
  .coin { width: 150px; height: 150px; }
  .coin .face { font-size: 70px; }
  .flip { width: 150px; }
  .flip .card .card-art span { font-size: 54px; }
  .flip .card .card-flavor { display: none; }
  .binder { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .binder .card.sm, .missing-card { width: 100%; }
  .pcard { width: 62px; height: 88px; }
  .pc-mid { font-size: 28px; }
  .pc-tl, .pc-br { font-size: 12px; }
  .bj-hand { min-height: 88px; }
  .bj-hand .pcard + .pcard { margin-left: -28px; }
  .bj-table { min-height: 420px; }
  .dmg-float { font-size: 28px; }
  .hs-table { padding: 10px 6px 14px; border-width: 4px; gap: 8px; }
  .minion { width: 46px; height: 60px; border-width: 2px; }
  .minion .m-art { font-size: 24px; }
  .minion .m-art .thumb { width: 38px; height: 38px; }
  .hs-c-art .thumb { width: 38px; height: 38px; }
  .minion .gem { width: 20px; height: 20px; font-size: 11px; }
  .hs-board { gap: 4px; min-height: 76px; padding: 6px 2px; }
  .hs-hero { width: 60px; height: 60px; }
  .hs-hero-face { font-size: 30px; }
  .hs-power { width: 44px; height: 44px; font-size: 18px; }
  .crystal { width: 9px; height: 12px; }
  .hs-card { width: 70px; height: 100px; margin-left: -8px; padding: 14px 3px 6px; }
  .hs-c-art { font-size: 22px; }
  .hs-c-name { font-size: 9px; }
  .hs-c-text { display: none; }
  .cm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cm-item .card.sm { width: 100%; }
  .cm-sort { min-width: 0; flex: 1; }
  .hs-card:hover { transform: translateY(-20px) scale(1.2); }
  .hs-end { padding: 7px 10px; font-size: 12px; }
  .hs-hand { min-height: 100px; }
  .hs-deckrow { grid-template-columns: 26px 24px minmax(0, 1fr) 40px 26px; }
  .hs-dl-kw { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ============ Leaderboard ============ */
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
.lb-step { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 22px 12px; }
.lb-step.lb-1 { order: 2; padding-top: 34px; border-color: var(--c-legendary); background: linear-gradient(180deg, rgba(251, 191, 36, .14), var(--panel)); }
.lb-step.lb-2 { order: 1; }
.lb-step.lb-3 { order: 3; }
.lb-step.me { box-shadow: 0 0 0 2px var(--accent); }
.lb-medal { font-size: 34px; line-height: 1; }
.lb-name { font-size: 16px; overflow-wrap: anywhere; }
.lb-bal { color: var(--accent); font-size: 20px; font-weight: 700; }
.lb-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: var(--panel-3) center / cover no-repeat; font-weight: 800; font-size: 13px; color: var(--text); }
.lb-av.big { width: 64px; height: 64px; font-size: 26px; border: 2px solid var(--line-2); }
.lb-player { display: inline-flex; align-items: center; gap: 10px; }
.lb-table td { vertical-align: middle; }

.lb-owes { font-size: 12px; color: var(--lose); }

/* ============ Loans ============ */
.loan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.loan-card { display: flex; flex-direction: column; gap: 10px; }
.loan-card.late { border-color: var(--lose); }
.loan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loan-owed { font-size: 30px; font-weight: 700; color: var(--accent); }
.loan-sub { margin: 0; font-size: 13px; }
.loan-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.loan-reqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.loan-reqs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.loan-reqs li:last-child { border-bottom: 0; padding-bottom: 0; }
.loan-note { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; text-decoration: none; color: var(--text); border-color: var(--accent); }
.loan-note > span:first-child { font-size: 24px; }
.loan-note b { margin-left: auto; color: var(--accent); white-space: nowrap; }
.tag.lose { color: var(--lose); }

/* ============ Sign-in ============ */
.avatar-btn { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2) center / cover no-repeat; color: var(--text); font-weight: 800; cursor: pointer; }
.avatar-btn:hover { border-color: var(--accent); }
.gate { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 24px 16px; }
.gate-box { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 28px; }
.gate-logo { font-size: 52px; margin: 0 0 6px; }
.gate-box p { color: var(--muted); margin: 0 0 6px; }
.gate-dev { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); text-align: left; }
.gate-dev input { flex: 1; min-width: 0; }
.signed-out .topbar .nav, .signed-out .topbar .balance, .signed-out main { display: none; }
.tile.soon { opacity: .45; cursor: default; }
.tile.soon:hover { transform: none; border-color: var(--line); background: var(--panel); }
