/* ==========================================================================
   BPMP Farm Quest: Gorontalo Edition · Roblox & Harvest Moon 3D Open World
   Styling for Free Walking, Joystick Analog, 30 Posko, & Mobile Landscape
   ========================================================================== */

:root {
  --wood-dark: #3e2723;
  --wood-med: #5d4037;
  --wood-light: #8d6e63;
  --bpmp-gold: #f59e0b;
  --bpmp-green: #10b981;
  --bpmp-blue: #38bdf8;
  --bpmp-red: #ef4444;
  --text-light: #fdfbf7;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #81c784;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text-light);
}

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

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
}

/* TOP HUD */
.top-hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
}

.wood-panel {
  background: linear-gradient(180deg, #5d4037 0%, #3e2723 100%);
  border: 2px solid #8d6e63;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 6px 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 2px solid #ffedd5;
  border-radius: 12px;
  padding: 6px 12px;
}

.brand-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.brand-sub {
  font-size: 10px;
  color: #fef3c7;
  font-weight: 600;
}

.timer-panel {
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.timer-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: #fde68a;
}

.timer-clock {
  font-size: 18px;
  font-weight: 900;
  font-family: 'Orbitron', monospace;
  color: #ffffff;
}

.timer-bar-bg {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
}

.timer-bar-fill {
  width: 100%;
  height: 100%;
  background: #43a047;
  transition: width 0.4s linear;
}

.score-badge {
  font-size: 16px;
  font-weight: 900;
  color: #fef08a;
}

.sync-badge {
  font-size: 10px;
  font-weight: 600;
  color: #bbf7d0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
}

/* RADAR MINIMAP */
.minimap-panel {
  position: absolute;
  top: 75px;
  right: 12px;
  background: rgba(30, 24, 20, 0.9);
  border: 2px solid #8d6e63;
  border-radius: 12px;
  padding: 6px;
  pointer-events: auto;
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.minimap-title {
  font-size: 9px;
  font-weight: 800;
  color: #fde68a;
  margin-bottom: 2px;
}

#minimap-canvas {
  border-radius: 6px;
  background: #2e7d32;
  display: block;
}

/* VIRTUAL JOYSTICK (UNTUK MOBILE / HP SEPERTI ROBLOX) */
.joystick-zone {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
  touch-action: none;
  z-index: 40;
}

.joystick-base {
  width: 110px;
  height: 110px;
  background: rgba(15, 23, 42, 0.65);
  border: 3px solid rgba(245, 158, 11, 0.8);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.joystick-stick {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 2px solid #fff;
  border-radius: 50%;
  position: absolute;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  cursor: grab;
  transition: transform 0.05s linear;
}

/* PROXIMITY ACTION BUTTON (TOMBOL MASUK POSKO SAAT DEKAT) */
.posko-action-container {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-enter-posko {
  background: linear-gradient(135deg, #f59e0b, #e65100);
  border: 3px solid #ffedd5;
  border-radius: 30px;
  padding: 12px 28px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.7);
  animation: pulseGlow 1.4s infinite;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6); }
  50% { transform: scale(1.05); box-shadow: 0 12px 30px rgba(245, 158, 11, 0.9); }
}

.desktop-controls-hint {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 11px;
  color: #e2e8f0;
}

/* MODAL SOAL POSKO (POP-UP RETRO PARCHMENT) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 20, 0.75);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.rpg-dialog-frame {
  background: #5d4037;
  border: 5px solid #8d6e63;
  outline: 3px solid #3e2723;
  border-radius: 20px;
  padding: 12px;
  width: 100%;
  max-width: 660px;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

.rpg-dialog-parchment {
  background: #fff8e1;
  border: 2px solid #d7ccc8;
  border-radius: 14px;
  padding: 16px;
  color: #2c1810;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #bcaaa4;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.dialog-title {
  font-size: 16px;
  font-weight: 800;
  color: #3e2723;
}

.dialog-meta {
  font-size: 11px;
  font-weight: 700;
  color: #e65100;
}

.dialog-question {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  color: #212121;
  margin-bottom: 14px;
}

.dialog-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .dialog-options {
    grid-template-columns: 1fr;
  }
}

.retro-option-btn {
  background: #ffffff;
  border: 2px solid #bcaaa4;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: #263238;
}

.retro-option-btn:hover:not(:disabled) {
  border-color: #f59e0b;
  background: #fffde7;
}

.retro-option-btn .option-key {
  width: 24px;
  height: 24px;
  background: #efebe9;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.retro-option-btn.correct {
  background: #e8f5e9 !important;
  border-color: #2e7d32 !important;
  color: #1b5e20 !important;
}

.retro-option-btn.wrong {
  background: #ffebee !important;
  border-color: #c62828 !important;
  color: #b71c1c !important;
}

.btn-rpg-primary {
  background: linear-gradient(180deg, #43a047, #2e7d32);
  color: #fff;
  border: 2px solid #a5d6a7;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

/* ANTI-CHEAT WARNING & ROTATE OVERLAYS */
.cheat-warning-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(185, 28, 28, 0.88);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.cheat-warning-card {
  background: #1e1b4b;
  border: 4px solid #ef4444;
  border-radius: 18px;
  padding: 20px;
  max-width: 420px;
  text-align: center;
  color: #fff;
}

.rotate-device-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: #fff;
}

