@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Outfit:wght@300;400;600;800&family=DotGothic16&display=swap');

:root {
  /* Premium HSL Color Palette */
  --bg-dark: 255, 20%, 6%;       /* #090810 */
  --panel-dark: 255, 18%, 12%;   /* #151322 */
  --neon-cyan: 185, 100%, 50%;    /* #00f0ff */
  --neon-magenta: 330, 100%, 50%; /* #ff0080 */
  --neon-pink: 320, 100%, 65%;    /* #ff4db2 */
  --neon-gold: 45, 100%, 50%;     /* #ffd700 */
  --neon-green: 140, 100%, 45%;   /* #00e65c */
  --neon-red: 0, 100%, 55%;       /* #ff1a1a */
  --text-main: 0, 0%, 100%;       /* #ffffff */
  --text-muted: 240, 10%, 70%;    /* #adadbd */

  /* Glow Definitions */
  --glow-cyan: 0 0 10px hsla(var(--neon-cyan), 0.6), 0 0 20px hsla(var(--neon-cyan), 0.3);
  --glow-magenta: 0 0 10px hsla(var(--neon-magenta), 0.6), 0 0 20px hsla(var(--neon-magenta), 0.3);
  --glow-gold: 0 0 10px hsla(var(--neon-gold), 0.6), 0 0 20px hsla(var(--neon-gold), 0.3);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Font Families */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Orbitron', sans-serif;
  
  --safe-padding: 16px;
}

/* Base resets & Touch/Scroll lock */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050409;
  font-family: var(--font-main);
  color: hsl(var(--text-main));
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

img {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Main Mobile Wrapper (Mobile layout fixed on PC) */
.app-container {
  width: 100vw;
  height: 100dvh;
  max-width: 480px;
  background: radial-gradient(circle at 50% 30%, hsl(255, 30%, 12%), hsl(var(--bg-dark)));
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 481px) {
  .app-container {
    height: 92dvh;
    max-height: 850px;
    border-radius: var(--radius-xl);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), 
                0 0 1px 1px hsla(var(--neon-cyan), 0.3),
                0 0 15px 2px hsla(var(--neon-magenta), 0.2);
    border: 2px solid hsla(var(--neon-cyan), 0.15);
  }
}

/* Screen Management */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--safe-padding);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: scale(0.96);
  z-index: 1;
  overflow-y: auto;     /* Scroll fallback if viewport height is too short */
  touch-action: pan-y;   /* Allow swipe up/down to scroll on title/results */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS Safari */
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 10;
}

/* Hard-lock active gameplay screens during intense tapping (disable scroll/zoom completely) */
#screen-measure, #screen-battle {
  overflow: hidden !important;
  touch-action: none !important;
}

/* Header UI Elements */
header {
  text-align: center;
  padding: 10px 0;
  flex-shrink: 0;
}

.game-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, hsl(var(--neon-cyan)), hsl(var(--neon-magenta)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px hsla(var(--neon-magenta), 0.3);
  display: inline-block;
  margin-bottom: 4px;
}

.tagline {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Common UI Elements */
.panel {
  background-color: hsla(var(--panel-dark), 0.7);
  border: 1px solid hsla(var(--neon-cyan), 0.15);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 15px hsla(var(--neon-cyan), 0.05);
}

.btn {
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 15px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  touch-action: manipulation;
  color: hsl(var(--text-main));
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--neon-cyan)), hsl(200, 100%, 45%));
  box-shadow: var(--glow-cyan);
  border: 1px solid hsla(var(--neon-cyan), 0.5);
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn-secondary {
  background: linear-gradient(135deg, hsl(var(--neon-magenta)), hsl(300, 100%, 40%));
  box-shadow: var(--glow-magenta);
  border: 1px solid hsla(var(--neon-magenta), 0.5);
}

.btn-secondary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn-outline {
  background: transparent;
  border: 1px solid hsla(var(--text-muted), 0.3);
  color: hsl(var(--text-muted));
}

.btn-outline:active {
  background: hsla(var(--text-muted), 0.1);
  transform: scale(0.97);
}

/* Home Screen Specific */
#screen-menu {
  justify-content: space-between;
  padding-bottom: 30px;
}

.menu-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  gap: 20px;
}

