@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@600;700;800;900&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);      /* ease-out-quint */
  --speed: .18s;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
  --z-nav: 10; --z-board: 30; --z-coach: 70; --z-banner: 80;
  --z-modal: 100; --z-fx: 110; --z-toast: 120;
  --line: rgba(23,40,75,.16);                       /* hairline borders */
  --ink: #17284b;                                   /* outlines + primary text */
  --bg: #e2f0fa; --panel: #ffffff; --panel2: #f0f8fe;
  --ice: #2c4bbf; --text: var(--ink); --dim: #54689f;
  --accent: #4169e8; --gold: #f2b23c; --green: #2fa866; --red: #e05252;
  --pop: 0 3px 0 rgba(23,40,75,.16);                /* sticker shadow */
  --r-common: #8fa3c0; --r-rare: #4a7dff; --r-epic: #a855f7; --r-legendary: #eda921;
}
html, body { height: 100%; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  background: var(--bg) url('../img/tiles.svg') repeat;
  background-size: 384px 192px;
  color: var(--text); overflow: hidden; user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ================= BACKDROP ================= */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora, .bergs { display: none; }
.a1 { background: linear-gradient(90deg, #1de9b6, transparent 70%); animation: drift 14s ease-in-out infinite alternate; }
.a2 { background: linear-gradient(90deg, transparent, #7c4dff 50%, transparent); animation: drift 18s ease-in-out infinite alternate-reverse; top: -4%; }
.a3 { background: linear-gradient(90deg, transparent 30%, #00b0ff); animation: drift 22s ease-in-out infinite alternate; top: 2%; }
@keyframes drift { from { transform: translateX(-6%) skewX(-6deg); } to { transform: translateX(6%) skewX(6deg); } }
.bergs { position: absolute; bottom: 0; left: 0; width: 100%; height: 34%; opacity: .9; }
.snow { position: absolute; inset: -10% 0 0 0; background-image:
  radial-gradient(2px 2px at 20% 30%, #ffffffee, transparent),
  radial-gradient(1.5px 1.5px at 60% 10%, #ffffffcc, transparent),
  radial-gradient(2.5px 2.5px at 80% 50%, #ffffffdd, transparent),
  radial-gradient(1.5px 1.5px at 35% 70%, #ffffffbb, transparent),
  radial-gradient(2px 2px at 90% 85%, #ffffffcc, transparent),
  radial-gradient(1.5px 1.5px at 10% 90%, #ffffffaa, transparent);
  background-size: 340px 340px; }
.s1 { animation: snowfall 11s linear infinite; }
.s2 { animation: snowfall 17s linear infinite; background-size: 460px 460px; opacity: .5; }
.s3 { animation: snowfall 26s linear infinite; background-size: 620px 620px; opacity: .3; }
.mascot { position: absolute; bottom: -6px; width: 150px; filter: drop-shadow(0 6px 10px rgba(23,40,75,.18)); }
.mascot.m-left { left: 2vw; }
.mascot.m-right { right: 2vw; transform: scaleX(-1); }
body.in-game .mascot { display: none; }
@media (max-width: 900px) { .mascot { display: none; } }
@keyframes snowfall { from { transform: translateY(-340px); } to { transform: translateY(0); } }

/* ================= NAV ================= */
#topnav {
  position: relative; z-index: var(--z-nav); display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; background: #ffffffd9; backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23,40,75,.14);
}
.nav-logo { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: 2px;  }
.pick-title, .logo, .op-title, #gameover-title, .modal-inner h2 { font-family: var(--display); }
.nav-tabs { display: flex; gap: 6px; flex: 1; }
.nav-tabs button {
  background: transparent; border: 1px solid transparent; color: var(--dim);
  padding: 8px 16px; border-radius: 10px; font-weight: 800; font-size: 14px;
}
.nav-tabs button:hover { color: var(--text); background: #ffffff0d; }
.nav-tabs button.sel { color: #fff; background: #eaf4fc; border-color: transparent; }
.pill { background: var(--gold); color: #402a00; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 2px; }
.nav-currencies { display: flex; gap: 10px; }
.cur { background: #ffffff; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: var(--pop); font-weight: 800; font-size: 14px; }
body.in-game #topnav { display: none; }

.screen { display: none; position: relative; z-index: 2; height: calc(100vh - 53px); overflow: hidden; }
.screen.active { display: block; }
body.in-game .screen.active { height: 100vh; }

/* ================= MENU ================= */
.menu-wrap { max-width: 1020px; margin: 0 auto; padding: 26px 20px 60px; text-align: center; height: 100%; overflow-y: auto; }
.pick-title { margin: 10px 0 4px; color: var(--ice); }
.hint { color: var(--dim); font-size: 13px; margin-bottom: 14px; }
#calling-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.calling-tile {
  --cc: #35a7ff;
  background: linear-gradient(180deg, #eaf4fc, #ffffff); border: 2px solid rgba(23,40,75,.28); border-radius: 14px;
  padding: 14px 10px; cursor: pointer; transition: transform var(--speed) var(--ease-out), border-color var(--speed) var(--ease-out), box-shadow var(--speed) var(--ease-out);
  position: relative; overflow: hidden;
}
.calling-tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--cc); }
.calling-tile:hover { transform: translateY(-4px); border-color: var(--cc); box-shadow: 0 8px 24px rgba(65,105,232,.22); }
.c-emoji { font-size: 40px; }
.c-name { font-weight: 800; font-size: 18px; margin-top: 4px; }
.c-hero { color: var(--gold); font-size: 12px; margin: 2px 0 6px; }
.c-power { color: var(--dim); font-size: 12.5px; line-height: 1.35; }
.deck-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.deck-tile {
  --cc: #35a7ff; display: flex; align-items: center; gap: 10px;
  background: #ffffff; border: 2px solid var(--cc); border-radius: 12px; padding: 10px 16px; cursor: pointer;
  transition: transform var(--speed) var(--ease-out), border-color var(--speed) var(--ease-out);
}
.deck-tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cc) 80%, #fff); }
.deck-tile .d-emoji { font-size: 26px; }
.deck-tile .d-name { font-weight: 800; }
.deck-tile .d-sub { color: var(--dim); font-size: 12.5px; }
.deck-empty { color: var(--dim); font-size: 13px; padding: 12px; }

.big-btn {
  background: linear-gradient(180deg, #5379ee, #3a5cd8); color: #fff; border: 1px solid rgba(23,40,75,.55); border-radius: 12px;
  padding: 12px 26px; font-size: 16px; font-weight: 800; box-shadow: var(--pop);
}
.big-btn:hover { filter: brightness(1.07); }
.big-btn.small { padding: 8px 14px; font-size: 13px; }
.big-btn.gold { background: linear-gradient(180deg, #ffd158, #f5b53a); border-color: var(--ink); color: #17284b; }
.big-btn:disabled { opacity: .45; cursor: default; filter: none; }

/* ================= CARDS ================= */
.card {
  --cc: #7f96ad; --rare: var(--r-common);
  position: relative; width: 122px; height: 172px; border-radius: 12px; flex: 0 0 auto;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cc) 32%, #eef6fd) 0%, #f6fbff 55%, #eaf3fb 100%);
  border: 2px solid color-mix(in srgb, var(--rare) 80%, #223); box-shadow: var(--pop);
  transition: transform var(--speed) var(--ease-out);
}
.card.r-legendary { border-color: var(--r-legendary); box-shadow: 0 0 12px #ffb02e55, 0 3px 10px #0009; }
.card.r-legendary::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, #ffe9b855 50%, transparent 70%);
  background-size: 250% 250%; animation: shimmer 3.2s linear infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.card.large { width: 152px; height: 214px; }
.card .cost {
  position: absolute; top: -8px; left: -8px; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #58b6ff, #1565b6); border: 2px solid #22345c;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; z-index: 2;
  box-shadow: 0 2px 6px #0008;
}
.card .art {
  font-size: 36px; text-align: center; margin: 10px auto 0; width: 76px; height: 54px; line-height: 54px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--cc) 55%, #d9ecfa), #d9ecfa 75%);
  border-radius: 50% / 42%; border: 1.5px solid color-mix(in srgb, var(--cc) 60%, #223);
}
.card.large .art { font-size: 46px; width: 100px; height: 66px; line-height: 66px; margin-top: 14px; }
.card .gem {
  width: 10px; height: 10px; margin: 3px auto 0; transform: rotate(45deg);
  background: var(--rare); border: 1px solid #fff8; box-shadow: 0 0 6px var(--rare);
}
.card .cname { font-size: 10.5px; font-weight: 800; text-align: center; padding: 1px 4px 0; line-height: 1.12; }
.card.large .cname { font-size: 12.5px; }
.card .ctext { font-size: 8.4px; color: #33456e; text-align: center; padding: 2px 6px; line-height: 1.25; max-height: 52px; overflow: hidden; }
.card.large .ctext { font-size: 10px; max-height: 74px; }
.card .tribe { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); font-size: 8px; color: var(--dim); background: #ffffffee; border-radius: 6px; padding: 1px 7px; border: 1px solid rgba(23,40,75,.14); }
.card .atk, .card .hp {
  position: absolute; bottom: -7px; width: 27px; height: 27px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; border: 2px solid #fff4;
  box-shadow: 0 2px 6px #0008;
}
.card .atk { left: -7px; background: radial-gradient(circle at 30% 30%, #ffd34d, #b97a00); color: #3a2600; }
.card .hp { right: -7px; background: radial-gradient(circle at 30% 30%, #ff7a7a, #a31212); }
.card.playable { cursor: pointer; }
.card.playable::before { content: ''; position: absolute; inset: -4px; border-radius: 14px; border: 2px solid var(--green); box-shadow: 0 0 14px #46d17a99; pointer-events: none; }
.card.playable:hover { transform: translateY(-16px) scale(1.4); z-index: 30; }
.card.discounted .cost { background: radial-gradient(circle at 30% 30%, #7dffa9, #0f8a3d); }
.card.pickable { cursor: pointer; }
.card.pickable:hover { transform: scale(1.08); box-shadow: 0 0 18px var(--accent); }
.card .owned-badge {
  position: absolute; top: -8px; right: -8px; z-index: 2; font-size: 11px; font-weight: 900;
  background: #ffffff; border: 1.5px solid rgba(23,40,75,.28); border-radius: 10px; padding: 2px 7px;
}
.card.unowned { filter: grayscale(.85) brightness(.6); }
.card .craft-btn {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); z-index: 3;
  background: linear-gradient(180deg, #3f8fd8, #3a5cd8); color: #fff; border: 1px solid #9cd2ff88;
  border-radius: 10px; font-size: 10px; font-weight: 800; padding: 3px 9px; display: none;
}
.card:hover .craft-btn { display: block; }
.card .craft-btn:disabled { opacity: .5; }

/* cardback */
.cardback {
  width: 46px; height: 64px; border-radius: 7px; flex: 0 0 auto;
  background:
    radial-gradient(circle at 50% 42%, #1d4a7c 0 34%, transparent 35%),
    repeating-conic-gradient(#12365e 0 15deg, #0f2c4e 15deg 30deg);
  border: 2px solid #7fc4ff88; box-shadow: 0 2px 8px #000a; position: relative;
}
.cardback::after { content: '🐧'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.cardback.big { width: 122px; height: 172px; border-radius: 12px; border-width: 3px; }
.cardback.big::after { font-size: 52px; }

/* ================= COLLECTION ================= */
.collection-header { display: flex; align-items: center; gap: 16px; padding: 14px 20px; flex-wrap: wrap; }
.collection-header h2 { font-size: 20px; color: var(--ice); }
#collection-search, #db-search, #db-name {
  background: #ffffff; color: var(--text); border: 1px solid rgba(23,40,75,.28); border-radius: 8px; padding: 8px 12px; width: 220px; font-size: 14px;
}
.owned-toggle { color: var(--dim); font-size: 13px; display: flex; gap: 6px; align-items: center; }
#collection-count { color: var(--dim); font-size: 13px; }
#collection-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; }
#collection-tabs button { background: #eef6fd; color: var(--dim); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: var(--pop); font-size: 13px; font-weight: 700; }
#collection-tabs button.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
#collection-grid {
  display: flex; flex-wrap: wrap; gap: 22px 16px; padding: 14px 20px 80px;
  overflow-y: auto; height: calc(100% - 110px); align-content: flex-start;
}

/* ================= PACKS ================= */
.packs-wrap { max-width: 900px; margin: 0 auto; text-align: center; padding: 18px; height: 100%; overflow-y: auto; }
.pack-stage { min-height: 330px; display: flex; align-items: center; justify-content: center; position: relative; }
.pack-visual { position: relative; cursor: pointer; transition: transform .15s; }
.pack-visual:hover { transform: scale(1.05) rotate(-2deg); }
.pack-visual.shake { animation: packshake .45s ease; }
@keyframes packshake { 0%,100% { transform: rotate(0);} 25% { transform: rotate(-6deg) scale(1.06);} 60% { transform: rotate(5deg) scale(1.1);} }
.pack-svg { width: 200px; filter: drop-shadow(0 10px 26px #35a7ff44); }
.pack-glow { position: absolute; inset: -30px; border-radius: 50%; background: radial-gradient(circle, rgba(65,105,232,.22), transparent 70%); z-index: -1; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); opacity: .7; } }
.pack-reveal { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; }
.flip { perspective: 900px; cursor: pointer; }
.flip-inner { position: relative; transition: transform .5s; transform-style: preserve-3d; }
.flip .front, .flip .back { backface-visibility: hidden; }
.flip .front { transform: rotateY(180deg); position: absolute; inset: 0; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip.flipped { cursor: default; }
.flip.burst-rare .front .card { animation: burst .5s ease; box-shadow: 0 0 26px var(--r-rare); }
.flip.burst-epic .front .card { animation: burst .55s ease; box-shadow: 0 0 32px var(--r-epic); }
.flip.burst-legendary .front .card { animation: burst .7s ease; box-shadow: 0 0 44px var(--r-legendary), 0 0 90px #ffb02e66; }
@keyframes burst { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.melt-tag { position: absolute; bottom: -24px; left: 0; right: 0; font-size: 12px; color: #9fd8ff; font-weight: 800; }
.pack-controls { display: flex; gap: 12px; justify-content: center; margin: 16px 0 12px; }
.pity-wrap { max-width: 460px; margin: 0 auto 30px; }
.pity-label { font-size: 14px; color: var(--ice); margin-bottom: 6px; }
.pity-bar { height: 10px; border-radius: 6px; background: #ffffff; border: 1px solid rgba(23,40,75,.28); overflow: hidden; }
#pity-fill { height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, #b45aff, var(--gold)); transition: transform .4s var(--ease-out); }
.pity-sub { color: var(--dim); font-size: 13px; margin-top: 6px; line-height: 1.4; }

/* ================= DECK BUILDER ================= */
.builder-layout { display: flex; gap: 12px; padding: 12px 16px; height: 100%; }
.builder-left { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.builder-head { display: flex; gap: 10px; margin-bottom: 10px; }
#db-calling { background: #ffffff; color: var(--text); border: 1px solid rgba(23,40,75,.28); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.db-pool { display: flex; flex-wrap: wrap; gap: 20px 14px; overflow-y: auto; padding: 8px 4px 60px; align-content: flex-start; }
.builder-right { width: 300px; display: flex; flex-direction: column; gap: 8px; background: #ffffffd9; border: 1px solid rgba(23,40,75,.2); border-radius: 14px; padding: 12px; }
#db-name { width: 100%; }
.db-count { font-weight: 900; color: var(--ice); font-size: 15px; }
.db-curve { display: flex; gap: 3px; align-items: flex-end; height: 44px; }
.db-curve .bar { flex: 1; background: linear-gradient(180deg, #58b6ff, #3a5cd8); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.db-curve .bar span { position: absolute; top: -14px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--dim); }
.db-deck { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.db-row {
  --cc: #7f96ad; display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 26%, #eef6fd), #eef6fd);
  border: 1px solid rgba(23,40,75,.14); border-radius: 8px; padding: 3px 8px; cursor: pointer; font-size: 12px;
}
.db-row:hover { border-color: var(--red); }
.db-row .r-cost { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #58b6ff, #1565b6); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px; flex: 0 0 auto; }
.db-row .r-name { flex: 1; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.db-row .r-name.leg { color: var(--gold); }
.db-row .r-n { color: var(--dim); font-weight: 900; }
.db-actions { display: flex; gap: 6px; }
.db-saved { border-top: 1px solid rgba(23,40,75,.2); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; max-height: 130px; overflow-y: auto; }
.db-saved .saved-row { display: flex; align-items: center; gap: 8px; font-size: 13px; background: #eef6fd; border-radius: 8px; padding: 5px 9px; }
.db-saved .saved-row b { flex: 1; cursor: pointer; }
.db-saved .saved-row button { background: none; border: none; color: var(--dim); font-size: 13px; }
.db-saved .saved-row button:hover { color: var(--red); }
.db-pool .card { cursor: pointer; }
.db-pool .card:hover { transform: translateY(-6px); }
.db-pool .card.at-cap { filter: brightness(.5); }

/* ================= GAME ================= */
.game-layout { display: flex; height: 100%; gap: 8px; padding: 8px 8px 14px; position: relative; z-index: 2; }
.board-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row { display: flex; justify-content: center; align-items: center; gap: 8px; }
.leader-row { padding: 3px 0; gap: 18px; }
.ai-hand { display: flex; gap: -6px; }
.ai-hand .cardback { margin-left: -18px; }
.ai-hand .cardback:first-child { margin-left: 0; }

.rink {
  flex: 1; display: flex; flex-direction: column; justify-content: space-around; margin: 2px 30px;
  background:
    radial-gradient(ellipse 75% 65% at 50% 50%, #e8f6ff14 0%, #bfe3ff0d 45%, transparent 72%),
    linear-gradient(180deg, #d5eafacc, #c9e3f7cc);
  border: 2px solid rgba(23,40,75,.14); border-radius: 26px;
  box-shadow: inset 0 0 60px #35a7ff18, 0 6px 30px #0006;
  position: relative;
}
.rink::before { content: ''; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: linear-gradient(90deg, transparent, #7fc4ff44, transparent); }
.rink::after { content: ''; position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; transform: translate(-50%,-50%); border: 2px solid #7fc4ff2e; border-radius: 50%; }
.board { min-height: 112px; padding: 4px; z-index: 1; }
.midline { display: flex; justify-content: space-between; padding: 2px 40px; height: 20px; z-index: 1; }
#turn-indicator { color: var(--ice); font-weight: 800; font-size: 13px;  }
#target-hint { color: var(--gold); font-weight: 700; font-size: 13px; }

.leader {
  display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, #eaf4fc, #ffffff);
  border: 2px solid rgba(23,40,75,.28); border-radius: 16px; padding: 5px 14px 5px 6px; min-width: 290px;
}
.l-portrait {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #bcd9f2, #e6f2fc); border: 2px solid var(--ink);
  box-shadow: inset 0 0 12px #000a;
}
.l-emoji { font-size: 30px; }
.l-info { flex: 1; }
.l-info > div:first-child { font-weight: 800; font-size: 14px; }
.l-stats { color: var(--dim); font-size: 12px; display: flex; gap: 10px; }
.l-hp {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff7a7a, #a31212);
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; border: 2px solid #fff5;
  box-shadow: 0 2px 8px #0008;
}
.l-armor { position: absolute; top: -10px; right: -12px; font-size: 11px; background: #5c6f85; border: 1px solid #b9c8d8; border-radius: 8px; padding: 1px 6px; font-weight: 800; }

.controls { display: flex; gap: 10px; margin-left: 14px; align-items: center; }
.controls > button {
  background: linear-gradient(180deg, #5379ee, #3a5cd8); border: 1px solid rgba(23,40,75,.55); color: #fff;
  border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: 13px;
}
.controls button:disabled { opacity: .4; cursor: default; }
#btn-concede { padding: 10px 12px; background: #eaf2fb; }
.endturn-wrap { position: relative; width: 68px; height: 68px; }
.timer-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #ffffff; stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 201; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.ring-fg.low { stroke: var(--red); }
#btn-endturn {
  position: absolute; inset: 8px; border-radius: 50%; border: none; font-weight: 900; font-size: 12px; line-height: 1.15;
  background: radial-gradient(circle at 35% 30%, #4cc681, #2fa866); color: #fff; box-shadow: 0 3px 10px #000a;
}
#btn-endturn:hover:not(:disabled) { filter: brightness(1.15); }

/* minions */
.minion {
  --cc: #7f96ad;
  position: relative; width: 88px; height: 102px; border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 30%, #f2f9ff), #ffffff);
  border: 2px solid var(--ink); text-align: center; transition: transform var(--speed) var(--ease-out);
  box-shadow: var(--pop);
}
.minion .m-art { font-size: 34px; margin-top: 8px; text-shadow: 0 3px 8px #0009; }
.minion .m-name { font-size: 8.5px; font-weight: 700; color: #33456e; padding: 0 3px; line-height: 1.1; overflow: hidden; max-height: 20px; }
.minion .m-atk, .minion .m-hp {
  position: absolute; bottom: -8px; width: 25px; height: 25px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; border: 2px solid #fff4;
  box-shadow: 0 2px 6px #0008;
}
.minion .m-atk { left: -7px; background: radial-gradient(circle at 30% 30%, #ffd34d, #b97a00); color: #3a2600; }
.minion .m-hp { right: -7px; background: radial-gradient(circle at 30% 30%, #ff7a7a, #a31212); }
.minion .m-hp.hurt { color: #ffdada; background: radial-gradient(circle at 30% 30%, #d95c5c, #7c0b0b); }
.minion .buffed { box-shadow: 0 0 8px #46d17a; }
.minion.chonky { border-color: #b9c8d8; box-shadow: 0 0 0 3px #8fa5bb66, 0 3px 8px #0008; border-radius: 46% 46% 14px 14px / 32% 32% 14px 14px; }
.minion.slippery { opacity: .8; border-style: dashed; }
.minion.frozen { filter: saturate(.35) brightness(1.2); }
.minion.frozen::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, #bfe9ff33, #6ec6ff22); pointer-events: none; }
.minion .m-frozen { position: absolute; top: -9px; right: -7px; font-size: 16px; z-index: 2; }
.minion.ready { border-color: var(--green); box-shadow: 0 0 12px #46d17a88; cursor: pointer; }
.minion.ready:hover { transform: scale(1.06); }

.targeting .valid-target { outline: 3px solid var(--gold); outline-offset: 2px; cursor: crosshair; border-radius: 12px; box-shadow: 0 0 16px #ffb02e99 !important; }

@keyframes wobble {
  0% { transform: rotate(0); } 25% { transform: rotate(-7deg) scale(.96); }
  50% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } 100% { transform: rotate(0); }
}
.minion.wobble { animation: wobble .45s var(--ease-out); }

#my-hand { display: flex; justify-content: center; gap: 6px; padding: 14px 10px 10px; min-height: 150px; align-items: flex-end; }
#my-hand .card { margin-top: 6px; }
#my-hand .card:not(:first-child) { margin-left: -10px; }

/* narrow windows: shrink board & hand, hide log */
@media (max-width: 1050px) {
  #log { display: none; }
  .game-layout { padding: 4px; }
  .rink { margin: 2px 8px; border-radius: 18px; }
  .board { min-height: 94px; }
  .leader { min-width: 225px; padding: 4px 10px 4px 5px; }
  .l-portrait { width: 42px; height: 42px; } .l-emoji { font-size: 24px; }
  .l-hp { width: 36px; height: 36px; font-size: 15px; }
  .minion { width: 72px; height: 86px; }
  .minion .m-art { font-size: 25px; margin-top: 6px; }
  .minion .m-name { font-size: 7.5px; }
  #my-hand { min-height: 138px; padding: 10px 6px 10px; }
  #my-hand .card { width: 96px; height: 132px; }
  #my-hand .card .art { width: 58px; height: 38px; line-height: 38px; font-size: 25px; margin-top: 8px; }
  #my-hand .card .ctext { font-size: 7.3px; max-height: 36px; }
  #my-hand .card .cname { font-size: 9px; }
  #my-hand .card.playable:hover { transform: translateY(-24px) scale(1.7); }
  .ai-hand .cardback { width: 34px; height: 48px; margin-left: -14px; }
  .ai-hand .cardback::after { font-size: 15px; }
  .controls { margin-left: 6px; gap: 6px; }
  .controls > button { padding: 8px 10px; font-size: 12px; }
  .endturn-wrap { width: 58px; height: 58px; }
}

#log {
  width: 220px; background: #ffffffd9; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px; font-size: 12.5px; color: #44587f; overflow-y: auto; line-height: 1.5;
}

/* ================= ONLINE / ACCOUNT / COSMETICS ================= */
.acct-btn { background: #eaf4fc; border: 1px solid transparent !important; color: var(--text); cursor: pointer; }
.acct-btn:hover { filter: brightness(1.2); }
.holder-badge { background: linear-gradient(180deg, #ffd158, #f5b53a); color: #17284b; border-color: #ffd98a; }

.online-panel {
  background: linear-gradient(180deg, #ffffffd9, #ffffffd9); border: 1px solid #35a7ff55;
  border-radius: 16px; padding: 14px 18px; margin-bottom: 22px; text-align: left;
}
.op-title { font-weight: 900; font-size: 17px; color: var(--ice); margin-bottom: 10px; }
.op-sub { font-weight: 600; font-size: 12.5px; color: var(--dim); margin-left: 6px; }
.op-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.op-row.wallet-row { margin-top: 10px; }
#mm-deck { background: #ffffff; color: var(--text); border: 1px solid rgba(23,40,75,.28); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-weight: 700; min-width: 220px; }
.op-status { color: var(--gold); font-weight: 800; font-size: 13px; min-height: 18px; margin-top: 8px; }

.acct-form { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }
.acct-form input { background: #ffffff; color: var(--text); border: 1px solid rgba(23,40,75,.28); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.acct-error { color: var(--red); font-size: 12.5px; font-weight: 700; min-height: 16px; }
.acct-note { color: var(--dim); font-size: 13px; line-height: 1.5; }

/* golden cosmetics for verified Pudgy holders */
.cardback.gold {
  border-color: #ffd98a;
  background:
    radial-gradient(circle at 50% 42%, #a4741b 0 34%, transparent 35%),
    repeating-conic-gradient(#8a5f10 0 15deg, #6b470b 15deg 30deg);
  box-shadow: 0 0 12px #ffb02e88, 0 2px 8px #000a;
}
body.holder .pack-reveal .cardback { border-color: #ffd98a;
  background:
    radial-gradient(circle at 50% 42%, #a4741b 0 34%, transparent 35%),
    repeating-conic-gradient(#8a5f10 0 15deg, #6b470b 15deg 30deg);
  box-shadow: 0 0 16px #ffb02e88; }
body.holder .rink { border-color: #ffb02e66; box-shadow: inset 0 0 60px #ffb02e14, 0 6px 30px #0006; }
body.holder .rink::before { background: linear-gradient(90deg, transparent, #ffd98a44, transparent); }
body.holder .rink::after { border-color: #ffd98a2e; }
body.holder .l-portrait { border-color: #ffd98a99; }

/* modals & toast */
.modal { display: none; position: fixed; inset: 0; background: rgba(23,40,75,.38); z-index: var(--z-modal); align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-inner { background: linear-gradient(180deg, #eaf4fc, #ffffff); border: 2px solid #35a7ff; border-radius: 18px; padding: 26px 30px; text-align: center; box-shadow: 0 12px 44px rgba(23,40,75,.28); }
.modal-inner h3 { margin-bottom: 16px; color: var(--ice); }
.modal-inner h2 { margin-bottom: 12px; }
.reward-line { color: var(--gold); font-weight: 800; margin-bottom: 16px; }
#discover-options { display: flex; gap: 16px; }
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px); z-index: var(--z-toast);
  background: #ffffffee; border: 1px solid #35a7ff; color: var(--text); border-radius: 12px;
  padding: 10px 22px; font-weight: 800; font-size: 14px; transition: transform .25s; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ================= TUTORIAL / COACH / JUICE ================= */

/* menu "Learn to Play" banner */
.tutorial-banner {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: linear-gradient(180deg, #f9e290, #f2d06b);
  border: 1px solid #ffb02e66; border-radius: 16px; padding: 12px 16px; margin-bottom: 16px;
}
.tutorial-banner .tb-icon { font-size: 34px; }
.tutorial-banner .tb-text { flex: 1; display: flex; flex-direction: column; }
.tutorial-banner .tb-text b { font-size: 15px; }
.tutorial-banner .tb-text span { color: var(--dim); font-size: 13px; }

/* first-run prompt */
.tp-penguin { font-size: 60px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.tp-text { color: var(--ice); line-height: 1.6; margin: 6px 0 18px; }
#tutorial-prompt .modal-inner { max-width: 440px; }
#tutorial-prompt button { display: block; width: 100%; margin: 8px auto 0; }

/* turn banner */
#turn-banner {
  position: fixed; top: 42%; left: 50%; transform: translate(-50%, -50%) scale(.6);
  font-family: var(--display); font-size: 52px; font-weight: 800; color: #fff;
  text-shadow: 0 0 24px #35a7ff, 0 4px 12px #000; opacity: 0; pointer-events: none; z-index: var(--z-banner);
}
#turn-banner.show { animation: turnpop 1.4s ease forwards; }
@keyframes turnpop {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.05); }
  70% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.1); }
}

/* floating damage / heal numbers */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-fx); }
.floater {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--display);
  font-weight: 800; font-size: 30px; text-shadow: 0 2px 6px #000, 0 0 10px currentColor;
  animation: floatup 1s ease-out forwards;
}
.floater.dmg { color: #ff5d5d; }
.floater.heal { color: #46d17a; }
@keyframes floatup {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.5); }
  20% { opacity: 1; transform: translate(-50%,-70%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%,-150%) scale(1); }
}

/* minion enter pop */
.minion.enter { animation: minpop .28s var(--ease-out); }
@keyframes minpop { 0% { transform: translateY(18px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* coach panel */
#coach {
  position: fixed; left: 16px; top: 46%; transform: translateY(-50%); width: 290px; z-index: var(--z-coach);
  display: none; gap: 12px;
  background: linear-gradient(180deg, #ffffffef, #ffffffef); backdrop-filter: blur(6px);
  border: 2px solid #35a7ff; border-radius: 18px; padding: 14px; box-shadow: 0 10px 36px rgba(23,40,75,.25);
  animation: coachIn .3s ease;
}
#coach.open { display: flex; }
#coach.big { border-color: var(--gold); box-shadow: 0 0 26px #ffb02e55, 0 12px 40px #000a; }
@keyframes coachIn { from { transform: translateX(-20px); opacity: 0; } }
.coach-avatar {
  font-size: 40px; flex: 0 0 auto; align-self: flex-start;
  filter: drop-shadow(0 3px 6px #0008); animation: bob 2.4s ease-in-out infinite;
}
.coach-body { flex: 1; }
.coach-lesson { font-size: 12px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.coach-text { font-size: 14px; line-height: 1.5; color: var(--text); }
.coach-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.coach-skip { background: none; border: none; color: var(--dim); font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.coach-skip:hover { color: var(--text); }

/* spotlight: pulsing gold ring on the element the coach points at */
.coach-spotlight { position: relative; z-index: 40; }
.coach-spotlight::after {
  content: ''; position: absolute; inset: -6px; border-radius: 16px; pointer-events: none;
  border: 3px solid var(--gold); box-shadow: 0 0 18px #ffb02eaa; animation: coachPulse 1.1s ease-in-out infinite;
}
@keyframes coachPulse { 0%,100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.02); } }

/* keep coach clear of the hand on short screens */
@media (max-width: 1050px) { #coach { width: 232px; left: 8px; } .coach-text { font-size: 12.5px; } }

/* ================= CARD ART (illustrations, emoji fallback) ================= */
/* Cards WITHOUT art keep the small oval emoji window. Cards WITH art get a
   larger banner illustration for a more premium, Hearthstone-like look. */
.card .art.art-img {
  width: calc(100% - 12px); height: 76px; margin: 6px auto 0; padding: 0;
  border-radius: 10px; overflow: hidden; background: #d9ecfa;
  border: 1.5px solid color-mix(in srgb, var(--cc) 60%, #223); line-height: 0;
}
.card.large .art.art-img { height: 98px; }
.card .art.art-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.minion .m-art.art-img {
  width: 100%; height: 58px; margin: 0; border-radius: 10px 10px 0 0;
  overflow: hidden; line-height: 0;
}
.minion .m-art.art-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 1050px) { .minion .m-art.art-img { height: 46px; } }

/* pack reveal & discover art sit inside the standard card, so they inherit the above */

/* ================= V7 DESIGN POLISH (impeccable pass) ================= */

/* Keyboard focus is a first-class state: visible ring on every control */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.card.playable:focus-visible, .minion.ready:focus-visible { outline-offset: 4px; }

/* Pressed feedback everywhere a finger lands */
.big-btn:active:not(:disabled),
.nav-tabs button:active,
.controls > button:active:not(:disabled),
#btn-endturn:active:not(:disabled),
.calling-tile:active,
.deck-tile:active { transform: translateY(1px); }

/* Tiles are real <button>s now: neutralize UA button styling */
.calling-tile, .deck-tile { color: inherit; font: inherit; text-align: inherit; }
.calling-tile { text-align: center; }

/* Balanced headings, tidy prose */
h1, h2, h3 { text-wrap: balance; }
.tp-text, .acct-note, .pity-sub, .tile-blurb { text-wrap: pretty; }

/* Border diet: hairlines instead of heavy outlines on passive surfaces */
.cur { border-color: var(--line); }
.online-panel { border-color: var(--line); }
.tutorial-banner { border-color: #ffb02e44; }
#collection-tabs button { border-color: var(--line); }
.db-row { border-color: transparent; }
.db-row:hover { border-color: var(--red); }
.saved-row { border: 1px solid transparent; }

/* Consistent radius language */
.big-btn { border-radius: var(--r-md); }
.calling-tile { border-radius: var(--r-lg); }
.online-panel, .tutorial-banner { border-radius: var(--r-lg); }
.modal-inner { border-radius: var(--r-xl); }

/* Section headers: one consistent voice on hub screens */
.pick-title {
  display: flex; align-items: center; gap: 14px; text-align: left;
  font-size: 20px; margin: 22px 0 6px;
}
.pick-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.hint { text-align: left; }

/* Reduced motion: calm everything that moves for its own sake */
@media (prefers-reduced-motion: reduce) {
  .aurora, .snow, .tp-penguin, .coach-avatar, .pack-glow,
  .card.r-legendary::after { animation: none !important; }
  .minion.enter, .minion.wobble, .pack-visual.shake,
  .flip .front .card, #turn-banner.show { animation-duration: .01s !important; }
  .flip-inner { transition-duration: .01s !important; }
  *, *::before, *::after { transition-duration: .01s !important; }
  .card.playable:hover { transform: none; }
}

/* ================= V8 LIGHT TILE THEME finishing ================= */

/* multicolor chunky wordmark, like the PengPal reference */
.nav-logo .lg-a { color: #4169e8; }
.nav-logo .lg-b { color: var(--ink); }
.nav-logo .lg-c { color: #f4766e; }

/* pill buttons with ink outline + sticker pop (reference style) */
.big-btn {
  border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--pop); color: #fff;
  text-transform: uppercase; letter-spacing: .04em; font-size: 14px;
}
.big-btn.small { font-size: 12px; }
.big-btn.gold { color: var(--ink); }
.big-btn:disabled { box-shadow: none; }
.controls > button, #btn-endturn { border: 2px solid var(--ink); box-shadow: var(--pop); }
#btn-concede { color: var(--ink); }

/* tiles + panels: ink sticker outlines */
.calling-tile, .deck-tile, .online-panel, .modal-inner, .leader,
.builder-right, #log, .coach-body, #coach { border-color: var(--ink); }
.calling-tile, .deck-tile { border-width: 2px; box-shadow: var(--pop); }
.online-panel, .modal-inner { border-width: 2px; }
#coach { border-width: 2px; box-shadow: 0 10px 36px rgba(23,40,75,.25); }

/* yellow notice banner: ink border like the reference's yellow strip */
.tutorial-banner { border: 2px solid var(--ink); box-shadow: var(--pop); }
.tutorial-banner .tb-text b, .tutorial-banner .tb-text span { color: var(--ink); }

/* headings: chunky ink, blue underline energy */
.pick-title { color: var(--ink); }
.section-title { color: var(--dim); }
.op-title { color: var(--ink); }
.modal-inner h2, .modal-inner h3 { color: var(--ink); }

/* game chrome on light */
.ring-bg { stroke: #cfe2f2; }
#turn-indicator { color: var(--ink); font-weight: 900; }
#turn-banner { color: #ffffff; text-shadow: 0 0 18px rgba(65,105,232,.9), 0 3px 0 var(--ink); }
.rink { border: 2px solid var(--ink); }
.board { background: rgba(255,255,255,.28); }
.midline span { text-shadow: none; }
.melt-tag { color: var(--ink); font-weight: 800; }
#toast { border: 2px solid var(--ink); color: var(--ink); box-shadow: var(--pop); }
.minion .m-name { color: var(--ink); }
.l-armor { background: #7d8fa8; border-color: var(--ink); color: #fff; }

/* inputs: white with ink outline */
input, select { border: 2px solid var(--ink) !important; }
input::placeholder { color: #7688a8; }

/* keep the deep blue cardback: it reads as a real card back on the light table */
.cardback { border-color: var(--ink); }

/* focus ring: ink-blue on light */
:focus-visible { outline: 2px solid var(--accent); }

/* contrast fixes after light-theme review */
.nav-tabs button.sel { color: #fff; background: var(--accent); border: 2px solid var(--ink); border-radius: 999px; }
.nav-tabs button { border-radius: 999px; }
.c-hero { color: #b0771c; }                     /* amber, 4.6:1 on white */
.tutorial-banner .big-btn.gold { background: linear-gradient(180deg, #5379ee, #3a5cd8); color: #fff; }
.op-status { color: #b0771c; }
.pity-label { color: var(--ink); }
