/**
 * style.css
 * Authoritative responsive fullscreen styling, dark theme, pixel-art rendering,
 * and game UI overlay components for "Skufato".
 */

:root {
  /* Theme Palette */
  --bg-dark: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-amber: #f59e0b;
  --accent-gold: #eab308;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;

  /* Viewport coordinates injected by Camera */
  --vp-x: 0px;
  --vp-y: 0px;
  --vp-w: 100vw;
  --vp-h: 100vh;
  --vp-scale: 1.0;
}

/* CSS Reset & Global Layout */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Root Game Container */
#game-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-dark);
  overflow: hidden;
}

/* Canvas 2D Surface */
canvas#game-canvas {
  display: block;
  touch-action: none;
  image-rendering: -webkit-crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* UI Overlay Layer */
#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Universal Screen Styles */
.ui-screen {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.ui-screen[hidden] {
  display: none !important;
}

.ui-screen.active:not([hidden]),
.ui-screen:not([hidden]) {
  display: flex;
}

/* Interactive elements inside overlay re-enable pointer events and fast tap */
.screen-content,
.modal-window,
.hud-pill,
.hp-bar-outer,
.game-btn,
.shop-card,
.archetype-card,
.garage-tab-btn,
.modal-close-btn,
.mode-btn {
  pointer-events: auto !important;
  touch-action: manipulation !important;
}

/* Prevent child spans, icons and text from capturing pointer clicks */
.game-btn *,
.archetype-card *,
.garage-tab-btn *,
.mode-btn *,
.modal-close-btn * {
  pointer-events: none;
}

/* -------------------------------------------------------------
   START SCREEN
------------------------------------------------------------- */
#start-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  z-index: 40;
  overflow-y: auto;
  padding: 16px;
}

.start-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: min(90vw, 600px);
  padding: 32px;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid var(--bg-surface-elevated);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  text-align: center;
}

.game-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #ea580c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.game-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 700;
  color: var(--accent-rose);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.preview-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.3);
  padding: 6px 14px;
  border-radius: 9999px;
}

.instructions-card {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.instructions-card h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.instructions-card kbd {
  background: #334155;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #475569;
  font-family: inherit;
  font-weight: 600;
}

.hint-text {
  margin-top: 6px;
  color: var(--accent-amber);
  font-size: 0.85rem;
  font-style: italic;
}

/* -------------------------------------------------------------
   BUTTON SYSTEM
------------------------------------------------------------- */
.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
  border-bottom: 4px solid rgba(0, 0, 0, 0.3);
}

.game-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.game-btn:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.game-btn:disabled {
  opacity: 0.5;
  filter: grayscale(0.8);
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-bottom-color: #92400e;
  box-shadow: 0 8px 20px -4px rgba(245, 158, 11, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  border-bottom-color: #047857;
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-bottom-color: #1d4ed8;
  box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.4);
}

/* -------------------------------------------------------------
   IN-GAME HUD
------------------------------------------------------------- */
.hud-screen {
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: min(100%, 1280px);
  margin: 0 auto;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: 9999px;
  padding: 8px 18px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hud-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.hud-value {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.hud-value.timer-frozen {
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.9), 0 0 20px rgba(251, 191, 36, 0.7);
  animation: pulse-frozen 0.75s infinite alternate ease-in-out;
}

@keyframes pulse-frozen {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.08); }
}

.pelmeni-pill .currency-icon {
  font-size: 1.2rem;
}

.pelmeni-pill .hud-value {
  color: var(--accent-gold);
}

.hud-pill.mute-btn {
  cursor: pointer;
  padding: 8px 14px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--bg-surface-elevated);
  transition: transform 0.15s ease, background-color 0.15s ease;
  user-select: none;
}

.hud-pill.mute-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  transform: scale(1.05);
}

.hud-pill.mute-btn:active {
  transform: scale(0.95);
}

.hud-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.btn-mute {
  min-width: 52px;
  padding: 12px 16px;
}

.hud-hp-container {
  display: flex;
  justify-content: center;
  width: 100%;
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
}

.hp-bar-outer {
  position: relative;
  width: min(90vw, 360px);
  height: 20px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid var(--bg-surface-elevated);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #10b981);
  transition: width 0.15s ease-out;
}

.hp-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.hud-xp-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  position: absolute;
  top: 98px;
  left: 0;
  right: 0;
  pointer-events: none;
}

