/* ============================================================
   STYLE.CSS — Kartoffel Chaos — PREMIUM DARK UI — MOBILE FIRST
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-dark: #0f0e17;
  --bg-panel: rgba(15, 14, 23, 0.9);
  --bg-glass: rgba(30, 28, 50, 0.8);
  --bg-glass-hover: rgba(45, 42, 70, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(167, 139, 250, 0.3);
  --text: #e8e6f0;
  --text-dim: #8a88a0;
  --accent: #7b5ea7;
  --accent-bright: #a78bfa;
  --gold: #ffd700;
  --cyan: #66ffee;
  --red: #ff4466;
  --green: #44dd66;
  --blue: #4488ff;
  --purple: #bb55ee;
  --orange: #ff8800;
  --rarity-common: #b0b0b0;
  --rarity-uncommon: #44cc66;
  --rarity-rare: #4488ff;
  --rarity-epic: #bb55ee;
  --rarity-legendary: #ff8800;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(123, 94, 167, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  cursor: crosshair;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* --- Screens --- */
.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  z-index: 10;
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; align-items: center; justify-content: center; pointer-events: auto; }
#screen-game.active { pointer-events: none; }

/* --- Buttons — Premium --- */
.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  padding: 16px 40px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  position: relative;
  overflow: hidden;
  min-height: 48px; /* Touch target */
  -webkit-tap-highlight-color: transparent;
}
.btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  transition: width 0.4s, height 0.4s, top 0.4s, left 0.4s;
}
.btn:active::after {
  width: 200%; height: 200%;
  top: -50%; left: -50%;
}
.btn-primary {
  background: linear-gradient(135deg, #7b5ea7, #a78bfa);
  color: #fff;
  box-shadow: 0 4px 20px rgba(123, 94, 167, 0.4);
}
.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(123, 94, 167, 0.3);
}
.btn-secondary {
  background: var(--bg-glass);
  color: var(--text);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
}
.btn-secondary:active {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  transform: scale(0.96);
}
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================================================
   MAIN MENU — Premium
   ================================================================ */
