/* Critter Clash prototype — phone-first (390x844 and 390x660), dark playful theme */
:root {
  --bg: #1d1238;
  --bg2: #2a1a52;
  --panel: rgba(38, 22, 78, .82);
  --panel2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .14);
  --text: #fff7ec;
  --muted: #c9b8ee;
  --orange: #ff8a1f;
  --yellow: #ffd23f;
  --pink: #ff5fa2;
  --teal: #2ee6c5;
  --me: #2ee6c5;
  --bot: #ff5f6d;
  --c-red: #ff4d5e; --c-orange: #ff9a2e; --c-yellow: #ffd23f; --c-green: #46d36b; --c-blue: #43b6ff; --c-purple: #a66bff;
  --r-common: #9fb3c8; --r-rare: #43b6ff; --r-epic: #b46bff; --r-legendary: #ffc23d;
  --radius: 18px;
  font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0e0820; color: var(--text); overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
img { user-select: none; -webkit-user-drag: none; }
h1, h2, h3, p { margin: 0; }

#app { position: relative; max-width: 430px; height: 100dvh; margin: 0 auto; overflow: hidden; background: var(--bg); }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 12px 16px 16px;
  opacity: 0; pointer-events: none; transform: translateY(12px) scale(.98); transition: opacity .3s, transform .3s; overflow-y: auto; }
.screen.active { opacity: 1; pointer-events: auto; transform: none; }
#app:has(.bottom-nav.show) .screen { padding-bottom: 84px; }
.sub { color: var(--muted); font-size: 14px; text-align: center; line-height: 1.3; }
.fine { color: var(--muted); font-size: 11px; opacity: .8; text-align: center; margin-top: auto; padding-top: 8px; }

/* ---------- buttons */
.btn-play { position: relative; width: min(300px, 100%); padding: 14px 0 12px; border-radius: 22px; font-size: 34px; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(#ffd23f, #ff8a1f 70%); color: #4a1d00; box-shadow: 0 6px 0 #b8510b, 0 10px 24px rgba(255, 138, 31, .45);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5); transition: transform .1s; animation: breathe 2.2s ease-in-out infinite; }
.btn-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8510b; }
.btn-play.small { font-size: 20px; padding: 12px 0 10px; letter-spacing: .5px; animation: none; }
.btn-ghost { width: min(300px, 100%); padding: 11px 0; border-radius: 16px; border: 2px solid var(--line); font-weight: 700; font-size: 16px; background: var(--panel2); }
.btn-link { color: var(--muted); font-weight: 700; padding: 8px; text-decoration: underline; text-underline-offset: 3px; }
@keyframes breathe { 50% { transform: scale(1.04); } }

.sheader { width: 100%; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheader h2 { font-size: 24px; font-weight: 800; flex: 1; }
.back { width: 38px; height: 38px; border-radius: 12px; background: var(--panel2); font-size: 28px; line-height: 34px; }

/* ---------- avatar */
.avatar { position: relative; display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none;
  background: radial-gradient(circle at 50% 35%, #ffe6b8, #ff9a5a 70%); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.avatar img { width: 120%; height: 120%; object-fit: cover; object-position: 50% 8%; margin-top: 18%; }
.avatar.gold-frame, .gold-frame .avatar { border-color: var(--yellow); box-shadow: 0 0 0 3px #b8860b, 0 0 16px var(--yellow); }

/* ---------- home */
.screen-home { background: url(../assets/bg-home.webp) center / cover; }
.screen-home::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(20, 10, 45, .35), rgba(20, 10, 45, .05) 30%, rgba(20, 10, 45, .7) 75%); pointer-events: none; }
.screen-home > * { position: relative; }
.topbar { width: 100%; display: flex; align-items: center; gap: 8px; }
.profile { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: left; }
.pinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.pinfo b { font-size: 17px; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.plevel { font-size: 13px; color: var(--yellow); font-weight: 700; }
.xpbar { width: 86px; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, .4); overflow: hidden; margin-top: 3px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #8af7e4); }
.wallet { display: flex; align-items: center; gap: 4px; padding: 4px 12px 4px 4px; border-radius: 20px; background: rgba(20, 10, 45, .75); border: 2px solid rgba(255, 210, 63, .5); font-weight: 800; font-size: 17px; }
.wallet img { width: 26px; height: 26px; }
.lang { width: 38px; height: 34px; border-radius: 12px; background: rgba(20, 10, 45, .75); font-weight: 800; font-size: 13px; }
.logo { width: min(270px, 70%); margin-top: 6px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); animation: float 3s ease-in-out infinite; }
.home-hero { flex: 1; min-height: 90px; display: flex; align-items: flex-end; justify-content: center; }
.hero-mascot { max-height: 100%; height: 30vh; max-width: 70%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); animation: float 3.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.screen-home .btn-play { margin-top: 8px; }
.home-cards { width: 100%; display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; margin-top: 4px; }
.home-card { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--line); text-align: left; min-height: 72px; backdrop-filter: blur(6px); }
.hc-img { width: 44px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.chest-card .hc-img { object-fit: contain; width: 54px; height: 54px; }
.hc-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; flex: 1; }
.hc-body b { font-size: 14px; }
.hc-body span { font-size: 12px; color: var(--muted); }
.home-card .bar, .set-progress .bar { display: block; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, .4); overflow: hidden; margin-top: 4px; }
.home-card .bar i, .set-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--yellow)); }
.chest-card.ready { border-color: var(--yellow); box-shadow: 0 0 18px rgba(255, 210, 63, .45); }
.chest-card.ready .chest-state { color: var(--yellow); font-weight: 800; font-size: 15px; }
.chest-card.ready .chest-img { animation: wiggle 1.4s ease-in-out infinite; }
.bounce { animation: bounce .7s !important; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } }
@keyframes bounce { 30% { transform: scale(1.35); } 60% { transform: scale(.9); } }
.fly-coin { position: absolute; width: 26px; height: 26px; z-index: 50; pointer-events: none; animation: flycoin .9s cubic-bezier(.5, -0.4, .6, 1) forwards; }
@keyframes flycoin { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translate(0, -30px) scale(1.1); } 100% { transform: translate(var(--dx), var(--dy)) scale(.7); opacity: .9; } }

