/* ==========================================================
   SUPABANGBANG - Landscape-First Mobile & Arcade Styles
   ========================================================== */

:root {
  --action-orange: #ff5500;
  --action-fire: #ff3d00;
  --action-crimson: #ff1744;
  --action-lime: #00e676;
  --action-amber: #ffd600;
  --action-gold: #ffab00;
  --bg-dark: #08090d;
  --panel-bg: #11131a;
  --panel-border: #2c1e18;
  --text-main: #f4f4f5;
  --font-arcade: 'Press Start 2P', monospace, sans-serif;
  --font-ui: 'Rajdhani', sans-serif;

  --header-height: 44px;
  --footer-height: 36px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-ui);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: manipulation;
}

/* Background ambient glow - Fiery action theme */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 12%, rgba(255, 85, 0, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(0, 230, 118, 0.08) 0%, transparent 50%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0px, rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 4px);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================
   ROTATE DEVICE MODAL (Forces Landscape on Mobile / Tablet)
   ========================================================== */
.rotate-device-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(7, 9, 14, 0.96);
  backdrop-filter: blur(12px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.rotate-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  background: #151019;
  border: 2px solid var(--action-orange);
  border-radius: 16px;
  padding: 30px 24px;
  box-shadow: 0 0 40px rgba(255, 85, 0, 0.4), inset 0 0 20px rgba(255, 85, 0, 0.15);
  animation: modalPulse 2.5s infinite alternate ease-in-out;
}

@keyframes modalPulse {
  0% { box-shadow: 0 0 25px rgba(255, 85, 0, 0.25); }
  100% { box-shadow: 0 0 45px rgba(255, 85, 0, 0.55); }
}