.menu-container {
  text-align: center;
  animation: fadeInUp 0.6s ease;
  padding: 20px;
}
.menu-potato-img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  animation: menuPotatoFloat 3s ease-in-out infinite, spin-in 0.8s ease;
  filter: drop-shadow(0 0 35px rgba(232, 184, 75, 0.6));
  margin-bottom: 10px;
}
.inline-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  vertical-align: middle;
  margin-right: 4px;
  object-fit: contain;
}
.inline-icon-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  vertical-align: middle;
  object-fit: contain;
}
.menu-title {
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  margin: 16px 0;
  color: #fff;
  text-shadow: 0 0 50px rgba(167, 139, 250, 0.5), 0 4px 8px rgba(0,0,0,0.5);
  letter-spacing: -1px;
}
.menu-title-accent {
  background: linear-gradient(135deg, #ff8800, #ff4466, #bb55ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.menu-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 28px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.menu-controls {
  margin-top: 36px;
  padding: 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}
.menu-controls h3 {
  font-size: 13px;
  color: var(--accent-bright);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.control-row {
  font-size: 13px;
  color: var(--text-dim);
  margin: 8px 0;
  line-height: 1.5;
}
.key {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
  margin-right: 6px;
  letter-spacing: 1px;
}
.touch-hint {
  display: none;
  color: var(--accent-bright);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  padding: 8px;
  background: rgba(167, 139, 250, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.2);
}

/* ================================================================
   SHOP — Premium Mobile
   ================================================================ */
.shop-container {
  width: 94%;
  max-width: 900px;
  animation: fadeInUp 0.3s ease;
  padding: 10px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.shop-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.shop-header h2 {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.shop-wave-info {
  font-size: 13px;
  color: var(--text-dim);
}
.shop-gold-display {
  margin-left: auto;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 6px;
}
.shop-gold-display img {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  object-fit: contain;
}
.shop-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.shop-card {
  background: var(--bg-glass);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  animation: cardSlideIn 0.3s ease backwards;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
.shop-card:nth-child(1) { animation-delay: 0.05s; }
.shop-card:nth-child(2) { animation-delay: 0.1s; }
.shop-card:nth-child(3) { animation-delay: 0.15s; }
.shop-card:nth-child(4) { animation-delay: 0.2s; }

.shop-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.6;
}
.shop-card:active {
  transform: scale(0.95);
}
.shop-card.sold {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}
.shop-card.too-expensive {
  opacity: 0.4;
}
.shop-card.locked {
  border-color: var(--gold) !important;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
}
.shop-card-sold {
  text-align: center;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 14px;
  padding: 30px 0;
}
.shop-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.shop-card-icon { font-size: 28px; }
.shop-card-icon-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.2));
}
.shop-card-rarity {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.shop-card-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 3px;
}
.shop-card-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
  flex-grow: 1;
}
.shop-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}
.shop-card-cost {
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
}
.shop-lock-btn {
  background: none;
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.5;
  transition: all 0.2s;
  min-height: 36px;
  min-width: 36px;
}
.shop-lock-btn:active { opacity: 1; }
.shop-lock-btn.active {
  opacity: 1;
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
}
.shop-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
}
.shop-sidebar {
  display: flex;
  gap: 12px;
}
.shop-info-panel {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  backdrop-filter: blur(10px);
}
.shop-info-panel h3 {
  font-size: 12px;
  color: var(--accent-bright);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.shop-weapon-slot {
  font-size: 13px;
  padding: 4px 0;
  display: flex;
  gap: 6px;
  align-items: center;
}
.shop-stat-row {
  font-size: 12px;
  padding: 2px 0;
  color: var(--text-dim);
}
.shop-stat-row strong { color: var(--text); }

/* Rarity glow effects */
.shop-card.rarity-uncommon { border-color: var(--rarity-uncommon); color: var(--rarity-uncommon); }
.shop-card.rarity-rare { border-color: var(--rarity-rare); color: var(--rarity-rare); }
.shop-card.rarity-epic { border-color: var(--rarity-epic); color: var(--rarity-epic); }
.shop-card.rarity-legendary {
  border-color: var(--rarity-legendary);
  color: var(--rarity-legendary);
  box-shadow: 0 0 25px rgba(255, 136, 0, 0.2);
  animation: legendaryPulse 2s ease-in-out infinite !important;
}

/* ================================================================
   LEVEL UP — Mobile Touch
   ================================================================ */
.levelup-container {
  text-align: center;
  animation: fadeInUp 0.3s ease;
  padding: 20px;
}
.levelup-title {
  font-size: 44px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 35px rgba(255, 215, 0, 0.5);
  margin-bottom: 8px;
}
.levelup-subtitle {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 24px;
}
.levelup-choices {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.levelup-card {
  background: var(--bg-glass);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 24px 20px;
  min-width: 140px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(12px);
  animation: cardSlideIn 0.3s ease backwards;
  -webkit-tap-highlight-color: transparent;
}
.levelup-card:nth-child(1) { animation-delay: 0.05s; }
.levelup-card:nth-child(2) { animation-delay: 0.1s; }
.levelup-card:nth-child(3) { animation-delay: 0.15s; }
.levelup-card:active {
  transform: scale(0.94);
  border-color: var(--gold);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.15);
}
.levelup-icon {
  font-size: 38px;
  margin-bottom: 10px;
}
.levelup-label {
  font-weight: 700;
  font-size: 14px;
}

/* ================================================================
   GAME OVER / VICTORY — Premium
   ================================================================ */
.endscreen-container {
  text-align: center;
  animation: fadeInUp 0.5s ease;
  padding: 20px;
}
.endscreen-title {
  font-size: 58px;
  font-weight: 900;
  margin-bottom: 10px;
}
.gameover-text {
  color: var(--red);
  text-shadow: 0 0 50px rgba(255, 68, 102, 0.5);
}
.victory-text {
  color: var(--gold);
  text-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
}
.endscreen-subtitle {
  color: var(--text-dim);
  font-size: 18px;
  margin-bottom: 24px;
}
.endscreen-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 24px 0;
  flex-wrap: wrap;
}
.endscreen-stat {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  backdrop-filter: blur(10px);
  min-width: 100px;
}
.endscreen-stat span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.endscreen-stat strong {
  font-size: 26px;
  font-weight: 800;
}

/* ================================================================
   WAVE ANNOUNCEMENT — Premium
   ================================================================ */
