/* Layout and effects. Colors, fonts and sizes come from theme.css variables. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none; overflow: hidden; font-weight: 700;
  -webkit-font-smoothing: antialiased;
}
/* Pixel display font for big, short text. Its pixels line up with screen pixels only at
   multiples of 8px (16, 24, 32, 48...), so keep its sizes on that grid or it gets blurry.
   Small labels use the body font instead. */
.logo, .btn, .code, .panel h2, .topbar-title, .seg button, .rank-btn, .code-input, .bomb-stamp {
  font-family: var(--font-display); letter-spacing: 0;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden, [hidden] { display: none !important; }

/* ---------- Background + CRT overlay ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 0; }
#crt {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; /* behind the UI so scanlines never cut through text */
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.12) 2px 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
}

#app {
  max-width: 520px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; position: relative; overflow: hidden; z-index: 1;
}
#app.shake { animation: shake 0.45s; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Pixel panels & buttons ---------- */
.panel-box {
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.btn {
  border: var(--border) solid var(--ink); border-radius: var(--radius); padding: 12px 18px;
  font-weight: 700; font-size: 16px; text-transform: uppercase;
  background: var(--btn-neutral); color: var(--text); box-shadow: var(--shadow);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s; position: relative; top: 0;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--btn-primary); }
.btn.secondary { background: var(--btn-secondary); }
.btn:disabled { filter: grayscale(0.85) brightness(0.65); cursor: default; }
.btn.wide { min-width: 220px; }
.icon-btn {
  border: var(--border) solid var(--ink); background: var(--btn-neutral); border-radius: var(--radius);
  width: 40px; height: 40px; font-size: 18px; box-shadow: 0 3px 0 var(--ink);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn.small { width: 30px; height: 30px; font-size: 13px; }

/* ---------- Start screen ---------- */
#screen-start { justify-content: flex-start; align-items: center; gap: 12px; padding: 22px 18px 120px; text-align: center; overflow-y: auto; }
.logo {
  font-size: 40px; font-weight: 700; color: var(--gold); line-height: 1.2; margin-top: 4px; white-space: nowrap;
  text-shadow: 3px 3px 0 var(--coral), 6px 6px 0 var(--ink);
  animation: wobble 3s ease-in-out infinite;
}
.subtitle { color: var(--muted); margin-top: -6px; font-size: 14px; text-transform: uppercase; letter-spacing: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.field label, .box-title, .code-label, .swap-title {
  font-size: 13px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px;
}
.seg { display: flex; background: var(--ink); border-radius: var(--radius); padding: 3px; gap: 3px; }
.seg button { border: 0; background: var(--violet); padding: 8px 18px; border-radius: 4px; font-weight: 700; font-size: 16px; }
.seg button.active { background: var(--sky); color: var(--ink); }
.input {
  border: var(--border) solid var(--ink); background: var(--cream); color: var(--ink); font-size: 18px;
  border-radius: var(--radius); padding: 9px 12px; text-align: center; width: 220px; outline: none; box-shadow: inset 0 3px 0 rgba(0,0,0,0.15);
}
.input:focus { border-color: var(--sky); }
.input::placeholder { color: rgba(18,14,34,0.4); }
.card-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 330px; padding: 12px 14px;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.join-row { display: flex; gap: 8px; align-items: stretch; }
.code-input { width: 130px; font-size: 16px; letter-spacing: 4px; font-weight: 700; text-transform: uppercase; }
.error-msg { color: var(--coral); font-size: 15px; min-height: 18px; max-width: 330px; text-shadow: 1px 1px 0 var(--ink); }
.muted { color: var(--muted); font-size: 15px; }
.center { text-align: center; }
.conn-status { font-size: 12px; color: var(--coral); }
.rules-list { padding-left: 18px; display: grid; gap: 7px; font-size: 15px; line-height: 1.4; font-weight: 600; max-height: 60vh; overflow-y: auto; }
.rules-list li::marker { color: var(--gold); }

/* Main menu top row: profile chip (opens the wardrobe) + rules */
.menu-top { display: flex; width: 100%; max-width: 330px; justify-content: space-between; align-items: center; }
.profile-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; min-height: 52px;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink);
}
.profile-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.profile-name { font-size: 17px; font-weight: 800; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wardrobe-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 4px;
  background: var(--gold); border: 2px solid var(--ink);
}
.wardrobe-icon svg { image-rendering: pixelated; }

/* Shard wheel button, bottom right of the main menu */
.wheel-fab {
  position: absolute; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 2;
  width: 92px; height: 92px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: var(--panel); border: var(--border) solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  animation: fab-bob 2.4s ease-in-out infinite;
}
.wheel-fab:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.wheel-fab canvas { width: 80px; height: 80px; image-rendering: pixelated; animation: wheel-idle 12s linear infinite; }
.wheel-fab-label {
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%) rotate(-4deg);
  font-size: 13px; font-weight: 900; letter-spacing: 1px; padding: 0 8px; line-height: 20px; text-transform: uppercase;
  background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; box-shadow: 0 2px 0 var(--ink);
}
.wheel-fab.ready .wheel-fab-label { animation: pulse-badge 1s steps(2) infinite; background: var(--coral); color: #fff; }
.wheel-fab:not(.ready) canvas { animation-duration: 30s; filter: saturate(0.6) brightness(0.8); }
@keyframes pulse-badge { 50% { transform: translateX(-50%) rotate(-4deg) scale(1.15); } }

/* Spin counter (top right of the menu and the wheel screen) */
.menu-top-right { display: flex; gap: 8px; align-items: center; }
.spin-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px 0 6px;
  font-family: var(--font-display); font-size: 16px; font-weight: 700; line-height: 1; color: var(--ink); text-shadow: none;
  background: var(--gold); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 3px 0 var(--ink);
}
button.spin-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.spin-chip.zero { background: var(--violet-hi); color: var(--muted); }
.spin-chip.bump { animation: pop-in 0.4s cubic-bezier(.2,1.6,.4,1) both; }
.spin-icon {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); flex: 0 0 auto;
  background: conic-gradient(var(--r-common) 0 25%, var(--r-rare) 0 45%, var(--r-uncommon) 0 70%, var(--r-epic) 0 90%, var(--r-legendary) 0 100%);
}
.wheel-progress { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--muted); }
.win-note { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--muted); text-align: center; }
.win-note.earned { color: var(--gold); font-size: 16px; }
.win-note.earned b { font-family: var(--font-display); font-size: 24px; text-shadow: 2px 2px 0 var(--coral), 4px 4px 0 var(--ink); animation: pop-in 0.5s cubic-bezier(.2,1.6,.4,1) both; }
.win-pips { display: flex; gap: 6px; }
.win-pips span { width: 18px; height: 18px; border: 3px solid var(--ink); border-radius: 4px; background: var(--violet); }
.win-pips span.on { background: var(--gold); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25); }
@keyframes wheel-idle { to { transform: rotate(360deg); } }
@keyframes fab-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }

