/* ==========================================================================
   BALOKDEN ARCADE - CERIA & MERIAH COLORFUL EDITION
   Vibrant, Cheerful Skeuomorphic Chrome with Explosive Animations & Confetti
   ========================================================================== */

:root {
  /* Cheerful Studio Backdrop */
  --bg-top: #fbfdff;
  --bg-mid: #eef3f9;
  --bg-bottom: #dde4ee;
  
  /* Chrome Metallic Gradients */
  --chrome-rim-light: #ffffff;
  --chrome-light: #f0f3f6;
  --chrome-mid: #c0c6ce;
  --chrome-dark: #828a95;
  --chrome-deep: #4f5660;
  
  /* Inner Inset Screen */
  --screen-bg: #090a0d;
  --screen-inset-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.95), inset 0 1px 2px rgba(0, 0, 0, 0.8);
  
  /* Typography */
  --font-main: 'Fredoka', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-digits: 'Outfit', 'Montserrat', sans-serif;

  /* Balokden Festive Jewel Colors */
  --c-magenta: #ff007f;
  --c-mint: #00f59b;
  --c-azure: #00d2ff;
  --c-coral: #ff4b4b;
  --c-amber: #ffc107;
  --c-blue: #3b82f6;
  --c-purple: #a855f7;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-main);
  background: radial-gradient(circle at 50% 25%, rgba(15, 23, 42, 0.72) 0%, rgba(9, 10, 15, 0.9) 100%),
              url('assets/balokden_bg.jpg') center/cover no-repeat fixed;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   CONFETTI CANVAS (FULLSCREEN VICTORY CELEBRATION)
   ========================================================================== */

.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1000;
}

/* ==========================================================================
   BACKGROUND 3D GEMS & SPARKLES
   ========================================================================== */

.background-gems {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.gem-svg-container {
  width: 100%;
  height: 100%;
}

@keyframes floatGentleLeft {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes floatGentleRight {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-2deg); }
}

.gems-left-group {
  animation: floatGentleLeft 6s ease-in-out infinite;
  transform-origin: 180px 380px;
}

.gems-right-group {
  animation: floatGentleRight 7s ease-in-out infinite;
  transform-origin: 820px 380px;
}

/* Sparkles pulsing */
@keyframes starTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.twinkle-star {
  animation: starTwinkle 2.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* ==========================================================================
   GAME WRAPPER & TOP NAV
   ========================================================================== */

.game-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  max-width: 1240px;
  width: 100%;
  max-height: 98vh;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin-bottom: 8px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  flex-shrink: 0;
  cursor: pointer;
}

.brand-logo-icon:hover {
  transform: scale(1.12) rotate(4deg);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.7), 0 0 0 2.5px rgba(255, 255, 255, 0.9);
}

.brand-text-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #ff1744 0%, #ff9100 25%, #ffd600 50%, #00e676 75%, #00f0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}

.mode-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff0077 0%, #7928ca 100%);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(121, 40, 202, 0.4), inset 0 1px 0 rgba(255,255,255,0.6);
  letter-spacing: 1px;
  animation: rainbowBorder 4s linear infinite;
}

.nav-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  background: linear-gradient(180deg, #ffffff 0%, #e2e6eb 100%);
  border: 1px solid #b5bcc5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12), inset 0 1px 0 #ffffff;
  border-radius: 18px;
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 700;
  color: #3b424d;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.mini-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f0f3f6 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}

.mini-btn:active {
  transform: translateY(1px) scale(0.98);
}

.mini-btn.highlight-btn {
  background: linear-gradient(180deg, #00b0ff 0%, #0070e0 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(0, 112, 224, 0.4), inset 0 1px 0 rgba(255,255,255,0.6);
  animation: pulseButton 2s infinite ease-in-out;
}

@keyframes pulseButton {
  0%, 100% { box-shadow: 0 4px 10px rgba(0, 112, 224, 0.3); }
  50% { box-shadow: 0 4px 16px rgba(0, 176, 255, 0.7); }
}

/* Status Banner */
.status-banner {
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid #00f0ff;
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.35);
  backdrop-filter: blur(5px);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 700;
  color: #e0faff;
  margin-bottom: 8px;
}

/* ==========================================================================
   1. SOLO STAGE LAYOUT (COMPACT & BALANCED)
   ========================================================================== */

.solo-stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left-column {
  width: 145px;
}

.right-column {
  width: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 590px;
}

/* ==========================================================================
   CHROME BEZEL DESIGN (PREMIUM GLOSSY SKEUOMORPHIC)
   ========================================================================== */

.chrome-frame {
  position: relative;
  border-radius: 26px;
  padding: 5px;
  background: linear-gradient(145deg, 
    #ffffff 0%, 
    #edf0f4 15%, 
    #c4cad2 45%, 
    #8b939f 80%, 
    #b0b6c1 100%
  );
  box-shadow: 
    0 16px 32px rgba(0, 0, 0, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.12),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.95),
    inset 0 -2px 3px rgba(60, 65, 75, 0.65),
    inset 1.5px 0 2px rgba(255, 255, 255, 0.7),
    inset -1.5px 0 2px rgba(80, 85, 95, 0.5);
  transition: transform 0.1s ease;
}