.wave-announce {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-family: var(--font);
  font-size: 52px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 50px rgba(167, 139, 250, 0.7), 0 6px 12px rgba(0,0,0,0.5);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
  letter-spacing: 4px;
}
.wave-announce.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: waveAnnounce 2.2s ease forwards;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes menuPotatoFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}
@keyframes spin-in {
  from { transform: rotate(-25deg) scale(0.5); opacity: 0; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(15px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 136, 0, 0.15); }
  50% { box-shadow: 0 0 30px rgba(255, 136, 0, 0.35); }
}
@keyframes waveAnnounce {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  20% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-25px); }
}

/* ================================================================
   LOADING SCREEN
   ================================================================ */
.loading-container {
  text-align: center;
  animation: fadeInUp 0.4s ease;
}
.loading-potato {
  font-size: 64px;
  animation: menuPotatoFloat 2s ease-in-out infinite;
  margin-bottom: 16px;
}
.loading-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.loading-bar-bg {
  width: 250px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright), var(--gold));
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* ================================================================
   SKIN SELECTION — Mobile Touch
   ================================================================ */
.skins-container {
  text-align: center;
  animation: fadeInUp 0.4s ease;
  max-width: 700px;
  width: 94%;
  padding: 20px;
}
.skins-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}
.skin-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.skin-card {
  background: var(--bg-glass);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 14px 8px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(12px);
  animation: cardSlideIn 0.3s ease backwards;
  -webkit-tap-highlight-color: transparent;
}
.skin-card:nth-child(1) { animation-delay: 0.05s; }
.skin-card:nth-child(2) { animation-delay: 0.1s; }
.skin-card:nth-child(3) { animation-delay: 0.15s; }
.skin-card:nth-child(4) { animation-delay: 0.2s; }
.skin-card:nth-child(5) { animation-delay: 0.25s; }
.skin-card:active {
  transform: scale(0.94);
}
.skin-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.25), 0 8px 30px rgba(0,0,0,0.3);
  background: rgba(255, 215, 0, 0.05);
}
.skin-card-img-wrap {
  width: 70px;
  height: 70px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skin-card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(232, 184, 75, 0.4));
  transition: transform 0.2s ease;
}
.skin-card:active .skin-card-img {
  transform: scale(1.1);
}
.skin-card.selected .skin-card-img {
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.5));
}
.skin-card-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}
.skin-card-desc {
  font-size: 10px;
  color: var(--text-dim);
}
.skins-container .btn {
  margin: 0 6px;
}

/* ================================================================
   PAUSE BUTTON & OVERLAY
   ================================================================ */
.pause-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(15, 14, 23, 0.75);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, background 0.15s ease;
  padding: 0;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.pause-btn:active {
  transform: scale(0.88);
  background: rgba(167, 139, 250, 0.4);
}
.pause-btn.visible {
  display: inline-flex;
}

.pause-overlay {
  background: rgba(10, 9, 20, 0.85);
  backdrop-filter: blur(12px);
  z-index: 60 !important;
}

.pause-container {
  text-align: center;
  animation: fadeInUp 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.pause-title {
  font-size: 52px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(167, 139, 250, 0.5);
  margin-bottom: 8px;
}

/* Show pause button when game is active */
#screen-game.active .pause-btn {
  display: flex;
}

@media (max-width: 768px) {
  .pause-btn {
    top: 10px;
    left: 10px;
    width: 56px;
    height: 56px;
    font-size: 26px;
    border-radius: 16px;
  }
}

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ================================================================
   FULL RESPONSIVE — Mobile First
   ================================================================ */
@media (max-width: 768px) {
  .menu-title { font-size: 2.4rem !important; letter-spacing: -0.5px; }
  .menu-potato-img { width: 100px; height: 100px; }

  .shop-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px !important;
  }
  .shop-sidebar { flex-direction: column; }
  .shop-container { padding: 8px; }

  .levelup-choices {
    flex-direction: column;
    align-items: center;
    gap: 10px !important;
  }
  .levelup-card { min-width: 200px; }

  .endscreen-stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .skin-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }

  .btn {
    font-size: 14px;
    padding: 14px 32px;
    min-height: 48px;
  }

  .wave-announce { font-size: 36px; }
}

@media (max-width: 400px) {
  .menu-title { font-size: 2rem !important; }
  .skin-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-items { grid-template-columns: repeat(2, 1fr); gap: 8px !important; }
  .shop-card { padding: 12px; min-height: 100px; }
  .shop-card-name { font-size: 13px; }
  .shop-card-desc { font-size: 10px; }
}