/* ==========================================================================
   STYLE DAYLIGHT MODE - GAMIFIKASI TARIK TAMBANG DIGITAL
   Desain Khusus Papan Interaktif Digital (PID) 4K & Smartphone Siswa
   SMK AL-WAFA - Arsitektur Von Neumann & Sistem Operasi
   ========================================================================== */

:root {
  /* Daylight Palette */
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-sky: #E0F2FE;
  
  /* Primary Daylight Accents */
  --sky-blue: #0EA5E9;
  --sky-blue-hover: #0284C7;
  --grass-green: #10B981;
  --grass-dark: #059669;
  --grass-light: #34D399;
  --mud-pit: #78350F;
  --mud-bg: #92400E;
  
  /* Team Branding */
  --blue-team: #0284C7;
  --blue-team-light: #38BDF8;
  --blue-team-bg: #E0F2FE;
  --blue-team-border: #7DD3FC;
  
  --red-team: #E11D48;
  --red-team-light: #FB7185;
  --red-team-bg: #FFE4E6;
  --red-team-border: #FDA4AF;
  
  /* Neutral Text & Borders */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-light: #FFFFFF;
  --border-light: #E2E8F0;
  --border-focus: #CBD5E1;
  
  /* Status Colors */
  --gold-accent: #F59E0B;
  --gold-glow: rgba(245, 158, 11, 0.4);
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.12), 0 6px 14px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 35px -8px rgba(15, 23, 42, 0.18);
  --shadow-team-blue: 0 8px 24px rgba(2, 132, 199, 0.25);
  --shadow-team-red: 0 8px 24px rgba(225, 29, 72, 0.25);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse at 10% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 0%, rgba(225, 29, 72, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.06) 0%, transparent 60%);
}

/* ==========================================================================
   BUTTONS & FORM ELEMENTS (TOUCH FRIENDLY MIN 48PX)
   ========================================================================== */
button {
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  padding: 10px 20px;
  font-size: 0.95rem;
  user-select: none;
}

button:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--sky-blue), var(--sky-blue-hover));
  color: white;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue-team), #0369A1);
  color: white;
  box-shadow: var(--shadow-team-blue);
}
.btn-blue:hover {
  filter: brightness(1.08);
}

