:root {
  --bg: #0b0a14;
  --panel: rgba(13, 11, 28, 0.78);
  --panel-solid: #15122a;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f3f1ff;
  --muted: #a9a4c7;
  --blue: #36b6ff;
  --blue-glow: #9be7ff;
  --red: #ff3b5c;
  --pink: #ff3b8e;
  --gold: #ffd84d;
  --violet: #8b5cff;
  --ok: #4be38a;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; width: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: var(--font); overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }
canvas#game { position: fixed; inset: 0; display: block; width: 100vw; height: 100dvh; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 12, 0.5) 100%); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: block; min-width: 200px; padding: 12px 26px; margin: 6px 0;
  font-weight: 900; font-style: italic; letter-spacing: 0.06em; text-transform: uppercase; font-size: 16px;
  background: linear-gradient(180deg, rgba(40, 34, 78, 0.95), rgba(22, 18, 46, 0.95));
  border: 1px solid var(--line); border-radius: 4px; transform: skewX(-12deg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.08s, filter 0.15s;
}
.btn > * { transform: skewX(12deg); }
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: skewX(-12deg) translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.btn.primary { background: linear-gradient(180deg, #ff5a8c, #c2185b 60%, #8e0f43); border-color: #ff9fbf; box-shadow: 0 4px 0 #4a0623, 0 0 24px rgba(255, 59, 142, 0.45); }
.btn.blue { background: linear-gradient(180deg, #4cc3ff, #1677c9 60%, #0d4a84); border-color: #9be7ff; box-shadow: 0 4px 0 #062a4d, 0 0 20px rgba(54, 182, 255, 0.4); }
.btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 16px; font-weight: 900; }
.icon-btn:active { transform: scale(0.94); }

/* ---------- Screens ---------- */
#screens { position: fixed; inset: 0; pointer-events: none; }
.screen {
  position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column;
  padding: calc(10px + var(--sat)) calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(ellipse at 50% 120%, rgba(139, 92, 255, 0.18), transparent 60%), rgba(8, 7, 16, 0.6);
  animation: fadein 0.25s ease;
}
.screen.modal { align-items: center; justify-content: center; background: rgba(5, 4, 12, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.card {
  background: linear-gradient(160deg, rgba(30, 26, 60, 0.97), rgba(14, 12, 30, 0.97)); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  max-height: calc(100dvh - 24px); overflow: auto; max-width: 100%;
}
.scr-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.scr-head h2 { margin: 0; font-style: italic; font-weight: 900; letter-spacing: 0.04em; font-size: 22px; text-transform: uppercase; text-shadow: 0 2px 0 #000; }
.back { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 26px; line-height: 36px; font-weight: 700; }
.seg { display: flex; margin-left: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 7px 12px; border-radius: 7px; font-weight: 800; font-size: 13px; color: var(--muted); }
.seg button.on { background: linear-gradient(180deg, #ff5a8c, #c2185b); color: #fff; box-shadow: 0 0 12px rgba(255, 59, 142, 0.4); }

/* Menu */
#sMenu { background: linear-gradient(90deg, rgba(8, 7, 16, 0.86) 0%, rgba(8, 7, 16, 0.45) 46%, rgba(8, 7, 16, 0) 70%); }
.menu-wrap { height: 100%; display: flex; flex-direction: column; justify-content: center; padding-left: 2vw; }
.logo { margin-bottom: 14px; }
.logo-main {
  font-size: clamp(44px, 9vw, 86px); font-weight: 900; font-style: italic; letter-spacing: -0.02em; line-height: 0.9;
  background: linear-gradient(180deg, #ffffff 20%, #9be7ff 60%, #36b6ff); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #0a0820) drop-shadow(0 0 18px rgba(54, 182, 255, 0.45));
}
.logo-main span { background: linear-gradient(180deg, #fff 10%, #ff9fbf 50%, #ff3b8e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-sub { margin-top: 4px; font-weight: 800; font-style: italic; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); font-size: 13px; text-shadow: 0 2px 0 #000; }
.menu-btns { display: flex; flex-direction: column; align-items: flex-start; }
.menu-btns .btn { min-width: 240px; text-align: left; }
.menu-foot { margin-top: 10px; color: var(--muted); font-size: 12px; text-shadow: 0 1px 0 #000; }

/* Campaign */
.levels { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; min-height: 0; }
.lvl {
  position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); text-align: left; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: flex-end; min-height: 0;
  background: linear-gradient(180deg, var(--c1, #2b4c9a), var(--c2, #f9b26b)); box-shadow: inset 0 -60px 50px rgba(0, 0, 0, 0.65);
}
.lvl canvas { position: absolute; right: -6px; top: 4px; opacity: 0.95; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.lvl .num { position: absolute; left: 8px; top: 4px; font-weight: 900; font-style: italic; font-size: 26px; text-shadow: 0 2px 0 #000; }
.lvl .name { position: relative; font-weight: 800; font-size: 13px; line-height: 1.1; text-shadow: 0 1px 2px #000; }
.lvl .stars { position: relative; color: var(--gold); font-size: 14px; letter-spacing: 1px; text-shadow: 0 1px 0 #000; }
.lvl .stars .off { color: rgba(255, 255, 255, 0.25); }
.lvl.locked { filter: saturate(0.35) brightness(0.42); }
.lvl.locked::after { content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.lvl:not(.locked):active { transform: scale(0.97); }
.level-card { width: min(560px, 100%); display: grid; grid-template-columns: 120px 1fr; gap: 6px 18px; }
.level-card .boss { grid-row: span 5; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.level-card h3 { margin: 0; font-size: 22px; font-weight: 900; font-style: italic; }
.level-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.35; }
.rules { list-style: none; margin: 4px 0; padding: 0; font-size: 13px; }
.rules li { padding: 2px 0; }
.rules li b { color: var(--gold); margin-right: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }

/* Gallery */
.gallery { flex: 1; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; align-content: start; padding-bottom: 8px; touch-action: pan-y; }
.gcard { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, #24204a, #120f26); aspect-ratio: 0.82; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; }
.gcard canvas { border-radius: 8px; }
.gcard .gname { font-size: 11px; font-weight: 800; text-align: center; padding: 2px 4px; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.gcard .garc { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 900; background: rgba(0, 0, 0, 0.55); padding: 1px 5px; border-radius: 6px; }
.gcard.villain { background: linear-gradient(180deg, #4a1530, #1a0a14); }
.gcard.locked .gname { color: var(--muted); }
.gal-count { color: var(--muted); font-size: 13px; font-weight: 700; }
.char-card { width: min(640px, 100%); display: grid; grid-template-columns: auto 1fr; gap: 4px 20px; align-items: start; }
.char-card .fig { grid-row: span 6; display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(circle at 50% 70%, rgba(139, 92, 255, 0.35), transparent 70%); border-radius: 12px; padding: 4px; }
.char-card h3 { margin: 0; font-size: 24px; font-weight: 900; font-style: italic; }
.char-card .series { color: var(--muted); font-weight: 700; font-size: 13px; }
.char-card .quote { font-style: italic; color: #e8e2ff; font-size: 14px; line-height: 1.35; border-left: 3px solid var(--pink); padding-left: 10px; margin: 6px 0; }
.stats { display: grid; grid-template-columns: auto 1fr auto; gap: 3px 8px; font-size: 12px; align-items: center; }
.stats .sb { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.stats .sb i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-glow)); }
.stats .villain i { background: linear-gradient(90deg, var(--red), #ff9aa9); }

/* Settings */
.settings { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; align-content: start; touch-action: pan-y; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.set.wide { grid-column: 1 / -1; }
.set small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.toggle { width: 52px; height: 30px; border-radius: 15px; background: rgba(255, 255, 255, 0.15); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.toggle.on { background: linear-gradient(90deg, #36b6ff, #8b5cff); }
.toggle.on::after { transform: translateX(22px); }
input[type=range] { accent-color: var(--pink); width: 140px; }

/* Pause / result */
.pause-card { display: flex; flex-direction: column; align-items: center; padding: 22px 40px; }
.pause-card h2, .result-card h2 { margin: 0 0 8px; font-size: 30px; font-weight: 900; font-style: italic; text-transform: uppercase; }
.result-card { text-align: center; width: min(520px, 100%); }
.result-card h2.win { background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 44px; filter: drop-shadow(0 0 16px rgba(255, 216, 77, 0.5)); }
.result-card h2.lose { color: var(--red); font-size: 44px; }
.big-stars { font-size: 44px; letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 18px rgba(255, 216, 77, 0.6); }
.big-stars span { display: inline-block; animation: starpop 0.5s cubic-bezier(.2, 1.8, .4, 1) both; }
.big-stars span.off { color: rgba(255, 255, 255, 0.18); text-shadow: none; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1); } }
.res-stats { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.res-stats b { color: var(--text); display: block; font-size: 18px; }
.unlocks { display: flex; justify-content: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.result-card .row { justify-content: center; }
.result-card .btn { min-width: 0; padding: 11px 18px; font-size: 14px; white-space: nowrap; }
.result-card .row { flex-wrap: nowrap; }
.unlocks canvas { width: 40px !important; height: 40px !important; border-radius: 8px; background: rgba(255,255,255,0.06); }

/* Loading */
#sLoading { align-items: center; justify-content: center; background: var(--bg); }
.loading { text-align: center; }
.load-bar { width: 260px; height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; margin: 18px auto 8px; }
.load-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--pink)); transition: width 0.2s; }
#loadTxt { color: var(--muted); font-size: 13px; }

/* ---------- Battle HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .summon-bar, #hud .tower-panel { pointer-events: auto; }
.hud-top { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); top: calc(6px + var(--sat)); display: flex; align-items: flex-start; gap: 8px; }
.hud-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.hud-left { width: min(300px, 36vw); }
.hud-right { width: min(220px, 26vw); margin-left: auto; }
.base-row, .res-row, .enemy-row { display: flex; align-items: center; gap: 6px; }
.res-row { margin-top: 4px; }
.arc-badge { font-size: 10px; font-weight: 900; font-style: italic; padding: 2px 6px; border-radius: 5px; background: linear-gradient(90deg, #36b6ff, #8b5cff); white-space: nowrap; }
.bar { position: relative; flex: 1; height: 14px; border-radius: 7px; background: rgba(0, 0, 0, 0.55); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.12); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: left; background: linear-gradient(180deg, #7fd8ff, #1f8fe0); transition: transform 0.15s; }
.bar.enemy i { background: linear-gradient(180deg, #ff8a9c, #d0193d); transform-origin: right; left: auto; right: 0; }
.bar.xp { height: 10px; }
.bar.xp i { background: linear-gradient(90deg, #8b5cff, #ff3b8e); }
.bar.xp.ready i { background: linear-gradient(90deg, #ffd84d, #ff9f1c); animation: pulse 0.8s infinite alternate; }
.bar span { position: absolute; inset: 0; font-size: 10px; font-weight: 800; line-height: 13px; text-align: center; text-shadow: 0 1px 1px #000; }
.bar.xp span { line-height: 9px; font-size: 9px; }
.gold { display: flex; align-items: center; gap: 4px; font-weight: 900; font-size: 15px; color: var(--gold); min-width: 86px; text-shadow: 0 1px 0 #000; }
.gold small { color: var(--muted); font-size: 10px; font-weight: 700; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc400 50%, #b07800); box-shadow: 0 0 6px rgba(255, 200, 0, 0.6); display: inline-block; }
.enemy-row { justify-content: space-between; margin-top: 3px; font-size: 10px; font-weight: 800; color: #ffb3c0; }
.hud-center { text-align: center; padding-top: 2px; min-width: 70px; text-shadow: 0 1px 2px #000; }
#hTime { font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
#hLevel { font-size: 10px; color: var(--muted); font-weight: 700; max-width: 22vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-btns { display: flex; gap: 6px; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.5); } }

.hud-bottom { position: absolute; left: calc(6px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(6px + var(--sab)); display: flex; align-items: flex-end; gap: 10px; }
.summon-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.queue { display: flex; gap: 4px; height: 26px; padding-left: 2px; }
.qi { position: relative; width: 26px; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.35); background: #120f26; }
.qi canvas { width: 26px; height: 26px; display: block; }
.qi i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--ok); width: 0; }
.summon-bar { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; padding: 2px 2px 0; -webkit-overflow-scrolling: touch; }
.summon-bar::-webkit-scrollbar { display: none; }
.sc {
  position: relative; flex: none; width: 66px; height: 74px; border-radius: 10px; overflow: hidden; padding: 0;
  background: linear-gradient(180deg, #2a2560, #141130); border: 2px solid rgba(155, 231, 255, 0.45); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}
.sc canvas { position: absolute; left: 0; top: 0; width: 62px; height: 62px; }
.sc .cost { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: rgba(6, 5, 14, 0.88); font-size: 12px; font-weight: 900; color: var(--gold); display: flex; align-items: center; justify-content: center; gap: 3px; }
.sc .cost .coin { width: 9px; height: 9px; }
.sc .key { position: absolute; right: 3px; top: 2px; font-size: 9px; font-weight: 900; color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 1px #000; }
.sc .role { position: absolute; left: 3px; top: 2px; font-size: 10px; text-shadow: 0 1px 1px #000; }
.sc.old { border-color: rgba(255, 255, 255, 0.2); width: 58px; }
.sc.no { filter: grayscale(0.85) brightness(0.6); }
.sc:active { transform: translateY(2px) scale(0.97); }
.sc.flash { animation: scflash 0.3s; }
@keyframes scflash { 50% { border-color: #fff; box-shadow: 0 0 18px #9be7ff; } }
.sc-sep { flex: none; width: 2px; margin: 8px 2px; background: rgba(255, 255, 255, 0.15); border-radius: 1px; }

.actions { display: flex; align-items: flex-end; gap: 8px; }
.act-btn {
  position: relative; overflow: hidden; width: 64px; height: 64px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(42, 36, 90, 0.95), rgba(18, 15, 40, 0.95)); border: 2px solid rgba(255, 255, 255, 0.2); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}
.act-btn .ico { font-size: 22px; line-height: 1; position: relative; z-index: 1; }
.act-btn .lbl { font-size: 10px; font-weight: 900; text-transform: uppercase; position: relative; z-index: 1; margin-top: 3px; }
.act-btn.small { width: 42px; height: 42px; border-radius: 50%; font-size: 20px; }
.act-btn.on { border-color: var(--blue-glow); box-shadow: 0 0 14px rgba(54, 182, 255, 0.6); }
.act-btn:active { transform: translateY(2px); }
.act-btn.evolve .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(180deg, rgba(139, 92, 255, 0.7), rgba(255, 59, 142, 0.7)); }
.act-btn.evolve.ready { border-color: var(--gold); animation: glowgold 0.9s infinite alternate; }
.act-btn.evolve.ready .fill { background: linear-gradient(180deg, #ffd84d, #ff8a1c); }
.act-btn.evolve.max { opacity: 0.45; }
@keyframes glowgold { from { box-shadow: 0 0 6px rgba(255, 216, 77, 0.5); } to { box-shadow: 0 0 22px rgba(255, 216, 77, 0.95); } }
.ult-btn { position: relative; width: 86px; height: 86px; border-radius: 50%; background: #120f26; border: 3px solid rgba(255, 255, 255, 0.25); overflow: hidden; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); }
.ult-btn canvas { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); border-radius: 50%; filter: grayscale(0.8) brightness(0.55); transition: filter 0.2s; }
.ult-btn .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--ultc, #ffd84d) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.08) 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.ult-btn .ult-name { position: absolute; left: 0; right: 0; bottom: 8px; font-size: 8px; overflow: hidden; word-break: break-word; font-weight: 900; text-transform: uppercase; text-shadow: 0 1px 2px #000; line-height: 1; padding: 0 8px; }
.ult-btn.ready { border-color: var(--ultc, var(--gold)); animation: ultglow 0.7s infinite alternate; }
.ult-btn.ready canvas { filter: none; }
@keyframes ultglow { from { box-shadow: 0 0 8px var(--ultc, #ffd84d); } to { box-shadow: 0 0 28px var(--ultc, #ffd84d), 0 0 4px #fff inset; } }

.tower-panel { position: absolute; right: calc(8px + var(--sar)); bottom: calc(100px + var(--sab)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; gap: 6px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.tslot { width: 96px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); padding: 6px; text-align: center; font-size: 11px; }
.tslot b { display: block; font-size: 12px; margin-bottom: 2px; }
.tslot .tbtn { margin-top: 5px; width: 100%; padding: 6px 0; border-radius: 7px; font-weight: 900; font-size: 12px; background: linear-gradient(180deg, #4cc3ff, #1677c9); }
.tslot .tbtn.sell { background: linear-gradient(180deg, #ff6b81, #b3123a); }
.tslot .tbtn:disabled { filter: grayscale(1) brightness(0.6); }
.tslot small { color: var(--muted); display: block; }
.toast { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); background: rgba(10, 8, 22, 0.88); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 13px; opacity: 0; transition: opacity 0.2s; white-space: nowrap; }
.toast.show { opacity: 1; }

/* Rotate prompt */
#rotate { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); text-align: center; padding: 24px; }
#rotate p { font-weight: 900; font-style: italic; font-size: 20px; }
.rot-ico { font-size: 56px; animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: flex; } }

/* Small landscape phones */
@media (max-height: 360px) {
  .sc { width: 58px; height: 66px; } .sc canvas { width: 54px; height: 54px; }
  .act-btn { width: 56px; height: 56px; } .ult-btn { width: 76px; height: 76px; }
  .btn { padding: 9px 22px; font-size: 14px; }
  .levels { gap: 6px; }
}
@media (min-width: 1100px) and (min-height: 600px) {
  .sc { width: 80px; height: 90px; } .sc canvas { width: 76px; height: 76px; }
  .act-btn { width: 76px; height: 76px; } .ult-btn { width: 104px; height: 104px; }
}
