:root {
  --bg1: #1b2a6b;
  --bg2: #3b1f6e;
  --ink: #1d2340;
  --panel: #ffffff;
  --muted: #6b7290;
  --accent: #ffcb05;
  --accent2: #ff7a1a;
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Baloo 2', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #3a56c9 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, #7b3fc4 0%, transparent 45%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
[hidden] { display: none !important; }

#app { height: 100%; }
.screen { display: none; height: 100%; flex-direction: column; padding-top: var(--safe-top); }
.screen.active { display: flex; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Tlačidlá ---------- */
.btn {
  background: #fff; color: var(--ink); padding: 10px 20px; border-radius: 999px;
  font-weight: 700; font-size: 18px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18); }
.btn.primary { background: linear-gradient(180deg, #ffd84a, #ffb700); color: #3a2a00; box-shadow: 0 5px 0 #c28400; }
.btn.big { font-size: 24px; padding: 14px 30px; font-weight: 800; }
.btn.small { font-size: 15px; padding: 6px 14px; }
.btn.danger { background: #ffe1e1; color: #b81d24; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 16px; font-size: 24px; font-weight: 800;
  background: rgba(255, 255, 255, 0.16); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(6px);
}
.icon-btn:active { transform: scale(0.92); }

.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; }
.spacer { flex: 1; }
.play-title { display: flex; flex-direction: column; line-height: 1.05; }
.play-title b { font-size: 22px; }
.play-title small { opacity: 0.8; font-size: 14px; }
.pill { background: rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 18px; }

/* ---------- Setup ---------- */
#screen-setup { align-items: center; justify-content: center; overflow-y: auto; padding: 16px; }
.setup-box, .panel {
  background: var(--panel); border-radius: 28px; padding: 24px; width: min(440px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; gap: 14px;
}
.logo { margin: 0; text-align: center; font-size: 42px; line-height: 1; color: #2a75bb;
  text-shadow: 2px 2px 0 #ffcb05, 4px 4px 0 rgba(0,0,0,.1); }
.logo span { color: #ff7a1a; }
.sub { text-align: center; margin: 0; color: var(--muted); font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.field.row { flex-direction: row; justify-content: space-between; align-items: center; }
.field input {
  border: 3px solid #e3e6f3; border-radius: 16px; padding: 10px 14px; font-size: 20px; outline: none;
}
.field input:focus { border-color: #2a75bb; }
.field small { font-weight: 500; color: var(--muted); }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatar { min-width: 0; aspect-ratio: 1; border-radius: 18px; background: #f1f3fa; padding: 4px; border: 3px solid transparent; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.avatar.on { border-color: #ffb700; background: #fff6d6; transform: scale(1.06); }
.seg { display: flex; background: #f1f3fa; border-radius: 999px; padding: 4px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.seg button.on { background: #2a75bb; color: #fff; }

/* ---------- Domov ---------- */
.me { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16); border-radius: 999px; padding: 4px 16px 4px 4px; color: #fff; font-weight: 800; font-size: 18px; }
.me img { width: 40px; height: 40px; background: #fff; border-radius: 50%; padding: 2px; }
.home-scroll { flex: 1; overflow-y: auto; padding: 4px 14px calc(24px + var(--safe-bot)); max-width: 720px; width: 100%; margin: 0 auto; }
.hero { display: flex; gap: 12px; align-items: stretch; margin-bottom: 16px; }
.album-btn {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: var(--radius);
  padding: 10px 16px; text-align: left; font-weight: 600; line-height: 1.15; box-shadow: 0 5px 0 rgba(0,0,0,.2);
}
.album-btn b { font-size: 22px; }
.album-ico { font-size: 34px; }
.album-btn.bump { animation: bump 0.5s; }
.play-btn { flex: 1; border-radius: var(--radius); }

.world {
  background: #fff; border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
  box-shadow: 0 5px 0 rgba(0,0,0,.18); border-left: 10px solid var(--t);
}
.world.locked .world-head, .world.locked .world-lock { filter: grayscale(0.85); opacity: 0.75; }
.world.locked { background: #ecebf3; }
.world-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--t) 22%, #fff), #fff); }
.world-num { width: 44px; height: 44px; border-radius: 50%; background: var(--t); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.world-name { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.world-name b { font-size: 20px; }
.world-name small { color: var(--muted); }
.world-prog { width: 90px; text-align: right; font-weight: 800; }
.bar { height: 10px; background: #eef0f7; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--t); border-radius: 99px; }
.world-lock { padding: 0 14px 12px; color: var(--muted); font-size: 15px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; padding: 6px 14px 16px; }
.lvl { aspect-ratio: 1; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-weight: 800; }
.lvl b { font-size: 20px; }
.lvl i { font-style: normal; font-size: 11px; color: #e0a000; letter-spacing: -1px; height: 12px; }
.lvl.done { background: color-mix(in srgb, var(--t) 25%, #fff); color: var(--ink); }
.lvl.now { background: var(--t); color: #fff; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--t); animation: pulse 1.4s infinite; }
.lvl.lock { background: #f0f1f6; color: #b5b9cc; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- Hra ---------- */
#screen-play { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--t, #4fb3e8) 45%, transparent), transparent 70%); }
#board-wrap { flex: 1; min-height: 0; padding: 4px 8px calc(12px + var(--safe-bot)); display: flex; }
.board { width: 100%; height: 100%; overflow: visible; }
.board-bg { fill: rgba(255, 255, 255, 0.92); }
.board-dot { fill: #dfe3f2; }
.play-tip {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-bot)); transform: translateX(-50%);
  background: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  width: max-content; max-width: 90vw; text-align: center; pointer-events: none; animation: bob 1.6s infinite;
}
@keyframes bob { 50% { transform: translate(-50%, -6px); } }
.hint-btn { background: rgba(255, 203, 5, 0.9); }

.snake { cursor: pointer; }
.snake path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.snake-outline { stroke: rgba(20, 20, 40, 0.35); stroke-width: 76; }
.snake-body { stroke-width: 64; }
.snake-belly { stroke-width: 16; opacity: 0.85; }
.snake-hit { stroke: transparent; stroke-width: 96; }
.tongue { stroke: #e8354b; stroke-width: 7; fill: none; }
.snake-head image { pointer-events: none; }
.snake.leaving { pointer-events: none; }
.snake.shake { animation: shake 0.4s; transform-box: fill-box; transform-origin: center; }
.snake.oops .snake-outline { stroke: #ff3b3b; }
.snake.hint .snake-outline { stroke: #ffcb05; stroke-width: 92; animation: glow 0.8s infinite alternate; }
@keyframes glow { to { stroke: #fff36b; stroke-width: 100; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 40, 0.75); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 50;
  padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bot)); animation: fadeIn 0.25s;
}
/* Okná sa zmestia na obrazovku a dajú sa posúvať (aj nad spodnou lištou telefónu). */
.overlay > .panel { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex-shrink: 1; }
.overlay > .panel > * { flex-shrink: 0; }
.panel h2 { margin: 0; }
.panel.center { align-items: center; text-align: center; }
.reward-box { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; max-height: 100%; overflow-y: auto; padding-bottom: 8px; }
.reward-box h2 { margin: 0; font-size: 36px; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.reward-stars { font-size: 52px; line-height: 1; display: flex; gap: 6px; }
.reward-stars span { color: rgba(255,255,255,.25); }
.reward-stars span.on { color: #ffcb05; animation: starIn 0.5s backwards; text-shadow: 0 0 20px #ffcb05; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } }
.reward-hint { color: #fff; font-size: 20px; margin: 0; min-height: 28px; }
.reward-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; min-height: 60px; }
.nw-badge { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; color: #fff; font-weight: 800; box-shadow: 0 0 0 8px #fff, 0 0 40px 10px rgba(255,203,5,.6); animation: starIn 0.7s; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: #fff; padding: 10px 20px; border-radius: 999px; font-weight: 700; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.3); }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { top: 110%; transform: rotate(720deg) translateX(40px); } }

/* ---------- Kartička ---------- */
.card { width: 100%; aspect-ratio: 63 / 88; perspective: 1200px; container-type: inline-size; }
.card.big { width: min(78vw, 300px, calc((100dvh - 400px) * 0.716)); min-width: 160px; cursor: pointer; }
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(.3,1.4,.5,1); }
.card.show-back .card-inner { transform: rotateY(180deg); }
.card.deal { animation: deal 0.7s cubic-bezier(.2,1.3,.5,1), wobble 1.6s 0.8s infinite; }
@keyframes deal { from { transform: translateY(80vh) rotate(-30deg) scale(0.4); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg) scale(1.02); } 75% { transform: rotate(3deg) scale(1.02); } }
.card.to-album { animation: toAlbum 0.65s ease-in forwards; }
@keyframes toAlbum { to { transform: translate(-40vw, -60vh) scale(0.1) rotate(-20deg); opacity: 0; } }

.card-face {
  position: absolute; inset: 0; border-radius: 4.5cqw; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.card-front {
  background: linear-gradient(160deg, var(--el), color-mix(in srgb, var(--e) 55%, #fff));
  border: 3.2cqw solid var(--t);
  box-shadow: inset 0 0 0 0.6cqw rgba(255,255,255,.7), 0 1.5cqw 4cqw rgba(0,0,0,.35);
  display: flex; flex-direction: column; padding: 2.6cqw 3cqw; gap: 1.6cqw; color: #1b1b1b;
  font-size: 5cqw; line-height: 1.1;
}
.card-front.tier-7 { box-shadow: inset 0 0 0 0.6cqw #ffd700, 0 0 5cqw rgba(255, 215, 0, .7); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.card-name { font-size: 7cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-hp { display: flex; align-items: center; gap: 1cqw; color: #c0152a; font-size: 6.5cqw; }
.card-hp small { font-size: 3.5cqw; }
.card-art {
  height: 42%; flex: none; border: 1.4cqw solid #d9b44a; border-radius: 1.5cqw;
  background: radial-gradient(circle at 50% 40%, #fff, var(--el) 60%, var(--e));
  display: grid; place-items: center; box-shadow: inset 0 0 4cqw rgba(0,0,0,.2);
  overflow: hidden;
}
.card-art img { height: 100%; width: 100%; object-fit: contain; filter: drop-shadow(0 1.5cqw 1.5cqw rgba(0,0,0,.35)); }
.card-info { font-size: 3.3cqw; text-align: center; background: linear-gradient(90deg, transparent, #e8c860, transparent); font-style: italic; padding: 0.4cqw; }
.card-attacks { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2cqw; }
.atk { display: flex; align-items: center; gap: 2cqw; border-bottom: 0.3cqw solid rgba(0,0,0,.15); padding-bottom: 1.5cqw; }
.atk .cost { display: flex; gap: 0.5cqw; min-width: 16cqw; }
.atk .cost .energy { width: 5.4cqw !important; height: 5.4cqw !important; }
.atk-name { flex: 1; font-weight: 800; font-size: 5.2cqw; }
.dmg { font-weight: 800; font-size: 7cqw; }
.card-bottom { display: flex; justify-content: space-between; font-size: 3cqw; }
.card-bottom span { display: flex; align-items: center; gap: 0.6cqw; }
.card-bottom .energy { width: 4.2cqw !important; height: 4.2cqw !important; }
.card-rarity { display: flex; align-items: center; gap: 1.5cqw; font-size: 3.5cqw; font-weight: 800; color: var(--td); }
.card-rarity .dupe { margin-left: auto; background: var(--td); color: #fff; border-radius: 99px; padding: 0 2cqw; }

.energy {
  display: inline-grid; place-items: center; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 40%, #fff), var(--c) 60%);
  box-shadow: inset 0 -0.3em 0.5em rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.25);
}
.energy svg { width: 66%; height: 66%; }
.card-hp .energy { width: 7cqw !important; height: 7cqw !important; }

.holo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0.45;
  background: linear-gradient(115deg, transparent 20%, rgba(255,0,170,.5) 35%, rgba(0,255,255,.5) 45%, rgba(255,255,0,.5) 55%, transparent 70%);
  background-size: 250% 250%; animation: holo 4s linear infinite;
}
@keyframes holo { from { background-position: 100% 100%; } to { background-position: 0% 0%; } }

.card-back {
  transform: rotateY(180deg); background: radial-gradient(circle at 50% 45%, #3d6fe0, #1a2f8a 55%, #0d1650);
  border: 3.2cqw solid #0b1240; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6cqw;
  box-shadow: 0 1.5cqw 4cqw rgba(0,0,0,.35);
}
.card-back::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,255,255,.07) 0 10deg, transparent 10deg 20deg);
}
.back-ring { width: 56cqw; height: 56cqw; border-radius: 50%; background: radial-gradient(#ffcb05 30%, #ff7a1a); display: grid; place-items: center; box-shadow: 0 0 10cqw rgba(255,203,5,.6); z-index: 1; }
.back-ball {
  width: 44cqw; height: 44cqw; border-radius: 50%; border: 2.5cqw solid #111;
  background: linear-gradient(#e8354b 0 46%, #111 46% 54%, #fff 54%); position: relative;
}
.back-ball::after { content: ''; position: absolute; left: 50%; top: 50%; width: 13cqw; height: 13cqw; transform: translate(-50%,-50%); border-radius: 50%; background: #fff; border: 2.5cqw solid #111; }
.back-title { z-index: 1; color: #ffcb05; font-size: 8cqw; font-weight: 800; text-align: center; line-height: 1; text-shadow: 0 0.8cqw 0 #1a2f8a, 0 0 4cqw rgba(0,0,0,.5); }
.back-title b { font-size: 12cqw; color: #fff; }

/* ---------- Album ---------- */
.sortbar { display: flex; gap: 6px; padding: 0 14px 8px; overflow-x: auto; scrollbar-width: none; align-items: center; }
.sortbar button { flex: none; background: rgba(255,255,255,.16); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; }
.sortbar button.on { background: #ffcb05; color: #3a2a00; }
.sort-tip { flex: none; color: rgba(255,255,255,.7); font-size: 14px; padding-left: 6px; }
.album-scroll { flex: 1; overflow-y: auto; padding: 0 14px calc(24px + var(--safe-bot)); }
.tier-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 12px; }
.tier-strip div { background: var(--t); border-radius: 12px; color: #fff; text-align: center; padding: 4px 0; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.tier-strip b { display: block; font-size: 14px; }
.tier-strip small { font-size: 11px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.slot { cursor: grab; transition: transform 0.15s; }
.slot:active { transform: scale(0.97); }
.slot-ghost { opacity: 0.35; }
.empty { color: #fff; text-align: center; font-size: 18px; grid-column: 1 / -1; padding: 30px; }
.missing-toggle { display: flex; gap: 8px; align-items: center; color: #fff; font-weight: 700; margin: 20px 0 10px; }
.missing-toggle input { width: 22px; height: 22px; }
.album-grid.missing { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.slot-missing {
  aspect-ratio: 63 / 88; border-radius: 12px; border: 3px dashed color-mix(in srgb, var(--t) 70%, #fff);
  background: rgba(255,255,255,.08); display: flex; flex-direction: column; align-items: center; justify-content: center; color: rgba(255,255,255,.6);
}
.slot-missing img { width: 80%; filter: brightness(0) invert(1); opacity: 0.35; }
.slot-missing b { font-size: 34px; }
.slot-missing span { font-size: 12px; font-weight: 700; }
.cardview-wrap { display: grid; place-items: center; }

/* ---------- Hráči ---------- */
.players-list { flex: 1; overflow-y: auto; padding: 0 14px calc(24px + var(--safe-bot)); display: flex; flex-direction: column; gap: 10px; max-width: 720px; width: 100%; margin: 0 auto; }
.player { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius); padding: 10px 14px; text-align: left; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.player.is-me { box-shadow: 0 0 0 4px #ffcb05, 0 4px 0 rgba(0,0,0,.18); }
.player img { width: 48px; height: 48px; }
.rank { font-size: 24px; width: 34px; text-align: center; font-weight: 800; }
.pname { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pname b { font-size: 19px; }
.pname small { color: var(--muted); }
.tbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: #eef0f7; margin-top: 4px; }
.pcount { font-size: 28px; font-weight: 800; text-align: center; line-height: 1; }
.pcount small { display: block; font-size: 12px; color: var(--muted); }

@keyframes bump { 40% { transform: scale(1.15); } }
@media (min-width: 700px) { .album-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }

/* ---------- Vzácne verzie kartičiek ---------- */
.card-front.v-silver, .card-front.v-gold, .card-front.v-diamond {
  border-color: transparent;
  background: linear-gradient(160deg, var(--el), color-mix(in srgb, var(--e) 55%, #fff)) padding-box, var(--vb) border-box;
}
.card-front.v-silver { --vb: linear-gradient(135deg, #f7f9fc, #9aa4b2 30%, #ffffff 50%, #8a94a3 75%, #eef1f6); }
.card-front.v-gold { --vb: linear-gradient(135deg, #fff3b0, #d4a017 30%, #fff6c8 50%, #b8860b 75%, #ffe680); box-shadow: 0 0 5cqw rgba(255, 200, 40, .6); }
.card-front.v-diamond { --vb: linear-gradient(135deg, #b9f3ff, #7fd7ff 25%, #ffffff 45%, #c9a7ff 65%, #7fffd4 85%, #e0fbff); box-shadow: 0 0 7cqw rgba(140, 220, 255, .8); }
.card-front.v-diamond::before {
  content: '✦ ✧ ✦'; position: absolute; inset: 0; pointer-events: none; color: #fff; font-size: 9cqw; letter-spacing: 20cqw;
  text-shadow: 0 0 3cqw #7fd7ff; display: grid; place-items: center; opacity: .8; animation: twinkle 1.6s infinite alternate;
}
@keyframes twinkle { from { opacity: .2; transform: scale(.9) rotate(-4deg); } to { opacity: .9; transform: scale(1.05) rotate(4deg); } }
.v-badge {
  position: absolute; top: 15%; right: -9cqw; transform: rotate(35deg); padding: 0.6cqw 10cqw; font-size: 3.6cqw; font-weight: 800;
  background: var(--vb); color: #3a2a00; box-shadow: 0 1cqw 2cqw rgba(0,0,0,.3); z-index: 2;
}
.slot-info { color: #fff; font-size: 13px; font-weight: 700; text-align: center; margin-top: 4px; line-height: 1.1; }
.slot-info .bar { height: 6px; background: rgba(255,255,255,.2); margin: 3px 10px 0; }
.slot-info .bar i { background: #ffcb05; }
.variant-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.variant-tabs button { background: rgba(255,255,255,.16); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; }
.variant-tabs button.on { background: #ffcb05; color: #3a2a00; }
.cardview-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lvl img { width: 60%; height: 50%; object-fit: contain; }
.lvl.done b { font-size: 13px; }
.avatars.many { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); max-height: 200px; overflow-y: auto; padding: 4px; }
.specials { font-size: 13px; color: var(--muted); }
.reward-special { color: #ffcb05; font-size: 26px; font-weight: 800; text-shadow: 0 0 20px rgba(255,203,5,.8); animation: starIn .6s; }

.group-form { background: #fff; border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; text-align: center; font-weight: 600; }
.group-form p { margin: 0; }
.group-form input { border: 3px solid #e3e6f3; border-radius: 16px; padding: 10px 14px; font-size: 22px; text-align: center; text-transform: uppercase; letter-spacing: 2px; outline: none; }
.group-form input:focus { border-color: #2a75bb; }
#setup-group, #set-group { text-transform: uppercase; letter-spacing: 1px; }

.rank-btn { width: auto; padding: 0 12px; gap: 4px; display: flex; align-items: center; font-size: 22px; }
.rank-btn b { font-size: 20px; }
.rank-btn small { font-size: 12px; opacity: .8; font-weight: 600; }

/* Úzke telefóny: menšie tlačidlá v hornej lište hry */
.play-title b, .play-title small { white-space: nowrap; }
@media (max-width: 430px) {
  #screen-play .topbar { gap: 6px; padding: 8px 10px; }
  #screen-play .icon-btn { width: 40px; height: 40px; font-size: 20px; border-radius: 13px; }
  #screen-play .play-title b { font-size: 18px; }
  #screen-play .play-title small { font-size: 12px; }
  #screen-play .pill { font-size: 15px; padding: 4px 9px; white-space: nowrap; }
}

/* Album: voľba počtu kartičiek vedľa seba */
.zoom { display: flex; gap: 3px; background: rgba(255,255,255,.16); border-radius: 999px; padding: 3px; }
.zoom button { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 16px; }
.zoom button.on { background: #ffcb05; color: #3a2a00; }
.album-grid.fixed-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 8px; }
.album-grid.missing.fixed-cols { grid-template-columns: repeat(calc(var(--cols) + 1), minmax(0, 1fr)); gap: 6px; }
.album-grid[data-cols="4"] .slot-info, .album-grid[data-cols="5"] .slot-info { font-size: 10px; }
.album-grid[data-cols="5"] .slot-info .bar { margin: 2px 4px 0; }
.album-grid[data-cols="4"] .slot-missing span, .album-grid[data-cols="5"] .slot-missing span { font-size: 9px; }
.album-grid[data-cols="4"] .slot-missing b, .album-grid[data-cols="5"] .slot-missing b { font-size: 20px; }

/* Nápoveda */
#help { z-index: 60; }
.help-panel { max-height: 100%; padding: 18px; overflow: hidden; }
.overlay > .panel > .help-body { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; touch-action: pan-y; }
.help-body { overflow-y: auto; line-height: 1.35; font-size: 16px; }
.help-body h3 { margin: 14px 0 6px; font-size: 20px; color: #2a75bb; }
.help-body h3:first-child { margin-top: 0; }
.help-body p { margin: 6px 0; }
.help-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.help-list .energy { vertical-align: middle; }
.help-tiles { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.help-tiles li { display: flex; gap: 10px; align-items: center; font-size: 15px; line-height: 1.2; }
.help-tile { flex: none; width: 52px; background: var(--t); border-radius: 10px; color: #fff; text-align: center; padding: 4px 0; text-shadow: 0 1px 2px rgba(0,0,0,.4); line-height: 1; }
.help-tile b { display: block; font-size: 14px; }
.help-tile small { font-size: 11px; }
.help-energies { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.help-energy { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.tier-strip div { cursor: pointer; }
#album-help { width: 40px; height: 40px; font-size: 20px; }

/* Bleskový bonus */
.speed { display: flex; align-items: center; gap: 6px; margin: 0 16px; height: 18px; transition: opacity .4s; }
.speed span { font-size: 16px; line-height: 1; filter: drop-shadow(0 0 4px #ffcb05); }
.speed i { flex: 1; height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); position: relative; overflow: hidden; }
.speed i::after { content: ''; position: absolute; inset: 0; width: calc(var(--left, 1) * 100%); background: linear-gradient(90deg, #ffcb05, #fff36b); border-radius: 99px; box-shadow: 0 0 8px #ffcb05; transition: width .1s linear; }
.speed.gone { opacity: .25; }
.reward-speed { margin: 0; color: #fff; font-size: 16px; text-align: center; line-height: 1.4; }
.reward-speed .fast { color: #ffcb05; font-size: 19px; text-shadow: 0 0 12px rgba(255,203,5,.8); }

/* Obrázková nápoveda */
.help-card { width: min(230px, 70%); margin: 8px auto 4px; }
.help-card .card { pointer-events: none; }
.help-card .card-hp, .help-card .atk, .help-card .card-bottom > span, .help-card .card-rarity { position: relative; }
.help-mark, .help-num {
  display: inline-grid; place-items: center; border-radius: 50%; background: #e8354b; color: #fff; font-weight: 800;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.4); font-style: normal; line-height: 1;
}
.help-mark { width: 6.5cqw; height: 6.5cqw; font-size: 4.2cqw; margin-right: 1cqw; flex: none; box-shadow: 0 0 0 0.5cqw #fff; }
.help-num { flex: none; width: 28px; height: 28px; font-size: 16px; }
.help-legend { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.help-legend li { display: flex; gap: 10px; align-items: flex-start; }
.help-legend p { margin: 4px 0 0; font-size: 15px; }
.vis { display: inline-flex; align-items: center; gap: 4px; background: #f3f5fb; border: 2px solid #e3e6f3; border-radius: 10px; padding: 3px 8px; font-size: 14px; font-weight: 600; }
.vis-hp { color: #c0152a; font-weight: 800; font-size: 17px; }
.vis-hp small { font-size: 10px; }
.vis-atk b { margin-left: 4px; }
.vis-atk .dmg { margin-left: 10px; font-size: 17px; }
.help-variants { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.vchip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 800; color: #3a2a00; }
.vchip.v-silver { background: linear-gradient(135deg, #f7f9fc, #9aa4b2, #ffffff); }
.vchip.v-gold { background: linear-gradient(135deg, #fff3b0, #d4a017, #fff6c8); }
.vchip.v-diamond { background: linear-gradient(135deg, #b9f3ff, #c9a7ff, #7fffd4); }

/* Výmeny */
.trade-btn { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 99px; background: #e8354b; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; box-shadow: 0 0 0 2px #fff; }
#trades, #tradepick { z-index: 55; }
.trade-panel { max-height: 100%; overflow: hidden; }
.trade-panel h2 { margin: 0; }
.trade-body, .trade-grid { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.overlay > .panel > .trade-body, .overlay > .panel > .trade-grid { flex: 1 1 auto; min-height: 0; }
.trade-body h3 { margin: 10px 0 4px; color: #2a75bb; }
.trade-row { background: #f3f5fb; border-radius: 16px; padding: 10px; margin-bottom: 10px; }
.trade-row p { margin: 0 0 6px; }
.trade-swap { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.trade-swap small { display: block; font-weight: 700; color: var(--muted); }
.trade-card { width: 100px; }
.trade-card .card { pointer-events: none; }
.trade-arrow { font-size: 30px; font-weight: 800; color: #2a75bb; }
.trade-wait { color: var(--muted); font-weight: 700; align-self: center; }
.trade-note { margin: 0; color: var(--muted); }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; padding: 4px; }
.trade-pick { border-radius: 12px; padding: 3px; border: 3px solid transparent; }
.trade-pick .trade-card { width: 100%; }
.trade-pick.on { border-color: #ffb700; background: #fff6d6; }
.btn:disabled { opacity: .5; }

/* Denná výzva */
.daily-btn {
  width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  background: linear-gradient(135deg, #ff9a3c, #ff5a8a); color: #fff; border-radius: var(--radius); padding: 10px 16px; margin: -4px 0 16px;
  box-shadow: 0 5px 0 rgba(0,0,0,.2);
}
.daily-btn span { grid-row: span 2; font-size: 32px; }
.daily-btn b { font-size: 20px; line-height: 1.1; }
.daily-btn small { opacity: .9; line-height: 1.2; }
.daily-list { background: linear-gradient(135deg, #fff3e6, #ffe6ef); border-radius: var(--radius); padding: 10px 14px; }
.daily-list h3 { margin: 0 0 6px; }
.daily-row { display: flex; gap: 10px; align-items: center; font-weight: 700; padding: 3px 0; }
.daily-row img { width: 32px; height: 32px; }
.daily-row span:nth-child(3) { flex: 1; }

/* Album na úzkom telefóne: nadpis sa skráti, prepínač a ❓ sa vždy zmestia */
#screen-album .topbar { gap: 6px; }
#screen-album .play-title { min-width: 0; flex: 1 1 auto; overflow: hidden; }
#screen-album .play-title b, #screen-album .play-title small { overflow: hidden; text-overflow: ellipsis; }
#screen-album .spacer { display: none; }
#screen-album .zoom, #album-help { flex: none; }
@media (max-width: 430px) {
  #screen-album .icon-btn { width: 40px; height: 40px; font-size: 20px; border-radius: 13px; }
  #screen-album .play-title b { font-size: 18px; }
  #screen-album .play-title small { font-size: 12px; }
  .zoom button { width: 28px; height: 28px; font-size: 14px; }
  #album-help { width: 36px; height: 36px; font-size: 18px; }
}
/* Tlačidlá triedenia v albume sa zalomia do riadkov – všetky sú vidieť bez posúvania */
.sortbar { flex-wrap: wrap; overflow: visible; }
.sortbar button { padding: 5px 12px; font-size: 15px; }
.sort-tip { flex-basis: 100%; padding-left: 2px; font-size: 13px; }

/* Lov vzácnych */
.hunt { background: #fff; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.hunt h3 { margin: 4px 0 6px; color: #2a75bb; font-size: 18px; }
.hunt p { margin: 0 0 8px; font-size: 15px; line-height: 1.35; }
.hunt-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid #eef0f7; }
.hunt-row img { width: 44px; height: 44px; object-fit: contain; }
.hunt-row span { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.hunt-row small { color: var(--muted); }

/* Kartičky zo zamknutého sveta (napr. z výmeny) */
.world-owned { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 14px 12px; }
.world-owned small { color: var(--muted); font-weight: 700; margin-right: 2px; }
.owned-chip { width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--t) 25%, #fff); padding: 3px; }
.owned-chip img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Súboj ---------- */
.battle-call { width: 100%; margin-bottom: 12px; background: linear-gradient(180deg, #ff6b6b, #e8354b); color: #fff; box-shadow: 0 5px 0 #a3172a; }
.stake-row { display: flex; gap: 12px; justify-content: center; }
.stake-row .btn { width: 70px; font-size: 30px; }
.stake-row .btn:disabled { opacity: .35; }
#battlestake, #battles { z-index: 55; }
#arena { z-index: 70; background: radial-gradient(circle at 50% 50%, #3b1f6e, #0b0f2e 75%); }
.arena-box { width: min(560px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; }
.arena-name { position: relative; z-index: 3; margin: 6px 0; font-weight: 800; font-size: 18px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.arena-cards { display: flex; gap: 10px; justify-content: center; }
.arena-card { width: min(28vw, 120px, calc((100dvh - 330px) / 2 * 0.716)); transition: transform .35s, opacity .5s, filter .5s; }
.arena-card .card { pointer-events: none; }
.arena-card.active { transform: scale(1.12); z-index: 2; }
.arena-card.clash { animation: clash .5s ease-in-out 2; }
.arena-card.won { transform: scale(1.12); filter: drop-shadow(0 0 14px #ffd84a) drop-shadow(0 0 4px #fff); }
.arena-card.lost { opacity: .35; filter: grayscale(1); transform: scale(.85) rotate(-6deg); }
@keyframes clash { 25% { transform: scale(1.15) translateX(-6px) rotate(-3deg); } 75% { transform: scale(1.15) translateX(6px) rotate(3deg); } }
.arena-mid { position: relative; height: 52px; display: grid; place-items: center; width: 100%; }
.arena-vs { font-size: 34px; font-weight: 800; color: #ffcb05; text-shadow: 0 0 18px #ff7a1a, 0 3px 0 #a3172a; }
.arena-boom { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.arena-boom span, .arena-boom i { position: absolute; opacity: 0; font-style: normal; }
.arena-boom span { font-size: 90px; }
.arena-boom i { font-size: 26px; }
.arena-boom.go span { animation: boom .9s ease-out; }
.arena-boom.go i { animation: stars .9s ease-out; }
@keyframes boom { 0% { opacity: 0; transform: scale(.2); } 30% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: scale(2.2); } }
@keyframes stars { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.5); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-120px) scale(1.2); } }
#arena.flash { animation: flash .3s; }
.arena-msg { margin: 4px 0 0; font-size: 18px; min-height: 48px; }
.arena-result { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.arena-result h4 { margin: 4px 0; }
.arena-result .trade-card { width: 80px; }
.trade-swap.lost .trade-card { opacity: .5; filter: grayscale(.8); }

/* ---------- Ring súboja ---------- */
#arena .arena-stakes { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#arena .arena-card { width: min(19vw, 78px); }
#arena .arena-card.chosen { transform: scale(1.18); filter: drop-shadow(0 0 10px #ffd84a); }
.ring {
  position: relative; width: 100%; height: min(42vh, 300px); margin: 6px 0; border-radius: 18px;
  background: radial-gradient(ellipse at 50% 85%, #e9d7b0 0 38%, #b98a4e 39% 42%, transparent 43%),
    radial-gradient(circle at 50% 0%, rgba(255,255,220,.35), transparent 60%), linear-gradient(#2a1f5e, #15103a);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6); overflow: visible;
}
.ring-ropes { position: absolute; left: 4%; right: 4%; top: 30%; height: 34%; border-top: 4px solid #ff4d6d; border-bottom: 4px solid #ff4d6d; box-shadow: 0 18px 0 -14px #fff inset; opacity: .85; }
.ring-ropes::before, .ring-ropes::after { content: ''; position: absolute; top: -14px; bottom: -40px; width: 10px; border-radius: 4px; background: linear-gradient(#ddd, #888); }
.ring-ropes::before { left: -6px; } .ring-ropes::after { right: -6px; }
.fighter { position: absolute; bottom: 14%; width: 34%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fighter.left { left: 6%; } .fighter.right { right: 6%; }
.fighter .hp { width: 100%; text-align: center; }
.hp-name { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.hp-bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; border: 2px solid rgba(255,255,255,.6); }
.hp-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #5be37d, #b6f36b); transition: width .45s ease-out; }
.hp-bar i.low { background: linear-gradient(90deg, #ff4d4d, #ff9a3c); }
.f-body { width: min(26vw, 110px); aspect-ratio: 1; border-radius: 50%; background: #fff; border: 6px solid var(--e); box-shadow: 0 8px 0 rgba(0,0,0,.35), 0 0 20px var(--e); display: grid; place-items: center; }
.f-body img { width: 88%; height: 88%; object-fit: contain; }
.fighter.right .f-body img { transform: scaleX(-1); }
.fighter.style-fly .f-body { animation: flap .5s ease-in-out infinite; }
@keyframes flap { 50% { translate: 0 -10px; scale: 1.06 .94; } }
.fighter.style-kick .f-body { animation: bounce .7s ease-in-out infinite; }
.fighter.style-tackle .f-body { animation: bounce 1s ease-in-out infinite; }
@keyframes bounce { 50% { translate: 0 -4px; } }
.fighter.down .f-body { animation: none; filter: grayscale(1) brightness(.8); box-shadow: none; }
.fighter.winner .f-body { animation: none; box-shadow: 0 0 30px #ffd84a, 0 0 8px #fff; }
.fighter.winner .hp::before { content: '👑'; display: block; font-size: 30px; line-height: 1; }
.f-fx { position: absolute; left: 50%; bottom: 30%; width: 0; height: 0; }
.f-fx i { position: absolute; font-style: normal; font-size: 26px; opacity: 0; }
.f-fx.go i { animation: bolt .45s ease-out; }
@keyframes bolt { 0% { opacity: 1; transform: rotate(var(--a)) translateY(-10px) scale(.6); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-70px) scale(1.3); } }
.dizzy { position: absolute; left: -16px; bottom: 20px; font-size: 34px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ring-fx { position: absolute; inset: 0; pointer-events: none; }
.shot { position: absolute; top: 48%; font-size: 40px; transform-origin: center; filter: drop-shadow(0 0 8px #fff); }

/* Domovská lišta: meno + ⚔️ 🔄 🏆 ⚙️ sa zmestia aj na úzky telefón */
#screen-home .topbar { gap: 6px; padding: 8px 10px; }
#screen-home .me { min-width: 0; flex: 0 1 auto; padding-right: 12px; }
#screen-home .me span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#screen-home .topbar .icon-btn { flex: none; }
@media (max-width: 430px) {
  #screen-home .me { font-size: 16px; max-width: 38vw; }
  #screen-home .me img { width: 34px; height: 34px; }
  #screen-home .topbar .icon-btn { width: 42px; height: 42px; font-size: 20px; border-radius: 14px; }
  #screen-home .topbar .rank-btn { width: auto; padding: 0 8px; font-size: 18px; }
  #screen-home .rank-btn b { font-size: 16px; }
  #screen-home .rank-btn small { display: none; }
}