@media (max-width: 768px) and (orientation: portrait) {
  .rotate-device-overlay {
    display: flex;
  }
}

.rotate-phone-anim {
  font-size: 48px;
  margin-bottom: 12px;
  animation: phoneRotate 2.5s infinite ease-in-out;
}

@keyframes phoneRotate {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(-90deg); }
  60% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.form-group {
  margin-bottom: 12px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #4e342e;
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #bcaaa4;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.avatar-selector {
  display: flex;
  gap: 8px;
}

.avatar-opt {
  flex: 1;
  background: #fff;
  border: 2px solid #d7ccc8;
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
}

.avatar-opt.active {
  border-color: #2e7d32;
  background: #e8f5e9;
}

.finish-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.finish-stat-card {
  background: #ffffff;
  border: 2px solid #d7ccc8;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #795548;
}

.stat-val {
  font-size: 16px;
  font-weight: 900;
  color: #2e7d32;
}

.retro-toast {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #3e2723;
  border: 2px solid #ffb300;
  border-radius: 16px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 800;
  color: #fff9c4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.retro-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   PETA ARENA INTERAKTIF & DIREKTORI 30 POSKO
   ========================================================================== */
.map-filter-btn {
  background: #efebe9;
  border: 1.5px solid #a1887f;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #4e342e;
  cursor: pointer;
  transition: all 0.2s;
}

.map-filter-btn.active, .map-filter-btn:hover {
  background: #3e2723;
  color: #fff9c4;
  border-color: #ffd54f;
}

.posko-dir-card {
  background: #ffffff;
  border: 2px solid #d7ccc8;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s, border-color 0.15s;
}

.posko-dir-card:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
}

.posko-dir-card.status-correct {
  border-color: #10b981;
  background: #f0fdf4;
}

.posko-dir-card.status-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.posko-dir-card.status-unanswered {
  border-color: #f59e0b;
  background: #fffbeb;
}

.posko-card-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-unanswered {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-correct {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-wrong {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.btn-guide-posko {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-guide-posko:hover {
  background: #0284c7;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

/* GPS GUIDE BAR (HUD ATAS) */
.gps-guide-bar {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid #38bdf8;
  border-radius: 20px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: pulse-gps 2s infinite ease-in-out;
}

@keyframes pulse-gps {
  0%, 100% { border-color: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
  50% { border-color: #f59e0b; box-shadow: 0 0 15px rgba(245, 158, 11, 0.6); }
}

.gps-dist-badge {
  background: #0284c7;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.btn-cancel-gps {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #cbd5e1;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-cancel-gps:hover {
  background: rgba(239, 68, 68, 0.8);
  color: white;
  border-color: transparent;
}

/* ==========================================================================
   CAMERA ZOOM & MOBILE TOUCH D-PAD CONTROLS
   ========================================================================== */
.camera-zoom-panel {
  position: absolute;
  right: 16px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  pointer-events: auto;
}

.btn-zoom-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid #f59e0b;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s, background 0.15s;
}

.btn-zoom-circle:active {
  transform: scale(0.92);
  background: #f59e0b;
  color: #1e293b;
}

.dpad-zone {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 140px;
  height: 140px;
  z-index: 40;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dpad-btn {
  width: 46px;
  height: 46px;
  background: rgba(30, 41, 59, 0.9);
  border: 2px solid #f59e0b;
  border-radius: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  transition: background 0.1s, transform 0.1s;
}

.dpad-btn:active, .dpad-btn.pressed {
  background: #f59e0b;
  color: #1e293b;
  transform: scale(0.92);
}

.dpad-mid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.dpad-center {
  width: 44px;
  height: 44px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
}

.btn-rpg-secondary {
  background: linear-gradient(135deg, #475569, #334155);
  border: 2px solid #94a3b8;
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.2s;
}

.btn-rpg-secondary:hover {
  background: #64748b;
}

.map-ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.9);
  border: 1.5px solid #f59e0b;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.map-ctrl-btn:active {
  background: #f59e0b;
  color: #1e293b;
}

/* ==========================================================================
   READING & LISTENING TTS AUDIO UI
   ========================================================================== */
.reading-passage-box {
  background: #fdf6e2;
  border: 2px dashed #bcaaa4;
  border-left: 5px solid #0284c7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #27272a;
  max-height: 180px;
  overflow-y: auto;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
}

.listening-player-box {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 2px solid #38bdf8;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.25);
  text-align: left;
}

.listening-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.listening-badge {
  background: #0284c7;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.listening-quota-tag {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid #f59e0b;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
}

.listening-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-tts-play {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: 2px solid #38bdf8;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-tts-play:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-tts-play:disabled {
  background: #475569;
  border-color: #64748b;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.tts-speed-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tts-speed-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.tts-speed-btn.active, .tts-speed-btn:hover {
  background: #38bdf8;
  color: #0f172a;
}

.sound-wave-anim {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.sound-wave-bar {
  width: 3px;
  background: #38bdf8;
  border-radius: 2px;
  animation: soundWave 0.8s infinite ease-in-out alternate;
}

.sound-wave-bar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.sound-wave-bar:nth-child(2) { height: 14px; animation-delay: 0.3s; }
.sound-wave-bar:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.sound-wave-bar:nth-child(4) { height: 16px; animation-delay: 0.4s; }

@keyframes soundWave {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1.0); }
}