.badge-logo {
  font-size: 5rem;
  animation: logoPulse 2.5s infinite alternate ease-in-out;
  filter: drop-shadow(0 0 15px hsla(var(--neon-cyan), 0.4));
}

.best-records-panel {
  width: 100%;
  text-align: center;
}

.best-records-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: hsl(var(--neon-gold));
  margin-bottom: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.best-records-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.record-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.record-label {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
  margin-bottom: 4px;
}

.record-val {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: hsl(var(--text-main));
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
}

/* How to Play Screen Specific */
#screen-how-to {
  justify-content: space-between;
}

.how-to-content {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 4px;
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: hsla(var(--neon-cyan), 0.3) transparent;
}

.how-to-content::-webkit-scrollbar {
  width: 4px;
}

.how-to-content::-webkit-scrollbar-thumb {
  background: hsla(var(--neon-cyan), 0.3);
  border-radius: 2px;
}

.how-to-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: hsl(var(--neon-cyan));
  margin-bottom: 8px;
  border-left: 3px solid hsl(var(--neon-cyan));
  padding-left: 8px;
}

.how-to-section p, .how-to-section li {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  line-height: 1.5;
  margin-bottom: 8px;
}

.how-to-section ul {
  padding-left: 20px;
}

.how-to-warning {
  border-color: hsla(var(--neon-gold), 0.3);
  background: hsla(var(--neon-gold), 0.05);
}

.how-to-warning h3 {
  color: hsl(var(--neon-gold));
  border-left-color: hsl(var(--neon-gold));
}

/* Gameplay Screen Structure (Measure & Battle) */
.game-screen-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  position: relative;
}

