/* ==========================================================================
   BUY ME A COFFEE - The Artisan Block Breaker
   Design System & Styling
   ========================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-cafe: #150f0b;
  --gold-primary: #f59e0b;
  --gold-hover: #fbbf24;
  --gold-dark: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.4);
  --wood-dark: #20140e;
  --wood-light: #3d261b;
  --cream: #fef3c7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-bg: rgba(21, 15, 11, 0.88);
  --glass-border: rgba(245, 158, 11, 0.25);
  --glass-blur: 16px;
  --accent-cyan: #38bdf8;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(245, 158, 11, 0.08), transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(56, 189, 248, 0.05), transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(217, 119, 6, 0.06), transparent 40%);
  color: var(--text-main);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Top Brand Navigation
   ========================================================================== */
.top-nav {
  position: relative;
  width: 100%;
  max-width: 900px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--gold-primary);
  text-decoration: none;
  letter-spacing: 1px;
  transition: opacity 0.2s;
}

.brand-link:hover {
  opacity: 0.85;
}

.brand-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
}

.nav-divider {
  color: #475569;
  font-size: 0.9rem;
}

.nav-sublink {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.nav-sublink:hover {
  color: #fff;
}

.game-badge {
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.8px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Main Game Outer Wrapper
   ========================================================================== */
.main-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 540px;
  background: #120d09;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 
    0 12px 45px rgba(0, 0, 0, 0.7),
    0 0 30px rgba(245, 158, 11, 0.15),
    inset 0 0 0 1px rgba(245, 158, 11, 0.3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HUD Header
   ========================================================================== */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(32, 20, 14, 0.95) 0%, rgba(18, 13, 9, 0.9) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  font-family: 'Outfit', sans-serif;
  z-index: 20;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

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

.score-num {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  color: var(--gold-primary);
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.lives-cups {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 1rem;
}

.cup-icon {
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.6));
  transition: transform 0.2s, opacity 0.2s;
}

.cup-icon.lost {
  opacity: 0.2;
  filter: grayscale(1);
  transform: scale(0.85);
}

.stage-tag {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.2) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

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

/* ==========================================================================
   Active Power-Up Badges Bar
   ========================================================================== */
.powerup-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 8px;
  min-height: 24px;
  background: rgba(10, 8, 6, 0.6);
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 15;
}

.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fff;
  animation: pulseBadge 1.5s ease-in-out infinite;
}

.p-badge.fire {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.p-badge.laser {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
}

.p-badge.shield {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ==========================================================================
   Main Canvas
   ========================================================================== */
#gameCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 540 / 800;
  background: #140d08;
  cursor: crosshair;
}

/* ==========================================================================
   Mobile Touch Controller Drag Square
   ========================================================================== */
.touch-controller {
  display: block;
  width: 100%;
  height: 72px;
  background: linear-gradient(180deg, #1c120b 0%, #100804 100%);
  border-top: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  flex-shrink: 0;
}

.touch-track {
  position: relative;
  width: calc(100% - 24px);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Grooved guide track */
.touch-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 8px;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9);
}

.touch-guide-labels {
  position: absolute;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
  z-index: 2;
}

.touch-instruction {
  font-family: 'Outfit', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: rgba(245, 158, 11, 0.65);
  text-transform: uppercase;
}

.touch-arrow {
  color: var(--gold-primary);
  font-size: 0.85rem;
  opacity: 0.75;
  animation: arrowPulse 1.5s ease-in-out infinite alternate;
}

@keyframes arrowPulse {
  0% { opacity: 0.4; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.08); }
}

/* Draggable Touch Handle (matches the barista tray) */
.touch-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76px;
  height: 44px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #5a3825 0%, #2c170d 100%);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  box-shadow: 
    0 4px 14px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 5;
  pointer-events: none;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
}

.touch-controller:active .touch-handle,
.touch-controller.active .touch-handle {
  border-color: #fbbf24;
  box-shadow: 
    0 6px 18px rgba(0, 0, 0, 0.95),
    0 0 25px rgba(245, 158, 11, 0.7);
  transform: translate(-50%, -50%) scale(1.06);
}

.handle-icon {
  font-size: 1.15rem;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.handle-grip {
  width: 14px;
  height: 16px;
  background: repeating-linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.75) 0px,
    rgba(245, 158, 11, 0.75) 2px,
    transparent 2px,
    transparent 4px
  );
  border-radius: 2px;
}

/* ==========================================================================
   Overlays (Start Screen, Game Over Screen)
   ========================================================================== */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 14px 32px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.overlay.active {
  display: flex;
  opacity: 1;
}

.overlay-card {
  width: 100%;
  max-width: 440px;
  background: rgba(28, 18, 13, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.15);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin: auto 0;
  flex-shrink: 0;
  touch-action: pan-y;
}

/* Custom sleek scrollbar for overlays */
.overlay::-webkit-scrollbar {
  width: 6px;
}

.overlay::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}

.overlay::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.45);
  border-radius: 3px;
}

.overlay::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.75);
}

