/* =========================================================
   EcoShield Web Lab - Kid-Friendly Accessible Stylesheet v2.0
   Mendukung Map 1 (Karhutla), Map 2 (Banjir), Kontrol Kamera 3D,
   Keterangan Karakter Kiki Inklusif, & Multiplayer Lobby
   ========================================================= */

:root {
  --color-primary: #2ECC71;
  --color-primary-dark: #27AE60;
  --color-sky: #3498DB;
  --color-sky-dark: #2980B9;
  --color-sun: #F39C12;
  --color-fire: #E74C3C;
  --color-water: #2980B9;
  --color-sand: #D35400;
  --color-bg-light: #EBF5FB;
  --color-card-bg: rgba(255, 255, 255, 0.95);
  --color-text-main: #2C3E50;
  --color-border: #D5DBDB;
  --font-family-kids: 'Fredoka', 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-playful: 0 8px 24px rgba(44, 62, 80, 0.16);
  --shadow-btn: 0 6px 0px rgba(0, 0, 0, 0.2);
  --border-radius-card: 20px;
}

/* =========================================================
   VECTOR SVG ICONS SYSTEM
   ========================================================= */
.icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
}

.icon-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family-kids);
  background-color: #87CEEB;
  color: var(--color-text-main);
  touch-action: manipulation;
}

#game-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* =========================================================
   TOP HUD & MULTIPLAYER BAR
   ========================================================= */
#top-hud {
  position: absolute;
  top: 10px;
  left: max(12px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
  box-sizing: border-box;
}

#top-hud > * {
  pointer-events: auto;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
}

.logo-and-map {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.game-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-card-bg);
  padding: 5px 12px;
  border-radius: 30px;
  box-shadow: var(--shadow-playful);
  border: 3px solid #2ECC71;
  flex-shrink: 0;
}

.logo-icon {
  display: flex;
  align-items: center;
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #27AE60;
  letter-spacing: 0.5px;
}

/* Pemilih Peta (Map 1 Karhutla vs Map 2 Banjir) */
.map-selector-group {
  display: flex;
  gap: 4px;
  background: var(--color-card-bg);
  padding: 3px 5px;
  border-radius: 25px;
  border: 3px solid #3498DB;
  box-shadow: var(--shadow-playful);
  flex-shrink: 0;
}

.btn-map {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 5px 10px;
  border-radius: 18px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #566573;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-map.active {
  background: #3498DB;
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(52, 152, 219, 0.4);
}

.btn-map:hover:not(.active) {
  background: #EBF5FB;
}

/* Multiplayer bar & player profile */
.multiplayer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.badge-offline {
  background: #FFF3CD;
  color: #856404;
  border: 2px solid #FFEEBA;
}

.badge-online {
  background: #D4EDDA;
  color: #155724;
  border: 2px solid #C3E6CB;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #E67E22;
}

.badge-online .status-dot {
  background: #2ECC71;
  box-shadow: 0 0 8px #2ECC71;
}

.btn-badge-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-card-bg);
  border: 2px solid #BDC3C7;
  border-radius: 20px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2C3E50;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.1s ease, border-color 0.2s;
}

.btn-badge-action:hover {
  border-color: #3498DB;
  transform: translateY(-1px);
}

/* HUD CENTER: SKOR & BINTANG */
.hud-center {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-card-bg);
  padding: 5px 14px;
  border-radius: 40px;
  border: 3px solid #F1C40F;
  box-shadow: var(--shadow-playful);
  flex-shrink: 0;
}

.score-in-bar {
  padding: 4px 12px;
  border-radius: 20px;
  border: 2px solid #F1C40F;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.score-in-bar .score-card {
  font-size: 1.05rem;
}

.score-in-bar .stars-card {
  font-size: 1.05rem;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #D35400;
}

.stars-card {
  display: flex;
  gap: 3px;
  font-size: 1.25rem;
}

.star.empty {
  color: #BDC3C7;
}

.star.active {
  color: #F1C40F;
  transform: scale(1.15);
  display: inline-block;
  animation: starPop 0.4s ease-out;
}

@keyframes starPop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.35); }
  100% { transform: scale(1.15); }
}