/* Screen Shake Effect during line clear / hard drop */
.screen-shake {
  animation: boardShakeAnim 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes boardShakeAnim {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-4px, 4px) rotate(-0.5deg); }
  30% { transform: translate(4px, -3px) rotate(0.5deg); }
  45% { transform: translate(-3px, 2px); }
  65% { transform: translate(2px, -2px); }
  85% { transform: translate(-1px, 1px); }
}

.chrome-bezel {
  border-radius: 22px;
  padding: 4px;
  background: linear-gradient(175deg, 
    #69717b 0%, 
    #8b939f 25%, 
    #b0b6c0 60%, 
    #d8dce2 90%, 
    #eef1f5 100%
  );
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 1px 1px rgba(255, 255, 255, 0.85);
}

.bezel-inner {
  border-radius: 18px;
  padding: 8px 8px 10px 8px;
  background: linear-gradient(180deg, #474d55 0%, #343940 50%, #24282e 100%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.frame-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 8px rgba(255, 255, 255, 0.25);
  margin-bottom: 6px;
  text-align: center;
}

/* Screen Container & Specular Glare */
.screen-container {
  position: relative;
  background: var(--screen-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--screen-inset-shadow);
  border: 1.5px solid #16181c;
}

.specular-glare {
  position: absolute;
  top: 5px;
  left: 7px;
  width: 14px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 75%);
  transform: rotate(-35deg);
  pointer-events: none;
  z-index: 5;
}

.screen-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 4;
}

/* Solo Sizing */
.hold-screen {
  width: 110px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.next-frame {
  height: 460px;
}

.next-frame .bezel-inner {
  height: 100%;
}

.next-screen {
  width: 110px;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stats Group */
.stats-frame .bezel-inner {
  padding: 10px 10px 12px 10px;
  gap: 8px;
}

.stat-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 2px;
}

.stat-display {
  width: 100%;
  background: #121417;
  border-radius: 8px;
  border: 1px solid #08090b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.25);
  padding: 4px 6px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-digits);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Solo Main Board */
.board-frame {
  border-radius: 30px;
  padding: 6px;
  box-shadow: 
    0 20px 42px rgba(0, 0, 0, 0.32),
    0 6px 12px rgba(0, 0, 0, 0.16),
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    inset 0 -3px 4px rgba(60, 65, 75, 0.7);
}

.board-frame .chrome-bezel { border-radius: 26px; padding: 5px; }
.board-frame .bezel-inner { border-radius: 20px; padding: 6px; }

.board-screen {
  width: 280px;
  height: 560px;
  border-radius: 14px;
  position: relative;
  background: #08090b;
}

#balokdenCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   DYNAMIC LINE CLEAR & COMBO ANIMATIONS
   ========================================================================== */

.line-clear-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}

/* Rainbow Neon Row Flash Animation */
.clear-flash-row {
  position: absolute;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%, 
    #ff1744 20%, 
    #ffd600 40%, 
    #00f0ff 60%, 
    #d500f9 80%, 
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow: 0 0 20px #00f0ff, 0 0 40px #ff0077, 0 0 60px #ffd600;
  animation: rowRainbowFlash 0.35s ease-out forwards;
}

@keyframes rowRainbowFlash {
  0% { opacity: 0.4; transform: scaleY(0.3) scaleX(0.8); filter: brightness(1.2); }
  50% { opacity: 1; transform: scaleY(1.3) scaleX(1); filter: brightness(2); }
  100% { opacity: 0; transform: scaleY(0.2) scaleX(1.05); filter: brightness(0.5); }
}

/* Flying Particle Debris Sparks */
.clear-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleBurst 0.5s ease-out forwards;
}

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