.game-hud {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: hsla(var(--panel-dark), 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.hud-panel:not(:last-child) {
  margin-right: 8px;
}

.hud-label {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.hud-value.highlight {
  color: hsl(var(--neon-cyan));
  text-shadow: 0 0 8px hsla(var(--neon-cyan), 0.5);
}

.hud-value.timer {
  color: hsl(var(--neon-magenta));
  text-shadow: 0 0 8px hsla(var(--neon-magenta), 0.5);
}

/* Battle Mode Specific HUD */
.enemy-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  position: relative;
}

.enemy-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.enemy-level {
  color: hsl(var(--neon-gold));
}

.enemy-hp-text {
  color: hsl(var(--text-main));
}

.hp-bar-container {
  width: 100%;
  height: 12px;
  background: #110e1a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.hp-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--neon-red)), hsl(350, 100%, 65%));
  box-shadow: 0 0 8px hsla(var(--neon-red), 0.6);
  transition: width 0.1s linear;
}

/* Game visual arena (Middle Area) */
.game-stage {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.enemy-sprite-container {
  width: 300px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11rem; /* For emoji fallback */
  position: relative;
  transition: transform 0.05s ease;
}

.enemy-sprite {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Damage flicker animation (simulates NES hardware sprite flickering) */
@keyframes fcFlicker {
  0% { opacity: 1; }
  24% { opacity: 1; }
  25% { opacity: 0; }
  49% { opacity: 0; }
  50% { opacity: 1; }
  74% { opacity: 1; }
  75% { opacity: 0; }
  99% { opacity: 0; }
  100% { opacity: 1; }
}
.enemy-sprite.damage-flicker {
  animation: fcFlicker 0.15s steps(1) infinite;
}

/* When damaged */
.enemy-sprite-container.shake {
  animation: spriteShake 0.1s linear;
}

/* When defeated */
.enemy-sprite-container.defeated {
  animation: spriteDefeated 0.5s forwards ease-out;
}

.active-item-badge {
  background: hsla(var(--neon-gold), 0.15);
  border: 1px solid hsla(var(--neon-gold), 0.4);
  color: hsl(var(--neon-gold));
  border-radius: 30px;
  padding: 4px 12px;
  font-size: 0.8rem;
  margin-top: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: itemPulse 1.5s infinite ease-in-out;
}

/* Big Tap Area */
.tap-instruction-area {
  text-align: center;
  margin-top: 15px;
  flex-shrink: 0;
}

.tap-instruction-sub {
  font-size: 0.85rem;
  font-weight: bold;
  color: #fff;
  opacity: 0.85;
  letter-spacing: 0.5px;
}

.tap-instruction-main {
  font-size: 0.95rem;
  font-weight: bold;
  color: #fff;
  margin-top: 15px;
  letter-spacing: 1px;
}

.tap-buttons-container {
  height: 33dvh;
  min-height: 220px;
  width: calc(100% - 32px);
  margin: 10px 16px 75px 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.watch-action-tap-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tap-btn-top-label {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffd200;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  line-height: 1;
}

.tap-btn-bottom-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: #adadbd;
  opacity: 0.8;
  letter-spacing: 0.5px;
  line-height: 1;
}

.watch-action-tap-btn {
  width: 125px;
  height: 125px;
  background: radial-gradient(circle at 35% 35%, #4c4a5c, #2a2835 60%, #151322 100%);
  border: 7px solid #ffd200; /* Yellow Frame matching watch */
  border-radius: 50%;
  box-shadow: 0 0 0 2.5px #151322,
              0 10px 20px rgba(0, 0, 0, 0.7), 
              inset 0 2px 4px rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  pointer-events: auto;
  touch-action: none;
  position: relative;
}

/* Hudson-style arch-shaped notch/groove on the top half of the button */
.watch-action-tap-btn::before {
  content: '';
  position: absolute;
  top: 14%;
  left: 15%;
  right: 15%;
  height: 60%;
  border-radius: 50%;
  border-top: 6.5px solid #100f1a; /* Dark groove shadow */
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  pointer-events: none;
  box-sizing: border-box;
  opacity: 0.9;
}

.watch-action-tap-btn.active, .watch-action-tap-btn:active {
  transform: translateY(6px) scale(0.94);
  box-shadow: 0 0 0 2.5px #151322,
              0 3px 5px rgba(0,0,0,0.5), 
              inset 0 6px 10px rgba(0,0,0,0.8);
}

.watch-bottom-decorations {
  width: calc(100% - 60px);
  margin: 15px auto 10px auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.decor-line {
  height: 2.5px;
  width: 100%;
}

.cyan-line {
  background-color: hsl(var(--neon-cyan));
  box-shadow: 0 0 8px hsl(var(--neon-cyan));
}

.gold-line {
  background-color: #ffd200;
}

.tap-area-glow-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, hsl(var(--neon-cyan)), transparent);
  box-shadow: 0 0 15px hsla(var(--neon-cyan), 0.8);
}

.tap-prompt {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: hsl(var(--text-main));
  letter-spacing: 4px;
  text-shadow: 0 0 10px hsla(var(--text-main), 0.5);
  pointer-events: none;
}

.tap-subprompt {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  margin-top: 8px;
  letter-spacing: 1px;
  pointer-events: none;
  text-transform: uppercase;
}

/* Floating Effects (Damage & Tap values) */
.tap-effect {
  position: absolute;
  pointer-events: none;
  font-family: 'DotGothic16', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  color: #ff1a1a; /* Retro Red */
  /* Thick NES-style black outline */
  text-shadow: 
    2px 2px 0 #000,
    -2px 2px 0 #000,
    2px -2px 0 #000,
    -2px -2px 0 #000,
    0px 2px 0 #000,
    0px -2px 0 #000,
    2px 0px 0 #000,
    -2px 0px 0 #000;
  z-index: 100;
  animation: floatUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.tap-effect.damage-double {
  color: #ffd200; /* Retro Yellow */
  font-size: 2.2rem;
}

.tap-effect.bomb-damage {
  color: #ff5500; /* Bright Orange */
  font-size: 2.5rem;
}

/* Countdown Overlay */
.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 8, 16, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.countdown-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 8rem;
  font-weight: 900;
  color: hsl(var(--neon-cyan));
  text-shadow: 0 0 30px hsla(var(--neon-cyan), 0.6);
  animation: countdownPulse 1s infinite ease-out;
}

.countdown-label {
  font-size: 1.2rem;
  color: hsl(var(--text-muted));
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 10px;
}

.countdown-instruction {
  font-size: 1.8rem;
  color: #ffffff;
  font-weight: bold;
  margin-top: 15px;
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4), 2px 2px 0 #151322;
  font-family: var(--font-main);
  letter-spacing: 1px;
}

/* Pixel particle spark effects */
.pixel-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background-color: #ffd200;
  border: 1px solid #151322;
  pointer-events: none;
  z-index: 99;
  animation: particleExplode 0.4s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes particleExplode {
  0% {
    transform: translate(0, 0) scale(1.5);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0);
    opacity: 0;
  }
}

/* Global Floating Mute Button */
.mute-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background-color: #fff3bd;
  border: 3px solid #151322;
  border-radius: 50%;
  box-shadow: 0 4px 0 #151322;
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  padding: 0;
  line-height: 1;
}

.mute-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #151322;
}