@keyframes slideUp {
  0% { transform: translateY(20px) scale(0.96); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Auth status bar in start popup */
.auth-bar-start {
  margin-bottom: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.auth-prompt-label {
  font-size: 11px;
  color: #fde68a;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

.skibidi-logged-out {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.skibidi-google-btn {
  display: flex;
  justify-content: center;
  min-height: 40px;
  width: 100%;
}

.skibidi-logged-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.skibidi-user-pill {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.6);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: #fef08a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
}

.skibidi-logout-btn {
  background: #451a03;
  border: 1px solid #78350f;
  color: #cbd5e1;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Outfit', sans-serif;
}

.skibidi-logout-btn:hover {
  background: #78350f;
  color: #fff;
}

.logo-box {
  margin-bottom: 16px;
}

.steam-cup-logo {
  font-size: 3.2rem;
  margin-bottom: 4px;
  animation: cupBob 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(245, 158, 11, 0.4));
}

@keyframes cupBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.game-main-title {
  font-family: 'Cinzel', serif;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.game-tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.instructions-panel {
  width: 100%;
  background: rgba(14, 10, 7, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.instr-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #cbd5e1;
}

.instr-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.highscore-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.72rem;
  color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 18px;
}

.overlay-btn-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.play-action-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 50px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transition: all 0.25s ease;
}

.play-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.6);
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}

.play-action-btn:active {
  transform: translateY(0) scale(0.98);
}

.secondary-lb-btn {
  width: 100%;
  padding: 11px 18px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--gold-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-lb-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  color: #fff;
}

/* Game Over Breakdown */
.game-over-icon {
  font-size: 3rem;
  margin-bottom: 6px;
}

.game-over-title {
  font-family: 'Cinzel', serif;
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--accent-red);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.game-over-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.score-breakdown {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.breakdown-item {
  background: rgba(14, 10, 7, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bd-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.bd-val {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  color: #fff;
}

.bd-val.highlight {
  color: var(--gold-primary);
}

.new-record-banner {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #000;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  animation: pulseBadge 1s infinite alternate;
}

/* ==========================================================================
   Ko-fi Footer (Unified standard across all Skibidi pages)
   ========================================================================== */
.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px 20px 20px;
  z-index: 10;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.kofi-footer-container {
  margin-bottom: 4px;
}

.kofi-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000000 !important;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 9px 22px;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.kofi-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6);
  filter: brightness(1.05);
}

.kofi-icon {
  font-size: 1.15rem;
  display: inline-block;
  animation: kofi-wiggle 3.5s ease-in-out infinite;
  transform-origin: bottom center;
}

@keyframes kofi-wiggle {
  0%, 82%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-12deg); }
  90% { transform: rotate(10deg); }
  94% { transform: rotate(-6deg); }
  97% { transform: rotate(4deg); }
}

.footer-legal {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  font-size: 0.76rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #fff;
}

/* Responsive compacting for short viewports and mobile screens */
@media (max-height: 720px), (max-width: 480px) {
  .overlay {
    padding: 12px 10px 24px;
  }
  .overlay-card {
    padding: 18px 16px;
    border-radius: 16px;
  }
  .steam-cup-logo {
    font-size: 2.2rem;
    margin-bottom: 2px;
  }
  .steam-cup-logo img {
    width: 52px !important;
    height: 52px !important;
  }
  .logo-box {
    margin-bottom: 10px;
  }
  .game-main-title {
    font-size: 1.6rem;
  }
  .game-tagline {
    font-size: 0.78rem;
  }
  .instructions-panel {
    padding: 10px 12px;
    gap: 7px;
    margin-bottom: 10px;
  }
  .instr-row {
    font-size: 0.78rem;
    gap: 8px;
  }
  .instr-icon {
    font-size: 1rem;
  }
  .highscore-badge {
    margin-bottom: 12px;
    padding: 6px 12px;
    font-size: 0.68rem;
  }
  .play-action-btn {
    padding: 12px 18px;
    font-size: 1rem;
  }
  .secondary-lb-btn {
    padding: 9px 16px;
    font-size: 0.88rem;
  }
}

/* Mobile Complete On-Screen Fitting (Entire Game + Drag Square Visible Without Scrolling) */
@media (max-width: 768px) {
  body {
    padding-top: 46px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .main-wrapper {
    padding: 2px 4px 4px;
    height: calc(100dvh - 48px);
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  #game-container {
    height: 100%;
    max-height: 100%;
    width: auto;
    max-width: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }

  #hud {
    width: 100%;
    flex-shrink: 0;
    padding: 6px 10px;
  }

  .powerup-bar {
    width: 100%;
    flex-shrink: 0;
    padding: 2px 6px;
    min-height: 20px;
  }

  #gameCanvas {
    flex: 1 1 auto;
    min-height: 0;
    width: auto;
    max-width: 100%;
    max-height: calc(100% - 44px - 72px);
    aspect-ratio: 540 / 800;
    object-fit: contain;
  }

  .touch-controller {
    width: 100%;
    height: 68px;
    flex-shrink: 0;
  }

  .site-footer {
    display: none;
  }
}