/* Floating Combo Banner */
.combo-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.combo-text {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  white-space: nowrap;
  animation: comboPopAnim 0.85s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes comboPopAnim {
  0% { opacity: 0; transform: scale(0.3) translateY(20px); }
  25% { opacity: 1; transform: scale(1.25) translateY(0); }
  50% { transform: scale(1) translateY(-6px); }
  80% { opacity: 1; transform: scale(1) translateY(-14px); }
  100% { opacity: 0; transform: scale(0.8) translateY(-30px); }
}

.combo-single {
  color: #00f0ff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.9), 0 2px 4px #000;
}

.combo-double {
  color: #00e676;
  text-shadow: 0 0 14px rgba(0, 230, 118, 0.9), 0 2px 4px #000;
}

.combo-triple {
  color: #ffd600;
  text-shadow: 0 0 16px rgba(255, 214, 0, 0.95), 0 2px 4px #000;
}

.combo-balokden {
  background: linear-gradient(135deg, #ff007f, #ffc107, #00f59b, #00d2ff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 32px;
  filter: drop-shadow(0 0 18px rgba(255, 0, 127, 0.8)) drop-shadow(0 0 25px rgba(0, 210, 255, 0.8));
}

/* Solo Pause Button */
.bottom-actions {
  display: flex;
  justify-content: flex-end;
  padding-right: 4px;
}

.chrome-btn-pause {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.chrome-btn-pause:hover { transform: scale(1.08); }
.chrome-btn-pause:active { transform: scale(0.92); }

.btn-bezel {
  border-radius: 16px;
  padding: 4px;
  background: linear-gradient(145deg, #ffffff 0%, #e2e5e9 20%, #b0b5be 50%, #7c838e 85%, #9aa1ab 100%);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22), inset 0 1.5px 2px #fff, inset 0 -2px 3px rgba(60, 65, 75, 0.65);
}

.btn-inner {
  width: 52px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(180deg, #4d5259 0%, #2f3338 60%, #1f2226 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-bars { display: flex; gap: 6px; }
.pause-bars .bar {
  width: 5px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #d8dbe0 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5), 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   2. BATTLE ARENA STAGE (DUAL BOARD EXPANDED ROOM & PROPORTIONS)
   ========================================================================== */

.battle-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 1140px;
}

/* Arena Room Header Bar */
.battle-room-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1040px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 8px 16px;
  backdrop-filter: blur(8px);
}

.room-info-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-pill-icon {
  font-size: 16px;
}

.room-pill-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
  text-transform: uppercase;
}

.room-pill-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 245, 155, 0.15);
  border: 1px solid rgba(0, 245, 155, 0.4);
  color: #00f59b;
  letter-spacing: 0.5px;
}

.room-live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.live-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f59b;
  box-shadow: 0 0 8px #00f59b;
  animation: livePulse 1.5s infinite;
}

.battle-arenas-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.battle-player-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 6px;
}

.player-tag {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.tag-you {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #e0f2fe;
  border: 1px solid #38bdf8;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.tag-opp {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #fee2e2;
  border: 1px solid #f87171;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.player-score {
  font-family: var(--font-digits);
  font-size: 14px;
  font-weight: 800;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.battle-columns {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mini-bezel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mini-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 1.5px;
}

.mini-screen {
  width: 80px;
  height: 70px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-screen-next {
  width: 80px;
  height: 210px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.battle-board-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.battle-board-frame {
  border-radius: 24px;
  padding: 5px;
}

.battle-board-frame .chrome-bezel { border-radius: 20px; padding: 4px; }
.battle-board-frame .bezel-inner { border-radius: 16px; padding: 4px; }

.battle-screen {
  width: 260px;
  height: 520px;
  border-radius: 12px;
  background: #08090b;
}

/* Garbage Meter Warning Bar */
.garbage-meter-container {
  width: 10px;
  height: 520px;
  background: #14171a;
  border-radius: 5px;
  border: 1px solid #2e343d;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
}

.garbage-bar {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #ff0055 0%, #ff5500 50%, #ffcc00 100%);
  border-radius: 5px;
  transition: height 0.2s ease;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.9);
}

/* Center Divider (VS Badge, Attack Text) */
.battle-center-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 72px;
}

.vs-badge {
  font-family: var(--font-digits);
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  color: #ff1744;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 0 14px rgba(255, 23, 68, 0.6);
  background: linear-gradient(145deg, #ffffff 0%, #e2e5e9 100%);
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,0.2), inset 0 2px 2px #fff;
}

.attack-alert {
  font-size: 11px;
  font-weight: 900;
  color: #ff0055;
  text-align: center;
  min-height: 18px;
  text-shadow: 0 0 10px rgba(255, 0, 85, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.attack-alert.active {
  opacity: 1;
  animation: attackShake 0.4s ease;
}

.btn-round-pause {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Battle Digital Timer Display */
.battle-timer-box {
  background: #0f1217;
  border-radius: 12px;
  border: 1.5px solid #28313e;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.25);
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 68px;
}

.timer-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #94a3b8;
}

.timer-digits {
  font-family: var(--font-digits);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  transition: color 0.2s ease;
}

.timer-digits.timer-urgent {
  color: #ff1744;
  text-shadow: 0 0 12px rgba(255, 23, 68, 0.9);
  animation: timerHurryPulse 0.6s infinite alternate;
}

@keyframes timerHurryPulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.12); filter: brightness(1.4); }
}

/* Choice Pill Buttons Group */
.time-btn-group {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.choice-pill-btn {
  flex: 1;
  background: #1b2027;
  border: 1px solid #333c48;
  border-radius: 8px;
  color: #cbd5e1;
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.choice-pill-btn:hover {
  background: #272f3a;
  color: #ffffff;
}

.choice-pill-btn.active {
  background: linear-gradient(180deg, #00b0ff 0%, #0066cc 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 3px 8px rgba(0, 102, 204, 0.45);
}

/* ==========================================================================
   MODE SELECTION MODAL & DIALOGS (EXPANDED & ULTRA-MODERN)
   ========================================================================== */

.dialog-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
}

.dialog-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dialog-header-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.dialog-header-icon:hover {
  transform: scale(1.08) rotate(3deg);
}

.dialog-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  text-align: center;
}

.pulse-soft {
  animation: softPulse 2.8s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.45));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 22px rgba(0, 240, 255, 0.8));
  }
}