.mute-btn.muted {
  background-color: #e2d2ad;
}

/* Ensure global mute button shrinks scale slightly in small heights to stay clean */
@media (max-height: 740px) {
  .mute-btn {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-width: 2px;
    box-shadow: 0 3px 0 #151322;
  }
  .mute-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #151322;
  }
}

/* Item Drop Modal Overlay */
.item-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 8, 16, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 60;
  padding: var(--safe-padding);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.item-drop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.item-drop-card {
  width: 100%;
  text-align: center;
  border-color: hsla(var(--neon-gold), 0.3);
  box-shadow: 0 0 20px hsla(var(--neon-gold), 0.15);
  animation: cardScaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.item-drop-title {
  font-family: var(--font-display);
  color: hsl(var(--neon-gold));
  font-size: 1.3rem;
  margin-bottom: 20px;
  letter-spacing: 1px;
}

.item-icon-glow {
  font-size: 4.5rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 15px hsla(var(--neon-gold), 0.5));
}

.item-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.item-desc {
  font-size: 0.9rem;
  color: hsl(var(--text-muted));
  margin-bottom: 25px;
  line-height: 1.4;
}

.item-stock-panel {
  width: 100%;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 12px;
  text-align: left;
}

.item-stock-title,
.item-choice-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: hsl(var(--neon-gold));
  margin-bottom: 6px;
  text-align: center;
}

.item-stock-list {
  font-size: 0.82rem;
  color: hsl(var(--text-main));
  line-height: 1.4;
  text-align: center;
}

.item-choice-area {
  width: 100%;
  margin-bottom: 12px;
}

.item-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 170px;
  overflow-y: auto;
  padding-right: 2px;
}

.item-choice-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid hsla(var(--neon-gold), 0.45);
  border-radius: var(--radius-sm);
  background: hsla(var(--neon-gold), 0.12);
  color: hsl(var(--text-main));
  padding: 8px 10px;
  text-align: left;
  font-family: var(--font-main);
  touch-action: manipulation;
}

.item-choice-icon {
  font-size: 1.5rem;
  text-align: center;
}

.item-choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.item-choice-text strong {
  font-size: 0.88rem;
}

.item-choice-text small,
.item-choice-empty {
  font-size: 0.74rem;
  color: hsl(var(--text-muted));
  line-height: 1.3;
}

.item-choice-empty {
  text-align: center;
  padding: 8px 0;
}

/* Result Screens */
.result-header {
  text-align: center;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.result-subtitle {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: hsl(var(--neon-magenta));
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.result-title {
  font-size: 1.8rem;
  font-weight: 800;
}

.result-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
}

.score-panel {
  text-align: center;
  padding: 25px 20px;
}

.score-large-label {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.score-large-val {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: hsl(var(--neon-cyan));
  text-shadow: 0 0 15px hsla(var(--neon-cyan), 0.5);
  line-height: 1;
  margin-bottom: 15px;
}

.rank-display {
  display: inline-block;
  background: hsla(var(--neon-magenta), 0.1);
  border: 1px solid hsla(var(--neon-magenta), 0.3);
  padding: 6px 16px;
  border-radius: 30px;
  font-weight: 700;
  color: hsl(var(--neon-pink));
  font-size: 0.95rem;
  box-shadow: inset 0 0 10px hsla(var(--neon-magenta), 0.1);
}

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

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.stat-label {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
}

.stat-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.stat-val.best {
  color: hsl(var(--neon-gold));
  text-shadow: 0 0 8px hsla(var(--neon-gold), 0.3);
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
  flex-shrink: 0;
}

.result-share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Animations */
@keyframes logoPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 10px hsla(var(--neon-cyan), 0.3));
  }
  100% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 25px hsla(var(--neon-cyan), 0.6));
  }
}

