/* ========================================================
   GAME RANTAI MAKANAN SD - STYLESHEET
   Desain Responsif 16:9 Khusus Layar Sentuh / TV Interaktif Kelas
   ======================================================== */

:root {
  /* Palet Warna Alam & Ceria (High Contrast, Child-Friendly) */
  --bg-deep: #143221;
  --bg-card: #ffffff;
  --text-dark: #1b382b;
  --text-light: #ffffff;
  
  --color-green-nature: #2a9d8f;
  --color-green-grass: #40916c;
  --color-green-bright: #2dc653;
  --color-green-dark: #1b4332;
  
  --color-amber-gold: #ffb703;
  --color-orange-sun: #fb8500;
  --color-coral: #e76f51;
  --color-red-soft: #e63946;
  
  --color-blue-sky: #0284c7;
  --color-blue-deep: #0369a1;
  --color-purple: #7209b7;
  
  /* Warna Peran Makhluk Hidup */
  --role-produsen: #2e7d32;
  --role-konsumen-1: #e65100;
  --role-konsumen-2: #0277bd;
  --role-konsumen-3: #6a1b9a;
  --role-konsumen-final: #c62828;
  --role-dekomposer: #5d4037;

  /* Font Sistem Ramah Anak */
  --font-main: 'Comfortaa', 'Nunito', 'Comic Neue', 'Chalkboard SE', 'Arial Rounded MT Bold', system-ui, -apple-system, sans-serif;
  
  /* Shadow & Radii Tactile */
  --radius-card: clamp(14px, 1.6vw, 24px);
  --radius-btn: 999px;
  --radius-pill: 999px;
  --shadow-btn: 0 6px 0 rgba(0, 0, 0, 0.25), 0 10px 18px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
  --shadow-card-drag: 0 18px 36px rgba(0, 0, 0, 0.35), 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Reset Dasar */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

img, video {
  -webkit-user-drag: none;
  user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-deep);
  font-family: var(--font-main);
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

/* ========================================================
   CONTAINER UTAMA (16:9 ASPECT RATIO LOCKED)
   ======================================================== */
.game-app {
  position: relative;
  /* Skala otomatis pas di 16:9 tanpa scroll pada layar apapun */
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  background: radial-gradient(circle at 50% 20%, #40916c 0%, #1e5538 60%, #113420 100%);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  border-radius: clamp(0px, 1vw, 16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Pola Daun Halus di Latar Belakang */
.game-app::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.08) 0%, transparent 35%);
  pointer-events: none;
  z-index: 1;
}

/* Layar Abstrak */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 5;
  padding: clamp(16px, 2.2vh, 32px) clamp(24px, 3vw, 48px);
}

.screen.active {
  display: flex;
}

/* ========================================================
   TOMBOL BESAR & TACTILE (MIN. 80PX TINGGI DI 1080P)
   ======================================================== */
button {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 16px);
  font-weight: 800;
  border-radius: var(--radius-btn);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  line-height: 1;
}

/* Tombol Utama (Besar, Ceria) */
.btn-primary {
  background: linear-gradient(180deg, #ffca3a 0%, #ff9f1c 100%);
  color: #4a2800;
  box-shadow: 0 7px 0 #cc6f00, 0 12px 24px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #cc6f00, 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Ukuran Tombol Besar (Min 80px di 1080p) */
.btn-big {
  min-height: clamp(64px, 8.2vh, 92px);
  padding: 0 clamp(32px, 3.5vw, 64px);
  font-size: clamp(24px, 2.4vw, 36px);
  letter-spacing: 0.5px;
}

/* Tombol Sekunder */
.btn-secondary {
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  color: #1e3a2b;
  min-height: clamp(54px, 6.8vh, 76px);
  padding: 0 clamp(20px, 2vw, 36px);
  font-size: clamp(18px, 1.7vw, 26px);
  box-shadow: 0 5px 0 #94a3b8, 0 8px 16px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #94a3b8, 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Tombol Suara (ON / OFF) */
.btn-sound {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  min-height: clamp(52px, 6.5vh, 72px);
  padding: 0 clamp(16px, 1.6vw, 28px);
  font-size: clamp(18px, 1.6vw, 24px);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-sound.muted {
  background: rgba(230, 57, 70, 0.45);
  border-color: #ff99a8;
}

.btn-sound:active {
  transform: scale(0.96);
}

/* ========================================================
   1. LAYAR AWAL (START SCREEN)
   ======================================================== */
.screen-start {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  background: radial-gradient(circle at 50% 30%, #38a374 0%, #1c5237 70%, #0d2c1c 100%);
  z-index: 10;
  overflow: hidden;
}

/* Video Loop Background */
.bg-video-loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
}

/* Lapisan Gelap Transparan agar Teks & Tombol Tetap Kontras & Jelas di TV */
.video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 35, 20, 0.42) 0%, rgba(10, 35, 20, 0.52) 100%);
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
  z-index: 2;
  pointer-events: none;
}

.start-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.start-header-right {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 18px);
}

.btn-about {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  padding: clamp(6px, 0.8vh, 10px) clamp(14px, 1.5vw, 22px);
  font-size: clamp(14px, 1.3vw, 19px);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.btn-about:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
}

.btn-about:active {
  transform: scale(0.96);
}

.btn-fullscreen {
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  padding: clamp(6px, 0.8vh, 10px) clamp(14px, 1.5vw, 22px);
  font-size: clamp(14px, 1.3vw, 19px);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.btn-fullscreen:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

.start-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90%;
  gap: clamp(10px, 1.8vh, 22px);
  position: relative;
  z-index: 10;
}

.start-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 10;
}