/* Shard wheel screen */
.wheel-page { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 18px 24px; overflow-y: auto; }
.wheel-wrap { position: relative; width: 300px; height: 300px; margin-top: 14px; flex: 0 0 auto; }
#wheel-big { width: 300px; height: 300px; image-rendering: pixelated; display: block; will-change: transform; }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--ink);
  background: var(--gold); border: var(--border) solid var(--ink); box-shadow: inset 0 -5px 0 rgba(0,0,0,0.2);
}
.wheel-pointer {
  position: absolute; left: 50%; top: -16px; z-index: 2; width: 34px; height: 40px; margin-left: -17px;
  background: var(--ink); clip-path: polygon(0 0, 100% 0, 100% 40%, 50% 100%, 0 40%);
  transform-origin: 50% 20%; transition: transform 0.08s;
}
.wheel-pointer::after {
  content: ""; position: absolute; inset: 4px 5px 7px; background: var(--coral);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 50% 100%, 0 40%);
}
.wheel-pointer.tick { transform: rotate(-22deg); transition: none; }
.wheel-wrap.landed #wheel-big { animation: wheel-land 0.5s steps(2) 3; }
@keyframes wheel-land { 50% { filter: brightness(1.5); } }
.wheel-result { min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 12px; text-align: left; }
.wheel-result .shard { width: 42px; height: 54px; }
.wheel-result .what { font-size: 20px; font-weight: 900; text-shadow: 2px 2px 0 var(--ink); }
.wheel-result .what small { display: block; font-size: 14px; color: var(--muted); font-weight: 800; }
.wheel-result.pop { animation: pop-in 0.4s cubic-bezier(.2,1.6,.4,1) both; }
.shard-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; width: 100%; max-width: 360px; }
.shard.mythic { animation: holo-hue 3s linear infinite; }
.shard-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius);
}
.shard-cell .shard { width: 21px; height: 27px; }
.shard-cell .n { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.shard-cell .r { font-size: 10px; font-weight: 900; text-transform: uppercase; color: var(--muted); }
.shard-cell.bump { animation: pop-in 0.4s cubic-bezier(.2,1.6,.4,1) both; outline: 3px solid var(--gold); outline-offset: -6px; }
.shard { image-rendering: pixelated; display: block; }

/* ---------- Settings ---------- */
.icon-btn svg { display: block; margin: auto; }
.set-group { display: grid; gap: 8px; padding: 10px 12px; background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 16px; }
.set-hint { font-size: 13px; color: var(--muted); }
/* Settings tabs + Statistics */
.set-tabs button { flex: 1; padding: 8px 6px; }
#set-main, #set-stats { display: grid; gap: 12px; }
#set-main[hidden], #set-stats[hidden] { display: none; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-tile {
  display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; text-align: center;
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius);
}
.stat-label { font-weight: 800; font-size: 14px; min-height: 22px; display: flex; align-items: center; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-tile.arschloch .stat-value { color: #c08a5e; }
.stat-tile.bombs .stat-value { color: #ff7a4a; }
/* Wardrobe: set colors (from a complete card set) get a gold star and a gold rim when locked */
.picker-row.set-color.locked { box-shadow: inset 0 0 0 2px var(--gold); border-radius: var(--radius); }
.set-done { color: var(--gold); font-weight: 800; }
.slider {
  --p: 80%; width: 100%; height: 26px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 12px; border: 3px solid var(--ink); border-radius: 4px;
  background: linear-gradient(to right, var(--sky) 0 var(--p), var(--violet) var(--p) 100%);
}
.slider::-moz-range-track { height: 6px; border: 3px solid var(--ink); border-radius: 4px; background: var(--violet); }
.slider::-moz-range-progress { height: 6px; background: var(--sky); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border: 3px solid var(--ink); border-radius: 4px; background: var(--gold);
}
.slider::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--ink); border-radius: 4px; background: var(--gold); }

/* ---------- Daily shop (main menu) ---------- */
.shop-head { display: flex; align-items: baseline; justify-content: space-between; width: 100%; }
.shop-timer { font-size: 13px; font-weight: 800; color: var(--muted); }
.shop-box { max-width: 370px; padding: 12px 10px; }
.shop-slots { display: flex; gap: 5px; justify-content: center; width: 100%; }
.shop-slots.rerolled .shop-slot { animation: pop-in 0.45s cubic-bezier(.2,1.6,.4,1) both; }
.shop-slots.rerolled .shop-slot:nth-child(2) { animation-delay: 0.06s; }
.shop-slots.rerolled .shop-slot:nth-child(3) { animation-delay: 0.12s; }
.shop-slots.rerolled .shop-slot:nth-child(4) { animation-delay: 0.18s; }
.shop-slot {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1 1 0; min-width: 0; max-width: 88px; padding: 7px 0 6px;
  background: var(--violet); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink);
}
.shop-slot.look { background: #3a2f63; } /* the outfit slot (common shards) */
.shop-slot:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.slot-art { height: 95px; display: grid; place-items: end center; }
.shop-slot .card { box-shadow: 0 3px 0 var(--ink); }
.shop-slot.owned .slot-art > * { filter: saturate(0.6) brightness(0.8); }
.slot-pack { font-size: 12px; font-weight: 900; line-height: 1.1; min-height: 2.2em; display: grid; place-items: center; }
.reroll-btn { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; margin-top: 4px; }
.reroll-btn .price { font-size: 14px; }
.reroll-btn.short .price { color: var(--coral); }
.look-preview { display: grid; place-items: end center; height: 110px; padding-bottom: 6px;
  background: radial-gradient(ellipse at 50% 92%, rgba(0,0,0,0.4) 0 24%, transparent 26%); }
.look-preview.unlocked .look-art > * { animation: pop-in 0.5s cubic-bezier(.2,1.6,.4,1) both; }
.look-art { display: flex; align-items: flex-end; justify-content: center; gap: 18px; }
.look-art .bucket { display: block; filter: drop-shadow(0 3px 0 var(--ink)); }
.slot-pack small { display: block; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.look-kind { margin: -6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.price { display: flex; align-items: center; gap: 4px; font-weight: 900; font-size: 15px; }
.price .shard { width: 14px; height: 18px; }
.price.short { color: var(--coral); }
.price.owned { font-size: 12px; text-transform: uppercase; color: var(--mint); min-height: 18px; }
.price-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; text-align: left; }
.price-line .shard { width: 21px; height: 27px; flex: 0 0 auto; }
.skin-preview { display: grid; place-items: center; padding: 6px 0 10px; }
.skin-preview .card { box-shadow: 0 6px 0 var(--ink); }
.skin-preview.unlocked .card { animation: pop-in 0.5s cubic-bezier(.2,1.6,.4,1) both; }
#btn-buy:disabled { opacity: 0.45; cursor: default; }

/* ---------- Wardrobe tabs + Cards tab ---------- */
.tabs { display: flex; gap: 3px; margin: 0 auto 4px; background: var(--ink); border-radius: var(--radius); padding: 3px; }
.tabs button { border: 0; background: var(--violet); padding: 7px 16px; border-radius: 4px; font-weight: 900; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.tabs button.active { background: var(--sky); color: var(--ink); }
.deck-view { flex: 1; overflow-y: auto; padding: 6px 10px 24px; display: flex; flex-direction: column; gap: 6px; }
.deck-suit { font-weight: 900; font-size: 15px; margin: 8px 0 0 4px; text-shadow: 1px 1px 0 var(--ink); }
.deck-suit.red { color: #ff8a99; }
.deck-row { display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: 10px 6px; justify-content: center; }
.deck-card { position: relative; padding: 0; border: 0; background: none; }
.deck-card .card { box-shadow: 0 3px 0 var(--ink); }
.deck-card:active .card { transform: translateY(2px); }
.deck-card.unused .card { filter: brightness(0.75) saturate(0.7); }
.skin-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 4px; display: grid; place-items: center;
  font-size: 12px; font-weight: 900; color: var(--ink); background: var(--gold); border: 2px solid var(--ink); border-radius: 10px;
}
.small { font-size: 13px; }
.skin-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.skin-opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px; font-size: 12px; font-weight: 900;
  background: var(--violet); border: var(--border) solid var(--ink); border-radius: var(--radius);
}
.skin-opt.on { background: var(--sky); color: var(--ink); }
.skin-opt.locked .card { filter: brightness(0.8) saturate(0.75); }
.skin-opt.locked { color: var(--muted); }
/* Epic / legendary sets get a rarity-colored inner rim */
.shop-slot.set-epic { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px var(--r-epic); }
.shop-slot.set-legendary { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px var(--r-legendary); animation: legend-glow 1.6s steps(4) infinite alternate; }
.skin-opt.set-epic { box-shadow: inset 0 0 0 2px var(--r-epic); }
.skin-opt.set-legendary { box-shadow: inset 0 0 0 2px var(--r-legendary); }
@keyframes legend-glow { to { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px var(--r-legendary), 0 0 10px 1px rgba(245, 197, 66, 0.55); } }
.skin-opt.peeking {background: var(--violet-hi); color: var(--gold); outline: 3px dashed var(--gold); outline-offset: 2px; }
.skin-opt.peeking .card { filter: none; }
.skin-preview.peek .card { filter: saturate(0.85); }
.skin-info { margin: -4px 0 2px; font-size: 14px; line-height: 1.5; }
.price.inline { display: inline-flex; vertical-align: middle; }
/* Rarity names in text */
.r-text { font-weight: 900; text-shadow: 1px 1px 0 var(--ink); }
.r-common { color: var(--r-common); }
.r-uncommon { color: var(--r-uncommon); }
.r-rare { color: #5aa2ff; } /* a touch lighter than --r-rare so it reads on dark panels */
.r-epic { color: #b88cff; }
.r-legendary { color: var(--r-legendary); }
.r-mythic {
  background: linear-gradient(90deg, #ff5d6c, #ffb347, #fff15a, #6dff9a, #5ad2ff, #b98cff, #ff5d6c) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none !important; filter: drop-shadow(1px 1px 0 var(--ink)); /* a text-shadow would paint over the rainbow */
  animation: rainbow-slide 1.8s linear infinite;
}
@keyframes rainbow-slide { to { background-position: -200% 0; } }

/* ---------- Mythic sets ---------- */
/* Rainbow rim in the shop and the skin picker: the hue turns all the time */
@property --mh { syntax: '<number>'; inherits: true; initial-value: 0; }
@keyframes mythic-hue { to { --mh: 360; } }
.shop-slot.set-mythic, .skin-opt.set-mythic { animation: mythic-hue 3s linear infinite; }
.shop-slot.set-mythic { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px hsl(var(--mh) 95% 65%), 0 0 12px 1px hsl(var(--mh) 95% 62% / 0.55); }
.skin-opt.set-mythic { box-shadow: inset 0 0 0 2px hsl(var(--mh) 95% 65%); }
/* Mythic cards change color: the border and the numbers/symbols show a rainbow that flows across the card.
   Each layer is masked by the pack's -rim / -ink image (vars set in js/skins.js). The ink rainbow is darker
   so the numbers stay readable on the light card. */
.card.holo .holo-rim, .card.holo .holo-ink {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(135deg, #ff5d6c, #ffa94d, #ffe45c, #6ee68f, #5ac8ff, #a98cff, #ff5d6c) 0 0 / 200% 200%;
  animation: rainbow-flow 2.6s linear infinite;
}
.card.holo .holo-rim {
  -webkit-mask: var(--skin-rim) var(--skin-pos) / 1300% 400% no-repeat;
  mask: var(--skin-rim) var(--skin-pos) / 1300% 400% no-repeat;
}
.card.holo .holo-ink {
  background-image: linear-gradient(135deg, #e0263f, #ee6a10, #c99500, #179c4c, #1a7fd6, #7443d8, #e0263f);
  animation-duration: 3.4s; animation-direction: reverse;
  -webkit-mask: var(--skin-ink) var(--skin-pos) / 1300% 400% no-repeat;
  mask: var(--skin-ink) var(--skin-pos) / 1300% 400% no-repeat;
}
@keyframes rainbow-flow { to { background-position: 200% 200%; } }
/* Holographic sheen over mythic cards: rainbow bands + a white glint sweep across, colors turning.
   Masked by the card art itself so the rounded corners stay clean (vars set in js/skins.js). */
.card.holo .holo-sheen {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.85) 47%, transparent 56%) 0 0 / 250% 250%,
    linear-gradient(115deg, rgba(255,90,120,0.42), rgba(255,215,90,0.42), rgba(110,255,170,0.42),
      rgba(90,200,255,0.42), rgba(185,130,255,0.42), rgba(255,90,120,0.42)) 0 0 / 300% 300%;
  -webkit-mask: var(--skin-img) var(--skin-pos) / 1300% 400% no-repeat;
  mask: var(--skin-img) var(--skin-pos) / 1300% 400% no-repeat;
  animation: holo-sweep 3.2s ease-in-out infinite, holo-hue 5s linear infinite;
}
@keyframes holo-sweep {
  0% { background-position: 120% 120%, 0% 0%; }
  60%, 100% { background-position: -40% -40%, 100% 100%; }
}
@keyframes holo-hue { to { filter: hue-rotate(360deg); } }
/* Halo: only on mythic cards in your hand */
.card .halo { display: none; }
#hand .card.holo .halo {
  display: block; position: absolute; z-index: 2; pointer-events: none;
  left: 19%; width: 62%; height: calc(var(--w) * 0.62 * 4 / 14); top: calc(var(--w) * -0.24);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 4' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffd84a' d='M4 0h6v1H4zM1 1h3v1H1zM10 1h3v1h-3zM0 2h3v1H0zM11 2h3v1h-3zM3 3h8v1H3z'/%3E%3Cpath fill='%23fff6c8' d='M5 0h3v1H5zM1 1h1v1H1z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 3px rgba(255, 226, 120, 0.95)) drop-shadow(0 0 6px rgba(255, 240, 180, 0.6));
  animation: halo-bob 2.4s ease-in-out infinite;
}
@keyframes halo-bob { 50% { transform: translateY(-3px); } }
/* Lucifer: the same layers, but only black, white and red (no hue turning), and devil horns instead of a halo */
.card.holo[data-holo="lucifer"] .holo-rim {
  background-image: linear-gradient(135deg, #0a0a0a, #e0102a, #ffffff, #e0102a, #0a0a0a, #e0102a, #ffffff, #e0102a, #0a0a0a);
}
.card.holo[data-holo="lucifer"] .holo-ink {
  background-image: linear-gradient(135deg, #ffffff, #ff2a3c, #ffffff, #ff2a3c, #ffffff); /* stays bright on the dark card */
}
.card.holo[data-holo="lucifer"] .holo-sheen {
  background:
    linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.32) 47%, transparent 54%) 0 0 / 250% 250%,
    linear-gradient(115deg, rgba(225,16,42,0.4), rgba(0,0,0,0.45), rgba(225,16,42,0.4), rgba(0,0,0,0.45),
      rgba(225,16,42,0.4)) 0 0 / 300% 300%;
  animation: holo-sweep 3.2s ease-in-out infinite;
}
#hand .card.holo[data-holo="lucifer"] .halo {
  /* goat horns: the bases sit close together in the middle, rise, then sweep outward with the tips hooking down */
  left: 18%; width: 64%; height: calc(var(--w) * 0.64 * 9 / 22); top: calc(var(--w) * -0.22);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 9' shape-rendering='crispEdges'%3E%3Cpath fill='%23e0102a' d='M2 1h3v1H2zM1 2h5v1H1zM0 3h2v1H0zM3 3h4v1H3zM0 4h1v1H0zM5 4h3v1H5zM6 5h3v2H6zM7 7h3v2H7zM17 1h3v1h-3zM16 2h5v1h-5zM20 3h2v1h-2zM15 3h4v1h-4zM21 4h1v1h-1zM14 4h3v1h-3zM13 5h3v2h-3zM12 7h3v2h-3z'/%3E%3Cpath fill='%238f0a1a' d='M4 3h1v1H4zM6 5h1v1H6zM8 7h1v1H8zM17 3h1v1h-1zM15 5h1v1h-1zM13 7h1v1h-1z'/%3E%3Cpath fill='%23ff9a8a' d='M2 1h2v1H2zM18 1h2v1h-2z'/%3E%3C/svg%3E");
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 5px rgba(255, 30, 40, 0.8));
  animation: horns-flicker 1.8s steps(2) infinite;
}
@keyframes horns-flicker { 50% { filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 8px rgba(255, 60, 30, 1)); } }

/* Win animations (wins.js): a pixel canvas over the finish effect, the wardrobe/shop preview stage, the picker */
.win-canvas { position: absolute; left: 0; top: 0; z-index: 1; image-rendering: pixelated; pointer-events: none; }
.win-preview {
  position: relative; width: 100%; max-width: 340px; height: 210px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, rgba(0,0,0,0.35) 0 22%, transparent 24%), rgba(18,14,34,0.55);
  border: var(--border) solid var(--ink); border-radius: var(--radius);
}
.win-preview > .character { margin-top: 30px; }
#win-stage { width: 100%; max-width: 340px; }
.win-preview .fx-finish { pointer-events: none; }
.win-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 340px; }
.win-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; font-size: 12px; font-weight: 900; line-height: 1.15;
  background: var(--violet); border: var(--border) solid var(--ink); border-radius: var(--radius);
}
.win-opt small { font-size: 10px; color: var(--muted); font-weight: 800; }
.win-opt .win-icon { filter: drop-shadow(0 2px 0 var(--ink)); }
.win-opt.on { background: var(--sky); color: var(--ink); }
.win-opt.on small { color: var(--ink); opacity: 0.7; }
.win-opt.locked { color: var(--muted); }
.win-opt.locked .win-icon { filter: brightness(0.75) saturate(0.6) drop-shadow(0 2px 0 var(--ink)); }
.win-opt.peeking { background: var(--violet-hi); color: var(--gold); outline: 3px dashed var(--gold); outline-offset: 2px; }
.win-opt.peeking .win-icon { filter: drop-shadow(0 2px 0 var(--ink)); }
/* impact frames + shakes of big win animations stay inside the preview stage */
.win-preview.impact { animation: impact 0.36s forwards; }
.win-preview.shake-big { animation: shake-big 0.7s; }
.win-preview.shake-mid { animation: shake-mid 0.4s; }
.win-preview.shake-small { animation: shake-small 0.16s; }
/* SSR Ultra Mythic tier: dark violet, pulsing glow and a glitchy shimmer on the label */
.tier-ultra {
  font-weight: 900; letter-spacing: 0.5px; color: #e6d0ff;
  background: linear-gradient(90deg, #b16cff, #ff4df0, #6ef0ff, #b16cff); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: ultra-text 2.4s linear infinite; filter: drop-shadow(1px 1px 0 #05020a);
}
@keyframes ultra-text { to { background-position: 300% 0; } }
.win-opt.tier-ultra-opt, .shop-slot.tier-ultra-opt {
  background: linear-gradient(160deg, #1d0b33, #0d0617); color: #efe0ff;
  box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px #8a3cff, 0 0 14px 2px rgba(177,108,255,0.55);
  animation: ultra-glow 1.6s ease-in-out infinite alternate;
}
.win-opt.tier-ultra-opt.on { background: linear-gradient(160deg, #3a1a6e, #1d0b33); }
.win-opt.tier-ultra-opt small { -webkit-text-fill-color: transparent; }
@keyframes ultra-glow {
  from { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px #8a3cff, 0 0 8px 1px rgba(177,108,255,0.4); }
  to { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 2px #ff4df0, 0 0 18px 3px rgba(255,77,240,0.55); }
}
.look-preview .win-preview { height: 190px; }
.look-art:has(.win-preview) { width: 100%; }
.look-art .win-icon { display: block; margin-bottom: 16px; filter: drop-shadow(0 3px 0 var(--ink)); }
.look-preview:has(.win-preview) { height: auto; }

/* Wardrobe screen */
.wardrobe { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 18px 24px; overflow-y: auto; }
.char-stage {
  width: 160px; height: 150px; display: grid; place-items: end center; padding-bottom: 8px;
  background: radial-gradient(ellipse at 50% 90%, rgba(0,0,0,0.4) 0 26%, transparent 28%);
}
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 280px; }
/* Your name under the character: the account name (or guest_1234), not editable here */
.char-name { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; max-width: 280px; }
.char-name b { font-size: 20px; text-shadow: 2px 2px 0 var(--ink); }
.char-name small { font-size: 12px; color: var(--muted); }
.link-btn { padding: 0; border: 0; background: none; color: var(--sky); font: inherit; text-decoration: underline; cursor: pointer; }
.picker-label {
  flex: 1; display: flex; flex-direction: column; align-items: center; padding: 4px 0;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius);
  font-size: 18px; font-weight: 800;
}
.picker-label small { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.picker-row.locked .picker-label { border-style: dashed; color: var(--muted); }
.wardrobe-buy { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 280px; }
.wardrobe-buy:empty { display: none; }
.wardrobe-buy p { margin: 0; }
.wardrobe-buy .btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-size: 14px; padding: 9px 12px; }
.wardrobe-buy .price.short { color: #ffd0d6; }

/* ---------- Characters ---------- */
.character { position: relative; flex: 0 0 auto; }
.character .sprite { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); background-repeat: no-repeat; image-rendering: pixelated; }
@keyframes sprite-play { from { background-position-x: 0; } to { background-position-x: var(--sheet-end); } }
/* Mythic set colors: the shirt shimmers like the deck's cards. Two layers masked to the shirt (masks drawn in
   characters.js), stepping through the same 2 bob frames as the body: a see-through holographic sheen over the
   whole shirt, and solid moving colors on its details. Seraph = rainbow, Lucifer = black / white / red. */
.character .holo-shirt, .character .holo-trim {
  -webkit-mask: var(--mask) 0 0 / var(--mask-size) no-repeat; mask: var(--mask) 0 0 / var(--mask-size) no-repeat;
  /* the colors repeat every --tile px (half the character's width), so a whole rainbow fits across the shirt */
  background-size: var(--tile) var(--tile); background-repeat: repeat;
  animation: mask-play 1s steps(2) var(--bob-delay) infinite, shirt-flow 2.2s linear infinite;
}
@keyframes mask-play {
  from { -webkit-mask-position: 0 0; mask-position: 0 0; }
  to { -webkit-mask-position: var(--sheet-end) 0; mask-position: var(--sheet-end) 0; }
}
@keyframes shirt-flow { from { background-position: 0 0; } to { background-position: var(--tile) var(--tile); } }
/* Each gradient runs its colors twice: a diagonal gradient only tiles without seams if it repeats every half tile */
.character .holo-shirt[data-holo="seraph"] {
  --a: 0.6;
  background-image: linear-gradient(135deg,
    rgba(255,93,108,var(--a)), rgba(255,169,77,var(--a)), rgba(255,228,92,var(--a)), rgba(110,230,143,var(--a)), rgba(90,200,255,var(--a)), rgba(169,140,255,var(--a)),
    rgba(255,93,108,var(--a)), rgba(255,169,77,var(--a)), rgba(255,228,92,var(--a)), rgba(110,230,143,var(--a)), rgba(90,200,255,var(--a)), rgba(169,140,255,var(--a)),
    rgba(255,93,108,var(--a)));
}
.character .holo-trim[data-holo="seraph"] {
  background-image: linear-gradient(135deg, #e0263f, #ee6a10, #c99500, #179c4c, #1a7fd6, #7443d8,
    #e0263f, #ee6a10, #c99500, #179c4c, #1a7fd6, #7443d8, #e0263f);
  animation-direction: normal, reverse;
}
.character .holo-shirt[data-holo="lucifer"] {
  --a: 0.65;
  background-image: linear-gradient(135deg, rgba(235,20,45,var(--a)), rgba(0,0,0,calc(var(--a)*.55)), rgba(255,255,255,calc(var(--a)*.5)), rgba(0,0,0,calc(var(--a)*.55)),
    rgba(235,20,45,var(--a)), rgba(0,0,0,calc(var(--a)*.55)), rgba(255,255,255,calc(var(--a)*.5)), rgba(0,0,0,calc(var(--a)*.55)), rgba(235,20,45,var(--a)));
}
.character .holo-trim[data-holo="lucifer"] {
  background-image: linear-gradient(135deg, #ffffff, #ff2a3c, #0a0a0a, #ff2a3c, #ffffff, #ff2a3c, #0a0a0a, #ff2a3c, #ffffff);
  animation-direction: normal, reverse;
}
/* In game the character is only 32-48 px: bolder colors there */
.character.holo-small .holo-shirt { --a: 0.92; }
/* Aura: a glow around the whole character in the deck's colors (Seraph cycles the rainbow, Lucifer flickers like fire) */
.character.holo-char[data-holo="seraph"] { animation: aura-seraph 3s linear infinite; }
@keyframes aura-seraph {
  0%, 100% { filter: drop-shadow(0 0 var(--px) rgba(255,93,108,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(255,93,108,.45)); }
  17% { filter: drop-shadow(0 0 var(--px) rgba(255,169,77,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(255,169,77,.45)); }
  33% { filter: drop-shadow(0 0 var(--px) rgba(255,228,92,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(255,228,92,.45)); }
  50% { filter: drop-shadow(0 0 var(--px) rgba(110,230,143,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(110,230,143,.45)); }
  67% { filter: drop-shadow(0 0 var(--px) rgba(90,200,255,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(90,200,255,.45)); }
  83% { filter: drop-shadow(0 0 var(--px) rgba(169,140,255,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(169,140,255,.45)); }
}
.character.holo-char[data-holo="lucifer"] { animation: aura-lucifer 1.4s steps(1) infinite; }
@keyframes aura-lucifer {
  0%   { filter: drop-shadow(0 0 var(--px) rgba(255,42,60,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(160,0,20,.6)); }
  30%  { filter: drop-shadow(0 0 var(--px) rgba(255,90,40,.9)) drop-shadow(0 0 calc(var(--px)*2.5) rgba(200,10,20,.5)); }
  55%  { filter: drop-shadow(0 0 var(--px) rgba(255,42,60,.7)) drop-shadow(0 0 calc(var(--px)*1.5) rgba(0,0,0,.8)); }
  80%  { filter: drop-shadow(0 0 var(--px) rgba(255,240,235,.85)) drop-shadow(0 0 calc(var(--px)*2) rgba(255,42,60,.6)); }
  88%  { filter: drop-shadow(0 0 var(--px) rgba(255,42,60,.95)) drop-shadow(0 0 calc(var(--px)*2) rgba(160,0,20,.6)); }
}
@media (prefers-reduced-motion: reduce) { .character.holo-char { animation: none; } }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 4px; font-weight: 800; font-size: 16px; text-shadow: 1px 1px 0 var(--ink); }
.topbar-title { font-size: 16px; font-weight: 700; text-shadow: 2px 2px 0 var(--ink); }
.spacer { flex: 1; }

/* ---------- Opponents ---------- */
#opponents { display: flex; justify-content: center; gap: 6px; padding: 6px 8px; }
.opp {
  flex: 1; max-width: 100px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px 6px; background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform 0.15s, background 0.2s;
}
.opp.current { background: var(--violet-hi); transform: translateY(-3px); outline: 3px solid var(--gold); outline-offset: -6px; }
.opp.passed { opacity: 0.6; }
.opp.out { opacity: 0.5; }
.opp.away .character { filter: grayscale(1); opacity: 0.6; }
.opp.away .character.holo-char { animation: none; } /* the aura would override the grey */
.opp-name { font-size: 14px; font-weight: 900; text-shadow: 1px 1px 0 var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-count { font-size: 13px; display: flex; align-items: center; gap: 4px; font-weight: 700; }
.mini-back { width: 10px; height: 14px; border-radius: 2px; background: var(--card-back); border: 2px solid var(--ink); }
.opp-status { font-size: 12.5px; color: var(--muted); min-height: 15px; font-weight: 800; }

.badge {
  font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 3px; white-space: nowrap; color: var(--t-text);
  background: var(--violet-hi); border: 2px solid var(--ink); text-transform: uppercase; letter-spacing: 0.3px;
}
.opp .badge { font-size: 9.5px; padding: 0 3px; letter-spacing: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.t-koenig { background: var(--t-koenig); }
.t-vize-koenig { background: var(--t-vize-koenig); }
.t-mittelschicht { background: var(--t-mittelschicht); }
.t-vize-arschloch { background: var(--t-vize-arschloch); }
.t-arschloch { background: var(--t-arschloch); color: #fff; }

/* ---------- Table ---------- */
#table { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px; min-height: 0; }
#pile-area { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#pile-owner { font-size: 16px; font-weight: 700; min-height: 20px; text-shadow: 2px 2px 0 var(--ink); }
#pile { display: flex; gap: 6px; min-height: calc(var(--pile-w) * 1.44); align-items: center; }
#pile .card { --w: var(--pile-w); }
#pile .card.pop { animation: pop-in 0.35s cubic-bezier(.2,1.6,.4,1) both; }
#pile.bomb .card { box-shadow: 0 0 0 3px var(--coral), 0 6px 0 var(--ink); }
#pile.won .card { opacity: 0.5; transform: scale(0.92); transition: all 0.3s; }
.pile-empty {
  width: var(--pile-w); height: calc(var(--pile-w) * 1.44); border-radius: var(--card-radius);
  border: 3px dashed rgba(246,241,255,0.25);
}
#status { font-size: 15px; line-height: 1.3; text-align: center; min-height: 58px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; text-shadow: 1px 1px 0 var(--ink); }
#status div { opacity: 0.6; font-weight: 700; }
#status div:last-child { opacity: 1; font-weight: 900; }

#swap-panel {
  padding: 14px; text-align: center; width: 100%; max-width: 340px; font-size: 16px; line-height: 1.35;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.swap-title { margin-bottom: 6px; }
.leftover-slot { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.leftover-slot .card { --w: var(--pile-w); }
.rank-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.rank-btn {
  border: var(--border) solid var(--ink); border-radius: var(--radius); padding: 10px 0; font-weight: 700; font-size: 24px;
  background: var(--cream); color: var(--card-black); box-shadow: 0 4px 0 var(--ink);
}
.rank-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.rank-btn:disabled { opacity: 0.3; text-decoration: line-through; }

/* ---------- My area ---------- */
#me-bar { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: 16px; min-height: 26px; font-weight: 700; text-shadow: 2px 2px 0 var(--ink); }
#me-bar .character { margin-top: -12px; }
#me-bar.turn .me-text { color: var(--cream); animation: pulse 1.2s ease-in-out infinite; }
#hand { display: flex; flex-direction: column; align-items: center; padding: 18px 10px 4px; min-height: calc(var(--card-w) * 1.44 + 24px); }
.hand-row { display: flex; justify-content: center; width: 100%; }
.hand-row + .hand-row { margin-top: calc(var(--card-w) * -0.62); }
/* Fan layout: bigger cards on an arc, bottom part hidden below the hand area */
#hand.fan {
  --fan-r: 520px;               /* distance from a card's top edge to the turning point */
  display: block; position: relative; overflow: hidden; padding: 0; min-height: 0; height: var(--fan-h);
}
#hand.fan .card {
  --w: var(--fan-card-w); position: absolute; top: 24px; left: calc(50% - var(--w) / 2);
  transform-origin: 50% var(--fan-r); transform: rotate(var(--a, 0deg)); animation: none;
}
/* A picked card pops out on top, see-through so the card behind it still shows (taps there go to that card) */
#hand.fan .card.selected { transform: rotate(var(--a, 0deg)) translateY(-22px); opacity: 0.7; }
#hand.fan .card.new::after { top: 4px; left: 4px; }
#actions { display: flex; gap: 10px; padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); }
#actions .btn { flex: 1; }
#btn-pass { background: var(--btn-secondary); }
#btn-play { background: var(--btn-primary); }

/* ---------- Cards ---------- */
.card {
  --w: var(--card-w);
  width: var(--w); height: calc(var(--w) * 1.4375); flex: 0 0 auto; position: relative;
  background: var(--card-bg); border: 3px solid var(--card-border); border-radius: var(--card-radius);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.12s cubic-bezier(.2,1.6,.4,1), filter 0.15s;
}
/* Sprite cards (skins): the art is a 32 x 46 cell of a 13 x 4 sheet, see js/skins.js */
.card.skin {
  background-color: transparent; background-repeat: no-repeat; background-size: 1300% 400%;
  border: 0; border-radius: calc(var(--w) / 16); image-rendering: pixelated;
}
.card.back { background: var(--card-back); }
#hand .card { animation: card-float 3.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.37s); }
.card.clickable { cursor: pointer; }
.card.clickable:hover { filter: brightness(1.05); }
.card.selected { transform: translateY(-18px) rotate(-2deg); box-shadow: 0 0 0 3px var(--sky), 0 8px 0 var(--ink); z-index: 2; }
.card.dim { filter: brightness(0.5) saturate(0.6); }
.card.new::after {
  content: "NEW"; position: absolute; top: -11px; left: 0; font-size: 10px; padding: 0 4px; line-height: 14px;
  background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px;
}

/* ---------- Lobby ---------- */
.lobby { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 18px; overflow-y: auto; text-align: center; }
.code {
  font-size: 56px; font-weight: 700; letter-spacing: 10px; color: var(--gold); margin: -6px 0 -2px; padding-left: 10px;
  text-shadow: 3px 3px 0 var(--coral), 6px 6px 0 var(--ink);
}
.seat-list { list-style: none; width: 100%; max-width: 330px; display: grid; gap: 8px; }
.seat-list li {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; min-height: 56px;
  background: var(--panel); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink);
}
.seat-list li.empty { justify-content: center; color: var(--muted); border-style: dashed; border-color: rgba(246,241,255,0.25); background: transparent; box-shadow: none; }
.seat-name { flex: 1; text-align: left; font-weight: 700; font-size: 17px; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; background: var(--violet-hi); border: 2px solid var(--ink); }
.tag.you { background: var(--sky); color: var(--ink); }
.lobby-actions { display: flex; gap: 10px; width: 100%; max-width: 330px; }
.lobby-actions .btn { flex: 1; font-size: 16px; padding: 10px 6px; line-height: 1.25; }

#toast {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 20;
  background: var(--panel-solid); border: var(--border) solid var(--ink); padding: 10px 16px; border-radius: var(--radius);
  font-size: 15px; box-shadow: var(--shadow); max-width: 90%; text-align: center;
}

/* ---------- Overlay ---------- */
#overlay { position: absolute; inset: 0; background: rgba(10, 7, 22, 0.6); display: grid; place-items: center; padding: 20px; z-index: 10; }
.panel {
  background: var(--panel-solid); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 8px 0 var(--ink);
  padding: 18px; width: 100%; max-width: 360px; display: grid; gap: 12px; animation: pop-in 0.3s cubic-bezier(.2,1.6,.4,1) both;
}
.panel h2 { font-size: 24px; font-weight: 700; text-align: center; color: var(--gold); text-shadow: 3px 3px 0 var(--ink); }
.panel .btn { width: 100%; }
.result-list { list-style: none; display: grid; gap: 6px; }
.result-list li { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--ink); padding: 4px 8px; border-radius: var(--radius); }
.result-list .place { font-weight: 700; width: 16px; color: var(--muted); }
.result-list .name { flex: 1; font-weight: 700; }
.result-list .stats { font-size: 12px; color: var(--muted); }

/* ---------- Turn timer ---------- */
#turn-timer {
  position: relative; height: 16px; margin: 4px 16px 0; border: 2px solid var(--ink); border-radius: 4px;
  background: rgba(18,14,34,0.55); overflow: hidden; opacity: 0; transition: opacity 0.2s;
}
#turn-timer.on { opacity: 1; }
#turn-timer .fill {
  position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--mint);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18), inset 0 3px 0 rgba(255,255,255,0.3);
}
#turn-timer.low .fill { background: var(--coral); }
#turn-timer.low { animation: pulse 0.5s steps(2) infinite; }
#turn-timer .secs {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 900; line-height: 1; color: var(--cream);
  text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink), 1px 0 0 var(--ink);
}

/* ---------- Bomb effect ---------- */
#pile.fx-hold .card { opacity: 0; animation: none !important; }
#fx { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
#screen-game { transition: filter 0.35s; }
#screen-game.slowmo { filter: saturate(0.25) brightness(0.6) contrast(1.15); }
#screen-game.slowmo #hand .card { animation-play-state: paused; }
.fx-bar { position: absolute; left: 0; right: 0; height: 11%; background: #000; z-index: 3; transition: transform 0.35s cubic-bezier(.3,0,.2,1); }
.fx-bar.top { top: 0; transform: translateY(-100%); }
.fx-bar.bottom { bottom: 0; transform: translateY(100%); }
#fx.cine .fx-bar { transform: translateY(0); }
.fx-slowmo-label {
  position: absolute; z-index: 4; left: 12px; bottom: calc(11% + 8px); font-family: var(--font-display); font-size: 16px;
  color: var(--cream); letter-spacing: 3px; opacity: 0; text-shadow: 2px 2px 0 var(--ink);
}
#fx.cine .fx-slowmo-label { opacity: 0.85; animation: pulse 0.6s steps(2) infinite; }
.fx-card {
  position: absolute; z-index: 2; transform-origin: 50% 80%;
  animation: bomb-fall var(--dur) var(--delay) both;
}
.fx-card.landed { animation: none; transform: rotate(var(--rot)); }
.fx-card.glow { box-shadow: 0 0 0 4px var(--coral), 0 0 22px 6px rgba(239,90,111,0.8), 0 6px 0 var(--ink); }
@keyframes bomb-fall {
  0%   { transform: translate(var(--fx), -115vh) rotate(var(--r0)) scale(2.4); animation-timing-function: cubic-bezier(.1,.7,.3,1); }
  30%  { transform: translate(calc(var(--fx) * 0.15), -70px) rotate(var(--r1)) scale(1.55); animation-timing-function: linear; }
  /* slow motion: the card hangs just above the table */
  86%  { transform: translate(0, -34px) rotate(calc(var(--r1) * 0.6)) scale(1.4); animation-timing-function: cubic-bezier(.7,0,1,.4); }
  90%  { transform: translate(0, 6px) rotate(var(--rot)) scale(0.86, 0.8); animation-timing-function: steps(1, end); }
  94%  { transform: translate(0, -4px) rotate(var(--rot)) scale(1.08); }
  100% { transform: translate(0, 0) rotate(var(--rot)) scale(1); }
}
.fx-dust { position: absolute; z-index: 1; width: 10px; height: 10px; background: var(--cream); border: 2px solid var(--ink);
  animation: dust 0.9s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes dust {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  55% { transform: translate(var(--dx), var(--dy)) rotate(var(--dr)); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.25), calc(var(--dy) + 140px)) rotate(calc(var(--dr) * 2)); opacity: 0; }
}
.fx-burst {
  position: absolute; z-index: 1; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 30%, var(--gold) 31% 50%, var(--coral) 51% 64%, transparent 65%);
  animation: burst 0.5s steps(5) forwards;
}
@keyframes burst { from { transform: scale(0.5); opacity: 1; } to { transform: scale(14); opacity: 0; } }
.fx-ring {
  position: absolute; z-index: 1; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 6px solid var(--cream); animation: ring 0.6s cubic-bezier(.1,.8,.3,1) forwards;
}
@keyframes ring { from { transform: scale(0.6); opacity: 1; } to { transform: scale(9); opacity: 0; border-width: 1px; } }
.fx-lines {
  position: absolute; inset: -20%; z-index: 0;
  background: repeating-conic-gradient(from 0deg at var(--cx) var(--cy), rgba(255,255,255,0.9) 0 1.5deg, transparent 1.5deg 8deg);
  -webkit-mask: radial-gradient(circle at var(--cx) var(--cy), transparent 0 18%, #000 40%);
  mask: radial-gradient(circle at var(--cx) var(--cy), transparent 0 18%, #000 40%);
  animation: lines 0.55s steps(4) forwards;
}
@keyframes lines { 0% { opacity: 1; transform: rotate(0); } 100% { opacity: 0; transform: rotate(6deg); } }
.fx-flash { position: absolute; inset: 0; z-index: 5; background: #fff; animation: flash 0.18s steps(2) forwards; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
.bomb-stamp {
  position: absolute; z-index: 6; left: 50%; top: 30%; font-size: 64px; line-height: 1; color: var(--gold); white-space: nowrap;
  text-shadow: 4px 4px 0 var(--coral), 8px 8px 0 var(--ink); -webkit-text-stroke: 2px var(--ink);
  transform: translate(-50%, -50%) rotate(-8deg); animation: stamp 0.45s cubic-bezier(.2,1.8,.4,1) both;
}
@keyframes stamp {
  0% { transform: translate(-50%, -50%) rotate(-20deg) scale(4); opacity: 0; }
  60% { transform: translate(-50%, -50%) rotate(-6deg) scale(0.9); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; }
}
#fx.out .bomb-stamp { transition: opacity 0.35s, transform 0.35s; opacity: 0; transform: translate(-50%, -80%) rotate(-8deg) scale(1.2); }
/* Impact frames: a few hard-cut frames of inverted / high-contrast image (classic anime impact) */
body.impact { animation: impact 0.36s forwards; }
@keyframes impact {
  0%   { filter: invert(1) grayscale(1) contrast(6); animation-timing-function: steps(1, end); }
  22%  { filter: grayscale(1) contrast(9) brightness(0.5); animation-timing-function: steps(1, end); }
  44%  { filter: invert(1) grayscale(1) contrast(6); animation-timing-function: steps(1, end); }
  66%  { filter: brightness(2.4) saturate(2.5); animation-timing-function: steps(1, end); }
  100% { filter: none; }
}
#app.shake-big { animation: shake-big 0.7s; }
#app.shake-small { animation: shake-small 0.16s; }
@keyframes shake-big {
  0%, 100% { transform: translate(0, 0); }
  8% { transform: translate(-14px, 9px) rotate(-1deg); } 16% { transform: translate(13px, -11px) rotate(1deg); }
  24% { transform: translate(-11px, -6px); } 32% { transform: translate(10px, 9px) rotate(0.6deg); }
  44% { transform: translate(-7px, 4px); } 56% { transform: translate(6px, -5px); }
  70% { transform: translate(-3px, 2px); } 85% { transform: translate(2px, -1px); }
}
@keyframes shake-small { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(0, 5px); } 66% { transform: translate(-2px, -2px); } }

/* ---------- Bigger bombs (Chaos: 5 MEGA, 6 ULTRA, 7 APOCALYPSE) ---------- */
/* Big piles overlap so 5-7 cards still fit on a phone */
#pile[data-n="5"] .card + .card { margin-left: -16px; }
#pile[data-n="6"] .card + .card { margin-left: -24px; }
#pile[data-n="7"] .card + .card, #pile[data-n="8"] .card + .card { margin-left: -30px; }
.fx-bar { height: var(--bar, 11%); }
.fx-slowmo-label { bottom: calc(var(--bar, 11%) + 8px); }
#fx.tier-1 .fx-slowmo-label, #fx.tier-2 .fx-slowmo-label, #fx.tier-3 .fx-slowmo-label { color: var(--tier); }
#fx.cine.tier-3 .fx-slowmo-label { animation: pulse 0.3s steps(2) infinite, rainbow-text 1s linear infinite; }
#screen-game.slowmo { transition: filter 0.35s; }
body:has(#fx.tier-2) #screen-game.slowmo { filter: saturate(0.1) brightness(0.45) contrast(1.3); }
body:has(#fx.tier-3) #screen-game.slowmo { filter: grayscale(1) brightness(0.35) contrast(1.5); }
/* Red warning glow at the screen edges, pulsing faster the bigger the bomb */
.fx-warn {
  position: absolute; inset: 0; z-index: 1; opacity: 0;
  box-shadow: inset 0 0 60px 20px var(--tier), inset 0 0 0 4px var(--tier);
  animation: warn 0.7s ease-in-out infinite;
}
#fx.tier-2 .fx-warn { animation-duration: 0.45s; box-shadow: inset 0 0 90px 30px var(--tier), inset 0 0 0 6px var(--tier); }
#fx.tier-3 .fx-warn { animation: warn 0.3s ease-in-out infinite, rainbow-hue 1.2s linear infinite; box-shadow: inset 0 0 120px 40px #ff3b3b, inset 0 0 0 8px #ff3b3b; }
#fx.out .fx-warn, #fx:not(.cine) .fx-warn { display: none; }
@keyframes warn { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.75; } }
@keyframes rainbow-hue { to { filter: hue-rotate(360deg); } }
@keyframes rainbow-text {
  0% { color: #ff5a6f; } 20% { color: #ffb347; } 40% { color: #fff36b; } 60% { color: #6bff8f; } 80% { color: #6bd1ff; } 100% { color: #ff5a6f; }
}
/* Ground trembles before a 6+ hit */
#screen-game.quake { animation: quake 0.09s linear infinite; }
@keyframes quake { 0%, 100% { translate: 0 0; } 25% { translate: 2px 1px; } 50% { translate: -2px -1px; } 75% { translate: 1px -2px; } }
.fx-card.glow { box-shadow: 0 0 0 4px var(--tier, var(--coral)), 0 0 22px 6px var(--tier, rgba(239,90,111,0.8)), 0 6px 0 var(--ink); }
#fx.tier-3 .fx-card.glow { animation: rainbow-hue 0.8s linear infinite; box-shadow: 0 0 0 4px #ff3b3b, 0 0 30px 10px #ff3b3b, 0 6px 0 var(--ink); }
.fx-ring.big { border-color: var(--tier, var(--cream)); border-width: 10px; }
#fx.tier-3 .fx-ring.big { animation-name: ring-huge; }
@keyframes ring-huge { from { transform: scale(0.6); opacity: 1; } to { transform: scale(26); opacity: 0; border-width: 1px; } }
/* 6+: a solid shockwave disc that flattens everything in its path */
.fx-shock {
  position: absolute; z-index: 1; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%;
  background: radial-gradient(circle, transparent 0 55%, var(--tier) 56% 62%, rgba(255,255,255,0.7) 63% 66%, transparent 67%);
  animation: shock 0.8s cubic-bezier(.1,.7,.3,1) forwards;
}
@keyframes shock { from { transform: scale(0.3); opacity: 1; } to { transform: scale(18); opacity: 0; } }
/* 7: the screen burns white, then slowly comes back */
.fx-whiteout { position: absolute; inset: 0; z-index: 5; background: #fff; animation: whiteout 1.1s ease-out forwards; }
@keyframes whiteout { 0%, 30% { opacity: 1; } 100% { opacity: 0; } }
/* 6+: the screen cracks */
.fx-crack { position: absolute; inset: 0; z-index: 4; animation: crack-in 0.12s steps(2) both; transition: opacity 0.35s; }
.fx-crack path { fill: none; stroke-linejoin: miter; stroke-linecap: square; }
.fx-crack .under path { stroke: var(--ink); stroke-width: 5; }
.fx-crack .over path { stroke: rgba(255,255,255,0.92); stroke-width: 2; }
#fx.out .fx-crack { opacity: 0; }
@keyframes crack-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: scale(1); } }
/* 6+: color channels split apart for a moment (chromatic aberration) */
#screen-game.aberr { animation: aberr 0.9s steps(9) forwards; }
@keyframes aberr {
  0%   { filter: drop-shadow(8px 0 0 rgba(255,0,60,0.8)) drop-shadow(-8px 0 0 rgba(0,220,255,0.8)); }
  40%  { filter: drop-shadow(-5px 2px 0 rgba(255,0,60,0.7)) drop-shadow(5px -2px 0 rgba(0,220,255,0.7)); }
  100% { filter: drop-shadow(0 0 0 rgba(255,0,60,0)) drop-shadow(0 0 0 rgba(0,220,255,0)); }
}
/* Stamps: bigger, louder text per tier */
.bomb-stamp.tier-1, .bomb-stamp.tier-2, .bomb-stamp.tier-3 { top: 25%; text-align: center; line-height: 0.95; }
.bomb-stamp.tier-1 { font-size: 50px; color: #d9b8ff; text-shadow: 4px 4px 0 #7a3bd6, 8px 8px 0 var(--ink); }
.bomb-stamp.tier-2 { font-size: 52px; color: #ffe08a; text-shadow: 4px 4px 0 #e01e1e, 8px 8px 0 var(--ink), 0 0 30px #ff3b3b;
  animation: stamp 0.45s cubic-bezier(.2,1.8,.4,1) both, stamp-jitter 0.08s 0.45s steps(2) 8; }
.bomb-stamp.tier-3 { font-size: min(34px, 8.6vw); text-shadow: 4px 4px 0 var(--ink), 0 0 26px #fff;
  animation: stamp-apoc 0.7s cubic-bezier(.2,1.6,.4,1) both, rainbow-text 0.6s linear infinite, stamp-jitter 0.06s 0.7s steps(2) 14; }
@keyframes stamp-jitter { 50% { translate: 3px -2px; } }
@keyframes stamp-apoc {
  0% { transform: translate(-50%, -50%) rotate(30deg) scale(9); opacity: 0; }
  55% { transform: translate(-50%, -50%) rotate(-12deg) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; }
}
.bomb-sub {
  position: absolute; z-index: 6; left: 50%; top: calc(25% + 58px); transform: translate(-50%, 0) rotate(-8deg);
  padding: 3px 12px; font-size: 16px; font-weight: 900; color: var(--ink); background: var(--tier, var(--gold));
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink); white-space: nowrap;
  animation: sub-in 0.3s 0.25s cubic-bezier(.2,1.8,.4,1) both;
}
#fx.tier-3 .bomb-sub { top: calc(25% + 26px); animation: sub-in 0.3s 0.4s cubic-bezier(.2,1.8,.4,1) both, rainbow-bg 1s linear infinite; }
@keyframes sub-in { from { transform: translate(-50%, 20px) rotate(-8deg) scale(0.4); opacity: 0; } }
@keyframes rainbow-bg {
  0% { background: #ff5a6f; } 20% { background: #ffb347; } 40% { background: #fff36b; } 60% { background: #6bff8f; } 80% { background: #6bd1ff; } 100% { background: #ff5a6f; }
}
#fx.out .bomb-sub { transition: opacity 0.35s; opacity: 0; }

/* ---------- Pair / three of a kind ---------- */
#pile, #pile-area { position: relative; }
#pile { isolation: isolate; }
.combo-tag {
  position: absolute; z-index: 3; left: 50%; top: -22px; pointer-events: none; white-space: nowrap;
  font-family: var(--font-display); font-size: 18px; color: var(--sky); -webkit-text-stroke: 1px var(--ink);
  text-shadow: 2px 2px 0 var(--ink); animation: combo-tag 1.2s cubic-bezier(.2,1.6,.4,1) 0.18s both;
}
.combo-tag.size-3 { font-size: 24px; color: var(--gold); text-shadow: 2px 2px 0 var(--coral), 4px 4px 0 var(--ink); }
@keyframes combo-tag {
  0% { transform: translate(-50%, 10px) scale(0.3) rotate(-10deg); opacity: 0; }
  18% { transform: translate(-50%, -6px) scale(1.15) rotate(-4deg); opacity: 1; }
  70% { transform: translate(-50%, -14px) scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -30px) scale(0.9) rotate(-4deg); opacity: 0; }
}
.combo-ring {
  position: absolute; z-index: -1; left: 50%; top: 50%; width: 100%; height: 70%; transform: translate(-50%, -50%);
  border: 4px solid var(--sky); border-radius: 50%; pointer-events: none; opacity: 0;
  animation: combo-ring 0.55s cubic-bezier(.1,.8,.3,1) 0.2s both;
}
.combo-ring.size-3 { border-color: var(--gold); border-width: 5px; animation-duration: 0.7s; }
@keyframes combo-ring { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.9; } 100% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; } }
.combo-spark {
  position: absolute; z-index: 2; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; pointer-events: none;
  background: var(--gold); border: 2px solid var(--ink); opacity: 0; animation: combo-spark 0.6s cubic-bezier(.1,.8,.3,1) both;
}
.combo-spark:nth-child(odd) { background: var(--cream); }
@keyframes combo-spark {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.4) rotate(180deg); opacity: 0; }
}
/* the cards themselves get a little extra: pairs click together, triples land with a bounce and a shine */
#pile[data-n="2"] .card.pop { animation: pop-in 0.35s cubic-bezier(.2,1.6,.4,1) both, combo-glint 0.5s 0.22s; }
#pile[data-n="3"] .card.pop { animation: pop-in 0.4s cubic-bezier(.2,1.9,.4,1) both, combo-glint-3 0.7s 0.24s; }
@keyframes combo-glint { 0% { box-shadow: 0 0 0 0 var(--sky), 0 4px 0 var(--ink); } 40% { box-shadow: 0 0 0 4px var(--sky), 0 0 14px 2px var(--sky), 0 4px 0 var(--ink); } 100% { box-shadow: 0 4px 0 var(--ink); } }
@keyframes combo-glint-3 { 0% { box-shadow: 0 0 0 0 var(--gold), 0 4px 0 var(--ink); } 40% { box-shadow: 0 0 0 5px var(--gold), 0 0 20px 4px var(--gold), 0 4px 0 var(--ink); } 100% { box-shadow: 0 4px 0 var(--ink); } }

/* ---------- Finish effect (1st gold, 2nd silver) ---------- */
.fx-finish { position: absolute; inset: 0; transition: opacity 0.35s; }
.fx-finish.out { opacity: 0; }
.fx-finish { --fin: var(--gold); --fin-hi: #ffe08a; --fin-shadow: #a8701a; }
.fx-finish.silver { --fin: #dfe6f0; --fin-hi: #ffffff; --fin-shadow: #6c7893; }
.fx-finish .fx-ring { border-color: var(--fin); }
.fx-rays {
  position: absolute; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%;
  background: repeating-conic-gradient(var(--fin) 0 8deg, transparent 8deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0 22%, transparent 66%);
  mask: radial-gradient(circle, #000 0 22%, transparent 66%);
  mix-blend-mode: screen; opacity: 0.8; animation: rays 1.6s steps(12) forwards;
}
.silver .fx-rays { width: 180px; height: 180px; margin: -90px 0 0 -90px; animation-duration: 1.2s; }
@keyframes rays {
  0% { transform: scale(0.2) rotate(0); opacity: 1; }
  25% { transform: scale(1) rotate(20deg); opacity: 0.9; }
  100% { transform: scale(1.15) rotate(90deg); opacity: 0; }
}
.finish-stamp {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap;
  animation: stamp-fin 0.4s cubic-bezier(.2,1.8,.4,1) both;
}
.finish-stamp .big {
  font-family: var(--font-display); font-size: 72px; font-weight: 700; line-height: 1; color: var(--fin);
  -webkit-text-stroke: 2px var(--ink); text-shadow: 4px 4px 0 var(--fin-shadow), 8px 8px 0 var(--ink);
}
.silver .finish-stamp .big { font-size: 56px; }
.finish-stamp .sub {
  display: inline-block; margin-top: 8px; padding: 4px 12px; font-size: 16px; font-weight: 900; color: var(--ink);
  background: var(--fin); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink);
}
@keyframes stamp-fin {
  0% { transform: translate(-50%, -50%) scale(3) rotate(10deg); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; }
}
/* Small impact frames: a gold (or silver) tinted flash, much shorter than the bomb's */
body.impact-gold { animation: impact-gold 0.28s forwards; }
/* Mythic drop: a white flash, then the whole screen cycles through the rainbow and settles */
body.impact-rainbow { animation: impact-rainbow 1.25s forwards; }
@keyframes impact-rainbow {
  0%   { filter: brightness(2.4) saturate(0); animation-timing-function: steps(1, end); }
  10%  { filter: brightness(1.5) saturate(3) hue-rotate(0deg); }
  80%  { filter: brightness(1.15) saturate(2) hue-rotate(720deg); }
  100% { filter: none; }
}
@keyframes impact-gold {
  0%   { filter: sepia(1) saturate(6) contrast(2.4) brightness(1.2); animation-timing-function: steps(1, end); }
  40%  { filter: brightness(1.9) saturate(1.6); animation-timing-function: steps(1, end); }
  70%  { filter: sepia(0.6) saturate(3) contrast(1.5); }
  100% { filter: none; }
}
body.impact-silver { animation: impact-silver 0.18s forwards; }
@keyframes impact-silver {
  0%   { filter: grayscale(1) contrast(2.6) brightness(1.35); animation-timing-function: steps(1, end); }
  55%  { filter: brightness(1.5); }
  100% { filter: none; }
}
#app.shake-mid { animation: shake-mid 0.5s; }
#app.shake-tiny { animation: shake-tiny 0.22s; }
@keyframes shake-mid {
  0%, 100% { transform: translate(0, 0); }
  12% { transform: translate(0, 9px); } 24% { transform: translate(-7px, -5px); } 36% { transform: translate(6px, 4px); }
  50% { transform: translate(-4px, -2px); } 66% { transform: translate(3px, 2px); } 82% { transform: translate(-1px, 0); }
}
@keyframes shake-tiny { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(0, 2px); } 65% { transform: translate(-1px, -1px); } }

/* ---------- Animations ---------- */
@keyframes pop-in {
  0% { transform: translateY(-24px) scale(1.25) rotate(var(--rot, 0deg)); opacity: 0; }
  70% { transform: scale(0.96) rotate(var(--rot, 0deg)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--rot, 0deg)); }
}
@keyframes card-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.03); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-6px, 3px); } 30% { transform: translate(6px, -4px); }
  45% { transform: translate(-5px, -2px); } 60% { transform: translate(4px, 4px); } 80% { transform: translate(-2px, 1px); }
}
/* ---------- Game modes ---------- */
.mode-btn {
  margin-top: -6px; padding: 5px 12px; border: 2px solid rgba(246,241,255,0.25); border-radius: var(--radius);
  background: rgba(18,14,34,0.45); color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 2px;
  font-weight: 800; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.mode-btn:hover, .mode-btn:focus-visible { border-color: var(--gold); color: var(--text); }
.mode-btn #mode-name { color: var(--gold); }
.mode-caret { font-size: 10px; margin-left: 2px; }
.mode-list { display: grid; gap: 10px; }
.mode-opt {
  display: grid; gap: 4px; text-align: left; padding: 12px 14px; cursor: pointer;
  border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink);
  background: #2e2556; color: #f6f1ff;
}
.mode-opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mode-opt.active { outline: 3px solid var(--gold); outline-offset: -7px; }
.mode-opt-name { font-family: var(--font-display); font-size: 24px; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); }
.mode-opt-text { font-size: 14px; font-weight: 700; line-height: 1.35; opacity: 0.85; }
.mode-opt.mode-chaos { background: repeating-linear-gradient(-45deg, #4a0b16 0 10px, #170508 10px 20px); }
.mode-opt.mode-chaos .mode-opt-name { color: #ff4d5e; }
.lobby-mode { font-size: 16px; font-weight: 800; }
/* Chaos look on top of the red/black colors in theme.css */
[data-mode="chaos"] .logo { text-shadow: 3px 3px 0 #b3172e, 6px 6px 0 #000; }
[data-mode="chaos"] .mode-btn { border-color: #ff4d5e; background: rgba(0,0,0,0.55); }
[data-mode="chaos"] .mode-btn #mode-name { color: #ff4d5e; }
[data-mode="chaos"] .card-box { border-color: #000; }

/* ---------- Chaos: jokers ---------- */
.joker-card {
  --w: 32px; width: var(--w); height: calc(var(--w) * 1.4375); flex: 0 0 auto;
  background: url(../assets/jokers/jokers.png) no-repeat; background-size: 800% 100%; image-rendering: pixelated;
}
.joker-kind { font-size: 11px; font-weight: 900; padding: 1px 6px; border: 2px solid var(--ink); border-radius: 3px; color: var(--ink); text-transform: uppercase; }
.k-strengthen { background: var(--j-strengthen); }
.k-weaken { background: var(--j-weaken); }
.k-transform { background: var(--j-transform); }
.k-add { background: var(--j-add); }
.k-delete { background: var(--j-delete); }

/* Bonus card (top right of the table) */
#table { position: relative; }
#bonus-box {
  position: absolute; top: 2px; right: 8px; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 5px 3px; background: var(--panel); border: 2px solid var(--gold); border-radius: var(--radius); box-shadow: 0 3px 0 var(--ink);
}
#bonus-box .card { box-shadow: 0 2px 0 var(--ink); }
.bonus-label { font-family: var(--font-display); font-size: 12px; line-height: 1; color: var(--gold); text-transform: uppercase; }
.bonus-hint { font-size: 10px; font-weight: 900; line-height: 1.1; color: var(--muted); }
#bonus-box.claimed { border-color: rgba(246,241,255,0.25); opacity: 0.55; }
#bonus-box.claimed .card { filter: grayscale(1); }
#bonus-box.claimed .bonus-label { color: var(--muted); }
.card.bonus:not(.selected) { box-shadow: 0 0 0 3px var(--gold), 0 4px 0 var(--ink); }
.card.bonus::before {
  content: "★"; position: absolute; right: -6px; top: -9px; z-index: 1; font-size: 14px; line-height: 1; color: var(--gold);
  text-shadow: 1px 1px 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink), 1px 0 0 var(--ink);
}
#hand.fan .card.bonus::before { right: 4px; top: 2px; }

/* Your joker tray (in the bar above your hand) */
.joker-tray { display: flex; gap: 4px; margin-left: 4px; }
.joker-slot { padding: 0; border: 0; background: none; border-radius: 3px; cursor: pointer; transition: transform 0.12s; }
.joker-slot.empty { width: 32px; height: 46px; border: 2px dashed rgba(246,241,255,0.25); }
.joker-slot .joker-card { box-shadow: 0 3px 0 var(--ink); border-radius: 2px; }
.joker-tray.ready .joker-slot:not(.empty) { animation: joker-ready 1s ease-in-out infinite; }
.joker-tray.ready .joker-slot:not(.empty) .joker-card { box-shadow: 0 0 0 2px var(--gold), 0 3px 0 var(--ink); }
.joker-slot:active:not(.empty) { transform: translateY(2px); }
@keyframes joker-ready { 50% { transform: translateY(-4px); } }
[data-mode="chaos"] #me-bar { min-height: 50px; }
.opp-jokers { display: inline-flex; gap: 2px; margin-left: 4px; }
.opp-jokers i { width: 8px; height: 12px; border: 2px solid var(--ink); border-radius: 2px; }

/* Joker panel */
.panel { max-height: calc(100vh - 40px); overflow-y: auto; }
.panel .rules-list { max-height: none; }
.joker-head { display: flex; gap: 14px; align-items: center; }
.joker-head h2 { text-align: left; margin-bottom: 4px; }
.joker-head p { margin-top: 6px; font-size: 15px; font-weight: 700; line-height: 1.35; }
.joker-big .joker-card { box-shadow: 0 5px 0 var(--ink); }
.jk-step { font-size: 13px; font-weight: 900; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }
.jk-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding-top: 14px; }
.jk-hand .card { --w: 32px; animation: none; }
.jk-hand .card.selected { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--sky), 0 5px 0 var(--ink); }
.jk-suits { justify-content: center; }
.jk-suits button { font-size: 22px; padding: 6px 16px; color: var(--card-black); background: var(--cream); font-family: var(--font); }
.jk-suits button.red { color: var(--card-red); }
.jk-suits button.active { background: var(--gold); }
.jk-suits button:disabled { opacity: 0.3; }
.jk-opps { display: grid; gap: 6px; }
.jk-opp.active { background: var(--gold); color: var(--ink); }
.jk-opp small { opacity: 0.7; }

/* Rules: joker list */
.chaos-rules { display: grid; gap: 8px; }
.chaos-rules h3 { font-family: var(--font-display); font-size: 16px; color: #ff4d5e; text-shadow: 2px 2px 0 var(--ink); }
.joker-list { display: grid; gap: 8px; }
.joker-row { display: flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; line-height: 1.35; }

/* Round over: joker award */
.award { display: flex; gap: 10px; align-items: center; padding: 8px 10px; font-size: 14px; line-height: 1.35;
  background: rgba(0,0,0,0.3); border: 2px solid var(--gold); border-radius: var(--radius); animation: pop-in 0.4s 0.2s both; }

/* Joker effect: big joker card + text in the middle */
.fx-joker { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  transition: opacity 0.3s; }
.fx-joker.out { opacity: 0; }
.fx-joker-rays {
  position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -170px 0 0 -150px; border-radius: 50%;
  background: repeating-conic-gradient(var(--kc) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0 20%, transparent 66%); mask: radial-gradient(circle, #000 0 20%, transparent 66%);
  opacity: 0.6; animation: rays 1.4s steps(12) forwards;
}
.fx-joker-card { position: relative; animation: joker-in 0.5s cubic-bezier(.2,1.6,.4,1) both; }
.fx-joker-card .joker-card { box-shadow: 0 0 0 4px var(--kc), 0 0 26px 6px var(--kc), 0 8px 0 var(--ink); border-radius: 6px; }
.fx-joker.gain .fx-joker-card { animation-name: joker-flip; animation-duration: 0.6s; }
@keyframes joker-in {
  0% { transform: scale(3) rotate(-25deg); opacity: 0; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}
@keyframes joker-flip {
  0% { transform: translateY(60px) scaleX(0) scale(0.6); opacity: 0; }
  60% { transform: translateY(-10px) scaleX(1) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(3deg); }
}
.fx-joker-text { position: relative; text-align: center; padding: 6px 14px; background: var(--panel-solid); border: 3px solid var(--ink);
  border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink); animation: pop-in 0.35s 0.15s both; }
.fx-joker-head { font-size: 14px; font-weight: 900; color: var(--muted); }
.fx-joker-name { font-family: var(--font-display); font-size: 24px; line-height: 1.1; color: var(--kc); text-shadow: 2px 2px 0 var(--ink); }
.fx-joker-detail { font-size: 18px; font-weight: 900; }
.fx-joker-detail .red { color: #ff7a8a; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Tutorials (tutorial.js): buttons at the top of the Rules panel, coach in the game ---------- */
.tut-box { display: grid; gap: 8px; padding: 10px; background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius); }
.tut-box .box-title { text-align: center; }
.tut-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tut-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 6px 8px;
  border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: 0 4px 0 var(--ink); color: var(--text);
  font-family: var(--font-display); font-size: 15px; font-weight: 700; text-transform: uppercase;
}
.tut-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tut-classic { background: var(--btn-primary); }
.tut-chaos { background: linear-gradient(180deg, #9c1c2c, #2a0710); }
.tut-btn small {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font); font-size: 12px; font-weight: 900; text-transform: none;
  background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; padding: 0 6px 0 3px; line-height: 18px;
}
.tut-btn small .spin-icon { width: 13px; height: 13px; border-width: 1px; }
.tut-btn:not(.done) small { animation: pulse-tut 1.2s steps(2) infinite; }
.tut-btn.done small { background: var(--mint); padding: 0 6px; }
@keyframes pulse-tut { 50% { transform: scale(1.1); } }
/* Account (Settings > Account): a dot on the gear until you've looked once, red when saving has a problem */
#btn-settings { position: relative; }
#btn-settings.reward::after, #btn-settings.warn::after, #set-tabs button.dot::after {
  content: ""; position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--ink);
}
#btn-settings.warn::after, #set-tabs button.dot.warn::after { background: var(--coral); }
#set-tabs button { position: relative; font-size: 12px; padding: 8px 4px; min-width: 0; }
#set-account[hidden] { display: none; }
.acct { justify-items: center; text-align: center; }
.acct .set-row { width: 100%; }
.acct-modes { width: 100%; }
.acct-modes button { flex: 1; padding: 8px 6px; }
.acct-form { display: grid; gap: 8px; justify-items: center; width: 100%; }
.acct-form .input { width: 100%; max-width: 260px; font-size: 16px; } /* 16px+ stops phones from zooming in */
.acct-status { font-weight: 800; font-size: 15px; color: var(--muted); }
.acct-status.s-saved { color: var(--mint, #7ee0a1); }
.acct-status.s-offline { color: var(--coral); }
.acct-delete { display: grid; justify-items: center; gap: 8px; width: 100%; margin-top: 6px; padding-top: 10px; border-top: 2px dashed rgba(255, 255, 255, 0.12); }
.acct-delete .link-btn { color: var(--muted); font-size: 13px; }
.acct a { color: var(--sky); }
.btn.danger { background: var(--danger); }
#btn-rules { position: relative; }
#btn-rules.reward::after {
  content: ""; position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--ink); animation: pulse-tut 1.2s steps(2) infinite;
}

/* Coach: dims the game, spotlights one thing and explains it. Above the game, below panels (#overlay is z 10). */
#coach { position: absolute; inset: 0; z-index: 9; }
#coach.no-target { background: rgba(10, 7, 22, 0.62); }
.coach-spot {
  position: absolute; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 200vmax rgba(10, 7, 22, 0.62);
  animation: coach-spot 1.2s ease-in-out infinite;
}
@keyframes coach-spot { 50% { box-shadow: 0 0 0 6px var(--gold), 0 0 0 200vmax rgba(10, 7, 22, 0.62); } }
.coach-bubble {
  position: absolute; left: 50%; translate: -50% 0; width: min(330px, calc(100% - 24px)); display: grid; gap: 8px;
  padding: 12px 14px 14px; background: var(--panel-solid); border: var(--border) solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--ink), 0 0 0 2px var(--gold) inset;
}
#coach.no-target .coach-bubble { top: 50%; translate: -50% -50%; }
#coach.in .coach-bubble { animation: pop-in 0.3s cubic-bezier(.2,1.6,.4,1) both; }
.coach-tag { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); }
.coach-face { width: 16px; height: 16px; border-radius: 3px; background: var(--gold); border: 2px solid var(--ink);
  box-shadow: inset 3px 4px 0 -1px var(--gold), inset -3px 4px 0 -1px var(--gold); position: relative; }