/* ---------- bottom nav */
.bottom-nav { position: absolute; left: 0; right: 0; bottom: 0; height: 68px; display: grid; grid-template-columns: repeat(5, 1fr); z-index: 20;
  background: rgba(16, 8, 36, .94); border-top: 2px solid var(--line); transform: translateY(100%); transition: transform .3s; }
.bottom-nav.show { transform: none; }
.bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; color: var(--muted); font-size: 11px; }
.bottom-nav span { font-size: 22px; transition: transform .2s; }
.bottom-nav button.on { color: var(--yellow); }
.bottom-nav button.on span { transform: translateY(-3px) scale(1.15); }

/* ---------- pick powers */
.screen-pick { background: radial-gradient(circle at 50% 0%, #3d2378, var(--bg) 70%); gap: 8px; }
.pick-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.pick-item { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 8px; border-radius: var(--radius); background: var(--panel); border: 3px solid var(--line); transition: transform .15s, border-color .15s; }
.pick-item img { width: 58px; height: 58px; object-fit: contain; }
.pick-item b { font-size: 15px; }
.pick-item .lv { font-size: 12px; color: var(--yellow); font-weight: 700; }
.pick-item small { font-size: 11.5px; color: var(--muted); line-height: 1.2; text-align: center; }
.pick-item.on { border-color: var(--pc); transform: scale(1.03); box-shadow: 0 0 16px var(--pc); }
.pick-item.on::after { content: '✓'; position: absolute; top: 6px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--pc); color: #1d1238; font-weight: 800; line-height: 24px; }
.pick-item.locked { opacity: .45; filter: grayscale(.8); }
.c-red { --pc: var(--c-red); } .c-orange { --pc: var(--c-orange); } .c-yellow { --pc: var(--c-yellow); }
.c-green { --pc: var(--c-green); } .c-blue { --pc: var(--c-blue); } .c-purple { --pc: var(--c-purple); }

/* ---------- matchmaking */
.screen-search { justify-content: center; gap: 12px; background: radial-gradient(circle at 50% 40%, #3a1f7a, #140a2c 75%); }
.radar { position: relative; width: 250px; height: 250px; border-radius: 50%; display: grid; place-items: center;
  background: repeating-radial-gradient(circle, rgba(46, 230, 197, .1) 0 1px, transparent 1px 40px), radial-gradient(circle, rgba(46, 230, 197, .15), transparent 70%); }
.radar::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(46, 230, 197, .45), transparent 25%); animation: spin 1.6s linear infinite; }
.radar > i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--teal); opacity: 0; animation: ping 2.1s ease-out infinite; }
.radar > i:nth-child(2) { animation-delay: .7s; } .radar > i:nth-child(3) { animation-delay: 1.4s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
.radar-me { position: relative; z-index: 2; width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 4px solid #fff; background: radial-gradient(#ffe6b8, #ff9a5a); }
.radar-me img, .radar-blip img { width: 120%; margin: 10% 0 0 -10%; }
.radar-blip { position: absolute; z-index: 2; top: 8px; right: 14px; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; border: 3px solid var(--bot); background: radial-gradient(#ffd6d6, #ff7b7b); animation: blip .35s infinite alternate; }
@keyframes blip { to { transform: scale(.9); opacity: .7; } }
.search-title { font-size: 26px; font-weight: 800; text-align: center; }
.search-title::after { content: ''; }
.found-card { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--bot);
  opacity: 0; transform: scale(.6); transition: .35s cubic-bezier(.3, 1.6, .5, 1); }
.found-card img { width: 56px; height: 56px; object-fit: contain; }
.found-card div { display: flex; flex-direction: column; line-height: 1.1; }
.found-card b { font-size: 20px; } .found-card span { color: var(--yellow); font-weight: 700; }
.found .found-card { opacity: 1; transform: none; }
.found .radar::before, .found .radar > i { animation-play-state: paused; opacity: .2; }
.found .radar-blip { animation: none; transform: scale(1.4) translate(-30%, 30%); transition: .4s; }
.found .search-sub { visibility: hidden; }

/* ---------- VS */
.screen-vs { flex-direction: row; justify-content: center; align-items: center; padding: 0; overflow: hidden;
  background: linear-gradient(115deg, #0c6b78 0 50%, #8a1d3c 50% 100%); }
.vs-side { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.vs-side img { width: 160px; height: 200px; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); }
.vs-side b { font-size: 20px; } .vs-side span { color: var(--yellow); font-weight: 700; }
.vs-side.left { transform: translateY(-60px); } .vs-side.right { transform: translateY(60px); }
.screen-vs.active .vs-side.left { animation: inL .5s cubic-bezier(.2, 1.4, .5, 1) both; }
.screen-vs.active .vs-side.right { animation: inR .5s cubic-bezier(.2, 1.4, .5, 1) both; }
@keyframes inL { from { transform: translate(-120%, -60px); } to { transform: translateY(-60px); } }
@keyframes inR { from { transform: translate(120%, 60px); } to { transform: translateY(60px); } }
.vs-mark { position: absolute; font-size: 84px; font-weight: 800; color: var(--yellow); -webkit-text-stroke: 3px #4a1d00; text-shadow: 0 6px 0 #b8510b, 0 0 30px rgba(255, 210, 63, .8); }
.screen-vs.active .vs-mark { animation: slam .6s .35s cubic-bezier(.2, 1.6, .5, 1) both; }
@keyframes slam { from { transform: scale(4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- duel: 1) scores + turn  2) the board on its own tray  3) powers */
.screen-duel { padding: 8px 10px 12px; gap: 8px; background: #140b2c; overflow: hidden; isolation: isolate; }
/* the scene stays only around the board, blurred and dimmed */
.screen-duel::before { content: ''; position: absolute; inset: -30px; z-index: -1; background: url(../assets/bg-board.webp) center / cover;
  filter: blur(10px) brightness(.42) saturate(1.15); }
.duel-top { width: 100%; display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 6px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; background: rgba(16, 8, 36, .8); border: 2px solid var(--line); font-size: 15px; font-weight: 800; color: var(--text); flex: none; }
.duel-player { display: flex; align-items: center; gap: 6px; padding: 3px; border-radius: 30px; background: rgba(16, 8, 36, .8); border: 2px solid transparent; transition: .3s; min-width: 0; }
.duel-player.bot { justify-content: flex-end; }
.duel-player .avatar { width: 42px; height: 42px; border-width: 2px; }
.duel-player.bot .avatar { background: radial-gradient(circle at 50% 35%, #ffd6d6, #ff7b7b 70%); }
.dp-info { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.duel-player.bot .dp-info { align-items: flex-end; }
.dp-info .nm { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.dp-info .sc { font-size: 24px; font-weight: 800; }
.duel-player.me.active { border-color: var(--me); box-shadow: 0 0 14px var(--me); }
.duel-player.bot.active { border-color: var(--bot); box-shadow: 0 0 14px var(--bot); }
.scorebar { width: 100%; height: 8px; border-radius: 6px; background: var(--bot); overflow: hidden; flex: none; opacity: .9; }
.scorebar .fill-me { display: block; height: 100%; width: 50%; background: var(--me); transition: width .4s; border-right: 2px solid #fff; }
/* one quiet status line: whose turn, moves left, round; rival powers as two tiny rings at the end */
.duel-status { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 22px; flex: none; }
.duel-turn { font-size: 13px; font-weight: 800; letter-spacing: .5px; }
.duel-turn.me { color: var(--me); } .duel-turn.bot { color: var(--bot); }
.duel-pips { display: flex; gap: 4px; }
.duel-pips i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, .15); transition: .25s; }
.duel-pips.me i.on { background: var(--me); } .duel-pips.bot i.on { background: var(--bot); }
.duel-round { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bot-powers { display: flex; gap: 4px; }
.bot-powers .power-btn { width: 24px; height: 24px; border-radius: 50%; border-width: 1.5px; }
.bot-powers .power-btn img { width: 16px; height: 16px; }
.bot-powers .pname, .bot-powers .pcount { display: none; }
.bot-powers .power-btn.ready { animation: none; box-shadow: 0 0 8px var(--pc); }
.my-powers { width: 100%; display: flex; gap: 12px; justify-content: center; flex: none; }
.power-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 96px; height: 74px; border-radius: 18px;
  background: rgba(16, 8, 36, .85); border: 2px solid var(--line); overflow: hidden; transition: transform .15s, opacity .3s; }
.power-btn .ring { position: absolute; inset: 0; background: linear-gradient(to top, color-mix(in srgb, var(--pc) 50%, transparent) calc(var(--pct) * 100%), transparent 0); transition: .4s; }
.power-btn img { position: relative; width: 38px; height: 38px; object-fit: contain; filter: grayscale(.5) brightness(.8); }
.power-btn .pname { position: relative; font-size: 11px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.power-btn .pcount { display: none; }
.power-btn.ready { border-color: var(--pc); box-shadow: 0 0 14px var(--pc); animation: readyPulse 1s ease-in-out infinite; }
.power-btn.ready img { filter: none; }
.power-btn:disabled { cursor: default; }
@keyframes readyPulse { 50% { transform: scale(1.06); } }
.screen-duel[data-turn="bot"] .my-powers { opacity: .45; }

.board-wrap { position: relative; flex: 1; width: 100%; min-height: 0; container-type: size; display: grid; place-items: center; }
/* the tray: calm solid backdrop, a clear frame, subtle cell slots */
.tray { --pad: 7px; padding: var(--pad); border-radius: 22px; background: linear-gradient(160deg, #3a2a72, #24174d 60%, #1c1240);
  border: 3px solid #6c55c9; box-shadow: 0 0 0 3px #1a0f38, 0 14px 30px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 255, 255, .15); transition: border-color .3s, box-shadow .3s; }
.screen-duel[data-turn="me"] .tray { border-color: color-mix(in srgb, var(--me) 75%, #6c55c9); }
.screen-duel[data-turn="bot"] .tray { border-color: color-mix(in srgb, var(--bot) 75%, #6c55c9); }
.board { --size: calc(min(100cqw, 100cqh) - 26px); --cell: calc(var(--size) / 8); position: relative; width: var(--size); height: var(--size); border-radius: 14px; touch-action: none;
  background: #1a1039; overflow: hidden; }
.slot { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); pointer-events: none; }
.slot::before { content: ''; position: absolute; inset: 5%; border-radius: 26%; background: rgba(255, 255, 255, .055); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35); }
.board.targeting { cursor: crosshair; box-shadow: 0 0 0 3px var(--c-red), 0 0 24px var(--c-red); }
.tile { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); padding: calc(var(--cell) * .07); transition: transform .26s cubic-bezier(.3, 1.25, .6, 1); will-change: transform; }
.tile img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); pointer-events: none; transition: transform .2s; }
.tile .fx { position: absolute; inset: 6%; border-radius: 30%; pointer-events: none; }
.tile.selected img { transform: scale(1.18); }
.tile.selected .fx { box-shadow: 0 0 0 3px #fff, 0 0 12px #fff; }
.tile.hint img { animation: hintBob .8s ease-in-out infinite; }
.tile.bot-pick .fx { box-shadow: 0 0 0 3px var(--bot), 0 0 16px var(--bot); animation: pick .35s ease-in-out infinite alternate; }
@keyframes hintBob { 50% { transform: scale(1.15) rotate(6deg); } }
@keyframes pick { to { transform: scale(1.12); } }
.tile.nope img { animation: nope .26s; }
@keyframes nope { 25% { transform: translateX(-12%); } 75% { transform: translateX(12%); } }
.tile.pop { transition: transform .2s ease-in, opacity .2s; opacity: 0; }
.tile.pop img { transform: scale(1.5); }
.tile.born img { animation: born .4s; }
@keyframes born { 40% { transform: scale(1.5); } }
.tile[data-special="row"] .fx { background: repeating-linear-gradient(0deg, transparent 0 18%, rgba(255, 255, 255, .85) 18% 26%); mix-blend-mode: overlay; box-shadow: 0 0 10px #fff; }
.tile[data-special="col"] .fx { background: repeating-linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, .85) 18% 26%); mix-blend-mode: overlay; box-shadow: 0 0 10px #fff; }
.tile[data-special="row"] img, .tile[data-special="col"] img { filter: drop-shadow(0 0 4px #fff) brightness(1.15); }
.tile[data-special="bomb"] .fx { border-radius: 50%; inset: 2%; box-shadow: 0 0 0 3px #fff8, 0 0 14px 4px #ffd23f; animation: bombGlow .7s ease-in-out infinite alternate; }
@keyframes bombGlow { to { box-shadow: 0 0 0 3px #fff, 0 0 20px 8px #ff8a1f; } }
.tile[data-special="rainbow"] .fx { inset: 10%; border-radius: 50%; background: conic-gradient(var(--c-red), var(--c-orange), var(--c-yellow), var(--c-green), var(--c-blue), var(--c-purple), var(--c-red));
  box-shadow: 0 0 0 3px #fff, 0 0 16px #fff; animation: spin 2s linear infinite; }
.blast { position: absolute; pointer-events: none; z-index: 5; }
.blast-row { left: 0; right: 0; top: calc(var(--cell) * var(--r)); height: var(--cell); background: linear-gradient(90deg, transparent, #fff, transparent); animation: blastFade .45s forwards; }
.blast-col { top: 0; bottom: 0; left: calc(var(--cell) * var(--c)); width: var(--cell); background: linear-gradient(transparent, #fff, transparent); animation: blastFade .45s forwards; }
.blast-bomb { left: calc(var(--cell) * (var(--c) - 1)); top: calc(var(--cell) * (var(--r) - 1)); width: calc(var(--cell) * 3); height: calc(var(--cell) * 3); border-radius: 50%;
  background: radial-gradient(#fff, #ffd23f 40%, transparent 70%); animation: boom .45s forwards; }
.blast-rainbow { inset: 0; background: conic-gradient(from 0deg, #ff4d5e88, #ffd23f88, #46d36b88, #43b6ff88, #a66bff88, #ff4d5e88); animation: blastFade .5s forwards; }
@keyframes blastFade { from { opacity: 1; } to { opacity: 0; } }
@keyframes boom { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.board.shuffling .tile { transition-duration: .45s; }
.board.shuffling .tile img { animation: spin .45s; }

.turn-banner { position: absolute; left: -10%; right: -10%; top: 42%; padding: 10px 0; text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 1px; z-index: 10; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(16, 8, 36, .9) 20% 80%, transparent); text-shadow: 0 3px 0 rgba(0, 0, 0, .5); opacity: 0; transform: translateX(-30%) skewX(-8deg); transition: .3s; }
.turn-banner.show { opacity: 1; transform: none; }
.turn-banner.me { color: var(--me); } .turn-banner.bot { color: var(--bot); }
.turn-banner.power, .turn-banner.combo { color: var(--yellow); font-size: 30px; }
.turn-banner.power.bot { color: var(--bot); }
.float-pts { position: absolute; z-index: 8; transform: translate(-50%, -50%); font-size: 22px; font-weight: 800; pointer-events: none; text-shadow: 0 2px 0 #000, 0 0 8px #000; animation: rise 1s ease-out forwards; }
.float-pts.me { color: var(--me); } .float-pts.bot { color: #ff9aa4; }
@keyframes rise { 0% { transform: translate(-50%, -30%) scale(.5); opacity: 0; } 20% { transform: translate(-50%, -60%) scale(1.25); opacity: 1; } 100% { transform: translate(-50%, -180%) scale(1); opacity: 0; } }
.duel-hint { height: 0; overflow: hidden; font-size: 13px; font-weight: 800; color: var(--yellow); text-align: center; flex: none; transition: height .2s; }
.duel-hint.show { height: 20px; }

/* ---------- result */
.screen-result { justify-content: center; gap: 12px; background: radial-gradient(circle at 50% 30%, #5b2fb0, #170c33 70%); }
.screen-result.win { background: radial-gradient(circle at 50% 30%, #ffb03a, #7a2a0c 45%, #170c33 80%); }
.result-title { font-size: 44px; font-weight: 800; color: var(--yellow); -webkit-text-stroke: 2px #4a1d00; text-shadow: 0 5px 0 #b8510b; animation: slam .6s cubic-bezier(.2, 1.6, .5, 1) both; }
.lose .result-title { color: #cfd8ff; text-shadow: 0 5px 0 #3b3f8a; -webkit-text-stroke: 2px #1d1238; }
.result-mascot { height: 26vh; max-height: 220px; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); animation: float 3s ease-in-out infinite; }
.win .result-mascot { animation: cheer .8s ease-in-out infinite; }
@keyframes cheer { 50% { transform: translateY(-14px) rotate(-3deg); } }
.result-score { display: flex; flex-direction: column; align-items: center; color: var(--muted); }
.result-score b { font-size: 30px; color: var(--text); }
.result-rewards { display: flex; gap: 10px; }
.rw { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--line); min-width: 90px; }
.rw img { width: 40px; height: 40px; object-fit: contain; }
.rw.pack img { height: 52px; width: 52px; margin: -6px 0; }
.rw .trophy { font-size: 32px; line-height: 40px; }
.rw b { font-size: 15px; text-align: center; line-height: 1.1; }
.screen-result.active .rw { animation: popIn .4s both; } .rw:nth-child(2) { animation-delay: .15s !important; } .rw:nth-child(3) { animation-delay: .3s !important; }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } }

/* ---------- pack opening */
.screen-pack { justify-content: center; background: radial-gradient(circle at 50% 40%, #6b33c9, #160b30 70%); }
.screen-pack.gold { background: radial-gradient(circle at 50% 40%, #e0a020, #4a2308 55%, #160b30 85%); }
.pack-stage { position: relative; width: 100%; flex: 1; display: grid; place-items: center; }
.pack-sealed { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; transition: .4s; }
.pack-sealed img { width: 210px; filter: drop-shadow(0 0 30px rgba(255, 210, 63, .6)); animation: packShake 1.2s ease-in-out infinite; }
.gold .pack-sealed img { filter: drop-shadow(0 0 30px #ffd23f) hue-rotate(-60deg) saturate(1.4); }
@keyframes packShake { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-5deg) scale(1.03); } 80% { transform: rotate(5deg) scale(1.05); } 90% { transform: rotate(-3deg); } }
.opened .pack-sealed { transform: scale(1.6); opacity: 0; pointer-events: none; }
.pack-cards { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; gap: 8px; perspective: 900px; }
.flip-card { width: 30%; max-width: 120px; aspect-ratio: 3 / 4.3; opacity: 0; transform: translateY(60px) scale(.5); animation: deal .45s calc(var(--i) * .12s + .2s) cubic-bezier(.2, 1.3, .5, 1) forwards; }
@keyframes deal { to { opacity: 1; transform: none; } }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); transform-style: preserve-3d; }
.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; }
.face.back img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, .5); }
.face.front { transform: rotateY(180deg); }
.face.front .card { width: 100%; height: 100%; }
.flipped.r-epic .face.front, .flipped.r-legendary .face.front { animation: glowR 1.4s ease-in-out infinite alternate; }
@keyframes glowR { to { box-shadow: 0 0 26px 6px var(--rc); } }
.badge { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); white-space: nowrap; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 800; }
.badge.new { background: var(--pink); color: #fff; font-size: 13px; }
.badge.dup { background: #3a3060; color: var(--muted); }
.pack-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; opacity: 0; pointer-events: none; transition: .3s; }
.done .pack-actions { opacity: 1; pointer-events: auto; }

/* ---------- cards (album + pack) */
.card { --rc: var(--r-common); position: relative; display: block; border-radius: 12px; overflow: hidden; border: 3px solid var(--rc); background: #120a26; aspect-ratio: 3 / 4.3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.card.rare { --rc: var(--r-rare); } .card.epic { --rc: var(--r-epic); } .card.legendary { --rc: var(--r-legendary); }
.r-common { --rc: var(--r-common); } .r-rare { --rc: var(--r-rare); } .r-epic { --rc: var(--r-epic); } .r-legendary { --rc: var(--r-legendary); }
.card img { width: 100%; height: 100%; object-fit: cover; }
.card.legendary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .45) 45%, transparent 60%); background-size: 250% 100%; animation: shine 2.4s linear infinite; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.card .rarity { position: absolute; top: 4px; left: 4px; padding: 0 6px; border-radius: 8px; font-size: 9px; font-weight: 800; background: var(--rc); color: #1d1238; text-transform: uppercase; }
.card .cname { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 4px 4px; font-size: 11px; line-height: 1.05; text-align: center; background: linear-gradient(transparent, rgba(10, 5, 25, .92) 45%); }
.card .count { position: absolute; top: 4px; right: 4px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-weight: 800; background: var(--pink); }
.card.missing img { filter: brightness(0) opacity(.5); }
.card.missing { border-style: dashed; background: #1f1540; }

/* ---------- album */
.screen-album { background: radial-gradient(circle at 50% 0%, #3d2378, var(--bg) 70%); gap: 8px; }
.album-total { color: var(--yellow); font-weight: 800; }
.set-tabs { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.set-tab { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 14px; background: var(--panel2); border: 2px solid transparent; line-height: 1.1; }
.set-tab b { font-size: 15px; } .set-tab span { font-size: 12px; color: var(--muted); }
.set-tab.on { border-color: var(--yellow); background: rgba(255, 210, 63, .12); }
.set-tab.done span::after { content: ' ✓'; color: var(--c-green); }
.set-head { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.set-progress { display: flex; align-items: center; gap: 8px; } .set-progress .bar { flex: 1; height: 10px; margin: 0; } .set-progress b { color: var(--yellow); }
.set-reward { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); }
.set-reward img { width: 40px; height: 40px; object-fit: contain; }
.set-reward.skin img { border-radius: 50%; border: 3px solid var(--yellow); box-shadow: 0 0 10px var(--yellow); background: #ffd9a0; object-fit: cover; object-position: top; }
.set-reward span { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.set-reward small { color: var(--muted); font-size: 11px; } .set-reward b { font-size: 14px; }
.claim { padding: 8px 14px; border-radius: 12px; background: linear-gradient(#ffd23f, #ff8a1f); color: #4a1d00; font-weight: 800; }
.claim:disabled { background: rgba(255, 255, 255, .1); color: var(--muted); }
.album-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- powers screen */
.screen-powers { background: radial-gradient(circle at 50% 0%, #3d2378, var(--bg) 70%); gap: 8px; }
.screen-powers .wallet { font-size: 15px; }
.powers-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.power-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--pc); }
.power-row > img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.power-row.locked > img { filter: grayscale(1) brightness(.6); }
.power-row.pulse { animation: bounce .6s; }
.pr-body { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pr-body b { font-size: 15px; } .pr-body .desc { font-size: 11.5px; color: var(--muted); } .pr-body .meta { font-size: 11px; color: var(--pc); font-weight: 700; }
.lvbar { display: flex; gap: 3px; margin-top: 3px; } .lvbar i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); } .lvbar i.on { background: var(--pc); }
.pr-actions { display: flex; flex-direction: column; gap: 4px; width: 84px; flex: none; }
.pr-actions button { padding: 5px 4px; border-radius: 10px; font-size: 12px; font-weight: 800; line-height: 1.1; }
.pr-actions img { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }
.up { background: linear-gradient(#ffd23f, #ff8a1f); color: #4a1d00; }
.up:disabled { background: rgba(255, 255, 255, .1); color: var(--muted); }
.up.hint { background: rgba(255, 255, 255, .1); color: var(--muted); font-size: 10.5px; }
.eq { background: rgba(255, 255, 255, .1); } .eq.on { background: var(--c-green); color: #0b3a17; }

/* ---------- league */
.screen-league { overflow: hidden; background: radial-gradient(circle at 50% 0%, #6b4a1c, var(--bg) 60%); gap: 6px; }
.league-tier { display: flex; align-items: center; gap: 8px; font-size: 22px; } .league-tier span { font-size: 40px; }
.league-list { width: 100%; flex: 1; min-height: 0; overflow-y: auto; list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 5px; }
.league-list li { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border-radius: 14px; background: var(--panel); }
.league-list li.promo { border: 2px solid rgba(255, 210, 63, .5); }
.league-list li.me { background: rgba(46, 230, 197, .2); border: 2px solid var(--teal); }
.league-list .pos { width: 24px; text-align: center; font-weight: 800; color: var(--yellow); }
.league-list img { width: 38px; height: 38px; object-fit: contain; }
.league-list b { flex: 1; } .league-list .pts { font-weight: 700; color: var(--muted); }

/* ---------- modal & toast */
.modal { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(8, 4, 20, .72); }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px; border-radius: 22px; background: var(--bg2); border: 2px solid var(--line); text-align: center; animation: popIn .3s; }
.modal-box h3 { font-size: 22px; } .modal-box p { color: var(--muted); }
.invite-link { width: 100%; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .35); font-family: ui-monospace, monospace; font-size: 14px; color: var(--teal); }
.zoom.card { width: 240px; }
.zoom.card .cname { font-size: 18px; } .zoom.card .rarity { font-size: 12px; }
.celebrate h3 { font-size: 28px; color: var(--yellow); animation: slam .6s both; }
.toast { position: absolute; left: 50%; top: 14px; z-index: 70; max-width: 90%; padding: 10px 16px; border-radius: 16px; background: rgba(16, 8, 36, .95); border: 2px solid var(--yellow);
  font-weight: 700; font-size: 14px; text-align: center; transform: translate(-50%, -140%); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- onboarding / edit profile */
.screen-onboard { background: radial-gradient(circle at 50% 0%, #4a2a8a, var(--bg) 70%); gap: 8px; }
.screen-onboard .logo.small { width: 170px; margin: 0; animation: none; }
.screen-onboard:not(.edit) .onboard-edit-only, .screen-onboard.edit .onboard-first-only { display: none; }
.ob-title { font-size: 17px; font-weight: 800; align-self: flex-start; }
.mascot-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mascot-pick { display: flex; flex-direction: column; align-items: center; padding: 6px 4px 4px; border-radius: 16px; background: var(--panel); border: 3px solid var(--line); transition: transform .15s, border-color .15s; }
.mascot-pick img { width: 100%; height: 82px; object-fit: contain; }
.mascot-pick b { font-size: 14px; line-height: 1.2; }
.mascot-pick.on { border-color: var(--yellow); background: rgba(255, 210, 63, .14); transform: scale(1.04); box-shadow: 0 0 14px rgba(255, 210, 63, .5); }
.nick-field { position: relative; width: 100%; }
.nick-field input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--text); font: inherit; font-size: 18px; font-weight: 700; outline: none; }
.nick-field.ok input { border-color: var(--c-green); } .nick-field.bad input { border-color: var(--c-red); }
.nick-field.shake { animation: nope .3s; }
.nick-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 800; pointer-events: none; }
.nick-status.ok { color: var(--c-green); } .nick-status.bad { color: var(--c-red); }
.nick-rules { align-self: flex-start; font-size: 12px; color: var(--muted); margin-top: -4px; }
.nick-suggest { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 0; }
.nick-suggest span { font-size: 12px; color: var(--muted); }
.chip { padding: 4px 10px; border-radius: 14px; background: rgba(46, 230, 197, .16); border: 1.5px solid var(--teal); font-size: 13px; font-weight: 700; }
.ob-go:disabled { filter: grayscale(.8) brightness(.7); box-shadow: none; }

/* ---------- menu sheet, how-to, pause */
.modal-box.sheet { max-width: 360px; }
.menu-list { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 12px 10px; border-radius: 14px; background: var(--panel2); border: 2px solid var(--line); text-align: left; }
.menu-item span { font-size: 20px; } .menu-item b { font-size: 15px; }
.menu-item.soon { opacity: .6; }
.menu-item small { position: absolute; top: -7px; right: 6px; padding: 0 6px; border-radius: 8px; background: var(--pink); font-size: 10px; font-weight: 800; }
.howto { text-align: left; margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); }
.howto-tiles { display: flex; gap: 4px; } .howto-tiles img { width: 34px; height: 34px; object-fit: contain; }
.danger { color: #ff8a95 !important; }

/* ---------- profile & settings */
.screen-profile, .screen-settings { background: radial-gradient(circle at 50% 0%, #3d2378, var(--bg) 70%); gap: 12px; }
.pf-card { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px; border-radius: 22px; background: var(--panel); border: 2px solid var(--line); }
.avatar.big { width: 120px; height: 120px; border-width: 4px; }
.pf-name { font-size: 26px; font-weight: 800; margin-top: 6px; }
.pf-level { color: var(--yellow); font-weight: 700; }
.pf-stats { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.pf-stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.pf-stats b { font-size: 18px; } .pf-stats span { font-size: 11px; color: var(--muted); }
.set-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.set-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); font-size: 16px; font-weight: 700; text-align: left; }
.set-row.link b { font-size: 22px; color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.toggle i { position: relative; width: 46px; height: 26px; border-radius: 13px; background: rgba(255, 255, 255, .15); transition: .2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle.on i { background: var(--c-green); } .toggle.on i::after { left: 23px; }
.seg { display: flex; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.seg button { padding: 6px 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--yellow); color: #3a1a00; }
.screen-result.gave-up .result-title { color: #cfd8ff; text-shadow: 0 5px 0 #3b3f8a; -webkit-text-stroke: 2px #1d1238; }

/* ---------- short phones (390x660) */
@media (max-height: 700px) {
  .logo { width: 200px; }
  .btn-play { font-size: 28px; padding: 10px 0 8px; }
  .home-card { min-height: 60px; }
  .duel-player .avatar { width: 36px; height: 36px; }
  .dp-info .sc { font-size: 20px; }
  .power-btn { height: 58px; width: 88px; } .power-btn img { width: 28px; height: 28px; }
  .mascot-pick img { height: 60px; } .screen-onboard .logo.small { width: 130px; } .avatar.big { width: 90px; height: 90px; }
  .pick-item small { display: none; }
  .radar { width: 200px; height: 200px; }
  .result-mascot { height: 20vh; }
}
.pause-btn { display: flex; align-items: center; justify-content: center; gap: 5px; }
.pause-btn i { width: 5px; height: 16px; border-radius: 2px; background: var(--text); }
/* round 2: bigger pack reveal, toast away from the headers */
.flip-card { width: 31%; max-width: 150px; }
.pack-cards { gap: 10px; padding: 0 4px; }
.toast { top: auto; bottom: 92px; transform: translate(-50%, 160%); opacity: 0; transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), opacity .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.screen-league .league-list { -webkit-mask-image: linear-gradient(transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(transparent, #000 14px, #000 calc(100% - 14px), transparent); padding: 8px 0; }