.footer-tip {
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

.footer-copyright {
  font-size: clamp(11px, 0.95vw, 14px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.3px;
}

.start-badge {
  background: #ffb703;
  color: #3b2200;
  font-size: clamp(16px, 1.5vw, 24px);
  font-weight: 900;
  padding: clamp(6px, 0.8vh, 12px) clamp(18px, 1.8vw, 32px);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.start-title {
  font-size: clamp(38px, 4.6vw, 76px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), 0 2px 0 #1b4332;
  letter-spacing: 2px;
  line-height: 1.1;
}

.start-subtitle {
  font-size: clamp(20px, 2vw, 32px);
  color: #d8f3dc;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.start-decorations {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.2vw, 20px);
  margin: clamp(4px, 0.8vh, 14px) 0;
}

.floating-emoji {
  font-size: clamp(36px, 3.8vw, 64px);
  display: inline-block;
  animation: floatBounce 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}

.floating-emoji:nth-child(3) { animation-delay: 0.4s; }
.floating-emoji:nth-child(5) { animation-delay: 0.8s; }
.floating-emoji:nth-child(7) { animation-delay: 1.2s; }
.floating-emoji:nth-child(9) { animation-delay: 1.6s; }
.floating-emoji:nth-child(11) { animation-delay: 2.0s; }

.floating-arrow {
  font-size: clamp(20px, 2.2vw, 36px);
  color: #ffb703;
  font-weight: 900;
}

@keyframes floatBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-12px); }
}

.start-info-card {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: clamp(12px, 1.4vh, 20px) clamp(24px, 2.4vw, 44px);
  border-radius: var(--radius-card);
  font-size: clamp(18px, 1.7vw, 26px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 850px;
}

/* ========================================================
   1B. LAYAR PILIH EKOSISTEM (ECOSYSTEM SELECT SCREEN)
   ======================================================== */
.screen-ecosystem {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(16px, 2.4vh, 28px) clamp(24px, 3.2vw, 48px);
  background: radial-gradient(circle at 50% 25%, rgba(20, 68, 44, 0.92) 0%, rgba(12, 38, 24, 0.96) 65%, rgba(6, 20, 12, 1) 100%),
              url('assets/bg-start.jpg') center/cover no-repeat;
  overflow: hidden;
  z-index: 10;
}

.screen-ecosystem.active {
  display: flex;
  animation: fadeInModal 0.25s ease-out;
}

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

.eco-title-group {
  text-align: center;
  flex: 1;
}

.eco-title {
  font-size: clamp(26px, 2.8vw, 44px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 230, 100, 0.3);
  letter-spacing: 0.5px;
}

.eco-subtitle {
  font-size: clamp(15px, 1.4vw, 22px);
  color: #d8f3dc;
  font-weight: 700;
  margin-top: 4px;
}

.eco-header-spacer {
  width: clamp(90px, 9vw, 130px);
}

.eco-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.2vw, 36px);
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  flex: 1;
  align-items: stretch;
  padding: clamp(12px, 1.8vh, 24px) 0;
}

.eco-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 249, 244, 0.94) 100%);
  border: 3.5px solid rgba(255, 255, 255, 0.85);
  border-radius: clamp(18px, 2.2vw, 32px);
  padding: clamp(16px, 2.2vh, 26px) clamp(16px, 1.8vw, 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(8px, 1.1vh, 14px);
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.18s, border-color 0.18s;
  position: relative;
}

.eco-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.45);
  border-color: #ffca3a;
}

.eco-card:active {
  transform: translateY(2px) scale(0.99);
}

