/* ==========================================================================
   GAMEE STUDIO - BIG RED BUTTON SIMULATOR (MOBILE FIRST)
   Brand Red: #DC2626 / Dark: #0F172A / Gold: #F59E0B
   ========================================================================== */

:root {
  --gamee-red: #DC2626;
  --gamee-red-light: #EF4444;
  --gamee-red-bright: #FF4646;
  --gamee-red-dark: #991B1B;
  --gamee-red-deep: #7F1D1D;
  --gamee-gold: #F59E0B;
  --gamee-dark-bg: #090D16;
  --gamee-dark-card: #131B2E;
  --gamee-dark-surface: #1E293B;
  --gamee-border: rgba(255, 255, 255, 0.08);
  --text-white: #FFFFFF;
  --text-muted: #94A3B8;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--gamee-dark-bg);
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(220, 38, 38, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 50% 85%, rgba(15, 23, 42, 0.8) 0%, transparent 60%);
  color: var(--text-white);
  font-family: var(--font-main);
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* Background Particle Canvas */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ==========================================================================
   APP CONTAINER & LAYOUT (PORTRAIT LOCK FEEL)
   ========================================================================== */
.app-layout {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(12px, 2.5vh, 20px) 16px;
  padding-top: max(clamp(12px, 2.5vh, 20px), env(safe-area-inset-top));
  padding-bottom: max(clamp(12px, 2.5vh, 20px), env(safe-area-inset-bottom));
  position: relative;
  z-index: 2;
  will-change: transform;
}

/* ==========================================================================
   REALISTIC SCREEN RUMBLE / SHAKE KEYFRAMES ("RUNG NHƯ THẬT")
   ========================================================================== */
.screen-rumble {
  animation: realisticRumble 0.15s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.screen-rumble-heavy {
  animation: heavyRumble 0.22s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes realisticRumble {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-3.5px, 2.5px) rotate(-0.4deg); }
  40% { transform: translate(3px, -3px) rotate(0.5deg); }
  60% { transform: translate(-2px, -1.5px) rotate(-0.3deg); }
  80% { transform: translate(2.5px, 1.5px) rotate(0.2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes heavyRumble {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  15% { transform: translate(-6px, 5px) scale(0.99) rotate(-1deg); }
  30% { transform: translate(6px, -5px) scale(1.01) rotate(1deg); }
  45% { transform: translate(-5px, -4px) scale(0.995) rotate(-0.6deg); }
  60% { transform: translate(4px, 4px) scale(1.005) rotate(0.5deg); }
  80% { transform: translate(-2px, 2px) scale(1) rotate(-0.2deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

/* ==========================================================================
   HEADER & SCOREBOARD
   ========================================================================== */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gamee-red-light);
  box-shadow: 0 0 10px var(--gamee-red-light);
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.brand-text {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #FCA5A5;
}

.tool-controls {
  display: flex;
  gap: 8px;
}

.btn-tool {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--gamee-border);
  background: var(--gamee-dark-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  background: var(--gamee-dark-surface);
  color: var(--text-white);
}

.btn-tool.active {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
  color: #F87171;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.25);
}

/* Score Card */
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: rgba(19, 27, 46, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.8), transparent);
}

.score-sub-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.score-number-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.score-counter {
  font-size: clamp(38px, 9vw, 52px);
  font-weight: 900;
  line-height: 1.05;
  background: linear-gradient(180deg, #FFFFFF 20%, #E2E8F0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(220, 38, 38, 0.35);
  transition: transform 0.08s ease;
  display: inline-block;
  will-change: transform;
}

.score-counter.punch {
  transform: scale(1.12);
}

/* Combo Streak Pill */
.combo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  color: #FCD34D;
  opacity: 0;
  transform: translateY(6px) scale(0.9);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-pill.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.combo-pill.fever {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.3), rgba(245, 158, 11, 0.3));
  border-color: #F87171;
  color: #FEF08A;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
  animation: feverPulse 0.6s infinite alternate;
}

@keyframes feverPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

/* ==========================================================================
   BUTTON STAGE (THE GIANT RED BUTTON - PORTRAIT PHONE HERO)
   ========================================================================== */
.button-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  margin: 10px 0;
}

/* Outer Mount / Chassis */
.button-mount {
  position: relative;
  width: min(90vw, 390px);
  height: min(90vw, 390px);
  max-width: 410px;
  max-height: 410px;
  border-radius: 50%;
  padding: clamp(10px, 2.5vw, 16px);
  background: radial-gradient(circle at 45% 45%, #27354A 0%, #172133 60%, #0B101B 100%);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.85),
    0 10px 20px rgba(0, 0, 0, 0.6),
    inset 0 3px 6px rgba(255, 255, 255, 0.18),
    inset 0 -5px 12px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Glowing ambiance around the mount */
.mount-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.35) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.button-mount.fever-active .mount-glow {
  opacity: 1;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.6) 0%, rgba(245, 158, 11, 0.3) 50%, transparent 75%);
  animation: glowPulse 0.8s infinite alternate;
}

@keyframes glowPulse {
  0% { transform: scale(0.97); opacity: 0.7; }
  100% { transform: scale(1.04); opacity: 1; }
}

/* ==========================================================================
   THE GIANT 3D RED BUTTON (TACTILE ARCADE PUSH BUTTON)
   ========================================================================== */
.giant-red-button {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

/* Metallic Rim Ring inside button */
.button-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #475569 0%, #1E293B 50%, #0F172A 100%);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), inset 0 -3px 6px rgba(0,0,0,0.6);
  padding: 6px;
  pointer-events: none;
}

/* 3D Tactile Dome Surface */
.button-dome {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, 
    var(--gamee-red-bright) 0%, 
    var(--gamee-red) 45%, 
    var(--gamee-red-dark) 80%, 
    var(--gamee-red-deep) 100%
  );
  /* 3D button height extrusion */
  box-shadow: 
    0 16px 0 var(--gamee-red-deep),
    0 18px 2px rgba(0, 0, 0, 0.4),
    0 24px 35px rgba(220, 38, 38, 0.5),
    inset 0 4px 8px rgba(255, 255, 255, 0.4),
    inset 0 -8px 16px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(0);
  transition: 
    transform 0.08s cubic-bezier(0.1, 0.9, 0.2, 1),
    box-shadow 0.08s cubic-bezier(0.1, 0.9, 0.2, 1);
  overflow: hidden;
  will-change: transform, box-shadow;
}