.dialog-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.dialog-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  width: fit-content;
}

.btn-close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
  flex-shrink: 0;
}

.btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
  color: #ffffff;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.45);
}

/* Chrome Dialog Specific for Mode Selector (Expanded Width) */
.chrome-dialog.mode-dialog {
  max-width: 820px;
  width: 95vw;
  max-height: 92vh;
  padding: 8px;
  border-radius: 30px;
  background: linear-gradient(145deg, #ffffff 0%, #cbd5e1 30%, #38bdf8 65%, #1e293b 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 45px rgba(56, 189, 248, 0.22), inset 0 2px 2px #ffffff;
  display: flex;
  flex-direction: column;
}

.mode-dialog .dialog-bezel {
  max-height: calc(92vh - 16px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 26px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 0%, #172133 0%, #0d131f 55%, #080b12 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.mode-dialog .dialog-bezel::-webkit-scrollbar {
  width: 7px;
}
.mode-dialog .dialog-bezel::-webkit-scrollbar-track {
  background: rgba(10, 15, 25, 0.5);
  border-radius: 4px;
}
.mode-dialog .dialog-bezel::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 4px;
}
.mode-dialog .dialog-bezel::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.65);
}

.mode-dialog .dialog-title {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #bae6fd 60%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.4));
  margin: 0;
  line-height: 1.2;
}

.mode-dialog .dialog-sub {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

/* Modern Segmented Navigation Tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 6px 0 14px;
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 6px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tab-btn .tab-icon {
  font-size: 22px;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.2s ease;
}

.tab-btn .tab-label {
  font-size: 13px;
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 0.3px;
  white-space: nowrap;
  pointer-events: none;
}

.tab-btn .tab-sub {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  pointer-events: none;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateY(-1px);
}
.tab-btn:hover .tab-icon { transform: scale(1.12); }
.tab-btn:hover .tab-label { color: #ffffff; }

.tab-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.28) 0%, rgba(3, 105, 161, 0.5) 100%);
  border: 1px solid rgba(56, 189, 248, 0.7);
  box-shadow: 0 4px 18px rgba(2, 132, 199, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #ffffff;
}
.tab-btn.active .tab-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.8));
}
.tab-btn.active .tab-label {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}
.tab-btn.active .tab-sub {
  color: #7dd3fc;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: tabFadeIn 0.25s ease; }

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

.mode-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Mode Intro Banner */
.mode-intro-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mode-intro-icon {
  font-size: 30px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(14, 165, 233, 0.05));
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-heading {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 3px;
}

.card-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}

/* Mode Features Row */
.mode-features-row {
  display: flex;
  gap: 10px;
  margin: 2px 0 6px;
}

.mode-feature-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}

/* Speed Slider Controls */
.speed-control-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.speed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 800;
  color: #e2e8f0;
}