.eco-card-sawah  { border-color: #52b788; }
.eco-card-hutan  { border-color: #2d6a4f; }
.eco-card-laut   { border-color: #0284c7; }

.eco-badge {
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 900;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
}

.badge-mudah     { background: #d8f3dc; color: #1b4332; }
.badge-sedang    { background: #fef08a; color: #713f12; }
.badge-menantang { background: #fee2e2; color: #991b1b; }

.eco-icon {
  font-size: clamp(48px, 5.2vw, 76px);
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
  margin: 4px 0;
}

.eco-card-title {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 900;
  color: #1b4332;
  line-height: 1.15;
}

.eco-card-desc {
  font-size: clamp(13px, 1.2vw, 16px);
  color: #475569;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
}

.eco-card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.eco-rounds-count {
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 800;
  color: #64748b;
}

.btn-eco-play {
  width: 100%;
  min-height: clamp(46px, 5.8vh, 60px);
  font-size: clamp(16px, 1.5vw, 22px);
  border-radius: var(--radius-pill);
}

/* ========================================================
   2. LAYAR PERMAINAN (GAMEPLAY SCREEN)
   ======================================================== */
.screen-game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  justify-content: flex-start;
  gap: clamp(8px, 1.2vh, 16px);
  background: radial-gradient(circle at 50% 25%, rgba(26, 74, 48, 0.88) 0%, rgba(14, 44, 28, 0.94) 65%, rgba(8, 26, 16, 0.98) 100%),
              url('assets/bg-start.jpg') center/cover no-repeat;
  overflow: hidden;
  z-index: 10;
}

/* Topbar Header */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: linear-gradient(180deg, rgba(20, 58, 38, 0.92) 0%, rgba(11, 35, 22, 0.96) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: clamp(14px, 1.6vw, 24px);
  padding: clamp(8px, 1vh, 14px) clamp(16px, 1.8vw, 28px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  flex-shrink: 0;
}

#btn-home-game {
  min-height: clamp(40px, 4.8vh, 50px);
  padding: 0 clamp(16px, 1.6vw, 24px);
  font-size: clamp(15px, 1.4vw, 20px);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 18px);
  flex-shrink: 0;
}

.round-badge {
  background: linear-gradient(180deg, #ffca3a 0%, #ff9f1c 100%);
  color: #3f2200;
  font-size: clamp(15px, 1.4vw, 22px);
  font-weight: 900;
  padding: clamp(6px, 0.8vh, 10px) clamp(14px, 1.4vw, 22px);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

.chain-title {
  font-size: clamp(22px, 2.3vw, 38px);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 230, 100, 0.3);
  text-align: center;
  letter-spacing: 0.5px;
}

/* Papan Skor */
.scoreboard {
  display: flex;
  align-items: center;
  gap: clamp(8px, 0.8vw, 14px);
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  padding: clamp(5px, 0.6vh, 9px) clamp(10px, 1vw, 16px);
  border-radius: var(--radius-pill);
  font-size: clamp(16px, 1.4vw, 22px);
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.score-total {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.45) 0%, rgba(251, 133, 0, 0.45) 100%);
  border-color: #ffb703;
}

.score-total .score-value {
  color: #ffe680;
  font-size: clamp(18px, 1.6vw, 26px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Area Balon Bantuan (Hint Bubble) */
.hint-bubble {
  display: none;
  align-items: center;
  width: 100%;
  background: linear-gradient(90deg, #fff3cd 0%, #ffecb5 100%);
  border: 3px solid #ffc107;
  border-radius: clamp(12px, 1.4vw, 18px);
  padding: clamp(8px, 1.1vh, 14px) clamp(16px, 1.6vw, 24px);
  gap: clamp(10px, 1.2vw, 18px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  animation: slideDownHint 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 20;
}

.hint-bubble.show {
  display: flex;
}

@keyframes slideDownHint {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.hint-avatar {
  font-size: clamp(26px, 2.6vw, 40px);
  animation: pulseAvatar 1.5s infinite;
}

@keyframes pulseAvatar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.hint-content {
  flex: 1;
}

.hint-title {
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 900;
  color: #856404;
  text-transform: uppercase;
}

.hint-message {
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 800;
  color: #533f03;
  line-height: 1.25;
}

.btn-close-hint {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  font-size: clamp(18px, 1.6vw, 26px);
  font-weight: 900;
  width: clamp(36px, 4vh, 48px);
  height: clamp(36px, 4vh, 48px);
  border-radius: 50%;
  color: #856404;
  cursor: pointer;
}

/* ========================================================
   MAIN GAME BOARD (SLOTS & CARDS)
   ======================================================== */
.game-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(10px, 1.4vh, 18px);
  min-height: 0;
}

/* Label Section */
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(4px, 0.6vh, 8px);
}

.label-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-size: clamp(13px, 1.2vw, 18px);
  font-weight: 900;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.label-desc {
  color: #d8f3dc;
  font-size: clamp(14px, 1.3vw, 20px);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Section Slots */
.slots-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slots-container {
  flex: 1;
  display: grid;
  gap: clamp(8px, 1.2vw, 18px);
  align-items: stretch;
  min-height: 0;
}

/* KOTAK SLOT TARGET (PERAN) */
.slot-box {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 100%);
  border: 3.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1vh, 12px) clamp(6px, 0.8vw, 10px);
  position: relative;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15);
  min-height: 0;
}

/* Tag Peran di Atas Slot */
.slot-role-tag {
  width: 100%;
  text-align: center;
  font-size: clamp(15px, 1.5vw, 23px);
  font-weight: 900;
  color: #ffffff;
  padding: clamp(6px, 0.8vh, 10px) 4px;
  border-radius: clamp(10px, 1vw, 14px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.3px;
  line-height: 1.15;
}

/* Warna Tag Peran Khusus */
.role-produsen        { background: linear-gradient(180deg, #38b000 0%, #2e7d32 100%); }
.role-konsumen-primer { background: linear-gradient(180deg, #fb8500 0%, #e65100 100%); }
.role-konsumen-sekunder { background: linear-gradient(180deg, #0284c7 0%, #0277bd 100%); }
.role-konsumen-tersier { background: linear-gradient(180deg, #8a2be2 0%, #6a1b9a 100%); }
.role-konsumen-final  { background: linear-gradient(180deg, #e63946 0%, #c62828 100%); }
.role-dekomposer      { background: linear-gradient(180deg, #795548 0%, #5d4037 100%); }

/* Area Kosong Dropzone Slot */
.slot-drop-area {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.65);
  min-height: 0;
}

.slot-drop-icon {
  font-size: clamp(26px, 2.6vw, 40px);
  opacity: 0.8;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.slot-drop-text {
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 700;
  text-align: center;
}

/* Efek Drag Over Slot */
.slot-box.drag-over {
  background: rgba(255, 255, 255, 0.28);
  border-color: #ffe600;
  border-style: solid;
  transform: scale(1.03);
  box-shadow: 0 0 24px rgba(255, 230, 0, 0.7);
}

/* Slot Benar (Terkunci) */
.slot-box.slot-correct {
  background: linear-gradient(145deg, #1e5e3a 0%, #15452a 100%);
  border: 3.5px solid #2dc653;
  box-shadow: 0 8px 24px rgba(45, 198, 83, 0.45);
}

.slot-box.slot-correct .slot-drop-area {
  display: none;
}

/* Efek Bantuan Tingkat 3: Slot Berkedip Kuning Bersinar */
.slot-box.slot-hint-glow {
  animation: beaconGlow 1.2s infinite alternate ease-in-out;
}

@keyframes beaconGlow {
  0% {
    border-color: #ffb703;
    border-style: solid;
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
    background: rgba(255, 183, 3, 0.2);
  }
  100% {
    border-color: #fff;
    border-style: solid;
    box-shadow: 0 0 32px rgba(255, 255, 255, 0.9), 0 0 15px #ffb703;
    background: rgba(255, 183, 3, 0.45);
    transform: scale(1.04);
  }
}

/* Efek Kedip Merah Lembut jika Salah */
.slot-box.slot-wrong-flash {
  animation: flashRedSoft 0.5s ease;
}

@keyframes flashRedSoft {
  0%, 100% { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.12); }
  50% { border-color: #e63946; background: rgba(230, 57, 70, 0.4); }
}

/* ========================================================
   AREA KARTU MAKHLUK HIDUP (MEJA RAK KARTU)
   ======================================================== */
.cards-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(16, 46, 30, 0.88) 0%, rgba(8, 26, 17, 0.96) 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: clamp(16px, 1.8vw, 24px);
  padding: clamp(8px, 1vh, 14px) clamp(12px, 1.4vw, 20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.cards-container {
  flex: 1;
  display: grid;
  gap: clamp(8px, 1.2vw, 18px);
  align-items: stretch;
  min-height: 0;
}

/* Dudukan Tetap untuk Setiap Kartu (Tidak Mengecil/Membesar) */
.card-dock-slot {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  border-radius: var(--radius-card);
  border: 2.5px dashed rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, background-color 0.2s;
}

/* Slot yang sudah selesai dipasang ke atas */
.card-dock-slot.is-filled-away {
  border-color: rgba(45, 198, 83, 0.3);
  background: rgba(45, 198, 83, 0.08);
}

.dock-slot-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(45, 198, 83, 0.6);
  font-size: clamp(24px, 2.8vw, 44px);
  font-weight: 900;
  user-select: none;
}

.card-dock-ghost {
  width: 100%;
  height: 100%;
  border: 3px dashed rgba(255, 183, 3, 0.6);
  background: rgba(255, 183, 3, 0.12);
  border-radius: var(--radius-card);
}

/* KARTU MAKHLUK HIDUP (TACTILE PHYSICAL CARD) */
.card-item {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1vh, 12px) clamp(6px, 0.8vw, 10px);
  cursor: grab;
  touch-action: none;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 0;
  border: 3px solid #e2e8f0;
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32), 0 0 14px rgba(255, 183, 3, 0.35);
  border-color: #ffb703;
}

/* Media Gambar / Emoji */
.card-media {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
  padding: 4px;
}

.card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  pointer-events: none;
}

.card-emoji {
  font-size: clamp(38px, 4.2vw, 68px);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  pointer-events: none;
}

/* Nama Makhluk Hidup (Besar & Tebal) */
.card-name {
  font-size: clamp(16px, 1.6vw, 24px);
  font-weight: 900;
  color: var(--text-dark);
  text-align: center;
  margin-top: 4px;
  line-height: 1.15;
  pointer-events: none;
}

/* Status Kartu Sedang Di-Drag */
.card-item.is-dragging {
  cursor: grabbing;
  z-index: 1000;
  position: fixed;
  pointer-events: none;
  transform: scale(1.12) rotate(3deg);
  box-shadow: var(--shadow-card-drag);
  border-color: #ffb703;
  transition: none !important;
}

/* Kartu di dalam slot yang sudah benar */
.slot-box .card-item.is-locked {
  cursor: default;
  box-shadow: none;
  border-color: transparent;
  width: 100%;
  height: 100%;
  animation: snapBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes snapBounce {
  0% { transform: scale(0.7); opacity: 0.5; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* Goyang Kartu jika Salah */
.card-shake {
  animation: cardShakeAnim 0.45s ease-in-out;
}

@keyframes cardShakeAnim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-12px); }
  40%, 80% { transform: translateX(12px); }
}

/* ========================================================
   3. MODAL OVERLAY (RANGKUMAN & HASIL AKHIR)
   ======================================================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 16, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: clamp(16px, 2vh, 32px);
}

.modal-overlay.active {
  display: flex;
  animation: fadeInModal 0.25s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: #ffffff;
  border-radius: clamp(20px, 2.5vw, 36px);
  width: 100%;
  max-width: 1100px;
  max-height: 94%;
  padding: clamp(18px, 2.2vh, 32px) clamp(24px, 3vw, 44px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 18px);
  overflow-y: auto;
}

.modal-summary-card {
  max-width: 1120px;
  padding: clamp(14px, 1.8vh, 26px) clamp(20px, 2.5vw, 40px);
  gap: clamp(8px, 1.2vh, 14px);
}

.modal-final-card {
  max-width: 980px;
  padding: clamp(18px, 2.2vh, 30px) clamp(24px, 2.8vw, 40px);
  gap: clamp(10px, 1.4vh, 18px);
}

.modal-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.celebration-badge {
  background: #2dc653;
  color: #ffffff;
  font-size: clamp(14px, 1.3vw, 20px);
  font-weight: 900;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  letter-spacing: 1px;
}

.modal-title {
  font-size: clamp(28px, 3.2vw, 48px);
  font-weight: 900;
  color: #1e3a2b;
  line-height: 1.1;
}

/* Deretan Bintang dengan Animasi Pop Bertahap */
.stars-row {
  display: flex;
  gap: clamp(12px, 1.5vw, 24px);
}

.stars-row .star {
  font-size: clamp(48px, 5.5vw, 84px);
  color: #d1d5db;
  line-height: 1;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s;
}

.stars-row .star.earned {
  color: #ffb703;
  text-shadow: 0 4px 14px rgba(255, 183, 3, 0.5);
  animation: starPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes starPop {
  0% { transform: scale(0.2) rotate(-45deg); opacity: 0; }
  70% { transform: scale(1.3) rotate(15deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Bar Statistik Rangkuman */
.summary-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.5vw, 40px);
  background: #f1f5f9;
  padding: clamp(8px, 1vh, 14px) clamp(18px, 2vw, 32px);
  border-radius: var(--radius-pill);
  width: 100%;
}

.summary-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(16px, 1.5vw, 24px);
  font-weight: 800;
}

.stat-name { color: #64748b; }
.color-green { color: #2e7d32; font-size: clamp(20px, 1.8vw, 28px); }
.color-gold  { color: #e65100; font-size: clamp(20px, 1.8vw, 28px); }
.color-red   { color: #c62828; font-size: clamp(20px, 1.8vw, 28px); }

/* Kotak Penjelasan Rantai Makanan Ilmiah (Produsen -> Dekomposer) */
.chain-explanation-box {
  width: 100%;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-card);
  padding: clamp(8px, 1.2vh, 14px) clamp(12px, 1.6vw, 20px);
}

.explanation-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(15px, 1.4vw, 20px);
  font-weight: 900;
  color: #1b4332;
  margin-bottom: clamp(6px, 0.8vh, 10px);
}


.chain-explanation-list {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(6px, 0.8vw, 12px);
  overflow-x: auto;
}

.explanation-node {
  flex: 1;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: clamp(10px, 1.2vw, 16px);
  padding: clamp(8px, 1vh, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.exp-role {
  font-size: clamp(11px, 1vw, 15px);
  font-weight: 900;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.exp-emoji {
  font-size: clamp(28px, 2.8vw, 42px);
  margin: 2px 0;
}

.exp-name {
  font-size: clamp(14px, 1.3vw, 18px);
  font-weight: 900;
  color: #1e293b;
}

.exp-reason {
  font-size: clamp(11px, 1vw, 14px);
  color: #475569;
  line-height: 1.25;
  font-weight: 600;
}

.exp-arrow {
  display: flex;
  align-items: center;
  font-size: clamp(18px, 2vw, 28px);
  color: #2dc653;
  font-weight: 900;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2vw, 32px);
  width: 100%;
}

/* ========================================================
   4. MODAL HASIL AKHIR SESI
   ======================================================== */
.trophy-icon {
  font-size: clamp(56px, 6vw, 92px);
  animation: floatBounce 2s infinite alternate ease-in-out;
}

.final-badge {
  background: #ffb703;
  color: #3f2200;
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 900;
  padding: 6px 20px;
  border-radius: var(--radius-pill);
}

.final-scores-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: clamp(12px, 1.6vw, 24px);
  width: 100%;
}

.final-stat-box {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-card);
  padding: clamp(10px, 1.4vh, 18px) clamp(10px, 1.2vw, 18px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.final-box-label {
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 900;
  color: #64748b;
  letter-spacing: 0.5px;
}

.final-box-val {
  font-size: clamp(32px, 3.5vw, 54px);
  font-weight: 900;
  line-height: 1.1;
}

.box-gold .final-box-val { color: #f59e0b; }

.box-stars .final-box-val {
  font-size: clamp(14px, 1.4vw, 18px);
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 5px;
  max-width: 290px;
  width: 100%;
  margin: 0 auto;
  min-height: 44px;
  padding: 2px 4px;
}

.final-star-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: clamp(14px, 1.4vw, 18px);
  filter: drop-shadow(0 2px 4px rgba(255, 183, 3, 0.45));
  animation: starMiniPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
  transform-origin: center;
}

@keyframes starMiniPop {
  0% { transform: scale(0); opacity: 0; }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.box-green .final-box-val { color: #10b981; }

.final-box-sub {
  font-size: clamp(13px, 1.2vw, 16px);
  color: #64748b;
  font-weight: 700;
}

.final-message {
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 800;
  color: #1e3a2b;
  text-align: center;
  line-height: 1.35;
  max-width: 800px;
}

/* Badge Hak Cipta & Identitas Sekolah di Modal Hasil Akhir */
.modal-credit-badge {
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  padding: 6px 20px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* ========================================================
   4B. MODAL TENTANG PEMBUAT (ABOUT DEVELOPER)
   ======================================================== */
.modal-about-card {
  max-width: 540px;
  position: relative;
  padding: clamp(26px, 3vh, 38px) clamp(22px, 2.5vw, 36px) clamp(22px, 2.4vh, 30px) clamp(22px, 2.5vw, 36px);
  gap: clamp(10px, 1.4vh, 16px);
  text-align: center;
  border: 3.5px solid #52b788;
  border-radius: clamp(24px, 2.8vw, 36px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.9);
}

.btn-close-modal {
  position: absolute;
  top: clamp(14px, 1.8vh, 22px);
  right: clamp(14px, 1.8vw, 22px);
  width: 66px;
  height: 66px;
  min-width: 66px;
  min-height: 66px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2.5px solid #cbd5e1;
  color: #475569;
  font-size: 32px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.btn-close-modal:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  transform: scale(1.08);
}

.btn-close-modal:active {
  transform: scale(0.94);
}

.about-avatar-wrapper {
  width: clamp(96px, 12vh, 130px);
  height: clamp(96px, 12vh, 130px);
  border-radius: 50%;
  border: 4px solid #ffca3a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  position: relative;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.about-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.about-avatar-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: clamp(52px, 7vh, 76px);
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  user-select: none;
}

.about-info-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.about-dev-name {
  font-size: clamp(24px, 2.5vw, 34px);
  font-weight: 900;
  color: #1e3a2b;
  line-height: 1.15;
}

.about-dev-role-badge {
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 900;
  color: #065f46;
  background: #d8f3dc;
  border: 1.5px solid #b7e4c7;
  padding: 3px 16px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
}

.about-bio-box {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 14px;
  padding: 10px 18px;
  margin-top: 4px;
  width: 100%;
  max-width: 470px;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.about-bio-text {
  font-size: clamp(13px, 1.2vw, 14.5px);
  line-height: 1.55;
  color: #1e3a2b;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

.about-bio-text strong {
  color: #047857;
  font-weight: 800;
}

.bio-tagline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #86efac;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: clamp(12px, 1.1vw, 13px);
  font-weight: 800;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(34, 197, 94, 0.12);
  letter-spacing: 0.2px;
}

.about-credits-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 470px;
  margin-top: 2px;
}

.about-credit-row {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 8px 14px;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.credit-desc {
  font-size: clamp(12.5px, 1.1vw, 14px);
  color: #475569;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.credit-desc strong {
  color: #1e3a2b;
  font-weight: 800;
}

.credit-sub {
  display: block;
  font-size: clamp(11.5px, 1vw, 13px);
  color: #64748b;
  font-weight: 500;
  margin-top: 1px;
}

/* Watermark Versi TV Merdeka di Bawah Layar Game */
.game-footer-watermark {
  width: 100%;
  text-align: center;
  font-size: clamp(10px, 0.9vw, 13px);
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  letter-spacing: 0.4px;
  padding: 0 0 2px 0;
  pointer-events: none;
  position: relative;
  z-index: 5;
}

/* ========================================================
   CANVAS & PARTIKEL EFEK (CONFETTI & SPARKLE)
   ======================================================== */
.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

.sparkle-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}

.sparkle-star {
  position: absolute;
  font-size: clamp(20px, 2.2vw, 32px);
  animation: starBurst 0.7s forwards ease-out;
  pointer-events: none;
}

@keyframes starBurst {
  0% { transform: translate(0, 0) scale(0.3); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.4); opacity: 0; }
}

/* ========================================================
   RESPONSIVE DESIGN: MOBILE SMARTPHONE (PORTRAIT & LANDSCAPE)
   ======================================================== */

/* 1. Mode Portrait Mobile / Layar Ramping (Lebar <= 850px atau Rasio Vertikal) */
@media (max-width: 850px) and (orientation: portrait), (max-width: 640px) {
  html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
  }

  .game-app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden;
    position: relative;
  }

  .screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: env(safe-area-inset-top, 10px) 12px env(safe-area-inset-bottom, 10px) 12px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: none;
  }

  .screen.active {
    display: flex !important;
  }

  .screen:not(.active) {
    display: none !important;
  }

  /* --- Start Screen Mobile --- */
  .screen-start {
    padding: clamp(12px, 2vh, 20px) 16px;
    justify-content: space-between;
  }

  .start-header {
    gap: 8px;
  }

  .btn-fullscreen {
    display: none; /* Layar penuh default di mobile */
  }

  .btn-sound {
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
  }

  .start-content {
    gap: 10px;
    padding: 4px 0;
    max-width: 100%;
    width: 100%;
  }

  .curriculum-badge {
    font-size: 11px;
    padding: 4px 12px;
    margin-bottom: 2px;
  }

  .game-title {
    font-size: clamp(28px, 8.5vw, 42px);
    line-height: 1.1;
    letter-spacing: 0.5px;
  }

  .game-subtitle {
    font-size: clamp(13px, 3.8vw, 17px);
    margin-top: 2px;
  }

  .food-chain-preview {
    padding: 6px 10px;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
    justify-content: center;
  }

  .floating-emoji {
    font-size: clamp(22px, 5.5vw, 32px);
  }

  .floating-arrow {
    font-size: clamp(14px, 3.5vw, 20px);
  }

  .start-info-card {
    font-size: clamp(12px, 3.4vw, 15px);
    padding: 10px 14px;
    line-height: 1.35;
    border-radius: 14px;
  }

  .btn-big {
    min-height: 52px;
    font-size: 18px;
    padding: 0 28px;
    width: 100%;
    max-width: 320px;
    margin: 4px auto 0 auto;
    border-radius: 999px;
  }

  .start-footer {
    padding-top: 6px;
    gap: 4px;
  }

  .footer-tip {
    font-size: 12px;
  }

  .footer-copyright {
    font-size: 10px;
    line-height: 1.3;
  }

  /* --- Ecosystem Select Screen Mobile --- */
  .screen-ecosystem {
    padding: env(safe-area-inset-top, 10px) 14px env(safe-area-inset-bottom, 12px) 14px;
    justify-content: flex-start;
    gap: 10px;
  }

  .eco-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
  }

  #btn-back-to-home {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
    flex-shrink: 0;
    border-radius: 999px;
  }

  .eco-title-group {
    text-align: center;
    flex: 1;
  }

  .eco-title {
    font-size: clamp(18px, 5vw, 24px);
    line-height: 1.15;
  }

  .eco-subtitle {
    font-size: 12px;
    margin-top: 2px;
  }

  .eco-header-spacer {
    display: none;
  }

  .eco-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 16px 0;
    flex: 1;
    width: 100%;
  }

  .eco-card {
    padding: 16px 14px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    border-radius: 20px;
    border-width: 2.5px;
  }

  .eco-card .eco-icon {
    font-size: 44px;
    margin: 2px 0;
    flex-shrink: 0;
  }

  .eco-card-title {
    font-size: 18px;
    line-height: 1.2;
    margin-bottom: 2px;
  }

  .eco-card-desc {
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .eco-badge {
    font-size: 11px;
    padding: 3px 12px;
  }

  .eco-card-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .eco-rounds-count {
    font-size: 11px;
    color: #475569;
    font-weight: 700;
  }

  .btn-eco-play {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
    border-radius: 999px;
    width: 100%;
    max-width: 240px;
    white-space: nowrap;
  }

  /* --- Game Play Arena Screen Mobile --- */
  .screen-game {
    padding: env(safe-area-inset-top, 8px) 8px env(safe-area-inset-bottom, 8px) 8px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
  }

  .game-topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "left center right"
      "title title title";
    gap: 4px 6px;
    align-items: center;
    margin-bottom: 4px;
    flex-shrink: 0;
    width: 100%;
  }

  .topbar-left {
    grid-area: left;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #btn-home-game {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 999px;
  }

  .round-badge {
    font-size: 11px;
    padding: 4px 8px;
    font-weight: 800;
    border-radius: 999px;
  }

  .topbar-center {
    grid-area: title;
    width: 100%;
    text-align: center;
  }

  .chain-title {
    font-size: clamp(14px, 4.2vw, 18px);
    line-height: 1.2;
    white-space: normal;
  }

  .topbar-right {
    grid-area: right;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
  }

  .scoreboard {
    gap: 4px;
  }

  .score-pill {
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 999px;
    gap: 3px;
  }

  .score-total .score-value {
    font-size: 13px;
  }

  #btn-sound-game {
    min-height: 34px;
    width: 34px;
    padding: 0;
    font-size: 14px;
    border-radius: 50%;
  }

  /* Area Petunjuk Hint Mobile */
  .hint-bubble {
    padding: 6px 10px;
    gap: 8px;
    border-radius: 12px;
    border-width: 2px;
    margin-bottom: 4px;
  }

  .hint-avatar {
    font-size: 20px;
  }

  .hint-title {
    font-size: 11px;
  }

  .hint-message {
    font-size: 12px;
    line-height: 1.25;
  }

  .btn-close-hint {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* Game Board Mobile: Fleksibel 2 Seksi */
  .game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    min-height: 0;
    width: 100%;
  }

  .section-label {
    margin-bottom: 2px;
    gap: 6px;
  }

  .label-badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  .label-desc {
    font-size: 11px;
  }

  .slots-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .cards-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    border-radius: 16px;
  }

  /* Grid Layout: 2 kolom (tiap baris 2 kotak) khusus mobile */
  .slots-container,
  .cards-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    align-items: stretch;
    flex: 1;
    min-height: 0;
  }

  /* Jika jumlah kartu ganjil (misal 5 kartu), kartu terakhir berada di tengah */
  .slot-box:last-child:nth-child(odd),
  .card-dock-slot:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc(50% - 4px);
    justify-self: center;
  }

  .slot-box {
    border-width: 2.5px;
    border-radius: 14px;
    padding: 5px 6px;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .slot-role-tag {
    font-size: clamp(12px, 3.2vw, 15px);
    padding: 4px 6px;
    border-radius: 9px;
    line-height: 1.15;
    font-weight: 900;
  }

  .slot-drop-area {
    gap: 2px;
    padding: 2px 0;
  }

  .slot-drop-icon {
    font-size: 22px;
  }

  .slot-drop-text {
    font-size: 11px;
    font-weight: 700;
    display: block;
  }

  .card-dock-slot {
    border-radius: 14px;
    border-width: 2px;
    min-height: 75px;
  }

  .dock-slot-empty {
    font-size: 24px;
  }

  .card-item {
    border-radius: 14px;
    border-width: 2.5px;
    padding: 5px 6px;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }

  .card-emoji {
    font-size: clamp(28px, 7.5vw, 40px);
  }

  .card-name {
    font-size: clamp(12px, 3.2vw, 15px);
    font-weight: 900;
    margin-top: 2px;
    line-height: 1.15;
  }

  /* Ukuran kartu ketika sudah terkunci di dalam slot peran di mobile */
  .slot-box .card-item.is-locked {
    padding: 3px 4px;
  }

  .slot-box .card-item.is-locked .card-emoji {
    font-size: clamp(22px, 6vw, 30px);
  }

  .slot-box .card-item.is-locked .card-name {
    font-size: clamp(11px, 2.9vw, 13px);
  }

  .game-footer-watermark {
    font-size: 10px;
    padding: 1px 0;
    margin-top: 2px;
  }

  /* --- Modals Mobile --- */
  .modal-overlay {
    padding: 8px;
  }

  .modal-card,
  .modal-summary-card,
  .modal-final-card {
    padding: 16px 14px !important;
    border-radius: 22px !important;
    max-height: 94vh !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .celebration-badge, .final-badge {
    font-size: 11px;
    padding: 4px 12px;
  }

  .modal-title {
    font-size: clamp(20px, 5.8vw, 26px);
  }

  .stars-row {
    gap: 10px;
  }

  .stars-row .star {
    font-size: clamp(34px, 9vw, 48px);
  }

  .summary-stats-bar {
    padding: 6px 10px;
    gap: 8px;
    flex-wrap: wrap;
    border-radius: 14px;
  }

  .summary-stat-item {
    font-size: 12px;
    gap: 4px;
  }

  .summary-stat-item .stat-number {
    font-size: 15px;
  }

  .chain-explanation-box {
    padding: 6px 8px;
    border-radius: 12px;
    max-height: 42vh;
    overflow-y: auto;
  }

  .explanation-heading {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .chain-explanation-list {
    flex-direction: column;
    gap: 4px;
  }

  .explanation-node {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 4px 8px;
    gap: 8px;
    border-radius: 8px;
  }

  .exp-role {
    font-size: 9px;
    padding: 2px 6px;
    flex-shrink: 0;
  }

  .exp-emoji {
    font-size: 20px;
    margin: 0;
    flex-shrink: 0;
  }

  .exp-name {
    font-size: 12px;
    margin: 0;
    flex-shrink: 0;
  }

  .exp-reason {
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
    flex: 1;
  }

  .exp-arrow {
    justify-content: center;
    transform: rotate(90deg);
    font-size: 12px;
    margin: -4px 0;
  }

  .final-scores-grid {
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 6px;
    align-items: stretch;
    width: 100%;
  }

  .final-stat-box {
    padding: 8px 6px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    height: 100%;
  }

  .final-box-label {
    font-size: 10px;
  }

  .final-box-val {
    font-size: 24px;
  }

  .final-star-mini {
    font-size: 11px;
  }

  .box-stars .final-box-val {
    font-size: 11px;
    min-height: 32px;
    gap: 2px 3px;
  }

  .final-box-sub {
    font-size: 10px;
  }

  .final-message {
    font-size: 13px;
    line-height: 1.3;
  }

  .modal-credit-badge {
    font-size: 10px;
    padding: 4px 12px;
  }

  /* Tombol Aksi di Seluruh Modal (Konsisten, Rapi & Seragam di Mobile) */
  .modal-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
    margin: 6px 0 0 0 !important;
    box-sizing: border-box !important;
  }

  .modal-actions button,
  .modal-actions .btn-big,
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 20px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    border-radius: 999px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  .modal-actions .btn-primary {
    background: linear-gradient(180deg, #ffca3a 0%, #ff9f1c 100%) !important;
    color: #4a2800 !important;
    box-shadow: 0 5px 0 #cc6f00, 0 8px 16px rgba(0, 0, 0, 0.25) !important;
  }

  .modal-actions .btn-secondary {
    background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%) !important;
    color: #1e3a2b !important;
    box-shadow: 0 4px 0 #94a3b8, 0 6px 14px rgba(0, 0, 0, 0.15) !important;
  }

  /* Modal Tentang Pembuat di Mobile */
  .modal-about-card {
    padding: 24px 16px 20px 16px !important;
    max-width: 380px !important;
    gap: 10px !important;
  }

  .modal-about-card .btn-close-modal {
    top: 10px;
    right: 10px;
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    font-size: 28px;
  }

  .about-avatar-wrapper {
    width: 90px;
    height: 90px;
    margin-top: 6px;
  }

  .about-dev-name {
    font-size: 20px;
  }

  .about-dev-role-badge {
    font-size: 12px;
    padding: 3px 12px;
  }

  .about-bio-box {
    padding: 8px 12px;
    border-radius: 12px;
    margin-top: 2px;
    gap: 6px;
  }

  .about-bio-text {
    font-size: 12.5px;
    line-height: 1.5;
  }

  .bio-tagline {
    font-size: 11.5px;
    padding: 2.5px 12px;
  }

  .about-credits-container {
    gap: 6px;
  }

  .about-credit-row {
    padding: 7px 10px;
    gap: 8px;
    border-radius: 12px;
  }

  .credit-pill {
    padding: 3px 8px;
    font-size: 11.5px;
    gap: 4px;
  }

  .credit-desc {
    font-size: 11.5px;
    line-height: 1.35;
  }

  .credit-sub {
    font-size: 10.5px;
    margin-top: 1px;
  }
}

/* 2. Mode Landscape Mobile (Tinggi Layar Pendek <= 520px) */
@media (max-height: 520px) and (orientation: landscape) {
  html, body {
    overflow: hidden;
  }

  .game-app {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
  }

  .screen {
    padding: 6px 14px 6px 14px;
  }

  .start-content {
    gap: 6px;
  }

  .curriculum-badge {
    font-size: 11px;
    padding: 2px 10px;
  }

  .game-title {
    font-size: 26px;
  }

  .game-subtitle {
    font-size: 13px;
  }

  .food-chain-preview {
    padding: 2px 8px;
    gap: 4px;
  }

  .floating-emoji {
    font-size: 22px;
  }

  .start-info-card {
    font-size: 12px;
    padding: 6px 12px;
  }

  .btn-big {
    min-height: 44px;
    font-size: 16px;
    padding: 0 24px;
  }

  .eco-header {
    margin-bottom: 4px;
  }

  .eco-title {
    font-size: 22px;
  }

  .eco-subtitle {
    font-size: 12px;
  }

  .eco-cards-grid {
    padding: 4px 0;
    gap: 12px;
  }

  .eco-card {
    padding: 8px 10px;
    gap: 4px;
  }

  .eco-icon {
    font-size: 34px;
  }

  .eco-card-title {
    font-size: 16px;
  }

  .eco-card-desc {
    font-size: 11px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .btn-eco-play {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .game-topbar {
    margin-bottom: 2px;
  }

  .chain-title {
    font-size: 16px;
  }

  .round-badge {
    font-size: 12px;
    padding: 2px 8px;
  }

  #btn-home-game {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }

  .score-pill {
    padding: 2px 6px;
    font-size: 12px;
  }

  .game-board {
    gap: 4px;
  }

  .section-label {
    margin-bottom: 2px;
  }

  .label-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .label-desc {
    font-size: 11px;
  }

  .slots-container,
  .cards-container {
    gap: 6px !important;
  }

  .slot-box {
    padding: 3px 2px;
  }

  .slot-role-tag {
    font-size: 11px;
    padding: 2px;
  }

  .slot-drop-icon {
    font-size: 18px;
  }

  .slot-drop-text {
    display: none;
  }

  .card-item {
    padding: 3px 2px;
  }

  .card-emoji {
    font-size: 28px;
  }

  .card-name {
    font-size: 11px;
  }

  .cards-section {
    padding: 4px 8px;
  }

  .modal-card {
    padding: 10px 16px;
    gap: 6px;
    max-height: 98vh;
  }

  .modal-title {
    font-size: 22px;
  }

  .stars-row .star {
    font-size: 32px;
  }

  .chain-explanation-box {
    max-height: 40vh;
    padding: 6px 10px;
  }

  .explanation-node {
    padding: 4px 6px;
    gap: 2px;
  }

  .exp-emoji {
    font-size: 20px;
  }

  .exp-name {
    font-size: 11px;
  }

  .exp-reason {
    font-size: 10px;
  }

  .modal-actions button {
    min-height: 38px;
    font-size: 14px;
    padding: 0 18px;
  }
}