@keyframes countdownPulse {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: translateY(-20px) scale(1.1);
  }
  100% {
    transform: translateY(-100px) scale(0.9);
    opacity: 0;
  }
}

@keyframes spriteShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(8px, -4px); }
  60% { transform: translate(-6px, -2px); }
  80% { transform: translate(6px, 2px); }
  100% { transform: translate(0, 0); }
}

@keyframes spriteDefeated {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    filter: brightness(1) saturate(1);
  }
  50% {
    transform: scale(1.2) rotate(15deg);
    filter: brightness(2) saturate(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(0) rotate(-45deg);
    filter: brightness(3);
    opacity: 0;
  }
}

@keyframes itemPulse {
  0% {
    box-shadow: 0 0 5px hsla(var(--neon-gold), 0.3);
  }
  50% {
    box-shadow: 0 0 15px hsla(var(--neon-gold), 0.6);
  }
  100% {
    box-shadow: 0 0 5px hsla(var(--neon-gold), 0.3);
  }
}

@keyframes cardScaleIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Image Preview Overlay for Mobile saving */
.image-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 8, 16, 0.96);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: var(--safe-padding);
}

.preview-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  max-width: 360px;
}

.preview-instruction {
  font-size: 0.95rem;
  color: hsl(var(--neon-cyan));
  text-align: center;
  line-height: 1.4;
  font-weight: 700;
  text-shadow: 0 0 8px hsla(var(--neon-cyan), 0.3);
}

#preview-image {
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 2px solid hsla(var(--neon-cyan), 0.3);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.2);
  /* Override global touch blocks to enable long-press save menu */
  user-select: contain !important;
  -webkit-user-select: auto !important;
  -webkit-touch-callout: default !important;
  pointer-events: auto !important;
}

/* Responsive adjustments for shorter viewports (e.g., iPhone SE) */
@media (max-height: 740px) {
  header {
    padding: 4px 0 !important;
  }
  .game-logo {
    font-size: 1.6rem !important;
    margin-bottom: 2px !important;
  }
  .tagline {
    font-size: 0.75rem !important;
  }
  .badge-logo {
    font-size: 3.2rem !important;
  }
  .panel {
    padding: 10px 14px !important;
  }
  .score-panel {
    padding: 12px 10px !important;
  }
  .score-large-val {
    font-size: 2.4rem !important;
    margin-bottom: 6px !important;
  }
  .rank-display {
    font-size: 0.8rem !important;
    padding: 4px 12px !important;
  }
  .stat-item {
    padding: 6px 10px !important;
  }
  .stat-val {
    font-size: 0.95rem !important;
  }
  .btn {
    padding: 10px 16px !important;
    font-size: 0.95rem !important;
  }
  .result-content {
    gap: 6px !important;
  }
  .result-buttons {
    gap: 6px !important;
    margin-top: 6px !important;
  }
  .result-share-row {
    gap: 6px !important;
  }
  .menu-hero {
    gap: 8px !important;
  }
  .best-records-title {
    margin-bottom: 6px !important;
  }
  .active-item-badge {
    margin-top: 8px !important;
    padding: 2px 10px !important;
    font-size: 0.75rem !important;
  }
  .item-icon-glow {
    font-size: 3rem !important;
    margin-bottom: 6px !important;
  }
  .item-name {
    font-size: 1.1rem !important;
  }
  .item-desc {
    font-size: 0.78rem !important;
    margin-bottom: 10px !important;
  }
  .item-stock-panel {
    padding: 7px !important;
    margin-bottom: 8px !important;
  }
  .item-choice-list {
    max-height: 118px !important;
    gap: 6px !important;
  }
  .item-choice-btn {
    padding: 6px 8px !important;
  }
  .enemy-sprite-container {
    width: 220px !important;
    height: 220px !important;
    font-size: 8rem !important;
  }
  .countdown-instruction {
    font-size: 1.4rem !important;
    margin-top: 10px !important;
  }
}

/* ==========================================
   SHOOTING WATCH (TIGER WATCH) DEVICE STYLES
   ========================================== */
.watch-concept-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: hsl(var(--neon-gold));
  margin: 10px 0 12px 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
}

