/* ==========================================================================
   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);
}
