@font-face {
  font-family: 'Orbitron'; font-style: normal; font-weight: 700 900; font-display: swap;
  src: url(fonts/orbitron-latin.woff2) format('woff2');
}

:root {
  --bg: #07060f;
  --cyan: #38f6ff;
  --pink: #ff4fd8;
  --gold: #ffd23f;
  --green: #5dff9a;
  --red: #ff3f5a;
  --text: #ece9ff;
  --muted: #9d95c9;
  --panel: rgba(16, 10, 36, 0.92);
  --line: rgba(130, 100, 255, 0.35);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; position: fixed; inset: 0;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }
.boot .screen, .boot #hud { visibility: hidden; }

button { font-family: inherit; touch-action: manipulation; cursor: pointer; }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  padding: var(--sat) var(--sar) var(--sab) var(--sal);
}
#xpbar {
  position: relative; height: 16px; margin: 0;
  background: rgba(20, 12, 50, 0.85); border-bottom: 1px solid var(--line);
  overflow: hidden;
}
#xpfill {
  position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #2c8dff, var(--cyan) 60%, #c8fdff);
  box-shadow: 0 0 12px var(--cyan);
  transition: transform 0.12s linear;
}
#lvl {
  position: absolute; right: 10px; top: 0; height: 16px; line-height: 16px;
  font: 900 12px Orbitron, system-ui, sans-serif; color: #fff; text-shadow: 0 0 6px #000, 0 0 3px #000;
}
#hud-top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; padding: 6px 10px 0; }
#slots { display: flex; flex-direction: column; gap: 3px; max-width: 42vw; }
#slots .srow { display: flex; gap: 3px; flex-wrap: wrap; }
#slots .slot {
  width: 30px; height: 30px; border-radius: 8px; position: relative;
  background: rgba(16, 10, 36, 0.75); border: 1px solid rgba(255, 255, 255, 0.12);
}
#slots .slot img { width: 100%; height: 100%; display: block; }
#slots .slot b {
  position: absolute; right: -2px; bottom: -3px; font: 800 10px system-ui, sans-serif;
  color: #fff; background: rgba(0, 0, 0, 0.7); border-radius: 5px; padding: 0 3px; line-height: 13px;
}
#slots .slot.evo { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 210, 63, 0.6); }
#hud-mid { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); text-align: center; }
#timer {
  font: 900 30px system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 2px; color: #fff;
  text-shadow: 0 0 10px var(--pink), 0 0 2px #000;
}
#timer.late { color: #ffd0e0; text-shadow: 0 0 14px var(--red), 0 0 2px #000; }
#kills { font-size: 13px; color: var(--muted); text-shadow: 0 0 4px #000; margin-top: -2px; }
#hud-right { display: flex; gap: 8px; align-items: center; }
#coins {
  display: flex; align-items: center; gap: 4px; font: 800 16px system-ui, sans-serif; color: var(--gold);
  text-shadow: 0 0 6px rgba(255, 210, 63, 0.6), 0 0 2px #000; margin-right: 4px;
}
.coin-ico { width: 22px; height: 22px; }
.icon-btn {
  pointer-events: auto; width: 44px; height: 44px; border-radius: 12px; padding: 0;
  background: rgba(16, 10, 36, 0.8); border: 1.5px solid var(--line); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 22px; height: 22px; }
