/* Goober Cards: phone + tablet tabletop card game. */
:root {
  --ink: #1f1f1f;
  --paper: #fffaf0;
  --yellow: #ffd34d;
  --orange: #ff9f45;
  --blue: #8ed3ff;
  --green: #7fe08f;
  --pink: #ff8bd1;
  --red: #ff5d5d;
  --purple: #8b6cff;
  --common: #d9d4ca;
  --rare: #3fa9ff;
  --epic: #b35cff;
  --legendary: #ff9a1f;
  --bg-1: #2a2238;
  --bg-2: #101014;
  --felt: #2c6e4f;
  --felt-2: #1f5139;
  --text: #fffaf0;
  --muted: #cfc6e0;
  --panel: #fffaf0;
  --panel-ink: #1f1f1f;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --display: "Anton", Impact, "Arial Black", system-ui, sans-serif;
  --body: "Nunito", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg-2); }
body {
  font-family: var(--body);
  color: var(--text);
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-1), var(--bg-2)) no-repeat;
  background-color: var(--bg-2);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img { -webkit-user-drag: none; user-select: none; }
[hidden] { display: none !important; }

#app { min-height: 100dvh; }

/* ---------- Shared bits ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  font-family: var(--display); font-size: 1.1rem; letter-spacing: 0.02em;
  color: var(--ink); background-color: #fff;
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { filter: grayscale(0.8) brightness(0.8); cursor: not-allowed; }
.btn.primary { background-color: var(--yellow); }
.btn.go { background-color: var(--green); }
.btn.hot { background-color: var(--orange); }
.btn.pink { background-color: var(--pink); }
.btn.blue { background-color: var(--blue); }
.btn.danger { background-color: #ff8f8f; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.95rem; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.btn.big { min-height: 64px; font-size: 1.6rem; padding: 12px 28px; border-radius: 20px; box-shadow: 0 6px 0 var(--ink); }
.btn.ghost { background: rgba(255, 255, 255, 0.1); color: var(--text); border-color: rgba(255, 255, 255, 0.5); box-shadow: none; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.35); border-radius: 14px; color: var(--text);
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.25);
  font-family: var(--display); font-size: 1.05rem;
}
.coin-icon { width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 0.3em; border-radius: 50%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45)); }
.coins-pill { background: #2b2140; border-color: var(--yellow); color: var(--yellow); }
.badge {
  position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; padding: 0 7px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); color: #fff; border: 3px solid var(--ink);
  font-family: var(--display); font-size: 0.95rem;
}
.muted { color: var(--muted); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; margin: 0; }

.screen { min-height: 100dvh; padding: calc(12px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); max-width: 1100px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.topbar h2 { font-size: 1.7rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .name-input {
  flex: 1; min-width: 0; padding: 8px 12px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: var(--text);
  font-family: var(--display); font-size: 1.5rem; text-transform: uppercase; letter-spacing: 0.02em;
}
.topbar .name-input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.3); }

.toast-wrap { position: fixed; left: 0; right: 0; top: calc(10px + var(--safe-top)); z-index: 200; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast {
  max-width: min(92vw, 440px); padding: 10px 16px; border-radius: 14px;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-weight: 800; text-align: center; animation: toastIn 0.25s ease-out;
}
.toast.bad { background: #ffd0d0; }
.toast.good { background: #d7ffd9; }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } }

/* ---------- Sheets / modals ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(10, 6, 20, 0.72); animation: fadeIn 0.18s; }
.modal .sheet {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink);
  padding: 20px; animation: popIn 0.22s cubic-bezier(0.2, 1.4, 0.5, 1);
  -webkit-user-select: text; user-select: text;
}
.sheet h2 { font-size: 1.8rem; margin-bottom: 8px; }
.sheet p { line-height: 1.45; }
.sheet .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.sheet input[type="text"] { width: 100%; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 14px; font-size: 1.1rem; font-weight: 800; color: var(--ink); background: #fff; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } }

.inspect { display: grid; justify-items: center; gap: 14px; }
.inspect .card { --cw: min(260px, 64vw); }
.inspect .details { width: min(420px, 100%); background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; padding: 12px 14px; box-shadow: 0 4px 0 var(--ink); }
.inspect .details p { margin: 4px 0; }
.kw-line { display: flex; gap: 8px; align-items: baseline; }
.kw-line b { white-space: nowrap; }

/* ---------- Card face ---------- */
.card {
  --rc: var(--common);
  --cat: #ffd34d;
  position: relative;
  width: var(--cw, 120px);
  aspect-ratio: 5 / 7;
  font-size: calc(var(--cw, 120px) / 10);
  flex: none;
  border-radius: 0.9em;
  color: var(--ink);
  isolation: isolate;
}
.card.rare { --rc: var(--rare); }
.card.epic { --rc: var(--epic); }
.card.legendary { --rc: var(--legendary); }
.card .frame {
  position: absolute; inset: 0;
  border-radius: 0.9em;
  border: 0.28em solid var(--ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--cat) 75%, #fff), var(--cat));
  box-shadow: 0 0.3em 0 var(--ink);
  overflow: hidden;
}
.card.legendary .frame { border-color: #6a3b00; box-shadow: 0 0 0 0.16em var(--legendary), 0 0.3em 0 var(--ink); }
.card .art {
  position: absolute; left: 0.45em; right: 0.45em; top: 0.45em; height: 52%;
  border: 0.2em solid var(--ink); border-radius: 0.7em;
  background: #f6f4ef; overflow: hidden; display: grid; place-items: center;
}
.card.is-spell .art { border-radius: 50% 50% 0.7em 0.7em / 30% 30% 0.7em 0.7em; background: radial-gradient(circle, #fff, #f5e6c8); }
.card .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card .art .emoji { font-size: 3.4em; line-height: 1; filter: drop-shadow(0 0.08em 0 rgba(0, 0, 0, 0.25)); }
.card .cost {
  position: absolute; left: -0.35em; top: -0.35em; z-index: 3;
  width: 2.3em; height: 2.3em; display: grid; place-items: center;
  font-family: var(--display); font-size: 1.25em; color: #fff; -webkit-text-stroke: 0.06em var(--ink); paint-order: stroke fill;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #ffb829 55%, #c77800);
  border: 0.14em solid var(--ink); border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
}
.card .name {
  position: absolute; left: 0.3em; right: 0.3em; top: 50%; z-index: 2;
  padding: 0.28em 0.4em; min-height: 2.1em; display: grid; place-items: center;
  background: #fff; border: 0.18em solid var(--ink); border-radius: 0.5em;
  font-family: var(--display); font-size: 0.95em; line-height: 1; text-align: center;
  overflow: hidden;
}
.card .name span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .gem {
  position: absolute; left: 50%; top: calc(50% - 0.55em); z-index: 3; transform: translateX(-50%) rotate(45deg);
  width: 0.95em; height: 0.95em; background: var(--rc); border: 0.14em solid var(--ink);
}
.card .text {
  position: absolute; left: 0.55em; right: 0.55em; top: calc(50% + 2.4em); bottom: 1.9em;
  display: grid; place-items: center; text-align: center;
  font-size: 0.78em; line-height: 1.15; font-weight: 800; overflow: hidden;
}
.card .text b { font-weight: 900; }
.card .tribe {
  position: absolute; left: 50%; bottom: 0.3em; transform: translateX(-50%);
  font-size: 0.7em; font-weight: 900; padding: 0.1em 0.7em; border-radius: 99px;
  background: rgba(255, 255, 255, 0.75); border: 0.12em solid var(--ink); white-space: nowrap; text-transform: capitalize;
}
.card .atk, .card .hp {
  position: absolute; bottom: -0.35em; z-index: 3;
  width: 2.25em; height: 2.25em; display: grid; place-items: center;
  font-family: var(--display); font-size: 1.25em; color: #fff; -webkit-text-stroke: 0.06em var(--ink); paint-order: stroke fill;
  border: 0.14em solid var(--ink);
}
.card .atk { left: -0.35em; background: radial-gradient(circle at 35% 30%, #fff1a8, #ffc21a 60%, #d68a00); border-radius: 40% 60% 50% 50%; }
.card .hp { right: -0.35em; background: radial-gradient(circle at 35% 30%, #ffc0c0, #ff4d4d 60%, #b31e1e); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.card.shiny .frame::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 0, 170, 0.35) 30%, rgba(255, 238, 0, 0.35) 40%, rgba(0, 255, 170, 0.35) 50%, rgba(0, 170, 255, 0.35) 60%, transparent 70%);
  background-size: 300% 300%; mix-blend-mode: color-dodge; animation: holo 3.2s linear infinite;
}
.card.shiny::before {
  content: "✨"; position: absolute; right: -0.2em; top: -0.5em; z-index: 5; font-size: 1.4em; filter: drop-shadow(0 0 0.2em #fff);
}
@keyframes holo { to { background-position: 300% 300%; } }
.card.back .frame {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 211, 77, 0.35), transparent 55%),
    repeating-linear-gradient(45deg, #1c1c22 0 0.7em, #26262e 0.7em 1.4em);
  display: grid; place-items: center; align-content: center; gap: 0.4em;
}
.card.back .frame::before {
  content: ""; width: 74%; aspect-ratio: 1; border-radius: 16%;
  background: #fff url("/assets/original-goober.jpg") 30% 25% / 160% auto no-repeat;
  border: 0.25em solid var(--ink); box-shadow: 0 0 0 0.22em var(--yellow), 0 0 1.2em rgba(255, 211, 77, 0.5);
}
.card.back .frame::after {
  content: "GOOBER CARDS"; font-family: var(--display); font-size: 1.05em; letter-spacing: 0.04em; white-space: nowrap;
  color: var(--yellow); -webkit-text-stroke: 0.08em var(--ink); paint-order: stroke fill;
}
.card.locked { filter: grayscale(1) brightness(0.55); }
.card.locked::after { content: "🔒"; position: absolute; left: 50%; top: 28%; transform: translate(-50%, -50%); font-size: 2.2em; z-index: 6; filter: none; }

/* ---------- Home ---------- */
.home { display: grid; gap: 16px; align-content: start; }
.home-top { display: flex; align-items: center; gap: 10px; }
.home-top .spacer { flex: 1; }
.logo { display: flex; align-items: center; gap: 12px; margin: 6px 0 2px; }
.logo img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 38% 45%; background: #fff; border: 4px solid var(--ink); box-shadow: 0 0 0 4px var(--yellow); }
.logo h1 { font-size: clamp(2.4rem, 10vw, 4rem); line-height: 0.95; text-transform: uppercase; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 0 4px 0 #000; letter-spacing: 0.02em; }
.logo small { display: block; font-family: var(--body); font-weight: 800; color: var(--muted); font-size: 0.95rem; -webkit-text-stroke: 0; text-shadow: none; margin-top: 6px; text-transform: none; letter-spacing: 0; }
.home-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 18px; border-radius: 26px; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink);
  background: linear-gradient(135deg, var(--felt), var(--felt-2));
}
.home-hero h2 { font-size: 1.6rem; }
.home-hero p { margin: 6px 0 12px; color: #e3f5e8; font-weight: 700; }
.home-hero .fan { position: relative; width: 150px; height: 150px; }
.home-hero .fan .card { --cw: 78px; position: absolute; left: 36px; top: 10px; transform-origin: 50% 120%; }
.home-hero .fan .card:nth-child(1) { transform: rotate(-16deg) translateX(-18px); }
.home-hero .fan .card:nth-child(3) { transform: rotate(16deg) translateX(18px); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  position: relative; display: grid; gap: 4px; align-content: start; text-align: left;
  padding: 14px; min-height: 110px; border-radius: 22px;
  border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); color: var(--ink);
  background-color: var(--paper);
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.tile .ico { font-size: 2rem; line-height: 1; }
.tile b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.tile span { font-weight: 700; font-size: 0.9rem; color: #5a5160; }
.tile.yellow { background-color: var(--yellow); } .tile.pink { background-color: var(--pink); } .tile.blue { background-color: var(--blue); }
.tile.green { background-color: var(--green); } .tile.orange { background-color: var(--orange); } .tile.white { background-color: var(--paper); }
.stats-row { display: flex; flex-wrap: wrap; gap: 8px; }
.home-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-foot a { color: var(--muted); font-weight: 800; }
@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .home-hero .fan { width: 220px; height: 190px; }
  .home-hero .fan .card { --cw: 110px; left: 55px; }
}

/* ---------- Solo / online setup ---------- */
.choice-list { display: grid; gap: 12px; }
@media (min-width: 720px) { .choice-list.three { grid-template-columns: repeat(3, 1fr); } .choice-list.four { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .choice-list.four { grid-template-columns: repeat(4, 1fr); } }
.choice {
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; text-align: left;
  padding: 12px; border-radius: 20px; border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  background: var(--paper); color: var(--ink);
}
.choice.selected { background-color: var(--yellow); }
.choice > img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ink); }
.choice b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; display: block; }
.choice small { font-weight: 800; color: #5a5160; }
.field-label { font-family: var(--display); font-size: 1.15rem; margin: 18px 0 8px; display: block; }
.deck-pick { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.deck-chip {
  flex: none; scroll-snap-align: start; min-width: 150px; text-align: left;
  padding: 10px 12px; border-radius: 16px; border: 3px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.deck-chip.selected { background-color: var(--green); }
.deck-chip b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.deck-chip small { font-weight: 800; color: #5a5160; }
.sticky-go { position: sticky; bottom: calc(10px + var(--safe-bottom)); margin-top: 18px; display: flex; justify-content: center; }
.code-box {
  font-family: var(--display); font-size: clamp(2.4rem, 12vw, 4rem); letter-spacing: 0.12em; text-align: center;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); padding: 8px 16px;
}
.online-card { display: grid; gap: 12px; padding: 16px; border-radius: 22px; border: 3px dashed rgba(255, 255, 255, 0.35); margin-top: 14px; }
.online-card input { width: 100%; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 14px; font-family: var(--display); font-size: 1.4rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); background: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.draw-form label { display: grid; gap: 6px; font-weight: 800; }
.online-card.draw-form input[type="text"], .online-card.draw-form select, .online-card.draw-form textarea {
  width: 100%; padding: 10px 12px; border-radius: 14px; font: inherit; font-weight: 700;
  background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.3);
}
.online-card.draw-form input, .online-card.draw-form select, .online-card.draw-form textarea { text-transform: none; letter-spacing: 0; font-family: inherit; }
.online-card.draw-form input[type="file"] { padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.3); font: inherit; font-size: 0.9rem; }
.draw-form select option { background: #1d1628; }
.draw-form textarea { min-height: 80px; resize: vertical; }
.draw-form input:focus, .draw-form select:focus, .draw-form textarea:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.3); }
.draw-preview { min-height: 140px; display: grid; place-items: center; border: 2px dashed rgba(255, 255, 255, 0.3); border-radius: 16px; color: var(--muted); font-weight: 800; overflow: hidden; }
.draw-preview img { max-width: 100%; max-height: 240px; object-fit: contain; background: #fff; border-radius: 10px; }
.draw-status { margin: 0; color: var(--yellow); font-weight: 800; }
.draw-result { text-align: center; }
.draw-card { display: grid; justify-items: center; }
.draw-card .card { --cw: min(200px, 56vw); }
.admin-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255, 90, 90, 0.5); }
.creator-note { padding: 8px 10px; border-radius: 12px; background: rgba(255, 159, 69, 0.15); border: 1px solid rgba(255, 159, 69, 0.45); }
.friends-btn { position: relative; text-decoration: none; }
.friend-add input { text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 1.05rem; flex: 1; min-width: 140px; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.friend-row > div:nth-child(2) { flex: 1; min-width: 0; }
.friend-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row small { display: block; font-weight: 800; color: var(--muted); }
.friend-row .dot { width: 12px; height: 12px; border-radius: 50%; background: #6b6480; flex: none; }
.friend-row .dot.on { background: #5cf08a; box-shadow: 0 0 8px #5cf08a; }
.friend-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.challenge-card { text-align: left; }
.challenge-head { display: flex; gap: 14px; align-items: center; }
.challenge-head > span { font-size: 3rem; line-height: 1; filter: drop-shadow(0 0 12px rgba(255, 95, 200, 0.7)); }
.challenge-head h2 { font-size: 2.4rem; text-transform: uppercase; color: var(--yellow); overflow-wrap: anywhere; }
.challenge-head small { display: block; font-weight: 800; color: var(--muted); }
.challenge-sent { display: grid; gap: 2px; text-align: center; padding: 10px; border-radius: 14px; background: rgba(255, 95, 200, 0.14); border: 1px solid rgba(255, 95, 200, 0.45); }
.challenge-sent b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; text-transform: uppercase; }
.live-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.live-head b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; text-transform: uppercase; }
.live-list { display: grid; gap: 8px; }
.live-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.live-row > div { flex: 1; min-width: 0; }
.live-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row small { display: block; font-weight: 800; color: var(--muted); }
.rank-card { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.18); }
.rank-card .rank-icon { font-size: 2.2rem; line-height: 1; filter: drop-shadow(0 0 10px rgba(255, 211, 77, 0.6)); }
.rank-card > div { flex: 1; min-width: 0; }
.rank-card b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.3rem; text-transform: uppercase; color: var(--yellow); }
.rank-card small { display: block; font-weight: 800; color: var(--muted); }
.rank-bar { height: 8px; margin-top: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffae1a, #ffd34d); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.25); border-top-color: var(--yellow); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seat-list { display: grid; gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); font-weight: 800; }
.seat .dot { width: 12px; height: 12px; border-radius: 50%; background: #777; }
.seat .dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- Packs ---------- */
.pack-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pack-tile { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: 22px; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
.pack-tile h3 { font-size: 1.4rem; }
.pack-tile p { margin: 4px 0 10px; font-weight: 700; font-size: 0.92rem; color: #5a5160; }
.pack-art {
  --pc: var(--yellow);
  position: relative; width: 110px; aspect-ratio: 3 / 4; border-radius: 14px;
  border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 30%),
    repeating-linear-gradient(-45deg, var(--pc) 0 12px, color-mix(in srgb, var(--pc) 80%, #fff) 12px 24px);
  display: grid; place-items: center; overflow: hidden;
}
.pack-art::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 8px; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 10px); opacity: 0.5; }
.pack-art img { width: 64%; aspect-ratio: 1; border-radius: 16%; object-fit: cover; object-position: 38% 45%; border: 4px solid var(--ink); background: #fff; }
.pack-art .label { position: absolute; bottom: 8px; left: 6px; right: 6px; text-align: center; font-family: var(--display); font-size: 0.95rem; background: #fff; border: 3px solid var(--ink); border-radius: 10px; color: var(--ink); }
.pity { margin: 16px 0; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); font-weight: 800; }
.pity .bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); margin-top: 8px; overflow: hidden; }
.pity .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--legendary)); border-radius: inherit; }

.opening { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-rows: auto 1fr auto; padding: calc(16px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); background: radial-gradient(circle at 50% 45%, #5b3fa8, #120c1f 70%); overflow: hidden; }
.opening .title { text-align: center; font-family: var(--display); font-size: 1.6rem; }
.opening .stage { position: relative; display: grid; place-items: center; }
.opening .pack-art { width: min(52vw, 230px); cursor: pointer; animation: packIdle 1.6s ease-in-out infinite; }
.opening .pack-art.shake { animation: packShake 0.5s linear; }
.opening .pack-art.burst { animation: packBurst 0.45s ease-in forwards; }
@keyframes packIdle { 50% { transform: translateY(-8px) rotate(-2deg); } }
@keyframes packShake { 20% { transform: rotate(-8deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(5deg); } }
@keyframes packBurst { to { transform: scale(1.6); opacity: 0; filter: brightness(3); } }
.opening .rays { position: absolute; width: 140vmax; height: 140vmax; background: repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0 10deg, transparent 10deg 20deg); animation: spin 30s linear infinite; pointer-events: none; }
.pull-grid { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 12px; max-width: 760px; }
.pull-grid .flip { --cw: min(28vw, 138px); perspective: 900px; width: var(--cw); aspect-ratio: 5 / 7; animation: dealIn 0.45s cubic-bezier(0.2, 1.3, 0.5, 1) backwards; cursor: pointer; }
.pull-grid .flip .inner { position: relative; width: 100%; height: 100%; transition: transform 0.55s cubic-bezier(0.3, 1.4, 0.5, 1); transform-style: preserve-3d; }
.pull-grid .flip.flipped .inner { transform: rotateY(180deg); }
.pull-grid .flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.pull-grid .flip .face.front { transform: rotateY(180deg); }
.pull-grid .flip.rare .face.back { filter: drop-shadow(0 0 10px var(--rare)); }
.pull-grid .flip.epic .face.back { filter: drop-shadow(0 0 14px var(--epic)); animation: throb 1s ease-in-out infinite; }
.pull-grid .flip.legendary .face.back { filter: drop-shadow(0 0 20px var(--legendary)); animation: throb 0.7s ease-in-out infinite; }
.pull-grid .flip.flipped .face.back { animation: none; }
.pull-grid .flip .tag-new { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%) rotateY(180deg); backface-visibility: hidden; z-index: 7; background: var(--green); color: var(--ink); border: 3px solid var(--ink); border-radius: 99px; padding: 0 10px; font-family: var(--display); font-size: 0.9rem; }
@keyframes dealIn { from { transform: translateY(40vh) scale(0.4) rotate(-20deg); opacity: 0; } }
@keyframes throb { 50% { transform: scale(1.04); } }
.opening .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.legend-flash { position: fixed; inset: 0; z-index: 130; pointer-events: none; background: radial-gradient(circle, rgba(255, 180, 40, 0.8), transparent 60%); animation: flash 0.9s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Collection ---------- */
.filters { position: sticky; top: 0; z-index: 20; display: grid; gap: 8px; padding: 10px 0; margin: 0 -16px 10px; padding-left: 16px; padding-right: 16px; background: linear-gradient(var(--bg-1) 80%, transparent); }
.filters input[type="search"] { width: 100%; padding: 10px 14px; border-radius: 14px; border: 3px solid var(--ink); font-weight: 800; color: var(--ink); background: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 99px; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 0.9rem; }
.chip.on { background-color: var(--yellow); color: var(--ink); border-color: var(--ink); }
.chip.rare.on { background-color: var(--rare); } .chip.epic.on { background-color: var(--epic); } .chip.legendary.on { background-color: var(--legendary); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 18px 12px; padding: 6px 4px 20px; }
@media (min-width: 720px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.grid-cell { position: relative; display: grid; justify-items: center; background: none; border: 0; padding: 0; container-type: inline-size; }
.grid-cell .card { --cw: 100cqi; }
.grid-cell .count { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); z-index: 8; padding: 1px 10px; border-radius: 99px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); font-family: var(--display); font-size: 0.95rem; white-space: nowrap; }
.grid-cell .new { position: absolute; top: -8px; left: -6px; z-index: 8; padding: 0 8px; border-radius: 99px; background: var(--green); color: var(--ink); border: 3px solid var(--ink); font-family: var(--display); font-size: 0.85rem; }
.grid-cell.maxed .card { opacity: 0.45; }
.grid-cell .in-deck { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); z-index: 8; padding: 2px 10px; border-radius: 99px; background: var(--ink); color: var(--yellow); font-family: var(--display); white-space: nowrap; }
.progress-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.empty-note { padding: 30px 12px; text-align: center; color: var(--muted); font-weight: 800; }

/* ---------- Decks ---------- */
.deck-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.deck-tile { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 20px; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 5px 0 var(--ink); text-align: left; }
.deck-tile.active { background-color: var(--green); }
.deck-tile .cover { width: 70px; height: 70px; border-radius: 16px; border: 3px solid var(--ink); background: #fff center / cover; display: grid; place-items: center; font-size: 2rem; }
.deck-tile b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.25rem; }
.deck-tile small { font-weight: 800; color: #5a5160; }
.deck-tile .row { margin-top: 8px; }
.deck-tile.new { place-items: center; grid-template-columns: 1fr; min-height: 104px; border-style: dashed; background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: none; border-color: rgba(255, 255, 255, 0.5); }

.builder { display: grid; gap: 12px; }
.builder-head { display: grid; gap: 10px; }
.builder-head .name-input { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 12px; border: 3px solid var(--ink); font-family: var(--display); font-size: 1.3rem; color: var(--ink); background: #fff; }
.curve { display: flex; align-items: flex-end; gap: 4px; height: 54px; padding: 4px 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); }
.curve div { flex: 1; display: grid; justify-items: center; align-content: end; gap: 2px; height: 100%; font-size: 0.75rem; font-weight: 900; }
.curve i { display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 0 0; background: var(--yellow); }
.tabs { display: flex; gap: 8px; }
.tabs button { flex: 1; padding: 10px; border-radius: 14px; border: 3px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.08); font-family: var(--display); font-size: 1.1rem; }
.tabs button.on { background-color: var(--yellow); color: var(--ink); border-color: var(--ink); }
.deck-rows { display: grid; gap: 6px; }
.deck-row {
  position: relative; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  height: 44px; padding: 0 12px 0 0; border-radius: 12px; overflow: hidden;
  background: #2a2140; border: 2px solid rgba(255, 255, 255, 0.2); text-align: left; color: var(--text);
}
.deck-row .c { height: 100%; display: grid; place-items: center; font-family: var(--display); font-size: 1.2rem; background: #1e5fa8; color: #fff; }
.deck-row .n { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; text-shadow: 0 1px 2px #000; }
.deck-row .x { font-family: var(--display); color: var(--yellow); position: relative; z-index: 1; }
.deck-row .bg { position: absolute; right: 0; top: 0; bottom: 0; width: 55%; background: center / cover; opacity: 0.55; -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%); }
.deck-row.legendary { border-color: var(--legendary); } .deck-row.epic { border-color: var(--epic); } .deck-row.rare { border-color: var(--rare); }
.deck-row.bad { background: #5a2030; }
@media (min-width: 860px) {
  .builder.split { grid-template-columns: 330px 1fr; align-items: start; }
  .builder.split .builder-head { grid-column: 1 / -1; }
  .builder.split .tabs { display: none; }
  .builder.split .pane { display: block !important; }
  .builder.split .pane.deck { position: sticky; top: 8px; max-height: calc(100dvh - 40px); overflow: auto; }
}

/* ---------- Battle ---------- */
body.in-battle { overflow: hidden; position: fixed; inset: 0; }
.battle {
  --mw: min(17vw, 100px);
  --hand-cw: min(24vw, 128px);
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto minmax(0, 1fr) auto calc(var(--hand-cw) * 0.95 + var(--safe-bottom));
  padding-top: var(--safe-top);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #3a2a1d, #2a1d13);
  touch-action: none;
  overflow: hidden;
}
.battle > * { grid-column: 1; min-width: 0; }
.battle .opp-bar { grid-row: 1; } .battle .opp-board { grid-row: 2; } .battle .midline { grid-row: 3; }
.battle .my-board { grid-row: 4; } .battle .my-bar { grid-row: 5; } .battle .hand { grid-row: 6; }
.battle .table {
  grid-row: 2 / 5; margin: 0 max(6px, 1.5vw); z-index: 0; pointer-events: none;
  border-radius: 28px; border: 5px solid #1a120b;
  background: radial-gradient(ellipse at 50% 50%, #3d8a63, var(--felt-2) 80%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 0 0 4px #5a3d24;
}
.hero-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.hero-bar.opp { padding-top: 8px; }
.hero {
  position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%;
  border: 4px solid var(--ink); background: #fff center / contain no-repeat; box-shadow: 0 0 0 3px var(--yellow);
}
.hero.opp { box-shadow: 0 0 0 3px var(--pink); }
.hero .hp {
  position: absolute; right: -10px; bottom: -8px; min-width: 30px; height: 30px; padding: 0 5px; display: grid; place-items: center;
  font-family: var(--display); font-size: 1.1rem; color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill;
  background: radial-gradient(circle at 35% 30%, #ffc0c0, #ff4d4d 60%, #b31e1e); border: 3px solid var(--ink); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.hero .hp.low { animation: throb 0.8s ease-in-out infinite; }
.hero .armor {
  position: absolute; left: -10px; bottom: -8px; min-width: 28px; height: 28px; padding: 0 4px; display: grid; place-items: center;
  font-family: var(--display); color: var(--ink); background: #e8eef5; border: 3px solid var(--ink); border-radius: 8px 8px 50% 50%;
}
.hero-info { min-width: 0; display: grid; gap: 3px; }
.hero-info .nm { font-family: var(--display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.mana { display: flex; align-items: center; gap: 6px; font-family: var(--display); color: var(--yellow); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.mana .pips { display: flex; gap: 2px; }
.mana .pips i { width: 9px; height: 13px; border-radius: 3px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.3); }
.mana .pips i.full { background: linear-gradient(#fff3b0, #ffc21a); border-color: var(--ink); }
.hero-bar .spacer { flex: 1; }
.deck-count, .hand-count { display: grid; place-items: center; min-width: 40px; height: 48px; padding: 0 6px; border-radius: 8px; font-family: var(--display); font-size: 1rem; color: #fff; background: repeating-linear-gradient(45deg, #5b3fa8 0 6px, #4a3290 6px 12px); border: 3px solid var(--ink); }
.hand-count { background: #fffaf0; color: var(--ink); }
.power {
  position: relative; flex: none; width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid var(--ink); background: radial-gradient(circle at 40% 35%, #ffe7a3, #ff9f45); font-size: 1.6rem;
  display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink);
}
.power .pc { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 0.9rem; color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; background: #ffb829; border: 2px solid var(--ink); }
.power.used, .power:disabled { filter: grayscale(1) brightness(0.6); }
.power.ready { animation: readyGlow 1.4s ease-in-out infinite; }
.menu-btn { width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem; background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.3); color: #fff; }

.board {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: max(8px, 2vw);
  padding: 4px 8px; min-height: calc(var(--mw) * 1.25 + 8px);
}
.board:has(> .minion:nth-child(6)) { --mw: min(14.5vw, 100px); gap: max(5px, 1.2vw); }
.opp-hand .card.back .frame::after { display: none; }
.opp-hand .card.back .frame::before { width: 80%; }
.board.drop-ok { background: radial-gradient(ellipse at center, rgba(255, 230, 120, 0.25), transparent 70%); }
.board .hint { color: rgba(255, 255, 255, 0.4); font-weight: 900; font-size: 0.9rem; }
.midline { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 10px; min-height: 48px; }
.midline .line { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); }
.watchers { font-weight: 800; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.battle.spectating .hand { display: none; }
.battle.spectating .power { opacity: 0.5; }
.turn-label { font-family: var(--display); font-size: 0.95rem; color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.end-turn {
  min-width: 112px; min-height: 44px; padding: 6px 14px; border-radius: 14px;
  font-family: var(--display); font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(#fff2a8, #ffc21a); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.end-turn.done { background: linear-gradient(#b8ffc4, #45d168); animation: readyGlow 1.2s ease-in-out infinite; }
.end-turn:disabled { background: #9b93a8; color: #3a3346; animation: none; }
.timer { position: absolute; left: 10px; right: 10px; bottom: -2px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--yellow); transition: width 1s linear; }
.timer.hurry i { background: var(--red); }
@keyframes readyGlow { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 18px 4px rgba(120, 255, 150, 0.85); } }

.minion {
  position: relative; flex: none; width: var(--mw); aspect-ratio: 1.08 / 1; font-size: calc(var(--mw) / 6.5);
  border-radius: 20%;
  transition: transform 0.2s, filter 0.2s;
}
.minion .body {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  border: 0.22em solid var(--ink); background: #f6f4ef;
  box-shadow: inset 0 0 0 0.16em var(--cat, #ffd34d), 0 0.25em 0 rgba(0, 0, 0, 0.5);
}
.minion .body img { width: 100%; height: 100%; object-fit: contain; padding: 0.2em 0.15em 0.55em; }
.minion .body .emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6em; }
.minion.legendary .body { border-color: #6a3b00; box-shadow: 0 0 0 0.14em var(--legendary), 0 0.25em 0 rgba(0, 0, 0, 0.5); }
.minion.guard::before {
  content: ""; position: absolute; inset: -0.45em -0.35em -0.3em; z-index: -1;
  background: linear-gradient(#e8eef5, #9aa6b5); border: 0.2em solid var(--ink);
  clip-path: polygon(50% 0, 100% 12%, 100% 60%, 50% 100%, 0 60%, 0 12%);
}
.minion.fluffy .body::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0.6em 0.3em rgba(255, 236, 150, 0.95); background: rgba(255, 245, 200, 0.18); }
.minion.tough .body { outline: 0.18em solid rgba(150, 140, 125, 0.95); outline-offset: -0.18em; }
.minion.fluffy { filter: drop-shadow(0 0 0.35em rgba(255, 225, 100, 0.95)); }
.minion.sneaky .body { opacity: 0.55; border-style: dashed; }
.minion.silenced .body { filter: grayscale(0.85) brightness(0.9); }
.minion.frozen .body::before { content: "💤"; position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font-size: 1.8em; background: rgba(130, 190, 255, 0.45); }
.minion.can-attack { filter: drop-shadow(0 0 0.35em #6dff8c) drop-shadow(0 0 0.2em #6dff8c); }
.minion.selected { transform: translateY(-8%) scale(1.08); filter: drop-shadow(0 0 0.5em #fff) drop-shadow(0 0 0.3em var(--yellow)); }
.minion.sick::after { content: "zZ"; position: absolute; right: -0.1em; top: -0.3em; font-family: var(--display); font-size: 0.9em; color: #fff; text-shadow: 0 0 4px #000; }
.minion .atk, .minion .hp {
  position: absolute; bottom: -0.35em; z-index: 3; width: 1.9em; height: 1.9em; display: grid; place-items: center;
  font-family: var(--display); font-size: 1.15em; color: #fff; -webkit-text-stroke: 0.07em var(--ink); paint-order: stroke fill; border: 0.13em solid var(--ink);
}
.minion .atk { left: -0.35em; background: radial-gradient(circle at 35% 30%, #fff1a8, #ffc21a 60%, #d68a00); border-radius: 40% 60% 50% 50%; }
.minion .hp { right: -0.35em; background: radial-gradient(circle at 35% 30%, #ffc0c0, #ff4d4d 60%, #b31e1e); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.minion .hp.hurt { color: #ffd0d0; }
.minion .buffed { color: #b6ffbe; }
.minion .icons { position: absolute; top: -0.4em; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 0.1em; font-size: 0.85em; filter: drop-shadow(0 1px 1px #000); white-space: nowrap; }
.minion.shiny .body::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 20%, rgba(255, 0, 170, 0.35) 35%, rgba(0, 255, 170, 0.35) 50%, transparent 65%); background-size: 300% 300%; mix-blend-mode: color-dodge; animation: holo 3.2s linear infinite; }

.targetable { cursor: crosshair; }
.minion.targetable, .hero.targetable { animation: targetPulse 0.9s ease-in-out infinite; }
@keyframes targetPulse { 50% { filter: drop-shadow(0 0 0.5em #ff4d4d) drop-shadow(0 0 0.25em #ff4d4d); } }
.minion.friendly-target, .hero.friendly-target { animation: friendPulse 0.9s ease-in-out infinite; }
@keyframes friendPulse { 50% { filter: drop-shadow(0 0 0.5em #6dd3ff) drop-shadow(0 0 0.25em #6dd3ff); } }
.hero.targetable { box-shadow: 0 0 0 3px #ff4d4d, 0 0 20px 6px rgba(255, 77, 77, 0.7); }
.hero.friendly-target { box-shadow: 0 0 0 3px #6dd3ff, 0 0 20px 6px rgba(109, 211, 255, 0.7); }

.hand {
  position: relative; z-index: 5;
  height: 100%;
}
.hand .hcard {
  position: absolute; bottom: calc(-0.3 * var(--hand-cw) * 1.4 + var(--safe-bottom)); left: 50%;
  width: var(--hand-cw); transform-origin: 50% 110%;
  transition: transform 0.18s ease-out, filter 0.18s;
}
.hand .hcard .card { --cw: var(--hand-cw); }
.hand .hcard.playable .card .frame { box-shadow: 0 0 0 0.2em #6dff8c, 0 0 1em 0.3em rgba(109, 255, 140, 0.6); }
.hand .hcard.selected { z-index: 30 !important; }
.hand .hcard.dragging { transition: none; z-index: 40 !important; pointer-events: none; }
.hand .hcard.drawn { animation: drawIn 0.45s ease-out; }
@keyframes drawIn { from { opacity: 0; translate: 40vw -20vh; } }
.opp-hand { display: flex; }
.opp-hand .card { --cw: 22px; margin-left: -12px; }
.opp-hand .card:first-child { margin-left: 0; }

.arrow-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.arrow-layer path { fill: none; stroke: #ff4d4d; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 2 14; filter: drop-shadow(0 0 4px #000); animation: dash 0.5s linear infinite; }
.arrow-layer path.friendly { stroke: #6dd3ff; }
.arrow-layer circle { fill: #ff4d4d; stroke: var(--ink); stroke-width: 3; }
@keyframes dash { to { stroke-dashoffset: -16; } }

.float-num {
  position: fixed; z-index: 80; pointer-events: none; transform: translate(-50%, -50%);
  font-family: var(--display); font-size: 2rem; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  animation: floatUp 1s ease-out forwards;
}
.float-num.dmg { color: #ff5d5d; font-size: 2.4rem; }
.float-num.dmg::before { content: ""; position: absolute; inset: -30% -40%; z-index: -1; background: #ffd34d; clip-path: polygon(50% 0, 61% 30%, 95% 20%, 72% 48%, 100% 70%, 64% 68%, 55% 100%, 42% 70%, 5% 85%, 28% 55%, 0 30%, 36% 32%); border: 0; }
.float-num.heal { color: #7fe08f; }
.float-num.buff { color: #b6ffbe; font-size: 1.5rem; }
.float-num.info { color: #8ed3ff; font-size: 1.4rem; }
@keyframes floatUp { 0% { transform: translate(-50%, -30%) scale(0.6); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -110%) scale(1); opacity: 0; } }
.shake { animation: shake 0.35s linear; }
@keyframes shake { 20% { translate: -5px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 3px 0; } }
.dying { animation: dying 0.5s ease-in forwards; }
@keyframes dying { to { transform: scale(0.2) rotate(25deg); opacity: 0; filter: grayscale(1); } }
.summoned { animation: summon 0.45s cubic-bezier(0.2, 1.5, 0.5, 1); }
@keyframes summon { from { transform: translateY(-30%) scale(1.5); opacity: 0; } }
.pop-shield { animation: popShield 0.5s ease-out; }
@keyframes popShield { 30% { filter: drop-shadow(0 0 1.2em #fff6b0) brightness(1.6); } }

.reveal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; }
.reveal .card { --cw: min(46vw, 210px); animation: revealIn 1.8s ease-in-out forwards; }
@keyframes revealIn { 0% { transform: translateY(-40vh) scale(0.3) rotate(-10deg); opacity: 0; } 20% { transform: none; opacity: 1; } 80% { transform: none; opacity: 1; } 100% { transform: translateY(-10vh) scale(0.5); opacity: 0; } }

.banner { position: fixed; left: 0; right: 0; top: 50%; z-index: 75; transform: translateY(-50%); pointer-events: none; display: grid; place-items: center; }
.banner div {
  font-family: var(--display); font-size: clamp(2.2rem, 10vw, 4rem); text-transform: uppercase; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill;
  padding: 10px 40px; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.6) 20%, rgba(0, 0, 0, 0.6) 80%, transparent);
  animation: banner 1.3s ease-in-out forwards; white-space: nowrap;
}
@keyframes banner { 0% { transform: scale(2); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(0.9); } }

.card-tip {
  position: fixed; z-index: 45; left: 50%; bottom: calc(var(--hand-cw) * 1.05 + var(--safe-bottom));
  transform: translateX(-50%); max-width: 92vw;
  padding: 6px 14px; border-radius: 99px; background: rgba(0, 0, 0, 0.75); color: #fff; font-weight: 800; font-size: 0.9rem; pointer-events: none; text-align: center;
}
.preview-card { position: fixed; z-index: 44; pointer-events: none; }
.preview-card .card { --cw: min(40vw, 190px); }

.bubble {
  position: absolute; z-index: 50; padding: 8px 14px; border-radius: 16px; background: #fff; color: var(--ink);
  border: 3px solid var(--ink); font-family: var(--display); font-size: 1.1rem; white-space: nowrap; animation: bubble 2.2s ease-in-out forwards; pointer-events: none;
}
@keyframes bubble { 0% { transform: scale(0.4); opacity: 0; } 10% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.emote-menu { position: absolute; z-index: 55; display: grid; grid-template-columns: repeat(2, auto); gap: 6px; }
.emote-menu button { padding: 8px 12px; border-radius: 14px; background: #fff; color: var(--ink); border: 3px solid var(--ink); font-family: var(--display); font-size: 1rem; box-shadow: 0 3px 0 var(--ink); }

.result { text-align: center; }
.result h2 { font-size: 6rem; line-height: 1; color: #fff; -webkit-text-stroke: 4px #000; paint-order: stroke fill; text-shadow: 0 6px 0 #000; }
.result.win h2 { color: #7fe08f; }
.result.lose h2 { color: #ff6b6b; }
.result .portrait { width: 140px; height: 110px; margin: 8px auto; border-radius: 18px; border: 5px solid var(--ink); background: #fff center / contain no-repeat; }
.result .reward { display: inline-flex; gap: 8px; align-items: center; font-family: var(--display); font-size: 1.4rem; margin: 6px 0; padding: 6px 16px; border-radius: 99px; background: #2b2140; color: var(--yellow); border: 3px solid var(--ink); }
.result .rank-reward { color: #c9b6ff; }
.result.sheet { background: linear-gradient(180deg, #fff6d6, #ffe6a0); }
.result.lose.sheet { background: linear-gradient(180deg, #ece8f4, #cfc8de); }
.log-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.log-list div { padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.06); font-weight: 700; }
.log-list div.me { background: rgba(127, 224, 143, 0.3); }
.log-list div.opp { background: rgba(255, 139, 209, 0.25); }
.rules h3 { font-size: 1.25rem; margin-top: 14px; }
.rules ul { padding-left: 20px; margin: 6px 0; }
.rules li { margin: 4px 0; font-weight: 700; }

@media (min-width: 700px) {
  .battle { --mw: min(12vw, 120px); --hand-cw: min(15vw, 140px); }
  .hero { width: 72px; height: 72px; }
  .hero-info .nm { font-size: 1.25rem; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .battle { --mw: min(10vh, 64px); --hand-cw: min(16vh, 86px); }
  .hero { width: 44px; height: 44px; }
  .hero-bar { padding: 2px 10px; }
  .midline { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* BARK FART */
.bark-word { color: #fff; font-size: 1.8rem; }
.fart-word { color: #b6e05a; font-size: 2.2rem; animation-duration: 1.2s; }
.fart-cloud {
  position: fixed; z-index: 79; pointer-events: none; font-size: 3rem; transform: translate(-50%, -50%);
  filter: hue-rotate(40deg) saturate(2) drop-shadow(0 0 10px rgba(160, 220, 60, 0.9));
  animation: fartCloud 1.2s ease-out forwards;
}
@keyframes fartCloud { 0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(-150%, -60%) scale(2.6); opacity: 0; } }

/* ---------- Shine pass: gloss, glints, metallic accents ---------- */
.btn, .tile, .choice, .deck-chip, .pack-tile, .deck-tile:not(.new), .chip.on, .tabs button.on {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.12) 48%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.08) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 4px 0 var(--ink);
}
.end-turn { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.8), 0 4px 0 var(--ink); }
.btn:active, .tile:active { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 1px 0 var(--ink); }
.btn.ghost { background-image: none; box-shadow: none; }
.btn.big.primary, .tile, .pack-tile { position: relative; overflow: hidden; }
.btn.big.primary::after, .tile::after, .pack-tile::after {
  content: ""; position: absolute; top: -50%; bottom: -50%; left: -60%; width: 35%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: skewX(-20deg); animation: sheen 4.5s ease-in-out infinite;
}
/* Tiles clip for the sheen, so their count badges sit inside the corner instead of poking out. */
.tile .badge { top: 10px; right: 10px; z-index: 1; }
.tile:nth-child(2)::after { animation-delay: 0.6s; } .tile:nth-child(3)::after { animation-delay: 1.2s; }
.tile:nth-child(4)::after { animation-delay: 1.8s; } .tile:nth-child(5)::after { animation-delay: 2.4s; } .tile:nth-child(6)::after { animation-delay: 3s; }
@keyframes sheen { 0%, 60% { left: -60%; } 85%, 100% { left: 130%; } }

.logo h1 { color: #ffd84d; text-shadow: 0 4px 0 #000, 0 0 18px rgba(255, 200, 60, 0.7), 0 0 40px rgba(255, 170, 30, 0.35); }
.logo img { box-shadow: 0 0 0 4px var(--yellow), 0 0 22px rgba(255, 211, 77, 0.6); }

/* Cards: glossy laminate + rarity glints. */
.card:not(.back) .frame::before {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.08) 28%, transparent 45%, transparent 75%, rgba(255, 255, 255, 0.15) 100%);
}
.card.rare .frame, .card.epic .frame, .card.legendary .frame { background-size: 100% 100%; }
.card.rare:not(.back) .frame::before, .card.epic:not(.back) .frame::before, .card.legendary:not(.back) .frame::before {
  background:
    linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.7) 45%, transparent 55%) -150% 0 / 250% 100% no-repeat,
    linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.08) 28%, transparent 45%, transparent 75%, rgba(255, 255, 255, 0.15) 100%);
  animation: glint 3.8s ease-in-out infinite;
}
@keyframes glint { 0%, 55% { background-position: -150% 0, 0 0; } 90%, 100% { background-position: 250% 0, 0 0; } }
.card.epic { filter: drop-shadow(0 0 0.35em rgba(179, 92, 255, 0.75)); }
.card.legendary { filter: drop-shadow(0 0 0.5em rgba(255, 170, 30, 0.9)); }
.card.legendary .frame { background: linear-gradient(160deg, #fff6c9, var(--cat) 45%, #ffcf4d 70%, var(--cat)); }
.card.locked { filter: grayscale(1) brightness(0.55); }
.card .cost, .card .atk, .card .hp, .minion .atk, .minion .hp, .hero .hp, .power {
  box-shadow: inset 0 0.18em 0.1em rgba(255, 255, 255, 0.75), inset 0 -0.15em 0.2em rgba(0, 0, 0, 0.25);
}
.card .gem { box-shadow: inset 0.08em 0.08em 0.1em rgba(255, 255, 255, 0.9), 0 0 0.4em var(--rc); }

/* Board: polished felt and glossy minion tiles. */
.battle .table {
  background:
    radial-gradient(ellipse 70% 40% at 50% 8%, rgba(255, 255, 255, 0.12), transparent 70%),
    radial-gradient(ellipse at 50% 50%, #3d8a63, var(--felt-2) 80%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 0 0 4px #5a3d24, 0 0 0 7px #c9a24a, 0 0 18px 6px rgba(201, 162, 74, 0.25);
}
.minion .body { box-shadow: inset 0 0 0 0.16em var(--cat, #ffd34d), inset 0 0.5em 0.6em -0.3em rgba(255, 255, 255, 0.9), 0 0.25em 0 rgba(0, 0, 0, 0.5); }
.minion.legendary .body { box-shadow: inset 0 0 0 0.16em var(--legendary), 0 0 0.6em 0.1em rgba(255, 170, 30, 0.85), 0 0.25em 0 rgba(0, 0, 0, 0.5); }
.minion.epic .body { box-shadow: inset 0 0 0 0.16em var(--epic), 0 0 0.5em rgba(179, 92, 255, 0.7), 0 0.25em 0 rgba(0, 0, 0, 0.5); }
.hero { box-shadow: 0 0 0 3px var(--yellow), 0 0 16px rgba(255, 211, 77, 0.55); }
.hero.opp { box-shadow: 0 0 0 3px var(--pink), 0 0 16px rgba(255, 139, 209, 0.55); }
.coins-pill { background: linear-gradient(180deg, #3a2e52, #1d1628); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 12px rgba(255, 211, 77, 0.35); }
.pack-art { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35), 0 5px 0 var(--ink), 0 0 18px rgba(255, 255, 255, 0.25); }
.pack-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.8) 42%, transparent 54%) -150% 0 / 250% 100% no-repeat;
  animation: glint 3s ease-in-out infinite;
}

/* =====================================================================
   Flash pass: animated backdrop, neon panels, rainbow rims, particles
   ===================================================================== */
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes rim { to { --angle: 360deg; } }
@keyframes aurora { 0% { transform: translate(0, 0) rotate(0deg) scale(1); } 50% { transform: translate(3%, -2%) rotate(8deg) scale(1.08); } 100% { transform: translate(-3%, 3%) rotate(-6deg) scale(1.02); } }
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 0.7; } }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes pulseGlow { 50% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.8), 0 6px 0 var(--ink), 0 0 36px 10px rgba(255, 200, 50, 0.6); } }

body { background: #0b0912; }
body::before {
  content: ""; position: fixed; inset: -25%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40% 35% at 20% 25%, rgba(155, 107, 255, 0.55), transparent 70%),
    radial-gradient(35% 30% at 80% 20%, rgba(255, 95, 200, 0.42), transparent 70%),
    radial-gradient(40% 35% at 70% 80%, rgba(69, 200, 255, 0.38), transparent 70%),
    radial-gradient(35% 30% at 25% 85%, rgba(255, 211, 77, 0.28), transparent 70%);
  filter: blur(30px);
  animation: aurora 22s ease-in-out infinite alternate;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 120px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 160px 60px, #ffe9a8, transparent),
    radial-gradient(1px 1px at 220px 170px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 300px 90px, #c9b6ff, transparent);
  background-size: 320px 220px;
  animation: twinkle 6s ease-in-out infinite alternate;
}

/* Home */
.logo h1 {
  font-size: clamp(2.8rem, 12vw, 4.8rem);
  background: linear-gradient(100deg, #fff 0%, #ffe066 30%, #ff9f45 45%, #ff5fc8 60%, #9b6bff 75%, #45c8ff 90%, #fff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 0; text-shadow: none;
  filter: drop-shadow(0 4px 0 #000) drop-shadow(0 0 18px rgba(255, 160, 60, 0.45));
  animation: titleShine 6s linear infinite;
}
@keyframes titleShine { to { background-position: -250% 0; } }
.logo h1 small { background: none; -webkit-text-fill-color: var(--muted); color: var(--muted); filter: none; }
.logo img { animation: bob 3s ease-in-out infinite; }
.home-hero {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 211, 77, 0.35), transparent 60%),
    linear-gradient(135deg, #2b1d52, #16112a 60%, #251044);
  border: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); isolation: isolate;
}
.home-hero::before, .online-card::before, .pack-tile::before, .tile::before, .battle .table::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 3px; pointer-events: none;
  background: conic-gradient(from var(--angle, 0deg), #ffd34d, #ff5fc8, #9b6bff, #45c8ff, #5cf08a, #ffd34d);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: rim 6s linear infinite;
}
.home-hero h2 { font-size: 2rem; text-transform: uppercase; }
.btn.big.primary { animation: pulseGlow 2.2s ease-in-out infinite; font-size: 1.8rem; text-transform: uppercase; }
.btn { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.btn.primary, .btn.go, .btn.hot, .btn.pink, .btn.blue, .btn.danger { border-color: #000; }
.btn.primary { background-image: linear-gradient(180deg, #fff3a8 0%, #ffd34d 45%, #ffae1a 100%); }
.btn.blue { background-image: linear-gradient(180deg, #c9f0ff 0%, #45c8ff 55%, #1f8fd6 100%); }
.btn.pink { background-image: linear-gradient(180deg, #ffd0ef 0%, #ff5fc8 55%, #d6269b 100%); color: #fff; text-shadow: 0 1px 0 #000; }
.btn.go { background-image: linear-gradient(180deg, #d0ffd9 0%, #5cf08a 55%, #1fb14c 100%); }
.btn.danger { background-image: linear-gradient(180deg, #ffc2c2 0%, #ff5d5d 55%, #c21e1e 100%); color: #fff; text-shadow: 0 1px 0 #000; }

.tile {
  color: var(--text); isolation: isolate; border: 0;
  background-color: rgba(28, 22, 44, 0.78) !important;
  background-image: radial-gradient(120% 90% at 0% 0%, var(--tile-c, #ffd34d) -40%, transparent 55%) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.tile::before { background: linear-gradient(135deg, var(--tile-c, #ffd34d), transparent 45%, var(--tile-c, #ffd34d)); animation: none; }
.tile.yellow { --tile-c: #ffd34d; } .tile.pink { --tile-c: #ff5fc8; } .tile.blue { --tile-c: #45c8ff; }
.tile.green { --tile-c: #5cf08a; } .tile.orange { --tile-c: #ff9f45; } .tile.white { --tile-c: #c9b6ff; }
.tile b { font-family: var(--display); font-size: 1.45rem; text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 #000; }
.tile span { color: var(--muted); }
.tile .ico { font-size: 2.3rem; filter: drop-shadow(0 0 10px var(--tile-c)); animation: bob 3.2s ease-in-out infinite; display: inline-block; }
.tile:nth-child(2n) .ico { animation-delay: -1.6s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 0 26px var(--tile-c), 0 10px 30px rgba(0, 0, 0, 0.4); }

/* Panels & sheets go dark glass */
.pack-tile, .deck-tile:not(.new), .choice, .deck-chip {
  color: var(--text); isolation: isolate; border-color: rgba(255, 255, 255, 0.18);
  background-color: rgba(28, 22, 44, 0.8) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.pack-tile { border: 0; }
.pack-tile p, .choice small, .deck-chip small, .deck-tile small { color: var(--muted); }
.choice.selected, .deck-chip.selected, .deck-tile.active { box-shadow: 0 0 0 3px var(--yellow), 0 0 26px rgba(255, 211, 77, 0.55); }
.choice > img { box-shadow: 0 0 0 3px var(--yellow); background: #fff; object-fit: contain; }
.online-card { position: relative; isolation: isolate; border: 0; background: rgba(28, 22, 44, 0.6); }
/* The rim is a border-box background (not a ::before) so it stays put when a long sheet scrolls. */
.modal .sheet {
  --rim: conic-gradient(from var(--angle, 0deg), #ffd34d, #ff5fc8, #9b6bff, #45c8ff, #5cf08a, #ffd34d) border-box;
  position: relative; isolation: isolate; color: var(--text); border: 3px solid transparent;
  background: linear-gradient(160deg, #2a2140, #15101f) padding-box, var(--rim);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(155, 107, 255, 0.25);
  animation: popIn 0.22s cubic-bezier(0.2, 1.4, 0.5, 1), rim 6s linear infinite;
}
.sheet p, .rules li { color: #e9e2f7; }
.sheet .muted { color: var(--muted) !important; }
.sheet input[type="text"] { background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.3); }
.sheet h2 { font-size: 2.2rem; text-transform: uppercase; color: var(--yellow); text-shadow: 0 3px 0 #000; }
.rules h3 { color: #fff; }
.log-list div { background: rgba(255, 255, 255, 0.06); color: #eee; }
.inspect .details { background: linear-gradient(160deg, #2a2140, #15101f); color: #f0eaff; border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.result.sheet, .result.lose.sheet { background: radial-gradient(circle at 50% 20%, #3b2a67, #140f22 70%) padding-box, var(--rim); }
.result h2 { font-size: 7rem; }
.result.win h2 { color: #7dff9c; text-shadow: 0 6px 0 #000, 0 0 40px rgba(92, 240, 138, 0.8); }
.result.lose h2 { color: #ff6b6b; text-shadow: 0 6px 0 #000, 0 0 40px rgba(255, 90, 90, 0.7); }
.filters { background: linear-gradient(rgba(11, 9, 18, 0.95) 80%, transparent); }
.topbar h2 { text-transform: uppercase; font-size: 2rem; text-shadow: 0 3px 0 #000, 0 0 20px rgba(155, 107, 255, 0.6); }

/* Cards: rainbow edge on legendaries, pulse on epics */
.card.legendary:not(.locked)::after {
  content: ""; position: absolute; inset: -0.25em; z-index: -1; border-radius: 1.1em;
  background: conic-gradient(from var(--angle, 0deg), #ffd34d, #ff5fc8, #9b6bff, #45c8ff, #5cf08a, #ffd34d);
  filter: blur(0.25em); animation: rim 3s linear infinite;
}
.card.epic { animation: epicPulse 2.4s ease-in-out infinite; }
@keyframes epicPulse { 50% { filter: drop-shadow(0 0 0.7em rgba(179, 92, 255, 1)); } }

/* Battle table */
.battle { background: radial-gradient(ellipse at 50% 50%, #2c2150, #0b0912 75%); }
.battle .table {
  position: relative; isolation: isolate; border: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% 8%, rgba(255, 255, 255, 0.14), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 10px, transparent 10px 20px),
    radial-gradient(ellipse at 50% 50%, #2f7d5a, #123a2a 85%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(155, 107, 255, 0.35);
}
.battle .table::before { padding: 4px; }
.hero { box-shadow: 0 0 0 3px var(--yellow), 0 0 22px 4px rgba(255, 211, 77, 0.6); }
.hero.opp { box-shadow: 0 0 0 3px var(--pink), 0 0 22px 4px rgba(255, 95, 200, 0.6); }
.hero-info .nm { text-transform: uppercase; letter-spacing: 0.03em; }
.end-turn { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em; font-size: 1.2rem; }
.end-turn.done { animation: pulseGlow 1.2s ease-in-out infinite; }
.power:not(:disabled) { box-shadow: 0 0 0 3px #9dff5c, 0 0 20px rgba(157, 255, 92, 0.7), 0 3px 0 var(--ink); }
.quake { animation: quake 0.3s linear; }
.quake-big { animation: quakeBig 0.5s linear; }
@keyframes quake { 25% { transform: translate(-3px, 2px); } 50% { transform: translate(3px, -2px); } 75% { transform: translate(-2px, -1px); } }
@keyframes quakeBig { 10% { transform: translate(-9px, 5px) rotate(-0.6deg); } 30% { transform: translate(8px, -6px) rotate(0.5deg); } 50% { transform: translate(-6px, 3px); } 70% { transform: translate(4px, -2px); } 90% { transform: translate(-2px, 1px); } }
.particle { position: fixed; z-index: 85; width: 9px; height: 9px; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); box-shadow: 0 0 8px currentColor; animation: particle 0.75s ease-out forwards; }
.particle.poof { width: 12px; height: 12px; border-radius: 3px; }
@keyframes particle { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2) rotate(200deg); opacity: 0; } }
.float-num.dmg.big { font-size: 3.4rem; }
.banner.legend div { color: #ffd34d; background: linear-gradient(90deg, transparent, rgba(80, 40, 0, 0.75) 20%, rgba(80, 40, 0, 0.75) 80%, transparent); text-shadow: 0 0 30px rgba(255, 200, 60, 0.9); }
.banner div { text-shadow: 0 0 30px rgba(155, 107, 255, 0.9); }

/* Hand: unaffordable cards */
.hand .hcard.pricey .card .cost { background: radial-gradient(circle at 35% 30%, #ffc0c0, #ff4d4d 55%, #8f1414); }
.hand .hcard.pricey:not(.selected) .card { filter: brightness(0.82) saturate(0.85); }
.hand .hcard.selected .card { filter: drop-shadow(0 0 0.6em rgba(255, 255, 255, 0.8)); }
.hand .hcard.selected .card .frame { box-shadow: 0 0 0 0.15em #fff, 0 0.3em 0 var(--ink); }

/* Hint bar with a Details button, centered on the table */
.card-tip {
  bottom: auto; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px;
  background: rgba(10, 8, 18, 0.88); border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(155, 107, 255, 0.4);
  pointer-events: auto; z-index: 46;
}
.card-tip button { pointer-events: auto; padding: 6px 12px; border-radius: 99px; border: 0; background: var(--yellow); color: var(--ink); font-weight: 900; }

/* Recently played strip on the center line */
.history { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; overflow: hidden; padding: 0 4px; }
.hist {
  position: relative; flex: none; width: 34px; height: 40px; padding: 0; border-radius: 8px; overflow: visible;
  background: #fff; border: 2px solid #000; display: grid; place-items: center; font-size: 1.2rem;
  animation: histIn 0.35s cubic-bezier(0.2, 1.5, 0.5, 1);
}
.hist img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.hist em { position: absolute; left: -6px; top: -7px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-family: var(--display); font-size: 0.7rem; color: #fff; -webkit-text-stroke: 0.5px #000; background: #ffb829; border: 1.5px solid #000; }
.hist.mine { box-shadow: 0 0 0 2px var(--yellow), 0 0 10px rgba(255, 211, 77, 0.6); }
.hist.theirs { box-shadow: 0 0 0 2px var(--pink), 0 0 10px rgba(255, 95, 200, 0.6); }
.hist.legendary { outline: 2px solid var(--legendary); }
@keyframes histIn { from { transform: scale(0) rotate(-20deg); } }

/* Starting-hand swap screen */
.mulligan { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, rgba(60, 40, 110, 0.92), rgba(8, 6, 14, 0.96)); animation: fadeIn 0.25s; }
.mulligan-box { width: min(760px, 100%); text-align: center; }
.mulligan h2 { font-size: clamp(2.4rem, 9vw, 3.6rem); text-transform: uppercase; color: var(--yellow); text-shadow: 0 4px 0 #000, 0 0 30px rgba(255, 200, 60, 0.6); }
.mulligan p { color: var(--muted); font-weight: 800; margin: 4px 0 16px; }
.mulligan-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 18px; }
.mull-card { position: relative; padding: 0; border: 0; background: none; --cw: min(28vw, 150px); transition: transform 0.2s; animation: dealIn 0.45s cubic-bezier(0.2, 1.3, 0.5, 1) backwards; }
.mull-card:nth-child(2) { animation-delay: 0.08s; } .mull-card:nth-child(3) { animation-delay: 0.16s; } .mull-card:nth-child(4) { animation-delay: 0.24s; } .mull-card:nth-child(5) { animation-delay: 0.32s; }
.mull-card .swap-x { position: absolute; inset: 0; z-index: 9; display: none; place-items: center; border-radius: 0.9em; background: rgba(200, 20, 40, 0.55); color: #fff; font-family: var(--display); font-size: 1.8rem; letter-spacing: 0.05em; text-shadow: 0 2px 0 #000; }
.mull-card.picked { transform: translateY(10px) rotate(-4deg) scale(0.94); }
.mull-card.picked .swap-x { display: grid; }
.mulligan .actions { justify-content: center; }

/* Confetti for wins */
.confetti { position: fixed; top: -20px; z-index: 160; width: 10px; height: 16px; pointer-events: none; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); } }
.card-tip span, .card-tip button { white-space: nowrap; }
.card-tip { max-width: 94vw; font-size: 0.85rem; }

/* Accounts */
.account-pill { cursor: pointer; color: var(--text); background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.welcome-actions { display: grid; gap: 10px; margin: 16px 0 10px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; font-weight: 900; color: var(--yellow); text-transform: uppercase; font-size: 0.82rem; letter-spacing: 0.04em; }
.auth-form input { width: 100%; padding: 12px 14px; border-radius: 14px; font-size: 1.05rem; font-weight: 800; color: var(--text); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.3); text-transform: none; letter-spacing: 0; }
.auth-form input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.3); }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 70, 90, 0.18); border: 1px solid rgba(255, 90, 90, 0.6); color: #ffd0d0 !important; font-weight: 800; }
.save-nudge {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 16px; border-radius: 18px; color: var(--text); font-weight: 700;
  background: linear-gradient(90deg, rgba(255, 95, 200, 0.28), rgba(155, 107, 255, 0.28));
  border: 1px solid rgba(255, 95, 200, 0.6); box-shadow: 0 0 20px rgba(255, 95, 200, 0.25);
}
.save-nudge span { margin-left: auto; font-weight: 900; color: var(--yellow); }
.sheet input[readonly] { opacity: 0.7; }

/* The raised card never blocks taps: they go through to the table and targets behind it. */
.hand .hcard.selected { pointer-events: none; }
.hand .hcard.selected.aiming .card { filter: drop-shadow(0 0 0.5em rgba(255, 90, 90, 0.9)); }

/* Hint bar: sits just under the center line (so End Turn stays visible) and always fits. */
.card-tip { transform: translate(-50%, 0); max-width: calc(100vw - 24px); gap: 8px; font-size: 0.82rem; }
.card-tip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-tip button { flex: none; padding: 5px 10px; }

/* Starting-hand screen: fit short phones (cards shrink with height, screen scrolls,
   and the Keep/Swap button stays pinned at the bottom). */
.mulligan { overflow-y: auto; place-items: start center; padding-bottom: calc(16px + var(--safe-bottom)); }
.mulligan-box { margin: auto 0; }
.mull-card { --cw: min(28vw, 150px, 22vh); }
.mulligan h2 { font-size: clamp(2rem, 8vw, 3.6rem); }
.mulligan .actions { position: sticky; bottom: 0; padding-top: 10px; background: linear-gradient(transparent, rgba(8, 6, 14, 0.95) 40%); }
/* The hint never catches taps meant for the table; only its Details button is tappable. */
.card-tip { pointer-events: none; }
.card-tip [data-details] { pointer-events: auto; }

/* Tutorial coach */
.coach { position: fixed; inset: 0; z-index: 140; pointer-events: none; }
.coach.blocking { pointer-events: auto; }
.coach-ring { position: fixed; display: none; border: 4px solid var(--yellow, #ffd34d); border-radius: 16px; pointer-events: none; animation: coachPulse 1.2s ease-in-out infinite; }
.coach.blocking .coach-ring { box-shadow: 0 0 0 200vmax rgba(10, 6, 20, 0.6); }
.coach-bubble { position: fixed; width: min(320px, calc(100vw - 16px)); padding: 12px 14px; border: 3px solid #1f1f1f; border-radius: 16px; background: #fff8e6; color: #1f1f1f; font-weight: 700; line-height: 1.35; pointer-events: auto; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.coach-bubble p { margin: 0 0 8px; }
.coach-bubble small { display: block; text-align: right; font-weight: 900; color: #9b6bff; }
.coach-bubble .btn { display: block; margin-left: auto; }
@keyframes coachPulse { 50% { border-color: #fff; transform: scale(1.03); } }
.coach:not(.blocking) .coach-bubble { pointer-events: none; opacity: 0.94; }
/* Hint bar: small and see-through; the text fades after a moment, leaving just Details. */
.card-tip { padding: 3px 3px 3px 10px; gap: 6px; font-size: 0.74rem; background: rgba(10, 8, 18, 0.55); border: 0; box-shadow: none; backdrop-filter: blur(3px); }
.card-tip button { padding: 3px 9px; font-size: 0.72rem; }
.card-tip span { max-width: 70vw; animation: tipFade 0.5s ease 2.5s forwards; }
.card-tip span:only-child { margin-right: 7px; animation: none; }
@keyframes tipFade { to { opacity: 0; max-width: 0; margin-right: -6px; } }

/* Deck builder: hero power flavor picker */
.power-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.power-pick button { display: grid; justify-items: center; gap: 1px; padding: 6px 4px; border-radius: 12px; border: 3px solid var(--ink); background: rgba(255, 255, 255, 0.08); color: inherit; font: inherit; cursor: pointer; }
.power-pick button span { font-size: 1.4rem; line-height: 1.1; }
.power-pick button b { font-size: 0.72rem; line-height: 1.1; text-align: center; }
.power-pick button small { font-size: 0.62rem; opacity: 0.8; }
.power-pick button.on { background: var(--yellow); color: var(--ink); box-shadow: 0 0 0 2px var(--yellow); }
.power-text { margin: 0; font-size: 0.85rem; }

/* Admin: all registered players on the Friends screen */
.admin-players input[type="search"] { width: 100%; padding: 8px 12px; border-radius: 12px; border: 3px solid var(--ink); font: inherit; text-transform: none; }
.admin-players [data-admin-list] { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.details .creator { font-weight: 800; opacity: 0.9; }

/* Trophy Room */
.tile.wide { grid-column: 1 / -1; }
.tile.gold { --tile-c: #ffb829; background-color: #ffcf5a; }
.trophy-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; border-radius: 18px; background: rgba(255, 184, 41, 0.14); border: 2px solid rgba(255, 184, 41, 0.5); font-weight: 900; }
.trophy-summary div { flex: 1; min-width: 140px; }
.trophy-summary b { font-family: var(--display); font-size: 2rem; color: #ffcf5a; }
.trophy-summary small { margin-left: 6px; color: var(--muted); }
.trophy-summary span { font-size: 1.1rem; }
.trophy-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.trophy { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.08); }
.trophy-icon { position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; background: rgba(0, 0, 0, 0.35); }
.trophy-icon em { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: 1.2rem; }
.trophy.tier-0 .trophy-icon span { filter: grayscale(1) brightness(0.6); }
.trophy.tier-1 { border-color: #c98a4b; } .trophy.tier-1 .trophy-icon { box-shadow: 0 0 12px rgba(201, 138, 75, 0.7); }
.trophy.tier-2 { border-color: #cfd6e0; } .trophy.tier-2 .trophy-icon { box-shadow: 0 0 12px rgba(207, 214, 224, 0.8); }
.trophy.tier-3 { border-color: #ffcf5a; background: rgba(255, 207, 90, 0.1); } .trophy.tier-3 .trophy-icon { box-shadow: 0 0 16px rgba(255, 207, 90, 0.9); }
.trophy-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.trophy-body b { font-size: 1rem; }
.trophy-body small { font-weight: 700; color: var(--muted); }
.trophy-bar { position: relative; height: 16px; border-radius: 99px; background: rgba(0, 0, 0, 0.4); overflow: hidden; }
.trophy-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ff9f45, #ffcf5a); border-radius: 99px; }
.trophy-bar span { position: relative; display: block; text-align: center; font-size: 0.7rem; font-weight: 900; line-height: 16px; text-shadow: 0 1px 2px #000; }
.trophy-steps { display: flex; gap: 4px; }
.trophy-steps i { font-style: normal; font-size: 0.95rem; opacity: 0.3; filter: grayscale(1); }
.trophy-steps i.on { opacity: 1; filter: none; }