/* Pressed State: Physically pushes DOWN 12px */
.giant-red-button:active .button-dome,
.giant-red-button.is-pressed .button-dome {
  transform: translateY(12px) scale(0.975);
  box-shadow: 
    0 4px 0 var(--gamee-red-deep),
    0 5px 2px rgba(0, 0, 0, 0.3),
    0 10px 20px rgba(239, 68, 68, 0.7),
    inset 0 2px 4px rgba(255, 255, 255, 0.25),
    inset 0 -4px 10px rgba(0, 0, 0, 0.6);
}

/* Rebound spring animation when released */
.giant-red-button.rebound .button-dome {
  animation: springBounce 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes springBounce {
  0% { transform: translateY(12px) scale(0.975); }
  60% { transform: translateY(-3px) scale(1.025); }
  85% { transform: translateY(1px) scale(0.995); }
  100% { transform: translateY(0) scale(1); }
}

/* Specular Curved Highlight */
.button-specular {
  position: absolute;
  top: 5%;
  left: 15%;
  right: 15%;
  height: 40%;
  border-radius: 50% / 35%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.05) 75%, transparent 100%);
  pointer-events: none;
}

/* ==========================================================================
   GAMEE LOGO IN THE CENTER
   ========================================================================== */
.button-emblem {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68%;
  height: 38%;
  max-width: 210px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 18px;
  border-radius: 36px;
  box-shadow: 
    0 6px 14px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(255, 255, 255, 0.8),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  transition: transform 0.08s ease;
}

.giant-red-button:active .button-emblem,
.giant-red-button.is-pressed .button-emblem {
  transform: scale(0.96);
}

.gamee-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  pointer-events: none;
}

/* Shockwave Ring inside dome on tap */
.touch-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.4);
}

.touch-ring.active {
  animation: shockwaveExpand 0.35s ease-out forwards;
}

@keyframes shockwaveExpand {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ==========================================================================
   FLOATING SCORE NUMBERS (+1, +2, CRITICAL!)
   ========================================================================== */
.floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: visible;
}

.floating-score {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 
    0 2px 4px rgba(0,0,0,0.6),
    0 0 12px var(--gamee-red);
  animation: floatPopUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
  pointer-events: none;
  white-space: nowrap;
}

.floating-score.bonus {
  font-size: 32px;
  color: #FDE047;
  text-shadow: 
    0 2px 6px rgba(0,0,0,0.7),
    0 0 16px rgba(245, 158, 11, 0.9);
}

.floating-score.critical {
  font-size: 36px;
  color: #FF4646;
  text-shadow: 
    0 3px 8px rgba(0,0,0,0.9),
    0 0 20px rgba(255, 70, 70, 1);
}

@keyframes floatPopUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) translateY(0);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.25) translateY(-12px);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift-x, 0px)), -50%) scale(0.95) translateY(-85px);
  }
}

/* ==========================================================================
   FOOTER & STATS BAR
   ========================================================================== */
.app-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(19, 27, 46, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(12px);
}

.stat-box {
  flex: 1;
  text-align: center;
}

.stat-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-white);
  font-family: var(--font-body);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.rank-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 8px;
  font-size: 11px;
  color: #FCA5A5;
}

/* Auto Click Simulator Drawer */
.autoclick-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.autoclick-panel.visible {
  display: flex;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auto-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #FCD34D;
}

.auto-speed-tag {
  background: rgba(245, 158, 11, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
}

.slider-wrapper {
  width: 100%;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gamee-gold);
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

/* ==========================================================================
   MODAL CONFIRMATION
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--gamee-dark-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gamee-red-light);
  font-size: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-white);
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  font-family: var(--font-body);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.btn-secondary, .btn-danger {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-main);
  transition: opacity 0.2s;
}

.btn-secondary {
  background: var(--gamee-dark-surface);
  color: var(--text-white);
}

.btn-danger {
  background: var(--gamee-red);
  color: #FFFFFF;
}

.btn-secondary:active, .btn-danger:active {
  opacity: 0.8;
}