/* HUD RIGHT: AKSESIBILITAS & BANTUAN */
.hud-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-right: 4px;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--color-card-bg);
  border: 2.5px solid #3498DB;
  border-radius: 20px;
  padding: 5px 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  color: #2980B9;
  cursor: pointer;
  box-shadow: var(--shadow-playful);
  transition: transform 0.1s ease, background 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.hud-btn .icon-svg {
  width: 17px;
  height: 17px;
}

.hud-btn:hover {
  background: #EBF5FB;
  transform: translateY(-2px);
}

.hud-btn:active {
  transform: translateY(2px);
}

.hud-btn.is-muted {
  border-color: #BDC3C7;
  color: #7F8C8D;
  background: #F8F9FA;
  opacity: 0.9;
}

.hud-btn.is-muted:hover {
  background: #ECEFF1;
  border-color: #3498DB;
  color: #2C3E50;
}

/* =========================================================
   CHECKLIST MISI SEDERHANA (DI DALAM HUD-LEFT)
   ========================================================= */
#mission-tracker {
  position: static;
  z-index: 10;
  background: var(--color-card-bg);
  border: 3px solid #2ECC71;
  border-radius: var(--border-radius-card);
  padding: 8px 12px;
  box-shadow: var(--shadow-playful);
  max-width: min(340px, 92vw);
  width: max-content;
  transition: all 0.2s ease;
}

.mission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mission-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #27AE60;
}

.mission-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #27AE60;
  display: inline-block;
  margin: 0;
}

.btn-mission-toggle {
  background: #E8F8F5;
  border: 1.5px solid #A3E4D7;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #16A085;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s;
}

.btn-mission-toggle:hover {
  background: #D1F2EB;
  transform: scale(1.1);
}

#mission-tracker.collapsed #mission-content {
  display: none;
}

#mission-tracker.collapsed {
  padding: 5px 10px;
}

.mission-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.mission-list.hidden {
  display: none;
}

.mission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #34495E;
}

.mission-status-icon.icon-svg {
  color: #BDC3C7;
  flex-shrink: 0;
}

.mission-item.completed {
  color: #27AE60;
  text-decoration: line-through;
}

.mission-item.completed .mission-status-icon.icon-svg {
  color: #2ECC71;
}

/* =========================================================
   3D CAMERA CONTROLS TOOLBAR (MELIHAT DARI BERBAGAI SUDUT)
   ========================================================= */
.camera-toolbar {
  position: absolute;
  top: 105px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px;
  border-radius: 20px;
  border: 3px solid #3498DB;
  box-shadow: var(--shadow-playful);
}

.cam-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 2px solid #BDC3C7;
  border-radius: 14px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: #2C3E50;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
}

.cam-btn:hover {
  background: #EBF5FB;
  border-color: #3498DB;
  color: #2980B9;
  transform: scale(1.05);
}

.cam-btn:active {
  transform: scale(0.95);
}

.cam-btn.btn-highlight {
  background: #3498DB;
  color: #FFFFFF;
  border-color: #2980B9;
}

.cam-btn.btn-highlight:hover {
  background: #2980B9;
  color: #FFFFFF;
}

/* =========================================================
   DIALOG POPUP KIKI (KETERANGAN INKLUSIF GEDSICC)
   ========================================================= */