.speed-header .speed-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-badge {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  padding: 3px 12px;
  border-radius: 20px;
  font-family: var(--font-digits);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.chrome-slider {
  width: 100%;
  height: 8px;
  border-radius: 6px;
  background: #1e293b;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 6px 0;
  cursor: pointer;
}

.chrome-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #00d2ff);
  border: 2px solid #0088cc;
  box-shadow: 0 0 10px #00d2ff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.chrome-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  box-shadow: 0 0 16px #00d2ff;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.tick-chip {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  background: rgba(30, 41, 59, 0.6);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Battle Rules Strip */
.battle-rules-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.rule-chip {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 6px;
  border-radius: 10px;
  color: #cbd5e1;
}

.rule-chip.highlight-rule {
  background: rgba(255, 0, 127, 0.12);
  border-color: rgba(255, 0, 127, 0.35);
  color: #ff77ba;
}

.section-tag-row {
  margin-top: 4px;
  margin-bottom: 2px;
}

.section-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #38bdf8;
}

/* Option Grid (4-Column AI Difficulty Selector) */
.option-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.option-card {
  position: relative;
  background: rgba(17, 24, 39, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.option-card input { display: none; }

.option-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(25, 36, 56, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.opt-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  width: fit-content;
  margin-bottom: 6px;
}

.opt-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.opt-desc {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.35;
}

/* Difficulty Theme Accents */
.opt-easy .opt-badge {
  background: rgba(0, 245, 155, 0.15);
  color: #00f59b;
  border: 1px solid rgba(0, 245, 155, 0.35);
}
.opt-easy.active {
  border-color: #00f59b;
  background: rgba(0, 245, 155, 0.12);
  box-shadow: 0 0 18px rgba(0, 245, 155, 0.35);
}

.opt-normal .opt-badge {
  background: rgba(255, 214, 0, 0.15);
  color: #ffd600;
  border: 1px solid rgba(255, 214, 0, 0.35);
}
.opt-normal.active {
  border-color: #ffd600;
  background: rgba(255, 214, 0, 0.12);
  box-shadow: 0 0 18px rgba(255, 214, 0, 0.35);
}

.opt-hard .opt-badge {
  background: rgba(255, 75, 75, 0.15);
  color: #ff7878;
  border: 1px solid rgba(255, 75, 75, 0.35);
}
.opt-hard.active {
  border-color: #ff4b4b;
  background: rgba(255, 75, 75, 0.12);
  box-shadow: 0 0 18px rgba(255, 75, 75, 0.35);
}

.opt-master .opt-badge {
  background: rgba(192, 132, 252, 0.2);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.4);
}
.opt-master.active {
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.35);
}

/* Time Battle Controls Grid & Push-Pull */
.time-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.push-pull-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.push-pull-header {
  font-size: 11px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 6px;
}

.push-pull-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.push-pull-item {
  display: flex;
  gap: 8px;
  font-size: 10.5px;
  line-height: 1.4;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  padding: 7px 9px;
  border-radius: 8px;
}

.pp-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Local 2P Offline Card Layout */
.local-split-section {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 78, 59, 0.22) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.local-split-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.submode-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.submode-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.keyboard-controls-hint {
  display: flex;
  gap: 8px;
  margin: 2px 0;
}

.hint-item {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 5px;
}