.xp-level-badge {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.xp-bar-outer {
  position: relative;
  width: min(75vw, 300px);
  height: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #0369a1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 8px #38bdf8;
  transition: width 0.12s ease-out;
}

.xp-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.hud-weapons-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* -------------------------------------------------------------
   LEVEL-UP SELECTION MODAL (Vampire Survivors Style)
------------------------------------------------------------- */
.level-up-modal {
  z-index: 120 !important;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(12px);
  animation: levelUpFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes levelUpFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.level-up-window {
  width: min(94vw, 920px);
  max-height: min(92vh, 620px);
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 2px solid #38bdf8;
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.25), 0 20px 50px rgba(0, 0, 0, 0.8);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.level-up-header {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 2px solid rgba(56, 189, 248, 0.3);
  text-align: center;
}

.level-up-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.level-up-badge {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 3px 12px;
  border-radius: 12px;
  box-shadow: 0 0 12px #38bdf8;
}

.level-up-title-group .modal-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 1.5px;
  margin: 0;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.5);
}

.level-up-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.level-up-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  align-content: center;
}

.level-up-card {
  position: relative;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid #475569;
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  user-select: none;
}

.level-up-card:hover,
.level-up-card:focus {
  transform: translateY(-6px);
  border-color: #38bdf8;
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.35);
  background: rgba(51, 65, 85, 0.95);
  outline: none;
}

.level-up-card:active {
  transform: translateY(-2px);
}

.level-up-card.tier-1 { border-color: #94a3b8; }
.level-up-card.tier-2 { border-color: #38bdf8; }
.level-up-card.tier-3 { border-color: #a855f7; }
.level-up-card.tier-4 { border-color: #f59e0b; }
.level-up-card.tier-5 { border-color: #ef4444; }

.card-header-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-type-badge {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-evolution {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border: 1px solid #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.badge-upgrade {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid #0284c7;
}

.badge-new {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
  border: 1px solid #059669;
}

.badge-stat {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid #9333ea;
}

.card-shortcut {
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 6px;
  border-radius: 6px;
}

.level-up-card .card-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.level-up-card .card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 4px;
}

.level-up-card .card-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.level-up-card .card-desc {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.35;
  margin-bottom: 16px;
  flex: 1;
}

.btn-select-perk {
  width: 100%;
  padding: 8px 16px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1px;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.level-up-card:hover .btn-select-perk {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #0f172a;
  box-shadow: 0 0 12px #38bdf8;
}

/* -------------------------------------------------------------
   LEGENDARY BOSS CHEST MODAL
------------------------------------------------------------- */
.chest-window {
  width: min(94vw, 920px);
  max-height: min(92vh, 620px);
  background: linear-gradient(180deg, #2a1505, #0f172a);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 50px rgba(251, 191, 36, 0.4), 0 20px 60px rgba(0, 0, 0, 0.9);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chest-header {
  padding: 16px 24px;
  background: rgba(30, 20, 10, 0.9);
  border-bottom: 2px solid rgba(251, 191, 36, 0.4);
  text-align: center;
}

.chest-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chest-badge {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  color: #451a03;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 4px 14px;
  border-radius: 12px;
  box-shadow: 0 0 14px #fbbf24;
}

.chest-title-group .modal-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fffbeb;
  letter-spacing: 1.5px;
  margin: 0;
  text-shadow: 0 2px 12px rgba(251, 191, 36, 0.6);
}

.chest-subtitle {
  font-size: 0.85rem;
  color: #fde68a;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.chest-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  align-content: center;
}

.chest-card {
  position: relative;
  background: rgba(45, 25, 10, 0.85);
  border: 2px solid #b45309;
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.chest-card:hover {
  transform: translateY(-4px);
  border-color: #fbbf24;
  background: rgba(70, 35, 15, 0.95);
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.35);
}

.chest-card .chest-key-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(251, 191, 36, 0.2);
  color: #fde047;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.chest-card .card-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.7));
}

.chest-card .card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fffbeb;
  margin-bottom: 4px;
}

.chest-card .card-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.chest-card .card-desc {
  font-size: 0.85rem;
  color: #fef3c7;
  line-height: 1.35;
  margin-bottom: 16px;
  flex: 1;
}

.btn-select-chest-card {
  width: 100%;
  padding: 8px 16px;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.chest-card:hover .btn-select-chest-card {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  color: #451a03;
  box-shadow: 0 0 14px #fbbf24;
}

/* -------------------------------------------------------------
   MODAL OVERLAYS (Shop & Game Over)
------------------------------------------------------------- */
.modal-overlay {
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100 !important;
  padding: 16px;
}

.modal-window {
  display: flex;
  flex-direction: column;
  width: min(94vw, 1080px);
  max-height: min(92vh, 680px);
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid var(--bg-surface-elevated);
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 2px solid var(--bg-surface-elevated);
}

.modal-title {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 1px;
}

.modal-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.7);
  border-top: 2px solid var(--bg-surface-elevated);
  gap: 16px;
}

/* Shop Modal Window & Cards */
.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.recipe-book-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.15));
  border: 1px solid var(--accent-amber);
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.recipe-book-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.45), rgba(217, 119, 6, 0.35));
  border-color: #fde047;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}