.coach-face::before { content: "?"; position: absolute; inset: -2px 0 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 11px; color: var(--ink); }
.coach-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); text-shadow: 2px 2px 0 var(--ink); }
.coach-text { font-size: 15px; font-weight: 600; line-height: 1.45; }
.coach-text .badge { font-size: 11.5px; }
.coach-bubble .btn { width: 100%; padding: 9px 14px; }

/* Your turn in the tutorial: the suggested cards glow, the hint replaces the turn text */
#hand .card.hint:not(.selected) { box-shadow: 0 0 0 3px var(--gold), 0 0 16px 4px rgba(245, 197, 66, 0.75), 0 4px 0 var(--ink); }
#btn-pass.hint-btn:not(:disabled), .rank-btn.hint-btn:not(:disabled) { box-shadow: 0 0 0 3px var(--gold), 0 0 16px 4px rgba(245, 197, 66, 0.75), var(--shadow); }
.coach-hint { color: var(--gold); font-weight: 900; }
.tut-done { text-align: center; font-family: var(--font-display); font-size: 16px; color: var(--mint); text-shadow: 2px 2px 0 var(--ink); }
.tut-reward {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px;
  font-family: var(--font-display); font-size: 26px; color: var(--gold); text-shadow: 2px 2px 0 var(--coral), 4px 4px 0 var(--ink);
  animation: pop-in 0.5s cubic-bezier(.2,1.6,.4,1) both;
}
.tut-reward .spin-icon { width: 34px; height: 34px; border-width: 3px; animation: wheel-idle 2s linear infinite; }
.panel { overflow-x: hidden; } /* pop-in / reward animations must not add a sideways scrollbar */
@media (prefers-reduced-motion: reduce) {
  .tut-btn small, #btn-rules.reward::after, .coach-spot, .tut-reward .spin-icon { animation: none; }
}
/* Hover highlight on every button (mouse only: on phones a hover would stay "stuck" after a tap) */
@media (hover: hover) and (pointer: fine) {
  button { transition: filter 0.08s; }
  button:not(:disabled):hover { filter: brightness(1.18) saturate(1.1); cursor: pointer; }
  .btn, .icon-btn, .spin-chip, .profile-chip { transition: filter 0.08s, transform 0.08s; }
  .btn:not(:disabled):hover:not(:active), .icon-btn:hover:not(:active),
  .spin-chip:hover:not(:active), .profile-chip:hover:not(:active) { transform: translateY(-2px); }
}