.p-tag {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
}
.p-tag.p1 { background: #0284c7; color: #fff; }
.p-tag.p2 { background: #10b981; color: #fff; }

.mode-sub-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 12px;
}

.p2p-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.join-row {
  display: flex;
  gap: 6px;
  flex: 1;
}

.room-code-input {
  flex: 1;
  width: auto;
  font-family: var(--font-digits);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

.header-left-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f59b;
  box-shadow: 0 0 8px #00f59b;
  display: inline-block;
  animation: livePulse 1.5s infinite;
}

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

.refresh-lobby-btn {
  padding: 4px 10px;
  font-size: 11px;
}

/* Primary Action Buttons */
.mode-start-btn {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 13px 20px;
  border-radius: 12px;
  width: 100%;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  background: linear-gradient(135deg, #00f59b 0%, #00b0ff 100%);
  color: #041b24;
  box-shadow: 0 6px 20px rgba(0, 245, 155, 0.35);
}

.mode-start-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 8px 25px rgba(0, 245, 155, 0.55);
}

.mode-start-btn:active {
  transform: translateY(1px);
}

.btn-ai-gradient {
  background: linear-gradient(135deg, #ff007f 0%, #a855f7 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(255, 0, 127, 0.35);
}

.btn-ai-gradient:hover {
  box-shadow: 0 8px 25px rgba(255, 0, 127, 0.55);
}

.btn-time-gradient {
  background: linear-gradient(135deg, #00d2ff 0%, #3b82f6 100%);
  color: #041b24;
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.35);
}

.btn-time-gradient:hover {
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.55);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .chrome-dialog.mode-dialog {
    max-width: 96vw;
    width: 96vw;
  }
  .mode-dialog .dialog-bezel {
    padding: 16px 14px;
  }
  .mode-tabs {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .option-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .time-controls-grid,
  .push-pull-grid,
  .multi-choice-grid {
    grid-template-columns: 1fr;
  }
  .mode-intro-banner {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   TOUCH CONTROLS
   ========================================================================== */

/* ==========================================================================
   TOUCH CONTROLS (ON-SCREEN GAMEPAD)
   ========================================================================== */

.touch-controls {
  display: none;
  margin: 10px auto 0;
  gap: 6px;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
}

.t-btn {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border: 1px solid #475569;
  border-radius: 12px;
  color: #f8fafc;
  font-size: 17px;
  font-weight: 800;
  width: 48px;
  height: 46px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, filter 0.08s ease;
}

.t-btn:active {
  transform: scale(0.92) translateY(2px);
  filter: brightness(1.25);
}

.t-btn-accent {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.5), inset 0 1px 0 rgba(255,255,255,0.35);
}


/* ==========================================================================
   VICTORY & COMMON MODALS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 25, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.chrome-dialog {
  border-radius: 28px;
  padding: 6px;
  background: linear-gradient(145deg, #ffffff 0%, #d5dae0 40%, #89919c 100%);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 2px 2px #ffffff;
  max-width: 380px;
  width: 90%;
  transform: scale(0.92);
  transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-backdrop.active .chrome-dialog { transform: scale(1); }

/* Victory Festive Dialog */
.victory-icon-badge {
  font-size: 48px;
  animation: bounceTrophy 1.2s infinite ease-in-out;
  margin-bottom: 2px;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.12); }
}

.festive-title {
  background: linear-gradient(135deg, #ff1744, #ff9100, #ffd600, #00f0ff, #d500f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
}

.defeat-title {
  background: linear-gradient(135deg, #ff1744 0%, #ff5252 50%, #ff7979 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  filter: drop-shadow(0 2px 10px rgba(255, 23, 68, 0.6));
}

.dialog-bezel {
  border-radius: 22px;
  padding: 20px 18px;
  background: linear-gradient(180deg, #3d434a 0%, #202429 100%);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
  text-align: center;
}

.dialog-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 4px;
}

.dialog-sub {
  font-size: 12px;
  color: #a1aab4;
  margin-bottom: 12px;
}

.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.dialog-btn {
  background: linear-gradient(180deg, #5b626d 0%, #3e444d 100%);
  border: 1px solid #737b87;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: all 0.15s ease;
}

.dialog-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.dialog-btn:active { transform: translateY(1px); }

.dialog-btn.primary-btn {
  background: linear-gradient(180deg, #00b0ff 0%, #005ecc 100%);
  border-color: #38bdf8;
  box-shadow: 0 5px 14px rgba(0, 110, 230, 0.4), inset 0 1px 0 rgba(255,255,255,0.6);
}

.dialog-btn.secondary-btn {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
  border-color: #34d399;
}

.dialog-btn.danger-btn {
  background: linear-gradient(180deg, #ff4757 0%, #c0392b 100%);
  border-color: #ff6b81;
  box-shadow: 0 5px 14px rgba(235, 47, 6, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.dialog-btn.danger-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(235, 47, 6, 0.65);
}

.dialog-btn.btn-large {
  padding: 12px 16px;
  font-size: 13.5px;
}

.keys-legend {
  margin-top: 14px;
  border-top: 1px solid #333a42;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  text-align: left;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  color: #cbd5e1;
}

.legend-row span:first-child {
  font-weight: 700;
  color: #38bdf8;
}

.results-box {
  background: #14171a;
  border-radius: 12px;
  border: 1px solid #282d33;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
}

.res-val {
  font-family: var(--font-digits);
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.res-val.highlight {
  color: #ffd600;
  text-shadow: 0 0 10px rgba(255, 214, 0, 0.6);
}

/* ==========================================================================
   MULTIPLAYER ONLINE / WIFI LOBBY & REFRESH RESUME MODALS
   ========================================================================== */

.lobby-header-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.lobby-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.lobby-field label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.code-input {
  background: #0f172a;
  border: 1px solid #334155;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  outline: none;
  transition: all 0.2s ease;
}

.code-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.code-input.text-left {
  text-align: left;
}

.chrome-select {
  background: #0f172a;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chrome-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.chrome-select option {
  background: #0f172a;
  color: #ffffff;
}

.online-list-wrapper {
  background: rgba(10, 15, 25, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
}

.online-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-players-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.online-players-container::-webkit-scrollbar {
  width: 6px;
}
.online-players-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.empty-lobby-msg {
  padding: 24px 12px;
  text-align: center;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.empty-lobby-msg .icon {
  font-size: 32px;
}

.empty-lobby-msg p {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.empty-lobby-msg small {
  font-size: 11px;
  color: #64748b;
}

.player-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.player-card-item:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.player-card-item.is-busy {
  opacity: 0.65;
  background: rgba(15, 23, 42, 0.5);
}

.p-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p-avatar {
  font-size: 22px;
  background: rgba(0, 0, 0, 0.4);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.p-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.p-name {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.p-meta {
  margin-top: 2px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.status-ready {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.4);
}

.status-busy {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.challenge-btn {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.disabled-btn {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Modals Enhancements */
.invite-dialog, .resume-dialog {
  max-width: 420px;
  width: 90%;
}

.invite-icon-badge, .resume-icon-badge {
  font-size: 44px;
  margin-bottom: 6px;
  animation: bounceTrophy 1.5s infinite ease-in-out;
}

.invite-info-card {
  background: #111418;
  border: 1px solid #282f38;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

.invite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #94a3b8;
}

.invite-row strong {
  font-size: 13px;
  font-weight: 800;
}

.highlight-yellow {
  color: #ffd600;
  text-shadow: 0 0 8px rgba(255, 214, 0, 0.5);
}

.highlight-cyan {
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

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

.dialog-actions-row .flex-1 {
  flex: 1;
}

.spinner-pulse {
  font-size: 40px;
  animation: pulseSpin 1.8s infinite ease-in-out;
  margin-bottom: 8px;
}

@keyframes pulseSpin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}



/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */

@media (max-height: 740px) {
  .game-wrapper {
    transform: scale(0.88);
    transform-origin: center top;
  }
}

@media (max-width: 1180px) {
  .battle-stage {
    transform: scale(0.92);
    transform-origin: top center;
  }
}

@media (max-width: 980px) {
  .battle-stage {
    transform: scale(0.82);
    transform-origin: top center;
  }
}

/* ==========================================================================
   ANDROID & MOBILE BROWSER RESPONSIVE RULES (VS LAPTOP VIEW)
   ========================================================================== */

@media (max-width: 820px), ((max-width: 1024px) and (pointer: coarse)) {
  body {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 12px)) !important;
  }

  .game-wrapper {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 12px)) !important;
  }

  .solo-stage {
    gap: 8px;
    transform: scale(0.85);
    transform-origin: top center;
  }

  .battle-stage {
    transform: scale(0.88);
    transform-origin: top center;
    width: 100%;
  }

  .left-column, .right-column { width: 110px; }
  .hold-screen, .next-screen { width: 95px; }

  /* 1. KONTROL NAVIGASI BERADA DI POSISI PALING BAWAH LAYAR */
  .touch-controls {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 10px)) 8px !important;
    background: linear-gradient(180deg, rgba(13, 17, 24, 0.96) 0%, rgba(6, 9, 14, 0.99) 100%) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    border-top: 1.5px solid rgba(0, 245, 155, 0.45) !important;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.85), 0 -1px 12px rgba(0, 245, 155, 0.25) !important;
    z-index: 9999 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    box-sizing: border-box !important;
  }

  .t-btn {
    flex: 1 1 0 !important;
    min-width: 36px !important;
    max-width: 54px !important;
    height: 48px !important;
    border-radius: 14px !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
  }

  /* Susunan Tombol: Sisi Kiri untuk Gerak, Sisi Kanan untuk Aksi/Putar */
  #tLeft { order: 1; background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important; color: #f8fafc !important; border-color: #475569 !important; }
  #tRight { order: 2; background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important; color: #f8fafc !important; border-color: #475569 !important; }
  #tDown { order: 3; background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important; color: #f8fafc !important; border-color: #475569 !important; margin-right: 6px !important; }
  #tRotCcw { order: 4; background: linear-gradient(180deg, #065f46 0%, #064e3b 100%) !important; color: #34d399 !important; border-color: #059669 !important; }
  #tRotCw { order: 5; background: linear-gradient(180deg, #065f46 0%, #064e3b 100%) !important; color: #34d399 !important; border-color: #059669 !important; }
  #tDrop { order: 6; background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important; color: #ffffff !important; border-color: #38bdf8 !important; }
  #tHold { order: 7; background: linear-gradient(180deg, #d97706 0%, #b45309 100%) !important; color: #ffffff !important; border-color: #f59e0b !important; }

  /* 2. PADA BROWSER ANDROID: PEMAIN BERADA DI POSISI BAWAH */
  .battle-arenas-row {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  /* Lawan (P2 / AI / WiFi) berada di posisi ATAS */
  #p2Side {
    order: 1 !important;
  }

  /* Indikator VS dan Timer berada di posisi TENGAH */
  .battle-center-divider {
    order: 2 !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
    width: 100% !important;
    min-width: unset !important;
    margin: 6px 0 !important;
  }

  /* Pemain Utama (P1 / Anda) berada di posisi BAWAH (dekat dengan kontrol sentuh) */
  #p1Side {
    order: 3 !important;
  }
}

/* Dukungan Selector Class Mobile Device */
html.is-mobile-device body {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 12px)) !important;
}

html.is-mobile-device .game-wrapper {
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 12px)) !important;
}

html.is-mobile-device .touch-controls {
  display: flex !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 10px)) 8px !important;
  background: linear-gradient(180deg, rgba(13, 17, 24, 0.96) 0%, rgba(6, 9, 14, 0.99) 100%) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  border-top: 1.5px solid rgba(0, 245, 155, 0.45) !important;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.85), 0 -1px 12px rgba(0, 245, 155, 0.25) !important;
  z-index: 9999 !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  box-sizing: border-box !important;
}

html.is-mobile-device .battle-arenas-row {
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
}

html.is-mobile-device #p2Side {
  order: 1 !important;
}