.shop-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.shop-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
}

.shop-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 2px solid var(--bg-surface-elevated);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.shop-card:hover:not(.disabled):not(.purchased) {
  transform: translateY(-4px);
  border-color: var(--accent-amber);
  box-shadow: 0 12px 24px -6px rgba(245, 158, 11, 0.3);
}

.shop-card.purchased {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  cursor: default;
}

.shop-card.disabled {
  opacity: 0.5;
  filter: grayscale(0.7);
  cursor: not-allowed;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-icon {
  font-size: 2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  border-radius: 10px;
}

.card-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-new-weapon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
}

.badge-upgrade-weapon {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.badge-passive {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple);
  border: 1px solid var(--accent-purple);
}

.badge-snack {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald);
}

.badge-weapon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
}

.badge-upgrade {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.badge-evolution {
  background: linear-gradient(135deg, #facc15, #ca8a04);
  color: #000000;
  font-weight: 900;
  border: 1px solid #fef08a;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
  animation: pulse-glow 1.8s infinite alternate;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-main);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.card-flavor {
  font-size: 0.78rem;
  font-style: italic;
  color: #64748b;
  line-height: 1.3;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--bg-surface-elevated);
}

.card-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.card-cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-gold);
  color: #000000;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: 9999px;
}

/* Legendary Evolution Shop Card */
.shop-card.evolution-card {
  border: 2px solid #eab308;
  background: linear-gradient(145deg, rgba(30, 27, 75, 0.95), rgba(49, 46, 129, 0.9));
  box-shadow: 0 0 24px rgba(234, 179, 8, 0.35), inset 0 0 16px rgba(234, 179, 8, 0.15);
  animation: card-legendary-pulse 3s infinite ease-in-out;
}

.shop-card.evolution-card:hover:not(.purchased) {
  border-color: #fde047;
  box-shadow: 0 0 35px rgba(250, 204, 21, 0.65), inset 0 0 22px rgba(250, 204, 21, 0.25);
  transform: translateY(-5px) scale(1.02);
}

@keyframes card-legendary-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.3), inset 0 0 12px rgba(234, 179, 8, 0.1);
  }
  50% {
    box-shadow: 0 0 32px rgba(250, 204, 21, 0.55), inset 0 0 20px rgba(250, 204, 21, 0.25);
    border-color: #fde047;
  }
}

/* -------------------------------------------------------------
   RECIPE BOOK MODAL (Супер-эволюции)
------------------------------------------------------------- */
.recipe-window {
  max-width: min(94vw, 840px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.recipe-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recipe-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recipe-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 24px 0 24px;
  font-size: 0.88rem;
  color: #fef08a;
  line-height: 1.45;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.recipe-item {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.recipe-item:hover {
  border-color: var(--accent-amber);
  transform: translateY(-2px);
}

.recipe-item.ready {
  border: 2px solid #eab308;
  background: linear-gradient(145deg, rgba(30, 27, 75, 0.8), rgba(49, 46, 129, 0.7));
  box-shadow: 0 0 18px rgba(234, 179, 8, 0.35);
}

.recipe-item.crafted {
  border: 2px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.recipe-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-icon {
  font-size: 1.4rem;
}

.recipe-name {
  font-size: 1.05rem;
  color: var(--text-main);
  font-weight: 800;
}

.recipe-status {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  text-transform: uppercase;
}

.status-progress {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid #475569;
}

.status-ready {
  background: rgba(234, 179, 8, 0.25);
  color: #fde047;
  border: 1px solid #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
  animation: pulse-glow 1.5s infinite alternate;
}

.status-crafted {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid var(--accent-emerald);
}

.recipe-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.recipe-ingredients {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--bg-surface-elevated);
}

.ingredient-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  flex: 1;
}

.ingredient-badge.ready {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-emerald);
  color: #6ee7b7;
}

.ingredient-badge.owned {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-amber);
  color: var(--accent-gold);
}

.ingredient-badge.missing {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  color: #64748b;
}

.recipe-plus {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent-gold);
}

.recipe-footer {
  justify-content: flex-end;
}