/* Lobby: time to act */
.field[hidden] { display: none; }
.field-hint { display: block; font-family: var(--font-body, inherit); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--muted); margin-top: 2px; }
#seg-timer button { padding: 8px 10px; }

/* ---------- Beta welcome gift ---------- */
.beta-gift { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; position: relative; }
.beta-shout { display: flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--font-display); }
.beta-shout span { display: block; font-size: 30px; color: var(--cream); -webkit-text-stroke: 1px var(--ink);
  text-shadow: 3px 3px 0 var(--coral), 5px 5px 0 var(--ink); animation: shout-in 0.45s cubic-bezier(.2,1.8,.4,1) both; }
.beta-shout span:nth-child(2) { animation-delay: 0.12s; }
.beta-shout .beta-word { font-size: 40px; margin-top: 4px; animation: shout-in 0.5s 0.26s cubic-bezier(.2,1.8,.4,1) both, rainbow-text 1.2s linear infinite, shout-jitter 0.1s 0.8s steps(2) 10; }
@keyframes shout-in { 0% { transform: scale(3.2) rotate(-12deg); opacity: 0; } 100% { transform: scale(1) rotate(-3deg); opacity: 1; } }
@keyframes shout-jitter { 50% { translate: 2px -2px; } }
.beta-sub { margin: 0; font-weight: 700; }
.beta-hint { margin: 0; font-weight: 900; color: var(--gold); animation: pulse 0.9s steps(2) infinite; }
.gift-box { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 0 0; border: 0; background: none;
  cursor: pointer; animation: gift-wiggle 1.6s ease-in-out infinite; }