html.is-mobile-device .battle-center-divider {
  order: 2 !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 14px !important;
  width: 100% !important;
  min-width: unset !important;
  margin: 6px 0 !important;
}

html.is-mobile-device #p1Side {
  order: 3 !important;
}

/* 3. TAMPILAN LEPTOP / DESKTOP NORMAL SEPERTI BIASA */
@media (min-width: 821px) {
  html:not(.is-mobile-device) .touch-controls {
    display: none !important;
    position: static !important;
  }

  html:not(.is-mobile-device) .battle-arenas-row {
    flex-direction: row !important;
    gap: 14px !important;
  }

  html:not(.is-mobile-device) #p1Side {
    order: 1 !important;
  }

  html:not(.is-mobile-device) .battle-center-divider {
    order: 2 !important;
    flex-direction: column !important;
  }

  html:not(.is-mobile-device) #p2Side {
    order: 3 !important;
  }
}


/* ==========================================================================
   MATCH CONCLUDED / REMATCH DECLINED MODAL STYLES
   ========================================================================== */
.match-finished-dialog {
  max-width: 440px;
  width: 92%;
  background: linear-gradient(135deg, rgba(20, 24, 34, 0.98), rgba(12, 14, 20, 0.98));
  border: 1px solid rgba(255, 75, 75, 0.35);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 75, 75, 0.22);
}