.btn-red {
  background: linear-gradient(135deg, var(--red-team), #BE123C);
  color: white;
  box-shadow: var(--shadow-team-red);
}
.btn-red:hover {
  filter: brightness(1.08);
}

.btn-success {
  background: linear-gradient(135deg, var(--grass-green), var(--grass-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-outline {
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--border-focus);
}

.btn-power-pull {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  min-height: 54px;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
  animation: pulse-power 1.5s infinite;
}

@keyframes pulse-power {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 25px rgba(239, 68, 68, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
}

/* ==========================================================================
   KOMPONEN GEMBOK DIGITAL 3D/NEON (DAYLIGHT EDITION)
   ========================================================================== */
.digital-padlock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}

.padlock-wrapper {
  position: relative;
  width: 90px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.padlock-shackle {
  position: absolute;
  top: 4px;
  width: 52px;
  height: 52px;
  border: 10px solid #64748B;
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: top left;
}

.padlock-body {
  position: absolute;
  bottom: 6px;
  width: 76px;
  height: 62px;
  background: linear-gradient(145deg, #FFFFFF, #E2E8F0);
  border: 3px solid #94A3B8;
  border-radius: 16px;
  box-shadow: 
    0 8px 18px rgba(15, 23, 42, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 2;
  transition: all 0.4s ease;
}

.padlock-core {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0F172A;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.padlock-core::after {
  content: "";
  position: absolute;
  bottom: -4px;
  width: 5px;
  height: 8px;
  background: #0F172A;
}

.padlock-led {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #EF4444;
  box-shadow: 0 0 10px #EF4444;
  transition: all 0.3s;
}

/* State: Terbuka (Unlocked) */
.padlock-wrapper.unlocked .padlock-shackle {
  transform: translateY(-20px) rotate(-35deg);
  border-color: #10B981;
}

.padlock-wrapper.unlocked .padlock-body {
  border-color: #10B981;
  background: linear-gradient(145deg, #ECFDF5, #D1FAE5);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.padlock-wrapper.unlocked .padlock-led {
  background: #10B981;
  box-shadow: 0 0 14px #10B981;
}

.padlock-badge {
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #FEE2E2;
  color: #991B1B;
  transition: all 0.3s;
}

.padlock-wrapper.unlocked + .padlock-badge {
  background: #D1FAE5;
  color: #065F46;
}

/* Shake Animation when wrong */
.padlock-shake {
  animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ==========================================================================
   ARENA TARIK TAMBANG 2D DAYLIGHT (PID MONITORING)
   ========================================================================== */
.tug-arena-container {
  width: 100%;
  position: relative;
  background: linear-gradient(180deg, #BAE6FD 0%, #E0F2FE 45%, #10B981 46%, #059669 100%);
  border-radius: 24px;
  border: 4px solid #FFFFFF;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Sky & Awan Cerah */
.arena-sky {
  height: 140px;
  position: relative;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50px;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.15);
  animation: float-clouds linear infinite;
}

.cloud-1 { top: 20px; left: -100px; width: 140px; height: 45px; animation-duration: 38s; }
.cloud-2 { top: 60px; left: -150px; width: 200px; height: 55px; animation-duration: 52s; animation-delay: 8s; }
.cloud-3 { top: 30px; left: -120px; width: 120px; height: 40px; animation-duration: 44s; animation-delay: 20s; }

@keyframes float-clouds {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 250px)); }
}

/* Rumput & Lapangan Tarik Tambang */
.arena-pitch {
  position: relative;
  height: 280px;
  background: 
    linear-gradient(180deg, #10B981 0%, #059669 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0px, rgba(255, 255, 255, 0.08) 40px, transparent 40px, transparent 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Garis Tengah Lapangan */
.center-line-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 6px;
  background: #EF4444;
  transform: translateX(-50%);
  z-index: 5;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.center-line-marker::before {
  content: "GARIS TENGAH";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #EF4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Zona Lumpur Kiri & Kanan (-300px & +300px) */
.mud-pit-left, .mud-pit-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 140px;
  background: radial-gradient(ellipse at center, #78350F 0%, #451A03 100%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FEF3C7;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  border: 3px dashed #B45309;
}

.mud-pit-left { left: 0; border-radius: 0 20px 20px 0; }
.mud-pit-right { right: 0; border-radius: 20px 0 0 20px; }

/* TALI TAMBANG DINAMIS & KARAKTER */
.rope-assembly {
  position: absolute;
  left: 50%;
  width: 900px;
  height: 200px;
  transform: translateX(calc(-50% + var(--rope-offset, 0px)));
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Gambar Tali Tebal */
.rope-strand {
  position: absolute;
  width: 100%;
  height: 20px;
  background: repeating-linear-gradient(45deg, #D97706, #D97706 15px, #B45309 15px, #B45309 30px);
  border-radius: 10px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

/* Pita Merah di Tengah Tali */
.rope-center-ribbon {
  position: absolute;
  top: -16px;
  left: 50%;
  width: 18px;
  height: 52px;
  background: #E11D48;
  transform: translateX(-50%);
  border-radius: 4px;
  z-index: 15;
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.5);
}

.rope-center-ribbon::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: #E11D48 transparent transparent transparent;
}

/* KARAKTER TIM BIRU (GARUDA DIGITAL) */
.team-squad {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 12;
}

.squad-blue {
  right: calc(50% + 50px);
  flex-direction: row-reverse;
}

.squad-red {
  left: calc(50% + 50px);
  flex-direction: row;
}

.puller-character {
  width: 75px;
  height: 110px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.puller-blue {
  animation: pull-strain-left 0.8s infinite alternate ease-in-out;
}

.puller-red {
  animation: pull-strain-right 0.8s infinite alternate ease-in-out;
}

@keyframes pull-strain-left {
  0% { transform: rotate(10deg) translateX(0); }
  100% { transform: rotate(18deg) translateX(-6px); }
}

@keyframes pull-strain-right {
  0% { transform: rotate(-10deg) translateX(0); }
  100% { transform: rotate(-18deg) translateX(6px); }
}

/* ==========================================================================
   SCOREBOARD & CYBER-ENGINE GAUGE
   ========================================================================== */
.scoreboard-card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 16px 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.team-badge-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-radius: 16px;
  min-width: 200px;
}

.badge-garuda {
  background: var(--blue-team-bg);
  border: 2px solid var(--blue-team-border);
}

.badge-rajawali {
  background: var(--red-team-bg);
  border: 2px solid var(--red-team-border);
}

.cyber-engine-meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.engine-bar-track {
  height: 14px;
  background: var(--bg-subtle);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.engine-bar-fill-blue {
  height: 100%;
  background: linear-gradient(90deg, #38BDF8, #0284C7);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.engine-bar-fill-red {
  height: 100%;
  background: linear-gradient(90deg, #FB7185, #E11D48);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* ==========================================================================
   CANVAS CONFETTI FULLSCREEN
   ========================================================================== */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* ==========================================================================
   MODAL PEMBAHASAN HOTS & OVERLAY
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

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

.modal-card {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid var(--border-light);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

/* RESPONSIVE UTILITIES */
@media (max-width: 768px) {
  .puller-character {
    width: 50px;
    height: 80px;
  }
  .arena-pitch {
    height: 220px;
  }
  .scoreboard-card {
    flex-direction: column;
    gap: 12px;
  }
}