.pause-bars { width: 14px; height: 16px; border-left: 4px solid #fff; border-right: 4px solid #fff; }
#bossbar {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 74px);
  width: min(560px, 72vw); text-align: center;
}
#bossname { font-weight: 900; font-size: 15px; color: #ffd0e0; text-shadow: 0 0 8px var(--red); margin-bottom: 3px; letter-spacing: 2px; }
#bossbar .bar { height: 12px; border-radius: 6px; background: rgba(40, 0, 20, 0.85); border: 1px solid rgba(255, 63, 90, 0.6); overflow: hidden; }
#bossfill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff2a6d, #ff9a2e); box-shadow: 0 0 10px var(--red); transform-origin: 0 50%; }
#combo {
  position: absolute; right: calc(var(--sar) + 14px); top: calc(var(--sat) + 120px);
  text-align: right; font-family: Orbitron, system-ui, sans-serif; line-height: 1;
}
#combo-n { display: block; font-weight: 900; font-size: 34px; color: #fff; text-shadow: 0 0 12px var(--pink), 0 0 2px #000; }
#combo .combo-l { font-size: 13px; color: var(--pink); font-family: system-ui, sans-serif; font-weight: 800; letter-spacing: 3px; }
#combo.pop #combo-n { animation: comboPop 0.18s ease-out; }
@keyframes comboPop { from { transform: scale(1.35); } to { transform: scale(1); } }
#banner {
  position: absolute; left: 0; right: 0; top: 26%; text-align: center;
  font-weight: 900; font-size: clamp(22px, 4.4vw, 42px); letter-spacing: 3px; color: #fff;
  text-shadow: 0 0 16px var(--cyan), 0 0 3px #000; opacity: 0; pointer-events: none; padding: 0 16px;
}
#banner.show { animation: bannerIn 2.4s ease-out forwards; }
#banner.boss { color: #ffe0e8; text-shadow: 0 0 18px var(--red), 0 0 40px var(--red), 0 0 3px #000; }
#banner.evo { color: #fff6d0; text-shadow: 0 0 18px var(--gold), 0 0 40px var(--gold), 0 0 3px #000; }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(1.6); letter-spacing: 20px; }
  12% { opacity: 1; transform: scale(1); letter-spacing: 3px; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* ---------------- screens ---------------- */
.screen {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain;
  background: radial-gradient(ellipse at center, rgba(7, 6, 15, 0.35), rgba(7, 6, 15, 0.85));
}
.screen.overlay { background: rgba(5, 3, 14, 0.62); }
.screen > * { margin: auto; }

.title-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo { font-family: Orbitron, system-ui, sans-serif; font-weight: 900; line-height: 0.95; display: flex; flex-direction: column; animation: flicker 6s infinite; }
.logo .l1 { font-size: clamp(34px, 9vw, 96px); color: #e6feff; text-shadow: 0 0 10px var(--cyan), 0 0 30px var(--cyan), 0 0 60px rgba(56, 246, 255, 0.5); letter-spacing: 6px; }
.logo .l2 { font-size: clamp(30px, 8vw, 84px); color: #ffe6fa; text-shadow: 0 0 10px var(--pink), 0 0 30px var(--pink), 0 0 60px rgba(255, 79, 216, 0.5); letter-spacing: 4px; }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: 0.6; } 95% { opacity: 1; } 97% { opacity: 0.8; } }
.subtitle { font-size: clamp(18px, 3vw, 26px); letter-spacing: 12px; color: var(--muted); margin: -4px 0 6px 12px; }
.subtitle:empty { display: none; }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title-info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.coin-line { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 20px; color: var(--gold); text-shadow: 0 0 8px rgba(255, 210, 63, 0.5); }
.record { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; max-width: 460px; line-height: 1.5; }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.toggles.left { justify-content: flex-start; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); min-height: 38px;
}
.chip.off { color: var(--muted); opacity: 0.7; }
.chip.lang { border-color: rgba(56, 246, 255, 0.6); color: var(--cyan); }

.btn {
  font-size: 17px; font-weight: 800; letter-spacing: 1px; color: #fff; min-height: 50px;
  padding: 12px 24px; border-radius: 14px; border: 2px solid var(--cyan);
  background: rgba(56, 246, 255, 0.08); text-shadow: 0 0 6px rgba(56, 246, 255, 0.6);
  box-shadow: 0 0 14px rgba(56, 246, 255, 0.25), inset 0 0 14px rgba(56, 246, 255, 0.12);
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.96); }
@media (hover: hover) { .btn:hover { box-shadow: 0 0 22px rgba(56, 246, 255, 0.55), inset 0 0 18px rgba(56, 246, 255, 0.2); } }
.btn.primary {
  border-color: var(--pink); background: linear-gradient(135deg, rgba(255, 79, 216, 0.35), rgba(120, 60, 255, 0.35));
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.8); box-shadow: 0 0 18px rgba(255, 79, 216, 0.4), inset 0 0 16px rgba(255, 79, 216, 0.2);
}
.btn.big { width: min(300px, 80vw); font-size: 21px; min-height: 58px; }
.btn.small { font-size: 14px; min-height: 42px; padding: 8px 16px; }
.btn.ghost { border-color: rgba(157, 149, 201, 0.5); background: transparent; box-shadow: none; text-shadow: none; color: var(--muted); }
.btn:disabled { opacity: 0.4; }

