/* ==========================================================================
   LENTERA PETUALANG: TKA SD (Numerasi & Literasi)
   Game Container & Thematic Adventure Styling
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600;700&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  --wood-dark: #3b200c;
  --wood-mid: #5c3417;
  --wood-light: #8d5328;
  --gold-accent: #f59e0b;
  --gold-light: #fef3c7;
  --jungle-deep: #064e3b;
  --jungle-mid: #047857;
  --jungle-light: #10b981;
  --parchment: #fffdfa;
  --parchment-border: #fef3c7;
}

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

input, textarea {
  user-select: auto;
}

html {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: radial-gradient(circle at 50% 20%, #1a3a2a 0%, #0d2218 50%, #05100b 100%);
  color: #1f2937;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Headings font */
.font-heading {
  font-family: 'Fredoka', cursive, sans-serif;
}

/* Monospace for code/numbers */
.font-mono-num {
  font-family: 'JetBrains Mono', monospace;
}

/* Master 16:9 Game Viewport Container (Desktop / Laptop) */
#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 177.78vh; /* 16:9 aspect ratio */
  max-height: 56.25vw;
  aspect-ratio: 16 / 9;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.95), 0 0 50px rgba(16, 185, 129, 0.2);
  border-radius: 18px;
  overflow: hidden;
  background-color: #0b1f14;
  display: flex;
  flex-direction: column;
}

/* Thematic Wood & Jungle Frame */
.wood-frame {
  border: 10px solid #5c3417;
  outline: 4px solid #2a1608;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.85);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 20%);
}

/* Metallic Rivets on Corners */
.rivet {
  position: absolute;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #fde68a, #d97706 60%, #78350f);
  border-radius: 50%;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.8), inset -1px -1px 2px rgba(0,0,0,0.6);
  z-index: 40;
}
.rivet-tl { top: 8px; left: 8px; }
.rivet-tr { top: 8px; right: 8px; }
.rivet-bl { bottom: 8px; left: 8px; }
.rivet-br { bottom: 8px; right: 8px; }

/* ==========================================================================
   MOBILE & GADGET RESPONSIVE ADAPTATION (Phones, Tablets, Touch Devices)
   ========================================================================== */
@media (max-width: 1023px), (orientation: portrait), (max-height: 580px) {
  html, body {
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  body {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  #game-wrapper {
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-width: 100% !important;
    max-height: 100dvh !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: none !important;
    outline: none !important;
  }
  #game-content {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: hidden !important;
  }
  .wood-frame {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  .rivet {
    display: none !important; /* Hide corner rivets on mobile/gadget */
  }
  .parchment-board {
    border-width: 2px !important;
    border-radius: 16px !important;
    outline-width: 1px !important;
  }
  .tab-wooden-btn {
    padding: 6px 10px !important;
    font-size: 10px !important;
    border-radius: 10px !important;
  }
  .pill-option {
    padding: 5px 10px !important;
    font-size: 10px !important;
  }
}

/* Hide scrollbars cleanly when needed */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: #d97706;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #b45309;
}

/* Glassmorphism Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.glass-dark {
  background: rgba(10, 26, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6);
}

/* Button & Interactive Animations */
.btn-press {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.btn-press:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.btn-press:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

/* Glowing gold pulse */
@keyframes pulse-gold {
  0%, 100% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.7), inset 0 0 10px rgba(253, 230, 138, 0.6);
  }
  50% {
    box-shadow: 0 0 30px rgba(245, 158, 11, 1), inset 0 0 18px rgba(253, 230, 138, 0.9);
  }
}
.glow-gold {
  animation: pulse-gold 2.2s infinite ease-in-out;
}

/* Floating animation */
@keyframes float-gentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}
.animate-float {
  animation: float-gentle 3.2s ease-in-out infinite;
}

/* Map Path dotted line styling */
.map-path {
  stroke-dasharray: 8, 8;
  animation: dash-flow 20s linear infinite;
}
@keyframes dash-flow {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Node pulse */
@keyframes ping-subtle {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.18); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.9; }
}
.node-active-ring {
  animation: ping-subtle 1.8s infinite ease-in-out;
}

/* Moving Tropical Clouds */
@keyframes cloud-drift-1 {
  0% { transform: translateX(-10%); }
  100% { transform: translateX(110%); }
}
@keyframes cloud-drift-2 {
  0% { transform: translateX(110%); }
  100% { transform: translateX(-10%); }
}
.cloud-1 {
  animation: cloud-drift-1 45s linear infinite;
}
.cloud-2 {
  animation: cloud-drift-2 60s linear infinite;
}

/* ==========================================================================
   LENTERA BUNYI STYLE: PARCHMENT BOARD & TAB NAVIGATION
   ========================================================================== */

/* Main Stage Parchment Container */
.parchment-board {
  background: #fffdfa;
  border: 4px solid #fef3c7;
  outline: 2px solid #b45309;
  border-radius: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(245, 158, 11, 0.08);
}

/* Wooden Tab Sidebar Buttons */
.tab-wooden-btn {
  background: linear-gradient(180deg, #6b3b19 0%, #4a240c 100%);
  border: 2px solid #8d5328;
  color: #fde68a;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 11px;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  flex-shrink: 0;
}
.tab-wooden-btn:hover {
  background: linear-gradient(180deg, #8d5328 0%, #5c3417 100%);
  color: #ffffff;
  transform: translateX(3px);
}
.tab-wooden-btn.active {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border-color: #fef3c7;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6), inset 0 1px 2px rgba(255,255,255,0.4);
  transform: scale(1.03);
}

/* Horizontal Matching Pills (Like Screenshot 1) */
.pill-option {
  background: #fffdfa;
  border: 1.5px solid #d97706;
  color: #78350f;
  padding: 7px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.pill-option:hover {
  background: #fef3c7;
  transform: translateY(-1px);
}
.pill-option.selected {
  background: #047857;
  border-color: #065f46;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(4, 120, 87, 0.4), inset 0 1px 1px rgba(255,255,255,0.3);
}

/* Certificate Styles */
.cert-border {
  border: 12px double #b45309;
  background: #fdfbf7;
  position: relative;
}
.cert-border::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 2px solid #d97706;
  pointer-events: none;
}