/* -------------------------------------------------------------
   GAME OVER MODAL (Defeat & Victory)
------------------------------------------------------------- */
.game-over-window {
  max-width: min(94vw, 640px);
}

.game-over-header {
  flex-direction: column;
  text-align: center;
  gap: 6px;
}

.defeat-theme {
  border-color: #ef4444;
  box-shadow: 0 0 60px rgba(239, 68, 68, 0.3);
}

.defeat-theme .modal-title {
  color: var(--accent-rose);
}

.victory-theme {
  border-color: #eab308;
  box-shadow: 0 0 60px rgba(234, 179, 8, 0.4);
}

.victory-theme .modal-title {
  background: linear-gradient(135deg, #fef08a, #eab308, #ca8a04);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats-body {
  padding: 24px;
}

.stats-header {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: 10px;
}

.stat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.game-over-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.game-over-footer .game-btn {
  font-size: 0.85rem;
  padding: 10px 14px;
}

/* -------------------------------------------------------------
   TOUCH JOYSTICK ZONE
------------------------------------------------------------- */
.joystick-touch-zone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* -------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
------------------------------------------------------------- */
@media (max-width: 768px) {
  .hud-top-bar {
    padding: 0 4px;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .hud-pill {
    padding: 4px 8px;
    gap: 4px;
  }
  .hud-value {
    font-size: 0.85rem;
  }
  .hud-label {
    font-size: 0.65rem;
  }
  .hud-hp-container {
    top: 56px;
  }
  .hud-xp-container {
    top: 80px;
  }
  .modal-window {
    width: 96vw;
    max-height: calc(96vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .game-btn {
    width: 100%;
    min-height: 44px;
  }
  .shop-cards-container {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .level-up-cards-container {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chest-cards-container {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .btn-select-perk {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hud-label {
    display: none;
  }
  .hud-pill {
    padding: 3px 6px;
    gap: 3px;
  }
  .hud-value {
    font-size: 0.78rem;
  }
  .modal-title {
    font-size: 1.1rem;
  }
  .level-up-card {
    padding: 12px 10px;
  }
  .level-up-card .card-desc {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }
  .shop-card {
    padding: 12px 10px;
  }
}

/* -------------------------------------------------------------
   MODE BADGE: ENDLESS MODE (CANONIC)
------------------------------------------------------------- */
.mode-badge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #3b82f6;
  border-radius: 12px;
  padding: 10px 18px;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
  margin-bottom: 8px;
  max-width: 520px;
  width: 100%;
}

.mode-badge-icon {
  font-size: 1.8rem;
  color: #60a5fa;
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
}

.mode-badge-info {
  text-align: left;
}

.mode-badge-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: #93c5fd;
  letter-spacing: 0.5px;
}

.mode-badge-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------
   ARCHETYPE SELECTOR (5 ARCHETYPES)
------------------------------------------------------------- */
.archetype-section {
  width: 100%;
  max-width: 520px;
  margin-bottom: 14px;
}

.archetype-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.archetype-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.archetype-card {
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid #334155;
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.archetype-card:hover {
  border-color: #64748b;
  transform: translateY(-2px);
}

.archetype-card:active {
  transform: scale(0.95);
}

.archetype-card.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  transform: translateY(-2px);
}

.archetype-card.active::after {
  content: '✓';
  position: absolute;
  top: 3px;
  right: 3px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 0.65rem;
  font-weight: 900;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arch-icon {
  font-size: 1.4rem;
}

.arch-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  text-align: center;
}

.arch-weapon {
  font-size: 0.65rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.archetype-desc-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #e2e8f0;
  text-align: left;
  min-height: 62px;
}

.arch-desc-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.arch-desc-title {
  font-weight: 800;
  color: #fbbf24;
  font-size: 0.95rem;
}

.arch-desc-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.weapon-badge-icon {
  display: inline-block;
  font-size: 0.85em;
  margin-right: 2px;
}

.arch-desc-weapon-box {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
}

.weapon-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.weapon-box-name {
  font-weight: 800;
  color: #38bdf8;
  font-size: 0.88rem;
}

.weapon-box-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.weapon-box-stats {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a3e635;
  margin-bottom: 3px;
}

.weapon-box-desc {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.3;
}

.arch-desc-perk {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-top: 4px;
}

.perk-label {
  font-weight: 800;
  color: #fbbf24;
}

.start-actions-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
}

.btn-garage {
  position: relative;
}

.garage-badge {
  background: #f59e0b;
  color: #0f172a;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  margin-left: 6px;
}

/* -------------------------------------------------------------
   GARAGE MODAL
------------------------------------------------------------- */
.garage-window {
  max-width: 780px;
  width: min(94vw, 780px);
  max-height: min(90vh, 700px);
  display: flex;
  flex-direction: column;
}

.garage-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-size: 1.2rem;
  font-weight: 800;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.3);
  border-color: #f43f5e;
  transform: scale(1.08);
}

.garage-info-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  padding: 8px 18px;
  font-size: 0.8rem;
  color: #fde68a;
}

.garage-tabs-bar {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid #334155;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.garage-tabs-bar::-webkit-scrollbar {
  display: none;
}

.garage-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.garage-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.garage-tab-btn.active {
  background: #334155;
  color: #fbbf24;
  border-color: #64748b;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

.garage-nodes-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 18px;
  overflow-y: auto;
  max-height: 52vh;
  scrollbar-width: thin;
  scrollbar-color: #475569 transparent;
}

.garage-nodes-container::-webkit-scrollbar {
  width: 6px;
}

.garage-nodes-container::-webkit-scrollbar-track {
  background: transparent;
}

.garage-nodes-container::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 999px;
}

.garage-node-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.garage-node-card:hover {
  border-color: #475569;
}

.garage-node-card.maxed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.node-icon {
  font-size: 1.5rem;
}

.node-title-group {
  display: flex;
  flex-direction: column;
}

.node-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.node-level {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 700;
}

.node-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 12px;
  flex-grow: 1;
}

