/* ── Bean Blitz Styles ─────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #050510;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  user-select: none;
  overflow: hidden;
  color: #ccc;
}

/* ── Screen System ──────────────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: #050510;
}
.screen.active { display: flex; }
.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 800px;
  width: 100%;
  padding: 20px;
}

/* ── Title Screen ───────────────────────────────────────────────────────────── */
#title-screen {
  background: radial-gradient(ellipse at center, #0a0a2a 0%, #050510 70%);
}
.game-logo {
  font-size: 42px; font-weight: 900; letter-spacing: 8px;
  color: #ff4444;
  text-shadow: 0 0 20px #ff4444, 0 0 40px #ff444466, 0 0 80px #ff444433;
  margin-bottom: 10px;
  text-align: center;
}
.game-subtitle {
  font-size: 11px; color: #5577aa; letter-spacing: 4px; margin-bottom: 20px;
  text-align: center;
}
.menu-btn {
  background: linear-gradient(135deg, #0033aa, #0055ff);
  color: #fff; border: 2px solid #4488ff; border-radius: 8px;
  padding: 14px 40px; font-size: 14px; font-family: 'Courier New', monospace;
  font-weight: 900; letter-spacing: 3px; cursor: pointer;
  box-shadow: 0 0 15px #0033aa88;
  width: 280px; text-align: center;
  transition: all 0.15s;
}
.menu-btn:hover {
  background: linear-gradient(135deg, #0044cc, #0077ff);
  box-shadow: 0 0 25px #0055ffaa;
  transform: translateY(-2px);
}
.menu-btn.secondary {
  background: linear-gradient(135deg, #1a1a3a, #0d0d22);
  border-color: #334466;
  box-shadow: 0 0 10px #22334455;
}
.menu-btn.secondary:hover {
  background: linear-gradient(135deg, #222244, #151530);
  border-color: #4466aa;
}
.menu-btn.danger {
  background: linear-gradient(135deg, #aa0033, #ff0055);
  border-color: #ff4488;
}
.back-btn {
  position: absolute; top: 20px; left: 20px;
  background: none; border: 1px solid #334; color: #668;
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-family: 'Courier New', monospace; font-size: 12px;
  letter-spacing: 2px;
}
.back-btn:hover { border-color: #66a; color: #aac; }

/* ── User Bar ──────────────────────────────────────────────────────────────── */
#user-bar {
  position: absolute; top: 12px; right: 16px;
  display: flex; align-items: center; gap: 8px;
  z-index: 20;
}
#user-bar-name {
  font-size: 12px; color: #00ffcc; font-weight: 900; letter-spacing: 2px;
}
.tier-badge {
  font-size: 9px; letter-spacing: 2px; padding: 3px 8px;
  border-radius: 4px; font-weight: 900;
}
.tier-badge.free {
  background: #1a1a3a; border: 1px solid #334466; color: #5577aa;
}
.tier-badge.full {
  background: linear-gradient(135deg, #3a2a00, #554400);
  border: 1px solid #FFD700; color: #FFD700;
}
.user-bar-btn {
  background: none; border: 1px solid #223355; color: #5577aa;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  font-family: 'Courier New', monospace; font-size: 10px;
  letter-spacing: 1px;
}
.user-bar-btn:hover { border-color: #4488ff; color: #88bbff; }

/* ── Auth Screen ───────────────────────────────────────────────────────────── */
#auth-screen {
  background: radial-gradient(ellipse at center, #0a0a2a 0%, #050510 70%);
}
#auth-login-form {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-width: 300px; width: 100%;
}

/* ── Account Screen ────────────────────────────────────────────────────────── */
#account-screen .screen-content {
  max-height: 90vh; overflow-y: auto;
}

/* ── Upgrade Overlay ───────────────────────────────────────────────────────── */
.upgrade-box {
  background: linear-gradient(135deg, #1a1500, #0d0d00);
  border: 2px solid #FFD700; border-radius: 10px;
  padding: 20px; max-width: 360px; text-align: center;
  margin-top: 10px;
}
.upgrade-box h3 {
  color: #FFD700; font-size: 14px; letter-spacing: 3px; margin-bottom: 10px;
}
.upgrade-box p {
  color: #aa9944; font-size: 11px; line-height: 1.8;
}

/* ── Character Select ───────────────────────────────────────────────────────── */
.enemy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 700px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}
.enemy-card {
  background: linear-gradient(135deg, #0d1a2a, #060f1a);
  border: 2px solid #1a3355; border-radius: 8px;
  padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.enemy-card:hover {
  border-color: #4488ff;
  box-shadow: 0 0 15px #0044aa44;
  transform: translateY(-3px);
}
.enemy-card canvas { border-radius: 4px; }
.enemy-card-name {
  font-size: 11px; font-weight: 900; letter-spacing: 2px; color: #ff8833;
  text-shadow: 0 0 8px #ff883355;
}
.enemy-card-desc { font-size: 8px; color: #4477aa; text-align: center; line-height: 1.4; }
.diff-pips { display: flex; gap: 2px; }
.diff-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1a0a0a;
}
.diff-pip.active { background: #ff4444; }

/* ── Pre-Battle ─────────────────────────────────────────────────────────────── */
#prebattle-screen {
  background: radial-gradient(ellipse at center, #0a0a2a 0%, #050510 70%);
}
.prebattle-name {
  font-size: 28px; font-weight: 900; letter-spacing: 4px;
  color: #ff8833; text-shadow: 0 0 15px #ff883355;
}
.prebattle-desc {
  font-size: 14px; color: #667799; font-style: italic; text-align: center;
  max-width: 400px;
}
.prebattle-round {
  font-size: 12px; color: #5577aa; letter-spacing: 3px;
}

/* ── Multiplayer Lobby ──────────────────────────────────────────────────────── */
.lobby-input {
  background: #0a0a1e; border: 2px solid #223355; border-radius: 6px;
  color: #00ffcc; font-family: 'Courier New', monospace; font-size: 16px;
  padding: 12px 16px; text-align: center; letter-spacing: 3px;
  width: 260px; outline: none;
}
.lobby-input:focus { border-color: #4488ff; box-shadow: 0 0 10px #0044aa44; }
.lobby-input::placeholder { color: #334455; letter-spacing: 2px; }
.room-code {
  font-size: 36px; font-weight: 900; letter-spacing: 8px;
  color: #00ffcc; text-shadow: 0 0 15px #00ffcc55;
  background: #0a0a1e; padding: 16px 32px; border-radius: 8px;
  border: 2px solid #1a3355;
}
.lobby-status {
  font-size: 12px; color: #5577aa; letter-spacing: 2px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.lobby-label {
  font-size: 10px; color: #336688; letter-spacing: 3px;
}
.lobby-divider {
  width: 200px; height: 1px; background: #223355; margin: 10px 0;
}

/* ── Game Screen ────────────────────────────────────────────────────────────── */
#game-screen { background: #050510; justify-content: flex-start; padding-top: 28px; }
#title-bar {
  font-size: 20px; font-weight: 900; letter-spacing: 8px;
  color: #ff4444; text-shadow: 0 0 15px #ff4444, 0 0 30px #ff444466;
  margin-bottom: 10px;
}
#game-area { display: flex; gap: 12px; align-items: flex-start; }
.side-panel { width: 130px; display: flex; flex-direction: column; gap: 5px; padding-top: 20px; }
.pbox {
  background: linear-gradient(135deg, #0c1828, #060e18);
  border: 1px solid #1a3050; border-radius: 8px; padding: 7px 10px;
  backdrop-filter: blur(4px);
}
.plabel { font-size: 9px; color: #4478a0; letter-spacing: 3px; margin-bottom: 2px; font-weight: 700; }
.pval {
  font-size: 14px; color: #00ffcc; font-weight: 900;
  letter-spacing: 2px; text-shadow: 0 0 8px #00ffcc55;
}
.pbig { font-size: 20px; font-weight: 900; text-shadow: 0 0 10px #00ffcc77; }
.board-section { display: flex; flex-direction: column; align-items: center; }
.board-label { font-size: 11px; letter-spacing: 4px; margin-bottom: 4px; font-weight: 900; }
.garb-row {
  height: 20px; display: flex; align-items: center; gap: 3px;
  margin-bottom: 4px; min-height: 20px;
}
.gi {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #cccccc, #888888, #333333);
  border: 1px solid #444; flex-shrink: 0;
}
.bwrap {
  padding: 8px;
  background: linear-gradient(145deg, #12122e, #0a0a1e);
  border-radius: 12px; border: 2px solid #2244aa;
  box-shadow: 0 0 24px #00aaff22, inset 0 0 30px #00000044;
  animation: boardGlow 3s ease-in-out infinite;
}
.bwrap.enemy {
  border-color: #aa2244;
  box-shadow: 0 0 24px #ff224422, inset 0 0 30px #00000044;
  animation: enemyGlow 3s ease-in-out infinite;
}
.bwrap.danger {
  animation: dangerpulse 0.4s infinite alternate !important;
}
@keyframes dangerpulse {
  from { box-shadow: 0 0 20px #ff000088; border-color: #ff0000; }
  to { box-shadow: 0 0 40px #ff0000cc; border-color: #ff6666; }
}
@keyframes boardGlow {
  0%, 100% { box-shadow: 0 0 24px #00aaff22, inset 0 0 30px #00000044; }
  50% { box-shadow: 0 0 40px #00aaff44, inset 0 0 30px #00000044; }
}
@keyframes enemyGlow {
  0%, 100% { box-shadow: 0 0 24px #ff224422, inset 0 0 30px #00000044; }
  50% { box-shadow: 0 0 40px #ff224444, inset 0 0 30px #00000044; }
}
canvas { display: block; }

#center-panel {
  width: 140px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding-top: 6px;
}
#vs-txt { font-size: 20px; font-weight: 900; color: #ff4444; text-shadow: 0 0 16px #ff4444; letter-spacing: 4px; }
#rnd-txt { font-size: 10px; color: #5577aa; letter-spacing: 3px; text-align: center; }
#en-name {
  font-size: 13px; font-weight: 900; letter-spacing: 3px;
  color: #ff8833; text-align: center; text-shadow: 0 0 10px #ff883355;
}
#en-desc { font-size: 9px; color: #5588aa; text-align: center; line-height: 1.6; padding: 0 4px; }
.chain-bonus-box { font-size: 9px; color: #5590b0; line-height: 1.8; width: 100%; }
.ctrl-box { font-size: 9px; color: #5590b0; line-height: 1.6; }
.ctrl-key {
  display: inline-block; background: #0a1525; border: 1px solid #2a4060;
  border-radius: 3px; padding: 1px 5px; color: #00ccee; font-size: 9px;
  font-weight: 700; min-width: 18px; text-align: center;
}
.ctrl-row { display: flex; align-items: center; gap: 4px; margin: 2px 0; }
.ctrl-action { color: #5590b0; font-size: 9px; }
#lives-row { display: flex; gap: 4px; flex-wrap: wrap; }
.life-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8888, #ff2222, #880000);
  border: 1px solid #880000;
  box-shadow: 0 0 6px #ff000044;
}
#diff-row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }

/* Chain pop */
.chain-pop {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ff6600, #ffaa00);
  color: #fff; font-size: 20px; font-weight: 900;
  padding: 6px 14px; border-radius: 8px; border: 2px solid #fff;
  text-shadow: 2px 2px 0 #aa4400; letter-spacing: 2px;
  pointer-events: none; z-index: 30;
  animation: cpop 0.4s ease-out;
}
@keyframes cpop {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ── Scores Screen ──────────────────────────────────────────────────────────── */
.scores-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.scores-tab {
  padding: 8px 18px; border-radius: 6px 6px 0 0;
  background: #0a0a1e; border: 1px solid #223355; border-bottom: none;
  color: #5577aa; font-family: 'Courier New', monospace;
  font-size: 11px; letter-spacing: 2px; cursor: pointer;
  font-weight: 700;
}
.scores-tab.active {
  background: #0d1a2a; border-color: #4488ff; color: #00ffcc;
}
.scores-period-tabs {
  display: flex; gap: 4px; margin-bottom: 10px;
}
.period-tab {
  padding: 6px 14px; border-radius: 4px;
  background: #0a0a1e; border: 1px solid #1a2a3a;
  color: #446688; font-family: 'Courier New', monospace;
  font-size: 10px; letter-spacing: 1px; cursor: pointer;
}
.period-tab.active { background: #0d1a2a; border-color: #336699; color: #00aacc; }
.scores-table {
  width: 100%; max-width: 600px;
  border-collapse: collapse;
}
.scores-table th {
  font-size: 9px; color: #336688; letter-spacing: 2px;
  padding: 8px; text-align: left; border-bottom: 1px solid #1a2a3a;
}
.scores-table td {
  font-size: 12px; color: #88aacc; padding: 6px 8px;
  border-bottom: 1px solid #0a1520;
}
.scores-table tr:nth-child(odd) td { background: #0a0a1800; }
.scores-table .rank { color: #ff8833; font-weight: 900; width: 30px; }
.scores-table .score-val { color: #00ffcc; font-weight: 900; }
.scores-table .name-val { color: #aaccee; }

/* ── How To Play ────────────────────────────────────────────────────────────── */
.rules-box {
  background: linear-gradient(135deg, #0d1a2a, #060f1a);
  border: 1px solid #1a3355; border-radius: 8px;
  padding: 20px; max-width: 500px; width: 100%;
  line-height: 1.8; font-size: 12px; color: #88aacc;
}
.rules-box h3 { color: #ff8833; font-size: 14px; letter-spacing: 2px; margin: 12px 0 6px; }
.rules-box h3:first-child { margin-top: 0; }
.rules-box kbd {
  background: #1a1a3a; border: 1px solid #334; border-radius: 3px;
  padding: 1px 6px; color: #00aacc; font-size: 11px;
}

/* ── Overlay (countdown, results) ───────────────────────────────────────────── */
.game-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 2, 18, 0.88);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; z-index: 50;
}
.game-overlay.active { display: flex; }
.countdown-num {
  font-size: 72px; font-weight: 900; color: #ff4444;
  text-shadow: 0 0 30px #ff4444;
  animation: countPop 0.8s ease-out;
}
@keyframes countPop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* Pause overlay */
#pause-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 2, 18, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 48;
}
.pause-text {
  font-size: 48px; font-weight: 900; letter-spacing: 12px;
  color: #ff4444;
  text-shadow: 0 0 30px #ff4444, 0 0 60px #ff444466;
  animation: pausePulse 2s ease-in-out infinite;
}
.pause-sub {
  font-size: 13px; color: #5577aa; letter-spacing: 2px;
}
.pause-sub kbd {
  background: #1a1a3a; border: 1px solid #334; border-radius: 3px;
  padding: 1px 6px; color: #00aacc; font-size: 12px;
}
@keyframes pausePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Projectile overlay canvas */
#proj-canvas {
  position: fixed; inset: 0; pointer-events: none; z-index: 45;
}

/* ── Scrollbar styling ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #050510; }
::-webkit-scrollbar-thumb { background: #223355; border-radius: 3px; }

/* ── Game Area Scaling ──────────────────────────────────────────────────────── */
#game-screen { justify-content: flex-start; overflow: hidden; }
#game-area-wrapper {
  display: flex; justify-content: center; width: 100%;
  overflow: visible;
}

/* ── Mobile HUD ───────────────────────────────────────────────────────────── */
#mobile-hud {
  display: none; /* shown via mobile media query */
  width: 100%;
  padding: 4px 8px;
  gap: 2px;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #0a0a2a, #050510);
  border-bottom: 1px solid #1a2244;
  flex-shrink: 0;
}
.mhud-item {
  display: flex; flex-direction: column; align-items: center;
  min-width: 0;
}
.mhud-label {
  font-size: 7px; color: #336688; letter-spacing: 2px; line-height: 1;
}
.mhud-val {
  font-size: 12px; color: #00ffcc; font-weight: 900; letter-spacing: 1px;
  white-space: nowrap;
}
.mhud-chain { color: #ff8833; }
.mhud-enemy { color: #ff4444; font-size: 10px; }
.mhud-garb { color: #cccccc; }
.mhud-lives { display: flex; gap: 2px; }
.mhud-lives .life-dot { width: 8px; height: 8px; }
.mhud-next-wrap canvas { display: block; }
#m-next { width: 40px; height: 36px; }

/* ── Touch Controls ────────────────────────────────────────────────────────── */
#touch-controls {
  display: none;
  width: 100%;
  padding: 6px 10px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  background: linear-gradient(0deg, #080818, #050510);
  border-top: 1px solid #1a2244;
}
.touch-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
}
.touch-dpad {
  display: flex; align-items: center; gap: 6px;
}
.touch-dpad-col {
  display: flex; flex-direction: column; gap: 6px;
}
.touch-actions {
  display: flex; align-items: center; gap: 8px;
}
.touch-btn {
  background: linear-gradient(145deg, #0d1a2a, #060f1a);
  border: 2px solid #1a3355;
  border-radius: 12px;
  color: #00ccff;
  font-size: 24px;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  transition: background 0.08s, border-color 0.08s;
}
.touch-btn:active {
  background: linear-gradient(145deg, #1a3355, #0d2244);
  border-color: #4488ff;
  box-shadow: 0 0 15px #0055ff44;
}
.tc-sublabel {
  font-size: 8px; letter-spacing: 2px; margin-top: -2px; opacity: 0.6;
}

/* D-pad arrows */
.tc-dir {
  width: 56px; height: 52px;
  font-size: 26px;
}
.tc-dir.tc-sm { height: 40px; font-size: 22px; }

/* Drop button */
.tc-drop {
  width: 56px; height: 40px;
  font-size: 11px; letter-spacing: 3px;
  color: #ff8833; border-color: #553311;
}
.tc-drop:active { border-color: #ff8833; box-shadow: 0 0 15px #ff883344; }

/* Rotate buttons */
.tc-rotate {
  width: 64px; height: 64px;
  font-size: 28px;
  color: #00ffcc; border-color: #115533;
}
.tc-rotate:active { border-color: #00ffcc; box-shadow: 0 0 15px #00ffcc44; }

/* Pause */
.tc-pause-btn {
  width: 38px; height: 38px;
  font-size: 12px; letter-spacing: 2px;
  color: #5577aa; border-color: #223355;
}
.tc-pause-btn:active { border-color: #5577aa; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .side-panel { width: 110px; }
  #center-panel { width: 120px; }
  .pbox { padding: 7px 9px; }
  .game-logo { font-size: 28px; }
  #game-area { gap: 8px; }
}

/* ── MOBILE APP LAYOUT ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Game screen: full-screen vertical app layout */
  #game-screen {
    padding-top: 0;
    justify-content: flex-start;
  }
  #title-bar { display: none; }
  #mobile-hud { display: flex !important; }

  /* Hide side panels and center panel — info is in mobile HUD */
  .side-panel { display: none !important; }
  #center-panel { display: none !important; }

  /* Game area: just the two boards side by side */
  #game-area {
    gap: 6px;
    justify-content: center;
    align-items: flex-start;
  }
  #game-area-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    min-height: 0;
  }

  /* Board labels */
  .board-label { font-size: 9px; letter-spacing: 2px; margin-bottom: 2px; }
  .garb-row { min-height: 14px; height: 14px; }
  .gi { width: 9px; height: 9px; }
  .bwrap { padding: 3px; border-radius: 8px; }

  /* ─── Menu screens: app-like full-screen feel ───── */
  .screen {
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top);
  }
  .screen-content {
    padding: 20px 16px;
    gap: 14px;
    justify-content: center;
    flex: 1;
    max-width: 100%;
  }

  /* Logo & subtitle */
  .game-logo {
    font-size: 32px; letter-spacing: 6px;
    text-shadow: 0 0 20px #ff4444, 0 0 40px #ff444466;
  }
  .game-subtitle { font-size: 10px; letter-spacing: 3px; margin-bottom: 10px; }

  /* Buttons: full-width, tall, easy to tap */
  .menu-btn {
    width: 100%; max-width: 320px;
    padding: 16px 24px;
    font-size: 15px;
    letter-spacing: 3px;
    border-radius: 10px;
  }

  /* Back button */
  .back-btn {
    position: relative; top: auto; left: auto;
    align-self: flex-start;
    margin-bottom: 4px;
    padding: 10px 16px;
    font-size: 12px;
  }

  /* User bar */
  #user-bar {
    position: relative; top: auto; right: auto;
    justify-content: center;
    width: 100%;
    padding: 8px 0;
    gap: 8px;
    flex-wrap: wrap;
  }
  #user-bar-name { font-size: 12px; }
  .user-bar-btn { padding: 6px 12px; font-size: 11px; }

  /* Auth / Login */
  #auth-login-form { max-width: 100%; width: 100%; padding: 0 10px; }
  .lobby-input {
    width: 100% !important; max-width: 320px;
    font-size: 16px !important;
    padding: 14px 16px;
  }
  .lobby-label { font-size: 11px; }

  /* Quick join */
  #qj-guest-form { max-width: 100% !important; }

  /* Lobby */
  #lobby-buttons { flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
  #lobby-buttons .menu-btn { width: 100%; }
  .room-code { font-size: 32px; padding: 14px 24px; letter-spacing: 8px; }
  .lobby-status { font-size: 12px; }
  #share-link-box { flex-direction: column; gap: 6px; }
  #share-link { width: 100% !important; font-size: 9px !important; }

  /* Character select */
  .enemy-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
  }
  .enemy-card { padding: 8px; gap: 4px; }
  .enemy-card canvas { width: 48px; height: 48px; }
  .enemy-card-name { font-size: 9px; letter-spacing: 1px; }
  .enemy-card-desc { display: none; }

  /* Pre-battle */
  .prebattle-name { font-size: 24px; }
  .prebattle-desc { font-size: 13px; }
  .prebattle-round { font-size: 11px; }

  /* Scores */
  .scores-tabs { gap: 3px; flex-wrap: wrap; justify-content: center; }
  .scores-tab { font-size: 10px; padding: 8px 12px; letter-spacing: 1px; }
  .scores-period-tabs { gap: 4px; }
  .period-tab { font-size: 10px; padding: 6px 14px; }
  .scores-table th { font-size: 8px; padding: 6px 4px; }
  .scores-table td { font-size: 11px; padding: 5px 4px; }
  #scores-container { max-height: 45vh; }

  /* How to play */
  .rules-box {
    max-width: 100%; font-size: 13px; padding: 16px;
    max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .rules-box h3 { font-size: 14px; }
  .rules-box kbd { font-size: 12px; }

  /* Account screen */
  #account-screen .screen-content { max-height: none; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #account-screen .pbox { width: 100% !important; max-width: 320px; }

  /* Overlay */
  .game-overlay { padding: 20px; }
  #ov-portrait { width: 100px; height: 100px; }
  #ov-title { font-size: 22px !important; }
  #ov-sub { font-size: 12px !important; }

  /* Upgrade box */
  .upgrade-box { max-width: 100%; }
}

/* Large desktop: scale up menus so they don't look tiny */
@media (min-width: 1200px) {
  .game-logo {
    font-size: 64px; letter-spacing: 12px;
    text-shadow: 0 0 30px #ff4444, 0 0 60px #ff444466, 0 0 100px #ff444433;
    margin-bottom: 16px;
  }
  .game-subtitle { font-size: 15px; letter-spacing: 6px; margin-bottom: 28px; }
  .menu-btn {
    padding: 18px 50px; font-size: 18px; letter-spacing: 4px;
    width: 360px; border-radius: 10px;
  }
  .screen-content { gap: 20px; max-width: 1000px; }
  .back-btn { font-size: 14px; padding: 10px 20px; top: 24px; left: 24px; }
  #user-bar { top: 16px; right: 20px; gap: 10px; }
  #user-bar-name { font-size: 14px; }
  .user-bar-btn { font-size: 12px; padding: 6px 14px; }
  .tier-badge { font-size: 11px; padding: 4px 10px; }
  .lobby-input { font-size: 20px; padding: 14px 20px; width: 320px; }
  .lobby-label { font-size: 12px; }
  .lobby-status { font-size: 14px; }
  .room-code { font-size: 44px; padding: 20px 40px; letter-spacing: 10px; }

  /* Character select */
  .enemy-grid { max-width: 900px; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .enemy-card { padding: 14px; gap: 8px; }
  .enemy-card-name { font-size: 13px; }
  .enemy-card-desc { font-size: 10px; }
  .diff-pips { gap: 3px; }
  .diff-pip { width: 10px; height: 10px; }

  /* Pre-battle */
  .prebattle-name { font-size: 36px; }
  .prebattle-desc { font-size: 16px; max-width: 500px; }
  .prebattle-round { font-size: 14px; }

  /* Scores */
  .scores-tabs { gap: 6px; }
  .scores-tab { font-size: 13px; padding: 10px 24px; letter-spacing: 2px; }
  .period-tab { font-size: 12px; padding: 8px 18px; }
  .scores-table th { font-size: 11px; padding: 10px; }
  .scores-table td { font-size: 14px; padding: 8px 10px; }
  #scores-container { max-width: 700px; }

  /* How to play */
  .rules-box { max-width: 600px; font-size: 14px; padding: 28px; }
  .rules-box h3 { font-size: 16px; }
  .rules-box kbd { font-size: 13px; padding: 2px 8px; }

  /* Auth */
  #auth-login-form { max-width: 380px; gap: 8px; }

  /* Account */
  .pbox .plabel { font-size: 10px; }
  .pbox .pval { font-size: 15px; }

  /* Game screen */
  #title-bar { font-size: 22px; letter-spacing: 8px; margin-bottom: 8px; }
}
