@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg-0: #03030A;
  --bg-1: #0A0A1A;
  --bg-2: #15122A;

  --accent: #FFB74D;
  --accent-dim: #E65100;
  --teal: #64FFDA;
  --blue: #82B1FF;
  --red: #EF5350;
  --violet: #B39DDB;

  --menu-text: #F2F5F9;
  --text-muted: #8A94A6;

  --glass-bg: rgba(26, 24, 52, 0.58);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-strong: rgba(255, 255, 255, 0.14);

  --radius-lg: 28px;
  --radius-md: 20px;

  --shadow-soft: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow-accent: 0 0 0 1px rgba(242, 179, 77, 0.25), 0 10px 30px rgba(242, 179, 77, 0.18);

  
  --r-common: #B0BEC5;
  --r-rare: #64B5F6;
  --r-epic: #BA68C8;
  --r-legendary: #FFB74D;

  --app-height: 100vh;
}
@supports (height: 100dvh) {
  :root { --app-height: 100dvh; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--menu-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

body.in-game { height: 100%; overflow: hidden; touch-action: none; }

.hidden { display: none !important; }

.screen {
  min-height: var(--app-height);
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(179, 157, 219, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 100% 10%, rgba(100, 255, 218, 0.05), transparent 55%),
    radial-gradient(1400px 900px at 50% 120%, rgba(242, 179, 77, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  overflow-y: auto;
}
.screen.active { display: flex; }

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-card {
  width: 100%;
  max-width: 440px;
  margin-top: 4vh;
  margin-bottom: 4vh;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.game-title {
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
  background: linear-gradient(180deg, #FFE9A8, var(--accent) 60%, var(--accent-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.board-screen-title { font-size: 24px; }

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(5, 5, 16, 0.42);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: 0 0 14px rgba(242, 179, 77, 0.4);
  flex-shrink: 0;
  background: var(--bg-2);
}
.avatar-stub {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: var(--accent);
}
.profile-info { text-align: left; flex: 1; min-width: 0; }
.profile-coins {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0; min-width: 76px; padding: 6px 12px;
  border-radius: 14px; background: rgba(255, 183, 77, 0.08); border: 1px solid rgba(255, 183, 77, 0.35);
}
.profile-coins b {
  font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 800; color: var(--accent);
  line-height: 1.2; margin-top: 2px;
}
.profile-coins-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.profile-coins.bump { animation: coinBump 0.6s ease-out; }
@keyframes coinBump { 0% { transform: scale(1); } 30% { transform: scale(1.12); box-shadow: 0 0 18px rgba(255, 183, 77, 0.55); } 100% { transform: scale(1); } }

.coin-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4 0 18%, #ffd36b 19% 55%, #d9901f 56% 100%);
  box-shadow: inset 0 0 0 1px #8a5a12;
}
.profile-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-best { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.profile-best b { color: var(--accent); font-family: 'JetBrains Mono', monospace; }
.profile-rank { margin-left: 6px; color: var(--text-muted); }

.menu-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-row2 .btn { padding-left: 8px; padding-right: 8px; }
.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.btn {
  border: none;
  border-radius: 18px;
  padding: 16px 20px;
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
  color: #1A1300;
  background: linear-gradient(180deg, #FFE9A8, var(--accent) 55%, #D89B33);
  box-shadow: var(--shadow-glow-accent), 0 8px 20px rgba(0, 0, 0, 0.35);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  color: var(--menu-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border-strong);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.09); }

.menu-notice {
  width: 100%;
  font-size: 13px;
  color: var(--accent);
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.2);
  border-radius: 14px;
  padding: 10px 12px;
}

.board-hint { font-size: 12px; color: var(--text-muted); margin-top: -6px; }

.board-table { width: 100%; }
.board-head, .board-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 84px 64px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.board-head {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}
.col-rank { text-align: left; }
.col-name { text-align: left; }
.col-char { text-align: left; }
.col-time { text-align: right; }
.board-rows-full {
  width: 100%;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 0;
}
.board-row {
  font-size: 14px;
  border-radius: 12px;
  margin: 2px 0;
}
.board-row:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.board-rank { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text-muted); text-align: left; }
.board-row:nth-child(1) .board-rank { color: #FFD54F; }
.board-row:nth-child(2) .board-rank { color: #CFD8DC; }
.board-row:nth-child(3) .board-rank { color: #FFAB91; }
.board-char { text-align: left; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-name { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-time { text-align: right; font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--accent); }

.board-me {
  background: rgba(255, 183, 77, 0.14) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 183, 77, 0.55);
}
.board-me .board-name { color: #FFE9A8; font-weight: 700; }
.board-sep { text-align: center; color: var(--text-muted); font-size: 12px; padding: 2px 0; letter-spacing: 4px; }
.board-empty { color: var(--text-muted); font-size: 13px; padding: 18px 0; }
.record-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1A1300;
  background: var(--accent);
  vertical-align: middle;
}

.stats-grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; width: 100%; }
.stats-grid > div { padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.stats-grid .stats-v { text-align: right; font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.stats-sub { margin-top: 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.stats-char { display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px 12px; width: 100%; font-size: 13px; }
.stats-char > div { padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.stats-char .stats-h { color: var(--text-muted); font-size: 11px; }
.stats-char .num { text-align: right; font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.card-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  overflow-y: auto;
  text-align: left;
}
.char-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(5, 5, 16, 0.42);
  border: 1px solid var(--glass-border);
}
.char-card.selected { border-color: rgba(255, 183, 77, 0.6); box-shadow: var(--shadow-glow-accent); }
.char-card { cursor: pointer; }
.char-card.locked { cursor: default; }
.char-card.locked .char-portrait { filter: grayscale(0.85) brightness(0.6); }
.char-badge.locked { color: var(--text-muted); border-color: rgba(255, 255, 255, 0.18); }
.char-buy { margin-top: 10px; padding: 8px 14px; font-size: 13px; width: auto; }
.char-buy[disabled] { opacity: 0.45; cursor: default; filter: none; }
.ench-how { text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border); }
.ench-how-title { font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.ench-how-line { font-size: 13px; color: var(--text-muted); line-height: 1.45; margin-top: 4px; }
.ench-card { cursor: default; }
.ench-card .char-ench-name { display: block; margin-top: 4px; font-size: 13px; }
.ench-card .char-ench-btn { margin-top: 10px; }
.ench-lv { margin-top: 2px; font-size: 12px; }
.char-ench { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.char-ench-name { font-weight: 700; color: var(--text-muted); }
.char-ench-btn { padding: 6px 12px; font-size: 12px; width: auto; }
.char-ench-btn[disabled] { opacity: 0.45; cursor: default; filter: none; }
.char-card.ench-reveal { animation: enchReveal 1.2s ease-out; }
@keyframes enchReveal {
  0% { box-shadow: 0 0 0 0 var(--ench-color, #ffd54f); }
  30% { box-shadow: 0 0 26px 6px var(--ench-color, #ffd54f); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.char-portrait {
  width: 72px; height: 72px; flex-shrink: 0;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(179, 157, 219, 0.25), rgba(0, 0, 0, 0.3));
  image-rendering: pixelated;
}
.char-info { flex: 1; min-width: 0; }
.char-name { font-weight: 800; font-size: 16px; }
.char-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); border: 1px solid rgba(255, 183, 77, 0.4);
}
.char-desc { font-size: 12px; color: var(--text-muted); margin: 4px 0 8px; line-height: 1.5; }
.char-stats {
  display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px;
  font-size: 12px;
}
.char-stats span { color: var(--text-muted); }
.char-stats b { color: var(--menu-text); font-family: 'JetBrains Mono', monospace; font-weight: 700; }

.coll-section { margin-top: 4px; }
.coll-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin: 8px 2px 6px;
}
.coll-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(5, 5, 16, 0.42);
  border: 1px solid var(--glass-border);
  margin-bottom: 6px;
}
.coll-name { font-weight: 700; font-size: 14px; }
.coll-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.coll-meta { font-size: 11px; margin-left: 6px; font-weight: 700; }

.rarity-common { color: var(--r-common); }
.rarity-rare { color: var(--r-rare); }
.rarity-epic { color: var(--r-epic); }
.rarity-legendary { color: var(--r-legendary); }

.settings-slot { width: 100%; }
.settings {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.setting-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.setting-row input[type="range"] { width: 45%; accent-color: var(--accent); cursor: pointer; }

#screen-game {
  padding: 0;
  background: #07060d;
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.hud-xp {
  position: absolute; top: 0; left: 0; right: 0;
  height: 6px;
  background: rgba(0, 0, 0, 0.55);
}
.hud-xp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #4FC3F7, #64FFDA);
  box-shadow: 0 0 10px rgba(100, 255, 218, 0.6);
  transition: width 0.12s linear;
}
.hud-top {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
}
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-hp {
  position: relative;
  width: 200px; max-width: 42vw;
  height: 18px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(239, 83, 80, 0.45);
  overflow: hidden;
}
.hud-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #EF5350, #B71C1C);
  transition: width 0.15s ease-out;
}
.hud-shield-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 205, 210, 0.85) 0 4px, rgba(229, 115, 115, 0.85) 4px 8px);
  border-right: 1px solid #fff;
}
.hud-hp-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px #000;
}
.hud-effects { display: flex; flex-wrap: wrap; gap: 4px; max-width: 46vw; }
.effect-chip {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--menu-text);
  font-family: 'Inter', sans-serif;
}
.hud-center { text-align: center; }
.hud-sub.event { color: #FF8A65; font-weight: 800; letter-spacing: 0.06em; }
.boss-bar {
  position: absolute; left: 50%; top: 128px; transform: translateX(-50%);
  width: min(460px, 70vw); pointer-events: none;
}
.boss-bar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; text-shadow: 0 1px 3px #000; }
.boss-name { font-weight: 800; font-size: 14px; color: #EDE3FF; letter-spacing: 0.04em; text-transform: uppercase; }
.boss-phase { font-size: 11px; color: #FFB74D; font-weight: 700; }
.boss-bar-track { height: 10px; border-radius: 6px; background: rgba(0,0,0,0.6); border: 1px solid rgba(179,120,255,0.6); overflow: hidden; position: relative; }
.boss-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #6e3bb0, #b378ff); transition: width 0.15s linear; }

.boss-bar-track::before, .boss-bar-track::after { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.55); z-index: 1; }
.boss-bar-track::before { left: 70%; }
.boss-bar-track::after { left: 40%; }
.hud-time {
  font-size: 30px; font-weight: 700;
  color: #FFE9A8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 18px rgba(255, 183, 77, 0.35);
}
.hud-sub {
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.12em;
  font-family: 'Inter', sans-serif;
}
.hud-right { display: flex; justify-content: flex-end; gap: 14px; }
.hud-stat { display: flex; flex-direction: column; align-items: flex-end; }
.hud-label {
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-family: 'Inter', sans-serif;
}
.hud-value { font-size: 18px; font-weight: 700; color: var(--accent); text-shadow: 0 1px 4px #000; }

.hud-bottom {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-between; align-items: flex-end;
}
.hud-ammo {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hud-ammo-text { font-size: 18px; font-weight: 700; color: var(--menu-text); }
.hud-ammo-text.empty { color: var(--red); }
.hud-reload { width: 110px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.hud-reload-fill { height: 100%; width: 0%; background: var(--accent); }
.hud-ability {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(179, 157, 219, 0.4);
}
.hud-ability.locked { opacity: 0.45; }
.hud-ability-key {
  width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--violet);
  border: 1px solid rgba(179, 157, 219, 0.6);
}
.hud-ability-name { font-size: 11px; color: var(--text-muted); font-family: 'Inter', sans-serif; }

.toast {
  position: absolute;
  left: 50%; top: 84px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(10, 8, 20, 0.88);
  border: 1px solid rgba(255, 183, 77, 0.35);
  color: #FFE9A8;
  font-size: 13px; font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  padding: 20px;
  
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: rgba(3, 3, 10, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: default;
}
.overlay > * { margin: auto; }   
.overlay-panel {
  width: 100%;
  max-width: 400px;
  padding: 26px 22px 22px;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.overlay-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
}
.overlay-note { margin: 0 0 14px; font-size: 13px; color: var(--text-muted); }
.overlay-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.overlay-panel button {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 18px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #1A1005;
  background: linear-gradient(180deg, #FFF3E0, var(--accent) 55%, var(--accent-dim));
  box-shadow: var(--shadow-glow-accent);
  cursor: pointer;
}
.overlay-panel button:active { transform: scale(0.97); }
.overlay-panel button.btn-ghost {
  color: var(--menu-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border-strong);
  box-shadow: none;
}
.overlay-panel .settings-slot { margin-top: 14px; }

.overlay-choice { background: rgba(3, 3, 10, 0.72); }
.choice-wrap { width: 100%; max-width: 820px; text-align: center; }
.choice-title {
  margin: 0 0 6px;
  font-size: 26px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  background: linear-gradient(180deg, #FFE9A8, var(--accent) 60%, var(--accent-dim));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.choice-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.choice-card {
  position: relative;
  padding: 20px 16px 16px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease;
  font-family: inherit;
  color: var(--menu-text);
}
.choice-card:hover { transform: translateY(-3px); border-color: rgba(255, 183, 77, 0.6); }
.choice-card.rarity-common { border-top: 3px solid var(--r-common); }
.choice-card.rarity-rare { border-top: 3px solid var(--r-rare); }
.choice-card.rarity-epic { border-top: 3px solid var(--r-epic); box-shadow: 0 0 24px rgba(186, 104, 200, 0.25); }
.rarity-synergy { color: #E1F5FE; }
.choice-card.rarity-synergy { border-top: 3px solid #B3E5FC; box-shadow: 0 0 28px rgba(179, 229, 252, 0.35), 0 0 12px rgba(255, 204, 128, 0.25); }
.choice-card.rarity-legendary { border-top: 3px solid var(--r-legendary); box-shadow: 0 0 28px rgba(255, 183, 77, 0.35); }
.choice-key {
  position: absolute; top: 10px; right: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted);
}
.choice-rarity { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.choice-name { font-size: 18px; font-weight: 800; margin: 4px 0 6px; }
.choice-desc { font-size: 13px; color: #C9D1DC; line-height: 1.5; }
.choice-stack { margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.choice-synergy { margin-top: 6px; font-size: 11px; font-weight: 700; color: #E1F5FE; text-shadow: 0 0 8px rgba(255, 204, 128, 0.7); }
.effect-chip.synergy { color: #E1F5FE; border-color: rgba(255, 204, 128, 0.6); }
.synergy { color: #E1F5FE; }

.end-panel { max-width: 440px; }
.end-record {
  display: inline-block;
  margin: 2px 0 10px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  color: #1A1300;
  background: linear-gradient(180deg, #FFE9A8, var(--accent));
  box-shadow: 0 0 24px rgba(255, 183, 77, 0.55);
  animation: record-pulse 1.4s ease-in-out infinite;
}
@keyframes record-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.end-time-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.12em; }
.end-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 48px; font-weight: 700; color: #FFE9A8;
  text-shadow: 0 0 24px rgba(255, 183, 77, 0.4);
  line-height: 1.1;
}
.overlay-rank { font-size: 13px; font-weight: 700; color: var(--accent); margin: 4px 0 12px; min-height: 18px; }
.end-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 12px;
}
.end-stats div {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}
.end-stats span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.end-stats b { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: var(--menu-text); }
.end-upgrades-title { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.end-upgrades { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 10px; min-height: 20px; }

.switch2 {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr;
  width: 170px; padding: 3px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--glass-border);
}
.switch2 button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: 7px 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--text-muted);
  transition: color 0.2s;
}
.switch2 button.on { color: #1a1320; }
.switch2-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 9px; background: var(--accent); transition: transform 0.22s ease;
}
.switch2.touch .switch2-thumb { transform: translateX(100%); }

.touch-ui { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.stick {
  position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22); opacity: 0.45; transition: opacity 0.15s;
}
.stick.active { opacity: 1; transition: none; }
.stick-move { border-color: rgba(255, 255, 255, 0.22); }
.stick-aim { border-color: rgba(255, 183, 77, 0.35); }
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.28); border: 1px solid rgba(255, 255, 255, 0.4);
}
.stick-aim .stick-knob { background: rgba(255, 183, 77, 0.4); border-color: rgba(255, 183, 77, 0.7); }
.stick-aim.firing .stick-knob { background: rgba(255, 183, 77, 0.75); }
.touch-pause {
  position: absolute; right: 12px; top: calc(62px + env(safe-area-inset-top, 0px));
  width: 42px; height: 42px; border-radius: 12px; pointer-events: auto;
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--menu-text); font-size: 14px; cursor: pointer;
}
.char-progress { margin-top: 8px; font-size: 12px; color: var(--text-muted); }

.stick-ability { width: 84px; height: 84px; margin: -42px 0 0 -42px; opacity: 0.9;
  border-color: rgba(255, 213, 79, 0.75); background: rgba(60, 40, 0, 0.35); }
.stick-ability .stick-knob { width: 44px; height: 44px; margin: -22px 0 0 -22px;
  background: rgba(255, 213, 79, 0.85); border-color: #fff3c4;
  display: flex; align-items: center; justify-content: center;
  color: #2a1a00; font: 700 15px/1 var(--font-ui, sans-serif); }
.stick-ability.ready { animation: abilReady 1.1s ease-in-out infinite; }
.stick-ability.cooling { opacity: 0.45; border-color: rgba(255, 255, 255, 0.25); animation: none; }
.stick-ability.cooling .stick-knob { background: rgba(120, 110, 90, 0.7); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.stick-ability.active { opacity: 1; }
@keyframes abilReady { 0%, 100% { box-shadow: 0 0 6px 1px rgba(255, 213, 79, 0.45); } 50% { box-shadow: 0 0 16px 5px rgba(255, 213, 79, 0.8); } }
body.touch-mode #screen-game { cursor: default; }
body.touch-mode #game-canvas { touch-action: none; }
body.touch-mode .hud-bottom { left: 50%; right: auto; transform: translateX(-50%); gap: 8px; }
body.touch-mode .hud-ability-key { display: none; }

body.rotated #screen-game {
  position: fixed; top: 0; left: 0;
  min-height: 0;
  transform-origin: 0 0;
}

.gear-item { text-align: left; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border); border-left: 3px solid var(--rar, var(--glass-border)); }
.gear-empty { opacity: 0.55; }
.gear-item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gear-icon { font-size: 18px; }
.gear-name { font-weight: 800; font-size: 14px; }
.gear-rar { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.gear-line { font-size: 13px; color: #E8E6F0; margin-top: 4px; }
.gear-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.gear-drop { background: rgba(255, 110, 110, 0.15); }
.loot-lost { color: #FF8A80; }
.gear-buy { margin-top: 4px; }
.gear-buy[disabled] { opacity: 0.45; cursor: default; filter: none; }
.coins-link { font-size: 12px; color: var(--accent); word-break: break-all; margin: 8px 0 4px; user-select: all; -webkit-user-select: all; }
.char-claim[disabled] { opacity: 0.45; cursor: default; filter: none; }