.rotate-phone-anim {
  position: relative;
  font-size: 52px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-icon {
  display: inline-block;
  animation: rotatePhone 2.2s infinite ease-in-out;
  transform-origin: center;
}

@keyframes rotatePhone {
  0%, 20% { transform: rotate(0deg); }
  50%, 75% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.rotate-arrow {
  position: absolute;
  font-size: 32px;
  color: var(--action-amber);
  top: -6px;
  right: -16px;
  animation: pulseArrow 1.5s infinite;
}

@keyframes pulseArrow {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

.rotate-title {
  font-family: var(--font-arcade);
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 0 0 12px var(--action-orange);
}

.rotate-subtitle {
  font-family: var(--font-arcade);
  font-size: 9px;
  color: var(--action-amber);
  letter-spacing: 1px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.rotate-hint {
  font-size: 13px;
  color: #a1a1aa;
  line-height: 1.4;
  margin-bottom: 22px;
}

.force-rotate-btn {
  background: linear-gradient(135deg, #ff1744 0%, #ff5500 50%, #ff9100 100%);
  color: #fff;
  border: 1px solid var(--action-amber);
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-arcade);
  font-size: 9px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(255, 85, 0, 0.6);
  transition: all 0.15s ease;
}

.force-rotate-btn:active {
  transform: translateY(2px);
  background: #ff3d00;
}

/* Trigger Rotate Modal when Portrait on small screens & tablets */
@media screen and (orientation: portrait) and (max-width: 1024px) {
  .rotate-device-modal {
    display: flex !important;
  }
  .arcade-cabinet {
    display: none !important;
  }
}

/* ==========================================================
   DESKTOP ARCADE CABINET CONTAINER
   ========================================================== */
.arcade-cabinet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min(
    calc(100vw - 16px), 
    calc((100dvh - var(--header-height) - var(--footer-height) - 16px) * (1000 / 700)),
    1080px
  );
  max-height: 100dvh;
  margin: auto;
}

.arcade-header {
  width: 100%;
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.logo-badge {
  font-family: var(--font-arcade);
  font-size: 7px;
  color: var(--action-amber);
  letter-spacing: 2px;
}

.logo-title {
  font-family: var(--font-arcade);
  font-size: 1.05rem;
  letter-spacing: 1.5px;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 85, 0, 0.7);
  white-space: nowrap;
}

.logo-title .highlight {
  color: var(--action-crimson);
  text-shadow: 0 0 14px rgba(255, 23, 68, 0.85);
}

.header-controls {
  display: flex;
  gap: 6px;
}

.arcade-btn-mini {
  background: #18151c;
  border: 1px solid #3d281e;
  color: #d4d4d8;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.arcade-btn-mini:hover {
  background: #2a1c17;
  color: #fff;
  border-color: var(--action-orange);
  box-shadow: 0 0 10px rgba(255, 85, 0, 0.5);
}

/* Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 700;
  background: #000;
  border-left: 2px solid var(--panel-border);
  border-right: 2px solid var(--panel-border);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  opacity: 0.45;
}

/* ==========================================================
   LANDSCAPE ON-SCREEN HUD CONTROLS (Tablets & Mobile Phones)
   ========================================================== */
.hud-touch-controls {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* Left Pad (Ergonomically Elevated Thumb Zone) */
.hud-left-pad {
  position: absolute;
  bottom: 45px;
  left: 35px;
  pointer-events: auto;
}

/* Precision Arcade D-Pad Cluster */
.hud-dpad-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.dpad-mid-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dpad-btn {
  background: radial-gradient(circle at 40% 40%, rgba(42, 28, 22, 0.9) 0%, rgba(20, 14, 18, 0.95) 100%);
  color: var(--action-amber);
  border: 2px solid rgba(255, 85, 0, 0.65);
  border-radius: 12px;
  font-size: 20px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), inset 0 2px 4px rgba(255, 171, 0, 0.25);
  touch-action: none;
  outline: none;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.08s ease;
}

/* Main Left and Right buttons are wider for effortless rocking */
.dpad-left, .dpad-right {
  width: 68px;
  height: 58px;
}

/* Up and Down ladder buttons */
.dpad-up, .dpad-down {
  width: 58px;
  height: 50px;
}

.dpad-center-hub {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #141118;
  border: 1px solid #ff5500;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(255, 85, 0, 0.3);
}

.dpad-btn:active, .dpad-btn.active {
  transform: scale(0.92);
  border-color: #ffd600;
  background: radial-gradient(circle at 50% 50%, rgba(255, 61, 0, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%);
  color: #fff;
  box-shadow: 0 0 18px var(--action-orange);
}

/* Virtual Analog Joystick Cluster (When toggled) */
.hud-joystick-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-base {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(22, 14, 18, 0.9) 0%, rgba(32, 20, 24, 0.92) 75%, rgba(45, 28, 30, 0.95) 100%);
  border: 3px solid rgba(255, 85, 0, 0.55);
  box-shadow: 
    inset 0 6px 14px rgba(0, 0, 0, 0.9),
    0 4px 16px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(255, 85, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
}

.joy-guide {
  position: absolute;
  font-size: 11px;
  color: #71717a;
  font-weight: bold;
  pointer-events: none;
}

.arrow-up { top: 6px; left: calc(50% - 6px); }
.arrow-down { bottom: 6px; left: calc(50% - 6px); }
.arrow-left { left: 8px; top: calc(50% - 7px); }
.arrow-right { right: 8px; top: calc(50% - 7px); }

.joy-guide.lit {
  color: var(--action-amber);
  text-shadow: 0 0 12px var(--action-orange);
  transform: scale(1.3);
}

.joystick-knob {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #442a22 0%, #261614 60%, #120a0a 100%);
  border: 2px solid #ff5500;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  will-change: transform;
}

.knob-cap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd600 0%, #ff5500 55%, #991b1b 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.joystick-knob.active {
  border-color: var(--action-amber);
  box-shadow: 0 0 18px rgba(255, 85, 0, 0.7);
}

/* Center Tools: Mode Switch & Pause */
.hud-center-tools {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-tool-pill {
  background: rgba(26, 18, 22, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 85, 0, 0.55);
  color: var(--action-amber);
  font-family: var(--font-arcade);
  font-size: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
}

.hud-tool-pill:active {
  background: var(--action-orange);
  color: #fff;
}

/* Right Pad: Elevated Arcade Fire Button */
.hud-right-pad {
  position: absolute;
  bottom: 45px;
  right: 35px;
  pointer-events: auto;
}

.hud-fire-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #111827;
  border: none;
  padding: 0;
  cursor: pointer;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.8),
    0 2px 0 #05070a;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  outline: none;
}

.fire-bezel {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3f2316, #140b08);
  border: 2px solid #ff5500;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 5px rgba(255, 171, 0, 0.3), 0 0 14px rgba(255, 85, 0, 0.35);
}

.fire-core {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff5252 0%, #ff1744 50%, #990011 100%);
  border: 2px solid #ffd600;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(255, 23, 68, 0.75),
    inset 0 3px 6px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  color: #fff;
  transition: transform 0.08s ease;
}

.fire-icon {
  font-size: 18px;
}

.fire-text {
  font-family: var(--font-arcade);
  font-size: 11px;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.hud-fire-btn:active .fire-core,
.hud-fire-btn.pressed .fire-core {
  transform: scale(0.92) translateY(2px);
  background: radial-gradient(circle at 50% 50%, #ff1744 0%, #d50000 70%, #450a0a 100%);
  box-shadow: 
    0 1px 4px rgba(0, 0, 0, 0.8),
    0 0 32px rgba(255, 23, 68, 0.95),
    inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Footer / Instructions (Desktop view) */
.arcade-footer {
  width: 100%;
  height: var(--footer-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  font-size: 0.8rem;
}

.controls-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #a1a1aa;
  white-space: nowrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

kbd {
  background: #1c151a;
  color: var(--action-amber);
  border: 1px solid #4a2820;
  border-bottom: 2px solid #201014;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-arcade);
  font-size: 8px;
}

.arcade-credit {
  font-family: var(--font-arcade);
  font-size: 8px;
  color: var(--neon-green);
  letter-spacing: 1px;
}

/* ==========================================================
   LANDSCAPE MOBILE & TABLET LAYOUT (TRUE FULLSCREEN ARCADE)
   ========================================================== */
@media screen and (orientation: landscape) and (max-height: 900px), 
       screen and (pointer: coarse) and (orientation: landscape) {
  body {
    padding: 0;
    margin: 0;
    background: #000;
  }

  .arcade-cabinet {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 0;
    justify-content: center;
  }

  .arcade-header {
    display: none; /* Screen is 100% dedicated to game */
  }

  .canvas-wrapper {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    aspect-ratio: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Show floating HUD on-screen touch controls */
  .hud-touch-controls {
    display: block !important;
  }

  .arcade-footer {
    display: none;
  }
}