.gift-box svg { display: block; position: relative; z-index: 1; filter: drop-shadow(0 6px 0 rgba(0,0,0,0.35)); }
.gift-lid { margin-bottom: -1px; transform-origin: 50% 100%; }
@keyframes gift-wiggle {
  0%, 60%, 100% { transform: rotate(0) translateY(0); }
  66% { transform: rotate(-7deg) translateY(-6px); } 72% { transform: rotate(6deg) translateY(-8px); }
  78% { transform: rotate(-4deg) translateY(-3px); } 84% { transform: rotate(2deg); }
}
.gift-box.opening { animation: gift-shake 0.09s linear infinite; }
@keyframes gift-shake { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-3px, 1px) rotate(-3deg); } 75% { transform: translate(3px, -1px) rotate(3deg); } }
.gift-box.open { animation: gift-pop 0.4s cubic-bezier(.2,1.8,.4,1); cursor: default; }
@keyframes gift-pop { 0% { transform: scale(1.25, 0.8); } 100% { transform: scale(1); } }
.gift-box.open .gift-lid { animation: lid-off 0.9s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes lid-off {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(90px, -170px) rotate(220deg); opacity: 0; }
}
.gift-rays { position: absolute; left: 50%; top: 55%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; z-index: 0; opacity: 0;
  background: repeating-conic-gradient(rgba(245,197,66,0.85) 0 9deg, transparent 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 68%); mask: radial-gradient(circle, #000 0 18%, transparent 68%); pointer-events: none; }
.gift-box.open .gift-rays { animation: gift-rays 1.2s ease-out forwards, spin-slow 8s linear infinite; }
@keyframes gift-rays { 0% { opacity: 0; scale: 0.2; } 30% { opacity: 1; scale: 1.1; } 100% { opacity: 0.55; scale: 1; } }
@keyframes spin-slow { to { rotate: 360deg; } }
.gift-confetti { position: absolute; left: 50%; top: 45%; z-index: 2; width: 7px; height: 7px; border: 2px solid var(--ink); pointer-events: none;
  animation: dust 1.3s cubic-bezier(.2,.8,.3,1) forwards; }
.gift-cards { display: flex; justify-content: center; gap: 16px; min-height: 0; }
.gift-cards:empty { display: none; }
.gift-card { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: gift-card-in 0.6s cubic-bezier(.2,1.6,.4,1) both; }
.gift-card .card { box-shadow: 0 0 0 3px var(--gold), 0 0 24px 6px rgba(245,197,66,0.6), 0 6px 0 var(--ink); }
@keyframes gift-card-in {
  0% { transform: translateY(-120px) scale(0.2) rotateY(180deg); opacity: 0; }
  60% { transform: translateY(8px) scale(1.08) rotateY(0); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.gift-label { font-size: 14px; font-weight: 900; }
.gift-after { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: shout-in 0.35s cubic-bezier(.2,1.6,.4,1) both; }
.gift-after[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .gift-box, .gift-box.opening, .beta-shout span, .beta-hint { animation: none !important; }
}