.kiki-dialog {
  position: absolute;
  top: 190px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: #FFFFFF;
  border: 4px solid #F1C40F;
  border-radius: 24px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  animation: bounceIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kiki-dialog.hidden {
  display: none;
}

@keyframes bounceIn {
  0% { transform: translate(-50%, -20px) scale(0.8); opacity: 0; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.kiki-avatar {
  font-size: 2.2rem;
  background: #FEF9E7;
  padding: 8px;
  border-radius: 50%;
  border: 2px solid #F39C12;
}

.kiki-content {
  flex: 1;
}

.kiki-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.kiki-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #D35400;
}

.kiki-role-badge {
  background: #2ECC71;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.kiki-text {
  font-size: 0.88rem;
  color: #34495E;
  line-height: 1.35;
}

.btn-close-sm {
  background: #F2F4F4;
  border: none;
  font-size: 1.4rem;
  color: #7F8C8D;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

/* =========================================================
   LIVE ANNOUNCEMENT BANNER
   ========================================================= */
.announcement-banner {
  position: absolute;
  top: 85px;
  left: 50%;
  transform: translateX(-50%);
  background: #2ECC71;
  color: #FFFFFF;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
  border: 3px solid #FFFFFF;
  z-index: 25;
  animation: slideBounce 0.4s ease-out;
  pointer-events: none;
}

.announcement-banner.hidden {
  display: none;
}

@keyframes slideBounce {
  0% { transform: translate(-50%, -30px); opacity: 0; }
  60% { transform: translate(-50%, 8px); opacity: 1; }
  100% { transform: translate(-50%, 0); }
}

/* =========================================================
   ACTION PROMPT (BALON DINAMIS DI TENGAH LAYAR)
   ========================================================= */
.action-prompt {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
}

.action-prompt.hidden {
  display: none;
}

.prompt-bubble {
  background: #FFFFFF;
  border: 4px solid #F39C12;
  border-radius: 30px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #D35400;
  box-shadow: var(--shadow-playful);
  animation: pulsePrompt 1s infinite alternate;
}

@keyframes pulsePrompt {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.04); }
}

/* =========================================================
   KONTROL TOUCH & MOUSE (VIRTUAL JOYSTICK + TOMBOL BESAR)
   ========================================================= */
.touch-controls-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 180px;
  pointer-events: none;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px 20px 20px;
}

.touch-controls-layer > * {
  pointer-events: auto;
}

/* Virtual Joystick di Kiri Bawah (Bisa diklik mouse atau disentuh) */
.joystick-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.joystick-base {
  width: 110px;
  height: 110px;
  background: rgba(255, 255, 255, 0.55);
  border: 4px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  position: relative;
  backdrop-filter: blur(5px);
  touch-action: none;
  cursor: grab;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transition: background 0.15s;
}

.joystick-base:active {
  cursor: grabbing;
  background: rgba(255, 255, 255, 0.75);
}