.finished-icon-badge {
  font-size: 52px;
  margin-bottom: 8px;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(255, 75, 75, 0.65));
  animation: finishedPulse 2s infinite ease-in-out;
}

@keyframes finishedPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 75, 75, 0.5)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 24px rgba(255, 75, 75, 0.85)); }
}

.match-finished-card {
  background: rgba(14, 18, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
  margin: 14px 0 12px;
  padding: 12px 16px;
}

.highlight-red {
  color: #ff4757 !important;
  font-weight: 800;
  text-shadow: 0 0 12px rgba(255, 71, 87, 0.7);
}

.finished-note {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 16px;
  line-height: 1.45;
}

.refresh-pulse-icon {
  font-size: 48px;
  margin-bottom: 8px;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.7));
  animation: refreshSpinPulse 2.5s infinite ease-in-out;
}

@keyframes refreshSpinPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.5)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.9)); }
}

/* ==========================================================================
   KEAMANAN & PROTEKSI KODE / KONTEN (ANTI-SELECT, ANTI-COPY, ANTI-DRAG)
   ========================================================================== */
html, body, main, div, canvas, span, h1, h2, h3, h4, p, button, header, section, footer {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

input[type="text"], input[type="search"], textarea {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

img, canvas, svg {
  -webkit-user-drag: none !important;
  user-drag: none !important;
}

/* Floating Security Toast Notification */
.security-toast-alert {
  display: none !important;
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px) scale(0.95);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(239, 68, 68, 0.6);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.85), 0 0 22px rgba(239, 68, 68, 0.4);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 30px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 99999999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.security-toast-alert.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.security-toast-alert .sec-toast-icon {
  font-size: 16px;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9));
}

.security-toast-alert .sec-toast-text {
  color: #fca5a5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}