.node-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.node-cost {
  font-size: 0.85rem;
  font-weight: 800;
  color: #f59e0b;
}

.max-badge {
  color: #10b981;
  font-weight: 800;
  font-size: 0.8rem;
}

.btn-rewarded {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #ffffff;
  border: none;
  font-weight: 800;
}

.btn-rewarded:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.4);
}

/* -------------------------------------------------------------
   HUD EXPANSIONS: BIOME & SHABASHKA PILLS
------------------------------------------------------------- */
.biome-pill {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
}

.biome-pill .hud-value {
  color: #60a5fa;
  font-size: 0.95rem;
}

.shabashka-pill .hud-value {
  color: #38bdf8;
}

/* -------------------------------------------------------------
   MOBILE & PORTRAIT RESPONSIVE ENHANCEMENTS
------------------------------------------------------------- */
@media (max-width: 680px), (orientation: portrait) {
  .start-content {
    padding: 16px 12px;
    gap: 12px;
    max-height: 94vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: min(96vw, 540px);
  }

  .archetype-section {
    max-width: 100%;
  }

  .archetype-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .archetype-card:last-child {
    grid-column: span 2;
  }

  .archetype-card {
    padding: 8px 6px;
    min-height: 64px;
    justify-content: center;
  }

  .arch-icon {
    font-size: 1.5rem;
  }

  .arch-name {
    font-size: 0.82rem;
  }

  .arch-weapon {
    display: block !important;
    font-size: 0.72rem;
    color: #38bdf8;
    font-weight: 700;
  }

  .start-actions-row {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .start-actions-row .game-btn {
    width: 100%;
    min-height: 48px;
  }

  .recipe-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .recipe-ingredients {
    flex-direction: column;
    align-items: stretch;
  }

  .recipe-plus {
    text-align: center;
  }

  .shop-header-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
}

/* Specific body.portrait-mode dynamic layout rules */
body.portrait-mode #game-container {
  touch-action: none;
}

body.portrait-mode .hud-top-bar {
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

body.portrait-mode .hud-pill {
  padding: 4px 8px;
  gap: 4px;
}

body.portrait-mode .hud-label {
  display: none;
}

body.portrait-mode .hud-value {
  font-size: 0.85rem;
}

body.portrait-mode .hud-hp-container,
body.portrait-mode .hud-xp-container {
  width: 96%;
  max-width: 480px;
}

body.portrait-mode .hud-weapons-bar {
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

body.portrait-mode .level-up-window,
body.portrait-mode .chest-window {
  width: 95vw;
  max-height: 90vh;
}

body.portrait-mode .level-up-header,
body.portrait-mode .chest-header {
  padding: 10px 14px;
}

body.portrait-mode .level-up-title-group .modal-title {
  font-size: 1.4rem;
}

body.portrait-mode .level-up-subtitle {
  font-size: 0.78rem;
}

body.portrait-mode .level-up-cards-container,
body.portrait-mode .chest-cards-container {
  grid-template-columns: 1fr;
  align-content: start;
  padding: 12px 10px;
  gap: 12px;
  max-height: 72vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.portrait-mode .level-up-card {
  padding: 12px 14px;
}

body.portrait-mode .btn-select-perk {
  min-height: 48px;
}