.shooting-watch-device {
  width: 94%;
  max-width: 360px;
  height: 220px;
  background-color: #ffd200; /* Retro Yellow */
  border-radius: var(--radius-lg);
  border: 5px solid #e0b000;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.6), 
              inset 0 4px 6px rgba(255, 255, 255, 0.5), 
              inset 0 -6px 8px rgba(0, 0, 0, 0.3);
  padding: 10px;
  box-sizing: border-box;
  display: inline-block;
  margin: 5px auto;
  position: relative;
  transition: transform 0.2s ease;
}

.watch-inner {
  width: 100%;
  height: 100%;
  background-color: #f7f7f9;
  border-radius: 16px;
  border: 2px solid #bbb;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Hazard Stripe on the bottom right (Larger area to fit larger A/B buttons) */
.watch-inner::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 175px;
  height: 125px;
  background: repeating-linear-gradient(45deg, #ffd200, #ffd200 8px, #151322 8px, #151322 16px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  z-index: 1;
  border-left: 2px solid #151322;
}

/* Speaker Grille */
.watch-speaker {
  position: absolute;
  left: 20px;
  top: 38px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #222 25%, #444 65%, #000 100%);
  border: 3.5px solid #ffd200;
  box-shadow: inset 0 3px 5px rgba(0,0,0,0.8), 0 1px 2px rgba(255,255,255,0.4);
}

/* Tiger Logo Area */
.watch-logo-area {
  position: absolute;
  left: 65px;
  top: 30px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
}

.watch-tiger-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
  line-height: 1;
}

.watch-logo-text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
  color: #151322;
  letter-spacing: 0.5px;
  border-bottom: 3px solid #ffd200;
  padding-bottom: 1px;
}

/* LCD Display */
.watch-lcd-container {
  position: absolute;
  right: 18px;
  top: 22px;
  width: 140px;
  z-index: 2;
}

.watch-lcd-glass {
  background-color: #a2b294; /* Classic GameBoy/Retro LCD Green */
  border: 3.5px solid #ffd200;
  border-radius: 4px;
  padding: 5px 10px;
  text-align: right;
  box-shadow: inset 0 3px 5px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.5);
  box-sizing: border-box;
}

.watch-lcd-val {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: #1e2a18;
  letter-spacing: 1px;
  display: block;
  line-height: 1.1;
  text-shadow: 1px 1px 0px rgba(255,255,255,0.25);
}

.watch-lcd-bottom-label {
  font-size: 0.55rem;
  color: #151322;
  font-weight: 900;
  font-family: var(--font-display);
  text-align: center;
  margin-top: 3px;
  letter-spacing: 0.2px;
}

.watch-lcd-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.45rem;
  color: #151322;
  font-weight: 900;
  padding: 2px 4px 0;
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

/* SELECT and START rubber buttons */
.watch-control-buttons {
  position: absolute;
  left: 20px;
  bottom: 25px;
  width: 110px;
  z-index: 2;
}

.watch-control-label-row {
  display: flex;
  justify-content: space-around;
  font-size: 0.6rem;
  color: #151322;
  font-weight: 900;
  margin-bottom: 2px;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
}