.joystick-thumb {
  width: 50px;
  height: 50px;
  background: #3498DB;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.joystick-helper {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1F618D;
  background: rgba(255, 255, 255, 0.85);
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Tombol Aksi Bulat Besar di Kanan Bawah */
.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.action-circle-btn {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-family: inherit;
  font-weight: 700;
  box-shadow: var(--shadow-btn);
  position: relative;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.action-circle-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0px rgba(0, 0, 0, 0.2);
}

.btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.btn-emoji {
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.btn-title {
  font-size: 0.65rem;
  letter-spacing: 0.3px;
  text-align: center;
}

.btn-shortcut {
  font-size: 0.55rem;
  opacity: 0.85;
}

.btn-spray {
  background: radial-gradient(circle, #3498DB 0%, #2980B9 100%);
  border: 3px solid #A9CCE3;
}

.btn-firebreak {
  background: radial-gradient(circle, #F39C12 0%, #D35400 100%);
  border: 3px solid #FAD7A0;
}

.btn-companion {
  background: radial-gradient(circle, #2ECC71 0%, #27AE60 100%);
  border: 3px solid #A9DFBF;
}

/* =========================================================
   MODAL POPUPS & FORMS (MULTIPLAYER & PROFIL)
   ========================================================= */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 28px;
  max-width: 540px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  border: 5px solid #2ECC71;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.35rem;
  color: #27AE60;
  font-weight: 700;
}

.btn-close {
  background: #F2F4F4;
  border: none;
  font-size: 1.8rem;
  color: #7F8C8D;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 700;
  font-size: 0.9rem;
  color: #2C3E50;
}

.input-text {
  padding: 10px 14px;
  border: 2px solid #BDC3C7;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #2C3E50;
  outline: none;
  transition: border-color 0.2s;
}

.input-text:focus {
  border-color: #3498DB;
}

.helper-text {
  font-size: 0.8rem;
  color: #7F8C8D;
}

.color-picker-grid {
  display: flex;
  gap: 10px;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch.active {
  border-color: #2C3E50;
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.share-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.btn-secondary {
  background: #EBF5FB;
  border: 2px solid #3498DB;
  color: #2980B9;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #D4E6F1;
}

.copy-feedback {
  font-size: 0.85rem;
  color: #27AE60;
  font-weight: 700;
}

.copy-feedback.hidden {
  display: none;
}

.edu-card {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.4;
}

.edu-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.edu-card p {
  font-size: 0.86rem;
  color: #34495E;
}

.card-blue {
  background: #EBF5FB;
  border-left: 6px solid #3498DB;
}

.card-blue h3 {
  color: #2980B9;
}

.card-green {
  background: #EAFAF1;
  border-left: 6px solid #2ECC71;
}

.card-green h3 {
  color: #27AE60;
}

.card-yellow {
  background: #FEF9E7;
  border-left: 6px solid #F39C12;
}

.card-yellow h3 {
  color: #D35400;
}

.modal-footer {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.modal-footer.victory-actions {
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.btn-primary-large {
  background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 30px;
  padding: 12px 28px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 0 #1E8449, 0 8px 18px rgba(46, 204, 113, 0.4);
  transition: transform 0.1s ease;
}

.btn-primary-large:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1E8449;
}

/* VICTORY MODAL */
.victory-card {
  text-align: center;
  border-color: #F1C40F;
}

.victory-confetti {
  font-size: 2.2rem;
  margin-bottom: 6px;
  animation: bounceConfetti 1s infinite alternate;
}

@keyframes bounceConfetti {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.victory-card h2 {
  font-size: 1.6rem;
  color: #D35400;
  margin-bottom: 4px;
}

.victory-subtitle {
  font-size: 1rem;
  color: #566573;
  margin-bottom: 12px;
}

.victory-stars {
  font-size: 2.8rem;
  color: #F1C40F;
  margin-bottom: 12px;
}

.victory-score-box {
  background: #FEF9E7;
  border: 2px dashed #F39C12;
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 1.15rem;
}

.badge-tag {
  display: inline-block;
  background: #2ECC71;
  color: #FFFFFF;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-top: 6px;
}

/* =========================================================
   MODE AKSESIBILITAS: KONTRAS TINGGI (HIGH CONTRAST)
   ========================================================= */
body.high-contrast {
  background-color: #000000;
  color: #FFFFFF;
}

body.high-contrast .game-logo,
body.high-contrast .hud-center,
body.high-contrast .hud-btn,
body.high-contrast #mission-tracker,
body.high-contrast .camera-toolbar,
body.high-contrast .kiki-dialog,
body.high-contrast .prompt-bubble,
body.high-contrast .modal-card,
body.high-contrast .map-selector-group {
  background: #000000 !important;
  color: #FFFFFF !important;
  border: 4px solid #FFE600 !important;
  box-shadow: none !important;
}

body.high-contrast .logo-text,
body.high-contrast .score-card,
body.high-contrast .hud-btn,
body.high-contrast .mission-title,
body.high-contrast .cam-lbl,
body.high-contrast .kiki-name,
body.high-contrast .prompt-bubble span,
body.high-contrast .modal-header h2,
body.high-contrast .victory-card h2 {
  color: #FFE600 !important;
}

body.high-contrast .mission-item,
body.high-contrast .kiki-text {
  color: #FFFFFF !important;
}

body.high-contrast .action-circle-btn,
body.high-contrast .cam-btn {
  border: 4px solid #FFE600 !important;
  color: #FFE600 !important;
  background: #000000 !important;
}

/* =========================================================
   RESPONSIVE DESIGN (HP & TABLET SISWA)
   ========================================================= */
@media (max-width: 820px) {
  #top-hud {
    flex-wrap: wrap;
    gap: 6px;
  }

  .logo-and-map {
    flex-wrap: wrap;
    gap: 6px;
  }

  .game-logo {
    padding: 4px 10px;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .hud-center {
    padding: 4px 12px;
  }

  .score-card {
    font-size: 1.15rem;
  }

  .camera-toolbar {
    top: auto;
    bottom: 185px;
    right: 12px;
    flex-direction: row;
    gap: 4px;
    padding: 4px;
  }

  .cam-btn {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  .cam-lbl {
    display: none;
  }

  #mission-tracker {
    top: 135px;
    padding: 6px 10px;
    max-width: 220px;
    font-size: 0.75rem;
  }

  .action-circle-btn {
    width: 68px;
    height: 68px;
  }

  .btn-emoji {
    font-size: 1.25rem;
  }

  .btn-title {
    font-size: 0.55rem;
  }

  .joystick-base {
    width: 90px;
    height: 90px;
  }

  .joystick-thumb {
    width: 40px;
    height: 40px;
  }

  .kiki-dialog {
    top: 130px;
    width: 94%;
    padding: 8px 12px;
  }
}

/* =========================================================
   LEADERBOARD MULTIPLAYER & SORAK (CHEER)
   ========================================================= */
.victory-leaderboard-box {
  margin: 16px 0;
  padding: 14px;
  background: #F8F9F9;
  border: 2px dashed #BDC3C7;
  border-radius: 16px;
  text-align: left;
}

.leaderboard-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: #2C3E50;
  margin-bottom: 10px;
  font-weight: 700;
}

.lb-player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.lb-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFF;
  border: 1px solid #E5E7E9;
  padding: 8px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.lb-player-row.is-me {
  background: #E8F8F5;
  border-color: #2ECC71;
  box-shadow: 0 2px 6px rgba(46, 204, 113, 0.2);
}

.lb-rank {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 55px;
}

.lb-avatar-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #FFF;
  box-shadow: 0 0 4px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  font-size: 0.92rem;
  color: #2C3E50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-me-tag {
  color: #27AE60;
  font-size: 0.8rem;
  margin-left: 4px;
}

.lb-score {
  font-size: 0.95rem;
  color: #E67E22;
  font-weight: 700;
}

.lb-single-player-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FEF9E7;
  border: 1px solid #F9E79F;
  padding: 12px;
  border-radius: 12px;
}

.notice-icon {
  font-size: 2rem;
}

.notice-text h4 {
  font-size: 0.95rem;
  color: #B7950B;
  margin-bottom: 2px;
}

.notice-text p {
  font-size: 0.85rem;
  color: #2C3E50;
  margin-bottom: 4px;
}

.lb-cheer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #E5E7E9;
  flex-wrap: wrap;
}

.lb-cheer-lbl {
  font-size: 0.82rem;
  font-weight: 600;
  color: #7F8C8D;
}

.lb-cheer-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-cheer-action {
  background: #FFF;
  border: 1px solid #BDC3C7;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  transition: transform 0.1s, background 0.2s;
}

.btn-cheer-action:hover {
  background: #F4F6F6;
  transform: translateY(-2px);
}

.btn-cheer-action:active {
  transform: translateY(0);
}

/* FLOATING CHEER TOASTS */
.cheer-toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.cheer-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border: 2px solid #2ECC71;
  font-size: 0.9rem;
  color: #2C3E50;
  animation: slideInUp 0.3s ease;
  transition: opacity 0.4s, transform 0.4s;
}

.cheer-toast.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

.cheer-emoji {
  font-size: 1.4rem;
}

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

/* =========================================================
   MODE GURU (TEACHER DASHBOARD & EDITOR)
   ========================================================= */
.hud-btn-teacher {
  background: #8E44AD;
  color: #FFF;
}

.hud-btn-teacher:hover {
  background: #7D3C98;
}

.modal-teacher-card {
  transition: max-width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 95%;
  border: 5px solid #8E44AD;
  border-radius: 28px;
  background: #FFFFFF;
}

.modal-teacher-card.is-locked {
  max-width: 440px !important;
  padding: 24px 28px;
}

.modal-teacher-card:not(.is-locked) {
  max-width: 860px;
  height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
}

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

.btn-lock-toggle {
  background: #F4ECF7;
  border: 1px solid #D7BDE2;
  color: #8E44AD;
  padding: 4px 10px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-lock-toggle:hover {
  background: #E8DAEF;
}

.teacher-pin-box {
  text-align: center;
  padding: 16px 8px 8px;
}

.pin-avatar {
  margin: 0 auto 16px;
  width: 72px;
  height: 72px;
  background: #F4ECF7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #D7BDE2;
}

.teacher-pin-box h3 {
  font-size: 1.35rem;
  color: #2C3E50;
  margin-bottom: 6px;
  font-weight: 700;
}

.pin-instruction {
  font-size: 0.88rem;
  color: #7F8C8D;
  margin-bottom: 20px;
  line-height: 1.4;
}

.pin-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-input {
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: 3px;
  padding: 10px 14px;
  border: 2px solid #BDC3C7;
  border-radius: 14px;
  background: #F8F9F9;
  width: 100%;
}

.pin-input:focus {
  border-color: #8E44AD;
  background: #FFFFFF;
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.18);
}

.btn-pin-submit {
  width: 100%;
  padding: 11px;
  font-size: 0.95rem;
  border-radius: 14px;
  background: #8E44AD;
  border: none;
  color: #FFFFFF;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
  transition: transform 0.1s, background 0.2s;
}

.btn-pin-submit:hover {
  background: #7D3C98;
  transform: translateY(-1px);
}

.pin-error {
  color: #E74C3C;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pin-shake {
  animation: shakeBox 0.4s ease-in-out;
}

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

.security-card {
  background: #FDFEFE;
  border: 1px solid #E5E7E9;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.security-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  color: #2C3E50;
}

.pin-change-msg {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 8px;
}

.pin-change-msg.success {
  color: #27AE60;
}

.pin-change-msg.error {
  color: #E74C3C;
}

/* Main Dashboard Panel */
.teacher-main-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.teacher-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid #E5E7E9;
  padding-bottom: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.teacher-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F4F6F6;
  border: none;
  padding: 8px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #7F8C8D;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.teacher-tab-btn.active {
  background: #8E44AD;
  color: #FFF;
}

.teacher-tab-content {
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
}

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

.pane-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #F9EBEA;
  padding: 10px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
}

.pane-desc {
  font-size: 0.85rem;
  color: #5D6D7E;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.input-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #BDC3C7;
  font-family: inherit;
  font-size: 0.88rem;
  background: #FFF;
}

.btn-teacher-action {
  background: #FFF;
  border: 1px solid #BDC3C7;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-teacher-action.btn-add {
  background: #2ECC71;
  color: #FFF;
  border-color: #27AE60;
}

.btn-teacher-action.btn-add:hover {
  background: #27AE60;
}

.btn-teacher-action.btn-reset {
  background: #FADBD8;
  color: #922B21;
  border-color: #F1948A;
}

.btn-teacher-action.btn-apply {
  background: #3498DB;
  color: #FFF;
  border-color: #2980B9;
}

.editor-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-card {
  background: #FFF;
  border: 1px solid #D5DBDB;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.editor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-badge {
  background: #E8F8F5;
  color: #16A085;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.btn-card-del {
  background: none;
  border: none;
  color: #E74C3C;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-card-del:hover {
  text-decoration: underline;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #34495E;
}

.editor-options-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #F8F9F9;
  padding: 8px;
  border-radius: 10px;
}