.panel {
  width: 100%; max-width: 600px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 20px; box-shadow: 0 0 40px rgba(120, 60, 255, 0.25), inset 0 0 30px rgba(120, 60, 255, 0.08);
}
.panel.wide { max-width: 900px; }
.panel h2 { margin: 0 0 10px; font-size: 26px; letter-spacing: 3px; text-shadow: 0 0 12px var(--pink); }
.panel h3 { margin: 14px 0 8px; font-size: 15px; color: var(--muted); letter-spacing: 2px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.row-btns { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.row-btns .btn { flex: 1 1 140px; max-width: 260px; }

/* characters */
.char-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.char-card {
  position: relative; border-radius: 16px; padding: 14px 12px; text-align: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 2px solid rgba(255, 255, 255, 0.1); color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 230px;
}
.char-card.sel { border-color: var(--c); box-shadow: 0 0 20px color-mix(in srgb, var(--c) 50%, transparent), inset 0 0 20px color-mix(in srgb, var(--c) 18%, transparent); }
.char-card img { width: 84px; height: 84px; }
.char-card .cn { font-size: 22px; font-weight: 900; color: var(--c); text-shadow: 0 0 10px var(--c); }
.char-card .ct { font-size: 13px; color: var(--muted); }
.char-card .cw { font-size: 14px; display: flex; align-items: center; gap: 4px; }
.char-card .cw img { width: 22px; height: 22px; }
.char-card .cb { font-size: 13px; color: var(--green); }
.char-card .cd { font-size: 13px; color: var(--muted); line-height: 1.4; }
.char-card.locked > *:not(.lock) { opacity: 0.35; }
.char-card .lock { margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.char-card .lock img { width: 18px; height: 18px; }
.char-card .lock .btn { width: 100%; min-height: 42px; font-size: 15px; padding: 6px; border-color: var(--gold); text-shadow: none; }

/* shop */
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tile {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1);
}
.tile img { width: 48px; height: 48px; grid-row: span 2; }
.tile .tn { font-weight: 800; font-size: 16px; }
.tile .td { font-size: 12px; color: var(--muted); grid-column: 2; }
.tile .pips { display: flex; gap: 3px; margin-top: 2px; }
.tile .pip { width: 12px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.tile .pip.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.tile .buy { grid-row: span 2; grid-column: 3; min-height: 44px; padding: 6px 10px; font-size: 14px; border-color: var(--gold); text-shadow: none; display: flex; align-items: center; gap: 4px; }
.tile .buy img { width: 16px; height: 16px; grid-row: auto; }
.tile.maxed .buy { border-color: var(--green); color: var(--green); }
.tile.flash { animation: tileFlash 0.5s; }
@keyframes tileFlash { 0% { box-shadow: 0 0 0 rgba(56, 246, 255, 0); } 30% { box-shadow: 0 0 30px var(--cyan); } 100% { box-shadow: 0 0 0 rgba(56, 246, 255, 0); } }

/* achievements */
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ach { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); opacity: 0.55; }
.ach.done { opacity: 1; border-color: rgba(255, 210, 63, 0.6); box-shadow: inset 0 0 14px rgba(255, 210, 63, 0.1); }
.ach .an { font-weight: 800; }
.ach.done .an { color: var(--gold); }
.ach .ad { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ach .ar { font-size: 12px; color: var(--gold); margin-top: 3px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-top: 8px; }
.stat-grid .st { background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 6px 10px; }
.stat-grid .st .k { font-size: 12px; color: var(--muted); }
.stat-grid .st .v { font-weight: 800; font-size: 16px; }
.stat-grid.big .st .v { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-grid .st .v .rec-tag { font-size: 11px; color: var(--gold); font-weight: 800; margin-left: 4px; font-variant-numeric: normal; }

/* level up */
.lv-wrap { text-align: center; width: 100%; max-width: 900px; }
.lv-title {
  font-size: clamp(40px, 8vw, 72px); font-weight: 900; letter-spacing: 8px; color: #fff;
  text-shadow: 0 0 14px var(--cyan), 0 0 40px var(--cyan); animation: lvIn 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.lv-sub { color: var(--muted); margin-bottom: 18px; letter-spacing: 3px; }
@keyframes lvIn { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; perspective: 900px; }
.card {
  --c: #fff; position: relative; width: 240px; min-height: 310px; padding: 22px 16px 16px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 18, 70, 0.96), rgba(12, 8, 30, 0.96));
  border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 26px color-mix(in srgb, var(--c) 12%, transparent);
  animation: cardIn 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) both; animation-delay: var(--d, 0s);
  transition: transform 0.12s, box-shadow 0.12s;
}
@keyframes cardIn {
  0% { transform: rotateY(90deg) translateY(40px) scale(0.7); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: rotateY(0) translateY(0) scale(1); opacity: 1; }
}
@media (hover: hover) { .card:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 0 34px color-mix(in srgb, var(--c) 60%, transparent), inset 0 0 30px color-mix(in srgb, var(--c) 18%, transparent); } }
.card:active { transform: scale(0.97); }
.card.sel { transform: scale(1.06); box-shadow: 0 0 50px var(--c); }
.card .c-key {
  position: absolute; left: 10px; top: 10px; width: 24px; height: 24px; border-radius: 6px; font-size: 13px; font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.25); color: var(--muted); line-height: 22px;
}
@media (hover: none) { .card .c-key { display: none; } }
.card .c-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 900; background: var(--c); color: #120a26; white-space: nowrap; box-shadow: 0 0 12px var(--c);
}
.card img.c-ico { width: 84px; height: 84px; filter: drop-shadow(0 0 10px var(--c)); }
.card .c-name { font-size: 22px; font-weight: 900; color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); }
.card .c-lv { font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: 1px; }
.card .c-desc { font-size: 15px; line-height: 1.5; }
.card .c-hint { font-size: 12px; color: var(--gold); margin-top: auto; }
.card.evo {
  --c: #ffd23f; border-color: var(--gold);
  background: linear-gradient(180deg, rgba(70, 50, 10, 0.96), rgba(30, 14, 30, 0.96));
  animation: cardIn 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) both, evoGlow 1.2s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s), 0.6s;
}
.card.evo::before {
  content: ''; position: absolute; inset: -3px; border-radius: 20px; z-index: -1;
  background: conic-gradient(from var(--a, 0deg), #ffd23f, #ff4fd8, #38f6ff, #5dff9a, #ffd23f);
  filter: blur(8px); opacity: 0.8; animation: spinA 2.5s linear infinite;
}
@property --a { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spinA { to { --a: 360deg; } }
@keyframes evoGlow { from { box-shadow: 0 0 20px rgba(255, 210, 63, 0.5); } to { box-shadow: 0 0 50px rgba(255, 210, 63, 0.95); } }
.lv-actions { margin-top: 18px; }

/* chest */
.chest-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; max-width: 560px; width: 100%; }
.chest-glow {
  position: absolute; top: -40px; left: 50%; width: 360px; height: 360px; margin-left: -180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 63, 0.45), rgba(255, 210, 63, 0) 65%); animation: chestGlow 2s ease-out both; pointer-events: none;
}
@keyframes chestGlow { from { transform: scale(0.2); opacity: 0; } 40% { opacity: 1; } to { transform: scale(1); opacity: 0.8; } }
.chest-img { width: 130px; height: 130px; animation: chestShake 0.7s ease-in-out both, chestPop 0.35s 0.7s cubic-bezier(0.2, 2, 0.4, 1) both; filter: drop-shadow(0 0 20px var(--gold)); }
@keyframes chestShake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 40% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } }
@keyframes chestPop { from { transform: scale(1); } 50% { transform: scale(1.35); } to { transform: scale(1); } }
.chest-title { font-size: 36px; font-weight: 900; color: #fff6d0; text-shadow: 0 0 16px var(--gold); letter-spacing: 6px; }
.chest-items { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.chest-item {
  --c: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; text-align: left;
  background: rgba(20, 12, 46, 0.92); border: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 30%, transparent);
  animation: itemIn 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; animation-delay: var(--d, 0s);
}
.chest-item img { width: 52px; height: 52px; }
.chest-item .n { font-weight: 900; color: var(--c); font-size: 17px; }
.chest-item .d { font-size: 13px; color: var(--muted); }
.chest-item.evo { --c: #ffd23f; }
@keyframes itemIn { from { transform: translateY(30px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.chest-coins { font-size: 20px; font-weight: 900; color: var(--gold); animation: itemIn 0.4s both; animation-delay: var(--d, 0s); }

/* pause / build */
.pause-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.build-list { display: flex; flex-direction: column; gap: 6px; }
.build-item { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 6px 10px; }
.build-item img { width: 36px; height: 36px; }
.build-item .bn { font-weight: 800; }
.build-item .bl { font-size: 12px; color: var(--muted); }
.build-item .bd { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.build-item.evo .bn { color: var(--gold); }
.empty { color: var(--muted); font-size: 13px; }

/* game over */
.dmg-list { display: flex; flex-direction: column; gap: 6px; }
.dmg-row { display: grid; grid-template-columns: 34px 140px 1fr 90px; gap: 8px; align-items: center; font-size: 14px; }
.dmg-row img { width: 34px; height: 34px; }
.dmg-row .bar { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.dmg-row .bar i { display: block; height: 100%; background: var(--c); box-shadow: 0 0 8px var(--c); border-radius: 5px; animation: barIn 0.9s ease-out both; transform-origin: 0 50%; }
@keyframes barIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.dmg-row .num { white-space: nowrap; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.dmg-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-break { margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(255, 210, 63, 0.07); border: 1px solid rgba(255, 210, 63, 0.35); display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.coin-break .tot { font-size: 22px; font-weight: 900; color: var(--gold); margin-left: auto; display: flex; align-items: center; gap: 6px; }
.coin-break span { color: var(--muted); font-size: 14px; }
.o-ach:empty { display: none; }
.o-ach { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.o-ach .chip { border-color: rgba(255, 210, 63, 0.6); color: var(--gold); }
#o-title.win { color: #fff6d0; text-shadow: 0 0 16px var(--gold); }
#o-title.lose { color: #ffd0d8; text-shadow: 0 0 16px var(--red); }

/* confirm dialog (in-game: native confirm() can be blocked inside an iframe) */
.screen.confirm { z-index: 35; }
.confirm-box { max-width: 420px; text-align: center; }
.confirm-box p { margin: 4px 0 0; font-size: 17px; line-height: 1.5; }
.confirm-box .row-btns { justify-content: center; }

/* toasts */
#toasts { position: fixed; bottom: calc(var(--sab) + 28px); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 6px; pointer-events: none; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 14px; background: rgba(30, 20, 6, 0.94); border: 1.5px solid var(--gold);
  color: #fff6d0; font-weight: 800; box-shadow: 0 0 20px rgba(255, 210, 63, 0.4); font-size: 15px; white-space: nowrap;
  animation: toastIn 2.6s ease-out forwards;
}
.toast small { color: var(--gold); margin-left: 8px; }
@keyframes toastIn { 0% { transform: translateY(-30px); opacity: 0; } 10% { transform: none; opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------------- narrow / portrait ---------------- */
@media (max-width: 760px) {
  .cards { flex-direction: column; align-items: center; gap: 12px; }
  .card { width: min(560px, 100%); min-height: 0; flex-direction: row; text-align: left; padding: 16px 14px; gap: 12px; animation-name: cardInRow; }
  .card.evo { animation-name: cardInRow, evoGlow; }
  @keyframes cardInRow { from { transform: translateX(-60px) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
  .card img.c-ico { width: 64px; height: 64px; flex: none; }
  .card .c-body { display: flex; flex-direction: column; gap: 3px; }
  .card .c-tag { left: auto; right: 14px; transform: none; }
  .card .c-hint { margin-top: 2px; }
  .char-list { grid-template-columns: 1fr; }
  .char-card { flex-direction: row; text-align: left; min-height: 0; align-items: center; flex-wrap: wrap; }
  .char-card img { width: 64px; height: 64px; }
  .char-card .cinfo { flex: 1; min-width: 160px; }
  .char-card .lock { position: static; width: 100%; }
  .pause-cols { grid-template-columns: 1fr; gap: 4px; }
  .dmg-row { grid-template-columns: 28px 112px 1fr auto; font-size: 12px; gap: 6px; }
  #coins { position: absolute; right: 0; top: 50px; margin: 0; }
  #hud-right { position: relative; }
  .toast { font-size: 13px; padding: 8px 12px; }
  #slots .slot { width: 26px; height: 26px; }
  #timer { font-size: 22px; }
}
@media (min-width: 761px) { .card .c-body { display: contents; } .char-card .cinfo { display: contents; } }
@media (max-height: 560px) and (orientation: landscape) {
  .card { min-height: 0; padding: 16px 12px 12px; }
  .card img.c-ico { width: 56px; height: 56px; }
  .lv-title { font-size: 34px; }
  .lv-sub { margin-bottom: 10px; }
  .logo .l1 { font-size: 38px; } .logo .l2 { font-size: 34px; }
  .btn.big { min-height: 44px; font-size: 17px; width: 100%; padding: 8px 18px; }
  .title-wrap { gap: 8px; }
  .menu { display: grid; grid-template-columns: repeat(3, minmax(0, 190px)); gap: 8px; }
  .menu #b-start { grid-column: 1 / -1; justify-self: center; width: min(300px, 80vw); }
  .subtitle { margin: -6px 0 0 12px; font-size: 18px; }
}