.watch-control-btn-row {
  display: flex;
  justify-content: space-around;
  background-color: #ffd200;
  border-radius: 12px;
  padding: 4px 6px;
  border: 1.5px solid #d0a000;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.watch-rubber-btn {
  width: 32px;
  height: 12px;
  background-color: #333;
  border-radius: 5px;
  border-bottom: 2px solid #111;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Action Buttons (A / B) */
.watch-action-buttons {
  position: absolute;
  right: 18px;
  bottom: 20px;
  display: flex;
  gap: 15px;
  z-index: 3;
}

.watch-action-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.watch-action-label {
  font-size: 0.85rem;
  font-weight: 900;
  color: #151322;
  font-family: var(--font-display);
  margin-bottom: 4px;
  text-shadow: 0 1px 0 #fff;
}

.watch-round-btn {
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 35% 35%, #444, #181818 70%, #050505 100%);
  border-radius: 50%;
  border: 3.5px solid #ffd200;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.5), 
              inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  cursor: pointer;
  box-sizing: border-box;
}

/* Active pressing state (triggered by touch/click and via js class) */
.watch-round-btn.active, .watch-round-btn:active {
  transform: translateY(3px) scale(0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), 
              inset 0 3px 5px rgba(0,0,0,0.8);
}

/* Responsive adjustment for short screen */
@media (max-height: 740px) {
  .watch-concept-label {
    margin: 2px 0 4px 0 !important;
  }
  .shooting-watch-device {
    transform: scale(0.85);
    margin: 0 auto !important;
  }
}

/* ==========================================
   RETRO TIGER WATCH THEME OVERRIDES
   ========================================== */
:root {
  --bg-dark: 48, 86%, 78%;
  --panel-dark: 48, 83%, 88%;
  --neon-cyan: 186, 80%, 30%;
  --neon-magenta: 354, 76%, 43%;
  --neon-pink: 354, 74%, 48%;
  --neon-gold: 48, 100%, 50%;
  --neon-green: 91, 21%, 55%;
  --neon-red: 354, 76%, 43%;
  --text-main: 230, 16%, 10%;
  --text-muted: 230, 10%, 31%;
  --glow-cyan: 0 3px 0 #0f1420, 0 8px 0 rgba(0, 0, 0, 0.18);
  --glow-magenta: 0 3px 0 #0f1420, 0 8px 0 rgba(0, 0, 0, 0.18);
  --glow-gold: 0 3px 0 #0f1420, 0 8px 0 rgba(0, 0, 0, 0.18);
}

html,
body {
  background: #151322;
}

.app-container {
  background:
    linear-gradient(90deg, rgba(21, 19, 34, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(rgba(21, 19, 34, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    radial-gradient(circle at 50% 0%, #fff4ba 0%, #f4cc35 46%, #d99b17 100%);
  color: #151322;
}

@media (min-width: 481px) {
  .app-container {
    border-color: #151322;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.45), 0 0 0 6px #ffd200;
  }
}

.screen {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.35), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 210, 0, 0.06));
}

#screen-measure,
#screen-battle {
  background: linear-gradient(180deg, #f9e58a 0%, #ffd200 48%, #e0a51a 100%);
}

.game-logo {
  color: #151322;
  background: none;
  -webkit-text-fill-color: #151322;
  text-shadow: 2px 2px 0 #ffd200, 4px 4px 0 rgba(21, 19, 34, 0.18);
  letter-spacing: 1px;
}

.tagline,
.result-subtitle {
  color: #40351e;
}

.panel,
.hud-panel,
.stat-item,
.record-box {
  background: #fff3bd;
  border: 3px solid #151322;
  box-shadow: 0 5px 0 #151322, inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.btn {
  border: 3px solid #151322;
  border-radius: 10px;
  color: #151322;
  box-shadow: 0 5px 0 #151322;
  text-shadow: none;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #151322;
}

.btn-primary {
  background: linear-gradient(180deg, #ffe45f, #ffd200);
  color: #151322;
}

.btn-secondary {
  background: linear-gradient(180deg, #f25b50, #c82e39);
  color: #fff8dc;
}

.btn-outline {
  background: #fff8dc;
  color: #151322;
  border-color: #151322;
}

#screen-menu {
  justify-content: space-between;
}

.menu-hero {
  gap: 14px;
  justify-content: flex-start;
}

.menu-watch-hero,
.result-watch-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.menu-watch-device {
  height: 198px;
  max-width: 342px;
  margin-top: 0;
}

.result-watch-device {
  height: 178px;
  max-width: 318px;
  margin: 0 auto 4px;
}

.menu-watch-device .watch-lcd-container {
  width: 130px;
}

.result-watch-device .watch-lcd-container {
  width: 128px;
  top: 20px;
  right: 16px;
}

.result-watch-device .watch-lcd-val {
  font-size: 1.95rem;
}

.result-watch-device .watch-control-buttons {
  bottom: 19px;
}

.result-watch-device .watch-action-buttons {
  bottom: 17px;
}

.watch-concept-label {
  color: #151322;
  background: #ffd200;
  border: 2px solid #151322;
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: 0 3px 0 #151322;
}

.best-records-title,
.score-large-label {
  color: #151322;
}

.record-val,
.hud-value.highlight,
.score-large-val,
.stat-val.best {
  color: #151322;
  text-shadow: 1px 1px 0 #ffd200;
}

.hud-value.timer,
.result-subtitle {
  color: #c82e39;
  text-shadow: none;
}

.enemy-panel {
  background: #fff8dc;
}

.hp-bar-container {
  background: #151322;
  border: 2px solid #151322;
}

.hp-bar {
  background: linear-gradient(90deg, #c82e39, #f25b50);
  box-shadow: none;
}

.game-stage {
  color: #151322;
}

.enemy-sprite-container {
  filter: drop-shadow(4px 6px 0 rgba(21, 19, 34, 0.18));
}

.active-item-badge,
.rank-display {
  background: #fff8dc;
  border: 3px solid #151322;
  color: #151322;
  box-shadow: 0 4px 0 #151322;
}

.item-stock-panel {
  background: #fff8dc;
  border: 3px solid #151322;
  box-shadow: 0 4px 0 #151322;
}

.item-stock-title,
.item-choice-title {
  color: #151322;
}

.item-stock-list {
  color: #151322;
}

.item-choice-btn {
  background: #fff8dc;
  border: 3px solid #151322;
  color: #151322;
  box-shadow: 0 4px 0 #151322;
}

.item-choice-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #151322;
}

.item-choice-text small,
.item-choice-empty {
  color: #40351e;
}

.tap-instruction-main,
.tap-instruction-sub,
.tap-btn-bottom-label {
  color: #151322;
  opacity: 1;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.watch-action-tap-btn {
  box-shadow: 0 0 0 2.5px #151322,
              0 10px 0 #151322,
              0 18px 20px rgba(0, 0, 0, 0.22),
              inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.decor-line {
  border: 1px solid #151322;
  box-shadow: none;
}

.cyan-line {
  background-color: #94a883;
}

.gold-line {
  background-color: #c82e39;
}

.result-header {
  margin-bottom: 8px;
}

.result-title {
  color: #151322;
  text-shadow: 1px 1px 0 #ffd200;
}

#screen-measure-result .result-content {
  justify-content: flex-start;
  gap: 10px;
}

#screen-measure-result .score-panel {
  padding: 14px 16px;
}

#screen-measure-result .score-large-val {
  font-size: 2.8rem;
}

.result-buttons {
  margin-top: 10px;
}

.item-drop-overlay,
.countdown-overlay,
.image-preview-overlay {
  background: rgba(21, 19, 34, 0.92);
}

.countdown-number {
  color: #ffd200;
  text-shadow: 4px 4px 0 #151322;
}

.countdown-label,
.preview-instruction {
  color: #fff8dc;
}

#preview-image {
  border-color: #ffd200;
  box-shadow: 0 0 0 4px #151322, 0 12px 24px rgba(0, 0, 0, 0.35);
}

@media (max-height: 740px) {
  .menu-watch-device {
    transform: scale(0.82) !important;
    margin: -18px auto -20px !important;
  }

  .result-watch-device {
    transform: scale(0.78) !important;
    margin: -24px auto -28px !important;
  }

  #screen-measure-result .score-large-val {
    font-size: 2.2rem !important;
  }
}

/* ==========================================================================
   Alternate Combo Feature Styles
   ========================================================================== */

/* Alternate Combo Badge styling */
.alt-combo-badge {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(21, 19, 34, 0.85);
  border: 2px solid hsl(var(--neon-gold));
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-gold), inset 0 0 8px hsla(var(--neon-gold), 0.2);
  z-index: 5;
  pointer-events: none;
  animation: altComboPop 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.alt-combo-count {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: hsl(var(--neon-gold));
  text-shadow: 0 0 5px hsla(var(--neon-gold), 0.5);
  line-height: 1;
}

.alt-combo-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: hsl(var(--text-main));
  letter-spacing: 1px;
  margin-top: 1px;
}

/* Animations for alternate combos */
@keyframes altComboPop {
  0% {
    transform: translateX(-50%) scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

.alt-combo-badge.bounce {
  animation: altComboBounce 0.15s cubic-bezier(0.25, 0.8, 0.25, 1.4);
}

@keyframes altComboBounce {
  0% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.25);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

/* Alternate Combo Damage text enhancement */
.tap-effect.damage-alt-combo {
  color: #ffd700 !important;
  font-weight: 900 !important;
  font-size: 1.65rem !important;
  text-shadow: 0 0 8px #ffd700, 0 0 15px rgba(255, 215, 0, 0.6), 2px 2px 0 #000 !important;
  z-index: 100;
}