.editor-options-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #34495E;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
}

.textarea-code {
  width: 100%;
  border: 1px solid #BDC3C7;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.export-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.teacher-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2C3E50;
  color: #FFF;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  animation: fadeInDown 0.3s ease;
  transition: opacity 0.4s;
}

.teacher-toast.fade-out {
  opacity: 0;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* TAB REKAP NILAI SISWA (DATABASE OFFLINE) */
.scores-table-wrapper {
  background: #FFF;
  border: 1px solid #D5DBDB;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  max-height: 440px;
  overflow-y: auto;
}

.scores-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #F8F9F9;
  border-bottom: 1px solid #EBEDEF;
  font-size: 0.85rem;
  color: #34495E;
}

.source-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}
.source-badge.server {
  background: #E8F8F5;
  color: #16A085;
}
.source-badge.local {
  background: #FEF9E7;
  color: #B7950B;
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.scores-table th {
  background: #F2F4F4;
  color: #2C3E50;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #BDC3C7;
  position: sticky;
  top: 0;
  z-index: 2;
}

.scores-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #EAEDED;
  color: #2C3E50;
}

.scores-table tbody tr:hover {
  background: #EAF2F8;
}

.scores-table tbody tr:nth-child(even) {
  background: #FBFCFC;
}

.score-badge {
  display: inline-block;
  background: #E8F8F5;
  color: #27AE60;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.scores-empty {
  text-align: center;
  padding: 40px 20px;
  color: #7F8C8D;
}

.scores-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.scores-empty h4 {
  font-size: 1.05rem;
  color: #34495E;
  margin-bottom: 6px;
}

.scores-loading {
  text-align: center;
  padding: 30px;
  color: #7F8C8D;
  font-size: 0.9rem;
}
