:root {
  --cok-gold: #d4af37;
  --up-green: #27ae60;
  --down-red: #c0392b;

  /* Z-INDEX SCALE (Titah Baginda: Standarisasi Lapisan Mutlak) */
  --z-map-base: 10;
  --z-map-objects: 100;
  --z-map-hud: 500;
  --z-hud-base: 6000;
  --z-hud-floating: 8000;
  --z-nav-bottom: 9500;
  --z-hud-critical: 11000; /* Lapisan Info Penting (Misi/Palu) */
  --z-page-overlay: 150000;
  --z-modal-royal: 200000;
  --z-confirm-overlay: 2000000;
  --z-modal-sub: 2500000;
  --z-toast: 3000000;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
  color: #fff;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 14px;
  /* Fixed to prevent jumbo scaling on large TVs */
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 12000;
}

.dragging {
  cursor: grabbing !important;
}

/* HUD ATAS EPIK */
.resource-bar {
  position: fixed;
  top: 0;
  width: 100%;
  height: clamp(60px, 7vh, 75px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.7) 100%);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1.5px solid rgba(212, 175, 55, 0.4);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.2vw, 15px);
  z-index: var(--z-hud-base);
  padding: 0 clamp(8px, 2vw, 20px);
  box-sizing: border-box;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.gold-box,
.diamond-box {
  font-size: clamp(0.85rem, 1.1vw, 1.2rem);
  font-weight: 900;
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  min-width: clamp(90px, 12vw, 140px);
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.gold-box {
  color: #f1c40f;
  border-color: rgba(212, 175, 55, 0.6);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.2), inset 0 0 10px rgba(212, 175, 55, 0.1);
  animation: goldPulse 4s infinite ease-in-out;
}

.diamond-box {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2), inset 0 0 10px rgba(0, 229, 255, 0.1);
  animation: diamondPulse 4s infinite ease-in-out;
}

@keyframes goldPulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    border-color: #d4af37;
  }

  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    border-color: #fffb00;
  }
}

@keyframes diamondPulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    border-color: #00e5ff;
  }

  50% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
    border-color: #00fbff;
  }
}

@keyframes royalPulse {
  0%, 100% { box-shadow: inset 0 0 10px rgba(212,175,55,0.4), 0 0 5px gold; border-color: gold; }
  50% { box-shadow: inset 0 0 25px rgba(255,100,0,0.7), 0 0 20px #ff4500; border-color: #ff4500; transform: scale(1.02); }
}

.nusantara-center {
    animation: royalPulse 2s infinite ease-in-out;
    z-index: 10 !important;
}

.gold-box:hover,
.diamond-box:hover {
  transform: scale(1.05) translateY(-2px);
  filter: brightness(1.2);
}

.resource-group {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  justify-content: center;
}

.res-item {
  background: rgba(40, 40, 40, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: clamp(65px, 8vw, 85px);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.res-item:hover {
    background: rgba(60, 60, 60, 0.5);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.res-item span {
  font-size: clamp(0.75rem, 0.95vw, 1.1rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
}

.res-bar-bg {
  width: 90%;
  height: 4px;
  background: #222;
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.res-bar-fill {
  height: 100%;
  background: var(--cok-gold);
  width: 0%;
  transition: width 0.3s;
}

@keyframes hammerSwing {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(-30deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 5px gold;
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 15px gold;
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 5px gold;
  }
}

@keyframes glow {
  0% {
    filter: drop-shadow(0 0 5px gold);
  }

  100% {
    filter: drop-shadow(0 0 20px gold);
  }
}

@keyframes powerUp {
  0% {
    transform: scale(1);
    color: #fff;
  }

  50% {
    transform: scale(1.3);
    color: #f1c40f;
    text-shadow: 0 0 10px gold;
  }

  100% {
    transform: scale(1);
    color: #f1c40f;
  }
}

.power-up-anim {
  animation: powerUp 0.6s ease-out;
}

/* BUBBLE PANEN - ULTRA PREMIUM STYLE */
.collect-bubble {
  position: absolute;
  top: -55px;
}
.chronicle-wrapper {
    position: fixed;
    top: calc(clamp(60px, 7vh, 75px) + 5px);
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 500px;
    height: 30px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 20px;
    z-index: var(--z-hud-base);
    display: flex;
    align-items: center;
    padding: 0 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.chronicle-content {
    font-size: 0.75rem;
    color: #f1c40f;
    font-weight: 800;
    white-space: nowrap;
    animation: newsTicker 20s linear infinite;
}

@keyframes newsTicker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

#city-hud-right .hud-btn {
    width: 50px;
    height: 50px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

#city-hud-right .hud-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    border-color: gold;
    background: rgba(40, 40, 40, 0.8);
    box-shadow: 0 12px 30px rgba(212, 175, 55, 0.3);
}

#city-hud-right .hud-btn img {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#city-hud-right .hud-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1.5px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.collect-bubble {
  position: absolute;
  top: -55px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(55px, 7.5vw, 70px);
  height: clamp(55px, 7.5vw, 70px);
  background: radial-gradient(circle at 30% 30%, rgba(60, 60, 60, 0.98), rgba(0, 0, 0, 1));
  border: 1.8px solid rgba(212, 175, 55, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
  cursor: pointer;
  z-index: var(--z-map-hud);
  animation: floatAnim 3s infinite ease-in-out;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(212, 175, 55, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

@keyframes floatAnim {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-50%) translateY(-15px) scale(1.05); }
}

.collect-bubble::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: ripple 2s infinite;
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.collect-bubble:hover {
  transform: translateX(-50%) scale(1.2);
  filter: brightness(1.2);
}

/* KONDISI KEEMASAN (PANEN BESAR) */
.collect-bubble.full-gold {
  background: radial-gradient(circle at 30% 30%, #fff7ad 0%, #f1c40f 40%, #d4af37 100%);
  border: 2px solid #fff;
  box-shadow: 0 0 20px #f1c40f, 0 0 40px rgba(241, 196, 15, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.8);
  animation: floatAnim 3s infinite ease-in-out, pulseGlow 1.2s infinite alternate;
}

.collect-bubble.full-gold span {
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.6));
}

@keyframes pulseGlow {
  from {
    box-shadow: 0 0 15px #f1c40f, 0 0 30px rgba(241, 196, 15, 0.4);
  }

  to {
    box-shadow: 0 0 35px #fff, 0 0 60px rgba(241, 196, 15, 0.8);
  }
}

/* MODAL & UI */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(65px, 8vh, 75px);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(20, 20, 20, 0.8) 100%);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1.5px solid rgba(212, 175, 55, 0.4);
  z-index: var(--z-nav-bottom);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
  padding: 0 10px;
}

.nav-item {
  color: #aaa;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Outfit', sans-serif;
  gap: 2px;
  position: relative;
}

.nav-item img, .nav-item svg {
  width: 44px !important;
  height: 44px !important;
  object-fit: contain;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.nav-item:hover {
    color: #fff;
}

.nav-item:hover img {
    transform: translateY(-5px) scale(1.1);
    filter: drop-shadow(0 5px 15px rgba(212, 175, 55, 0.4));
}

.nav-item.active {
  color: var(--cok-gold);
}

.nav-item.active img {
  transform: translateY(-8px) scale(1.2);
  filter: drop-shadow(0 8px 20px rgba(212, 175, 55, 0.6));
}

.nav-item span {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.8;
  transition: all 0.3s;
}

.nav-item:hover span {
    opacity: 1;
    letter-spacing: 2px;
}

.map-ctrl-btn {
  width: auto;
  min-width: 48px;
  height: 48px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.85);
  border: 1.5px solid var(--cok-gold);
  color: gold;
  cursor: pointer;
  display: flex;
  flex-direction: row-reverse; /* Icon on right, label on left */
  align-items: center;
  justify-content: flex-end;
  box-shadow: 0 5px 15px rgba(0,0,0,0.6);
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  padding: 0 12px;
  gap: 10px;
}

.map-ctrl-btn .ctrl-label {
  font-size: 0.75rem;
  font-weight: 900;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  white-space: nowrap;
}

.map-ctrl-btn img {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 5px rgba(212,175,55,0.4));
}

.map-ctrl-btn:hover {
  background: var(--cok-gold);
  transform: translateX(-5px); /* Slide slightly left on hover */
}

.map-ctrl-btn:hover .ctrl-label {
  color: #000;
}

.map-ctrl-btn:active {
  transform: scale(0.95) translateX(-5px);
}

#game-canvas {
  position: absolute;
  top: clamp(50px, 6vh, 68px);
  /* Matches HUD height */
  bottom: 62px;
  width: 100%;
  overflow: hidden; /* Hapus bilah gulir (scroll bar) */
  background: #0a0a0a;
  display: block;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
  cursor: grab; /* Kembalikan kursor grab */
}

.city-map {
  position: relative;
  width: 1200px;
  /* Fixed comfortably large size */
  height: 1200px;
  background: url('../assets/denah_benteng.png') no-repeat center/100% 100%;
  flex-shrink: 0;
  margin: 0 auto;
  /* Center in the scrollable area */
}

.building-slot {
  position: absolute;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 100;
  perspective: 1000px;
  /* Memberikan efek kedalaman */
  pointer-events: none;
  /* Jangan tangkap klik di area kosong slot */
}

#map-controls {
  position: fixed;
  bottom: 110px;
  right: 20px;
  left: auto;
  z-index: var(--z-hud-floating);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.map-ctrl-btn {
  background: rgba(15, 15, 15, 0.9);
  border: 1.5px solid var(--cok-gold);
  border-radius: 8px;
  padding: 8px 12px;
  color: gold;
  display: flex;
  flex-direction: row-reverse; /* Icon on right, text on left */
  align-items: center;
  gap: 10px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
  min-width: 100px;
  justify-content: flex-end;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.map-ctrl-btn:hover {
  background: rgba(40, 40, 40, 0.95);
  transform: translateX(-5px);
  box-shadow: 0 6px 15px rgba(212, 175, 55, 0.3);
}

.map-ctrl-btn .ctrl-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.building-content {
  position: relative;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-style: preserve-3d;
  pointer-events: auto;
  /* Aktifkan klik hanya pada area visual bangunan */
}

.ground-plate {
  position: absolute;
  bottom: 0;
  left: 10%;
  /* Tengah */
  width: 80%;
  /* Dipersempit kanan-kiri */
  aspect-ratio: 1/1;
  /* Dipanjangkan atas-bawah agar jadi persegi */
  background: rgba(40, 40, 40, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 4px;
  z-index: 1;
  pointer-events: none;
}

/* Hilangkan pondasi jika bangunan sudah jadi atau merupakan slot premium agar tidak 'melebar' */
.is-built .ground-plate,
.is-empty .ground-plate {
  display: none;
}

/* Efek bercahaya hanya untuk slot kosong/sedang dibangun */
.is-empty .ground-plate,
.is-building .ground-plate {
  background: rgba(60, 60, 60, 0.5);
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  animation: pulseGoldGlow 2.5s infinite ease-in-out;
  will-change: transform, box-shadow;
}

.hammer-icon-animated {
    will-change: transform;
}

@keyframes pulseGoldGlow {

  0%,
  100% {
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6), 0 0 5px rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.4);
  }

  50% {
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 215, 0, 0.5);
    border-color: rgba(255, 215, 0, 1);
  }
}

.building-slot:hover .ground-plate {
  background: rgba(80, 80, 80, 0.6);
  border-color: gold;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* Bayangan Bangunan */
.building-slot img {
  width: 100%;
  pointer-events: none;
  z-index: 2;
  transition: transform 0.3s ease;
}

/* Hanya slot yang belum jadi yang pakai bayangan dinamis */
.is-building img {
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.6));
}

.is-built img {
  filter: none;
  /* Hilangkan bayangan agar tidak melebar */
}

.building-slot:hover img {
  transform: translateY(-5px);
  filter: drop-shadow(20px 20px 15px rgba(0, 0, 0, 0.6));
}

.plot-label {
  background: rgba(0, 0, 0, 0.85);
  color: gold;
  padding: 2px 10px;
  border: 1px solid gold;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 5px;
  z-index: 3;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

#page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.9) 100%);
  z-index: var(--z-page-overlay);
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px); /* Optimized from 5px for smoother performance */
}

.page-window {
    background: linear-gradient(rgba(20, 10, 5, 0.9), rgba(20, 10, 5, 0.95)), 
                radial-gradient(circle at 50% 50%, #f4e4bc 0%, #d2b48c 50%, #8b4513 100%);
    border: 2px solid #d4af37;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.9), 0 0 30px rgba(212, 175, 55, 0.2);
    animation: windowPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto;
    border-radius: 20px;
}

/* ROYAL CORNER ORNAMENTS */
.page-window::before {
    content: '⚜️';
    position: absolute;
    top: 5px;
    left: 5px;
    color: gold;
    font-size: 1.2rem;
    z-index: 100;
    opacity: 0.6;
    pointer-events: none;
}

.page-window::after {
    content: '⚜️';
    position: absolute;
    top: 5px;
    right: 5px;
    color: gold;
    font-size: 1.2rem;
    z-index: 100;
    opacity: 0.6;
    pointer-events: none;
    transform: scaleX(-1);
}

#page-title {
    padding: 15px;
    text-align: center;
    color: #ffd700;
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    border-bottom: 2px solid rgba(212, 175, 55, 0.4);
    background: rgba(0,0,0,0.3);
    text-transform: uppercase;
}

@keyframes windowPop {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.page-window.mini-mode {
    width: 92%;
    max-width: 480px;
    height: auto;
    max-height: 80vh;
    border-radius: 15px;
}

.page-window.train-mode {
  width: 94%;
  max-width: 900px;
  height: 85vh;
  max-height: 700px;
  border-radius: 18px;
}

/* TRAINING MENU PREMIUM STYLES */
.train-menu-premium {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
}

.train-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-shrink: 0;
}

.train-header h1 {
    color: gold;
    text-transform: uppercase;
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 0 0 10px rgba(212,175,55,0.4);
    letter-spacing: 2px;
}

.train-main-layout {
    display: flex;
    gap: 25px;
    padding: 0 10px;
    flex: 1;
    min-height: 0;
}

.train-visual-container {
    flex: 1;
    min-height: 300px;
    background: rgba(0,0,0,0.4);
    border-radius: 16px;
    border: 2px solid rgba(212,175,55,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background-image: radial-gradient(circle at center, rgba(212,175,55,0.1) 0%, transparent 70%);
}

.train-controls-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.train-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.train-stat-box {
    background: rgba(255,255,255,0.04);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 0.3s;
}

.train-stat-box:hover {
    background: rgba(255,255,255,0.08);
}

.train-amount-input-wrapper {
    background: #000;
    border: 1.5px solid #444;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    position: relative;
    transition: border-color 0.3s;
}

.train-amount-input-wrapper:focus-within {
    border-color: gold;
}

.train-amount-input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    text-align: center;
    font-size: 2.2rem;
    font-weight: bold;
    outline: none;
}

.train-action-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
}

.page-window.chat-mode {
  width: clamp(320px, 95%, 600px);
  height: clamp(400px, 85vh, 800px);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8), 0 0 30px rgba(212,175,55,0.2);
}

.page-window.full-mode {
  width: 95%;
  max-width: 1000px;
  height: 90vh;
  max-height: 850px;
  border-radius: 20px;
}

.page-window.mail-mode {
  width: clamp(320px, 98%, 1100px);
  height: clamp(500px, 90vh, 850px);
  border-radius: 24px;
}

#page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Default as layout container, inner elements should scroll */
  padding: 0; /* Let children handle padding for better scroll control */
  box-sizing: border-box;
}

/* --- TITAH BAGINDA: GLOBAL PREMIUM SCROLLBAR --- */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #d4af37, #8e6e1e);
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.2);
}

/* Support for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #d4af37 rgba(0, 0, 0, 0.1);
}

.page-window.mail-mode {
  width: 96%;
  height: 92vh;
  max-width: 1150px;
  border-radius: 20px;
}

.page-window.bursa-mode {
  width: 98%;
  height: min(95vh, 900px);
  max-width: 1250px;
  max-height: calc(100vh - 40px);
  border-radius: 24px;
}

.page-window.alliance-menu {
    width: 96%;
    height: min(92vh, 800px);
    max-width: 1100px;
    border-radius: 20px;
}


/* HORIZONTAL SWIPE CONTAINER for Bursa */
.bursa-horizontal-container {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 10px;
  height: 100%;
  align-items: center;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.bursa-horizontal-container::-webkit-scrollbar {
  height: 6px;
}

.bursa-horizontal-container::-webkit-scrollbar-thumb {
  background: gold;
  border-radius: 10px;
}

/* Removed duplicate alliance menu CSS */
.bursa-card {
  min-width: 280px;
  max-width: 320px;
  height: 80%;
  scroll-snap-align: center;
  flex-shrink: 0;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  border: 2px solid #d4af37;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  filter: brightness(1.2);
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4);
}

.close-btn:active {
    transform: scale(0.9);
}


/* ROYAL OVERLAY & MODAL SYSTEM */
.royal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: var(--z-confirm-overlay); /* Standar Kerajaan (Mencegah overlapping) */
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s;
}

.royal-modal {
    background: linear-gradient(135deg, rgba(30,30,30,0.98), rgba(15,15,15,1));
    border: 2px solid var(--cok-gold);
    width: 90%;
    max-width: 420px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 40px rgba(212,175,55,0.1), inset 0 0 20px rgba(212,175,55,0.05);
    animation: royalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

@keyframes royalSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.royal-modal-title {
    background: linear-gradient(90deg, #b8860b, #d4af37, #b8860b);
    color: black;
    padding: 12px 20px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    text-shadow: 0 1px 1px rgba(255,255,255,0.3);
}

.royal-modal-body {
    padding: 30px 25px;
    color: #f0e6cc;
    text-align: center;
    line-height: 1.6;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
}

#confirm-icon-box {
    font-size: 3rem;
    margin-bottom: 20px;
}

.royal-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(212,175,55,0.1);
}

.royal-btn {
    padding: 14px;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.royal-btn.primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(39,174,96,0.3);
    border-bottom: 3px solid #1e8449;
}

.royal-btn.secondary {
    background: linear-gradient(135deg, #444, #555);
    color: #ccc;
    border-bottom: 3px solid #222;
}

.royal-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.royal-btn:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
}

/* TOAST REFINEMENT */
#toast-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999999; /* Set extreme high for absolute visibility */
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.royal-toast {
    background: rgba(15,15,15,0.95);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    margin-bottom: 12px;
    border-left: 5px solid gold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.royal-toast.success { border-left-color: #27ae60; background: linear-gradient(90deg, rgba(39,174,96,0.1), rgba(0,0,0,0.95)); }
.royal-toast.error { border-left-color: #c0392b; background: linear-gradient(90deg, rgba(192,57,43,0.1), rgba(0,0,0,0.95)); }
.royal-toast.info { border-left-color: #3498db; background: linear-gradient(90deg, rgba(52,152,219,0.1), rgba(0,0,0,0.95)); }
.royal-toast.warning { border-left-color: #f1c40f; background: linear-gradient(90deg, rgba(241,196,15,0.1), rgba(0,0,0,0.95)); }

@keyframes toastPop {
    from { transform: translateY(-40px) scale(0.8); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
    to { transform: translateY(-20px); opacity: 0; }
}

#action-menu-local {
  position: fixed;
  z-index: 9999;
  display: flex;
  gap: 15px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  padding: 15px;
  border-radius: 20px;
  border: 2px solid rgba(212, 175, 55, 0.5);
  transform: translate(-50%, -100%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  animation: menuSlideUp 0.3s ease-out;
}

@keyframes menuSlideUp {
  from {
    transform: translate(-50%, -80%);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -100%);
    opacity: 1;
  }
}


/* EPIC ACTION BUTTONS - ROYAL GOLD */
.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
  color: #fff;
  border: 1.5px solid var(--cok-gold);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 5px;
}

.action-btn .btn-label {
  font-size: 0.6rem;
  font-weight: 900;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: gold;
}

.action-btn:hover {
  transform: scale(1.18) rotate(8deg);
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.7), inset 0 0 15px rgba(255, 255, 255, 0.5);
  z-index: 100;
}

.action-btn:active {
  transform: scale(0.92);
}


@keyframes hammerFloat {
  0%, 100% { transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-15px) rotate(10deg); }
}

@keyframes hammerSwing {
  0% { transform: rotate(-25deg); }
  100% { transform: rotate(25deg); }
}

.hammer-slot {
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(212, 175, 55, 0.1);
  transition: all 0.3s;
  cursor: pointer;
  min-width: 160px;
}

.hammer-slot:hover {
  background: rgba(30,30,30,0.9);
  border-color: gold;
  transform: translateX(5px);
}

.hammer-slot.working {
  border-left: 4px solid #3498db;
}

.hammer-slot.locked {
  opacity: 0.6;
  filter: grayscale(1);
}

.hammer-slot.idle {
  border-left: 4px solid #2ecc71;
}

.hammer-icon-animated {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hammerSwing 1s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.empty-slot {
  font-size: 2.2rem;
  color: rgba(212, 175, 55, 0.6);
  z-index: 2;
  margin-bottom: 30px;
  animation: hammerFloat 2s infinite ease-in-out;
  pointer-events: none;
  /* Klik tembus ke slot */
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
}

.hammer-anim {
  font-size: 2.5rem;
  animation: hammerFloat 1.5s infinite ease-in-out;
  z-index: 3;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  /* Klik tembus ke slot */
}

.build-bar-bg {
  width: 100%;
  height: 8px;
  background: #000;
  border: 1px solid gold;
  border-radius: 4px;
  overflow: hidden;
}

.build-bar-fill {
  height: 100%;
  background: gold;
  width: 0%;
  transition: width linear;
}

/* EPIC BUILD MENU CARDS */
.scroll-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.95) 0%, rgba(10, 10, 10, 1) 100%);
  padding: 18px 12px;
  border-radius: 16px;
  border: 1.5px solid rgba(212, 175, 55, 0.25);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.scroll-card:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: #d4af37;
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.inventory-item-card {
  aspect-ratio: 1/1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, rgba(60,60,60,0.8), rgba(20,20,20,0.95));
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inventory-item-card:hover {
  border-color: gold;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
  transform: scale(1.05);
}

.inventory-item-count {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #c0392b;
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid white;
  font-weight: bold;
}

.scroll-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.scroll-card:hover::before {
  opacity: 1;
}

.scroll-card b {
  display: block;
  color: #ffd700;
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  margin: 0;
}

.scroll-card small {
  color: #bdc3c7;
  font-size: 0.75rem;
  line-height: 1.2;
  opacity: 0.8;
}


/* EPIC GIANT BUTTON */
.btn-giant {
  width: 100%;
  padding: 12px 15px;
  background: linear-gradient(90deg, #d4af37 0%, #f1c40f 50%, #d4af37 100%);
  background-size: 200% auto;
  color: #000;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.btn-giant:hover {
  background-position: right center;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5);
  color: #000;
}

@keyframes shine {
  0% {
    background-position: 0% central;
  }

  100% {
    background-position: 200% central;
  }
}

/* CHAT POPUP STYLE */
.page-window.chat-mode {
    width: 94%;
    max-width: 950px;
    height: 85vh;
    max-height: 750px;
    border-radius: 20px;
}

/* EXP BAR STYLE */
.exp-bar-container {
  width: 120px;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.exp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3498db, #2980b9);
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
  transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* PROFILE STYLES */
.profile-container {
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 4vw, 20px);
  color: #fff;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: clamp(10px, 4vw, 20px);
  background: rgba(255, 255, 255, 0.05);
  padding: clamp(10px, 4vw, 20px);
  border-radius: 15px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  margin-bottom: 20px;
}

.profile-avatar-large {
  width: clamp(70px, 18vw, 100px);
  height: clamp(70px, 18vw, 100px);
  flex-shrink: 0;
  border-radius: 50%;
  background: #111;
  border: 3px solid var(--cok-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
  transition: 0.3s;
}


.profile-avatar-large:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.profile-info {
  flex: 1;
  text-align: left;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  transition: 0.3s;
}

.stat-card:hover {
  border-color: var(--cok-gold);
  background: rgba(212, 175, 55, 0.05);
}

.stat-value {
  display: block;
  font-size: clamp(1rem, 1.5vw, 1.8rem);
  font-weight: 800;
  color: #ffd700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 25px;
}

.rank-btn {
  background: linear-gradient(180deg, #2c3e50, #000);
  border: 1px solid #444;
  padding: 12px 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.rank-btn:hover {
  border-color: var(--cok-gold);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.rank-btn span {
  font-size: 1.2rem;
}

.rank-btn label {
  font-size: 0.65rem;
  color: #ccc;
  cursor: pointer;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.btn-secondary {
  padding: 15px;
  background: #333;
  color: #fff;
  border: 1px solid #555;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.btn-secondary:hover {
  background: #444;
}

.avatar-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  padding: 20px;
}

.avatar-opt {
  width: 60px;
  height: 60px;
  background: #222;
  border: 2px solid #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: 0.3s;
  position: relative;
}

.avatar-opt.locked {
  filter: grayscale(1) opacity(0.5);
}

.avatar-opt.locked::after {
  content: '🔒';
  position: absolute;
  font-size: 0.8rem;
  bottom: -5px;
  right: -5px;
}

.avatar-opt:hover:not(.locked) {
  border-color: var(--cok-gold);
  transform: scale(1.1);
}

.avatar-opt.active {
  border-color: var(--cok-gold);
  box-shadow: 0 0 15px var(--cok-gold);
}

/* VIP NEW UI STYLES (COK STYLE) */
.vip-selector-bar {
  display: flex;
  gap: 12px;
  padding: 10px 5px;
}

.vip-bar-item {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.vip-bar-item.selected {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
  z-index: 10;
}

.vip-bar-item.shining {
  animation: vipPlayerGlow 1.5s infinite alternate;
}

@keyframes vipPlayerGlow {
  from {
    box-shadow: 0 0 10px gold;
    border-color: #fff;
  }

  to {
    box-shadow: 0 0 25px gold, 0 0 40px rgba(255, 215, 0, 0.4);
    border-color: gold;
  }
}

.crown-icon {
  position: absolute;
  top: -10px;
  font-size: 1.2rem;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
  animation: crownFloat 2s infinite ease-in-out;
}

@keyframes crownFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.vip-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
  transform: skewX(-25deg);
  animation: vipShine 5s infinite;
  pointer-events: none;
}

@keyframes vipShine {
  0% {
    left: -100%;
  }

  15% {
    left: 200%;
  }

  100% {
    left: 200%;
  }
}

.vip-benefit-row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.benefit-icon {
  font-size: 1.5rem;
  width: 30px;
}

.benefit-text {
  flex: 1;
  color: #aaa;
  font-size: 0.9rem;
}

.benefit-value {
  color: #2ecc71;
  font-size: 1.1rem;
}

.vip-reward-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.vip-reward-item:last-child {
  border-bottom: none;
}

/* --- FLOATING MARCH STATUS ITEM --- */
.march-status-item {
  background: rgba(5, 10, 15, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-left: 4px solid var(--cok-gold);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  margin-bottom: 6px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.march-status-item:hover {
  background: rgba(15, 20, 25, 1);
  border-color: var(--cok-gold);
  transform: translateX(4px);
}

.march-status-icon {
  font-size: 1.8rem;
  width: 50px;
  height: 50px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}

.march-status-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.march-status-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.march-status-time {
  font-size: 0.85rem;
  color: #fff;
  font-family: monospace;
  font-weight: bold;
  margin-top: 1px;
}

/* Premium Tiny Progress Bar */
.march-progress-bg {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  margin-top: 5px;
  border-radius: 2px;
  overflow: hidden;
}

.march-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #f1c40f);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.4);
}

.march-recall-btn {
  width: 30px;
  height: 30px;
  background: rgba(255, 0, 0, 0.2);
  border: 1px solid rgba(255, 0, 0, 0.5);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ff4444;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin-left: 8px;
}

.march-recall-btn:hover {
  background: #ff4444;
  color: white;
  transform: scale(1.1);
}

/* Chat window now handled in common page-window section */
.chat-mode .chat-item {
  max-width: 92%;
}

/* CHAT SYSTEM STYLING - UPDATED FOR FIXED HEADER/FOOTER */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.chat-header {
  flex-shrink: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 1);
  border-bottom: 2px solid #333;
}

.chat-tabs {
  display: flex;
  padding-right: 50px;
  /* Ruang untuk tombol X */
}

.chat-tab {
  flex: 1;
  padding: 18px 20px;
  background: transparent;
  color: #888;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  transition: all 0.3s;
}

.chat-tab:hover {
  background: rgba(212, 175, 55, 0.05);
  color: gold;
}

.chat-tab.active {
  color: gold;
  border-color: gold;
  background: rgba(212, 175, 55, 0.15);
}

.chat-messages-container {
  flex: 1;
  padding: 20px 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at center, rgba(10, 15, 20, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
  scrollbar-width: thin;
}

.chat-input-area {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  padding: 15px 20px;
  background: rgba(20, 25, 30, 0.95);
  border-top: 1px solid rgba(212, 175, 55, 0.4);
  align-items: center;
  box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
}

#chat-input-field {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 12px 15px;
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.3s;
}

#chat-input-field:focus {
  outline: none;
  border-color: gold;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.5);
}

.chat-send-btn {
  background: linear-gradient(180deg, #d4af37, #8b6d05);
  border: 1px solid #fff;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, filter 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-load-more {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  color: gold;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  margin-bottom: 5px;
  transition: 0.2s;
}

.chat-load-more:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: gold;
}

.chat-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 16px;
  border-left: 3px solid #444;
  animation: messageIn 0.3s ease-out;
  max-width: 85%;
  align-self: flex-start;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  background: #222;
  border: 1px solid gold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.chat-item.is-me {
  align-self: flex-end;
  flex-direction: row-reverse;
  border-left: none;
  border-right: 4px solid gold;
  background: rgba(212, 175, 55, 0.1);
}

.chat-item.is-me .chat-meta {
  flex-direction: row-reverse;
}

.chat-item.is-me .chat-body {
  text-align: right;
}

.chat-body {
  flex: 1;
}

.chat-item.system {
  border-color: #3498db;
  background: rgba(52, 152, 219, 0.1);
}

.chat-item.player {
  border-color: var(--cok-gold);
}

.chat-item.custom {
  border-color: #8e44ad;
  background: rgba(142, 68, 173, 0.1);
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.7rem;
  gap: 15px;
}

.chat-sender {
  font-weight: 800;
  color: gold;
  text-transform: uppercase;
}

.chat-time {
  color: #666;
  white-space: nowrap;
}

.chat-text {
  font-size: 1.05rem;
  line-height: 1.5;
  color: #eee;
}

.chat-input-area {
  flex-shrink: 0;
  display: flex;
  padding: 15px;
  gap: 10px;
  background: rgba(0, 0, 0, 1);
  border-top: 1px solid #333;
}

#chat-input-field {
  flex: 1;
  background: #111;
  border: 1px solid #444;
  border-radius: 25px;
  padding: 12px 25px;
  color: white;
  font-size: 1rem;
}

.chat-send-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, gold, #b8860b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

@keyframes notificationPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

@keyframes missionReadyPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7), 0 10px 25px rgba(0,0,0,0.8); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(46, 204, 113, 0), 0 15px 35px rgba(0,0,0,0.9); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0), 0 10px 25px rgba(0,0,0,0.8); }
}

/* --- MARCH RANGE SLIDER --- */
.march-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  outline: none;
  border: 1px solid #444;
  margin: 10px 0;
}

.march-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #f1c40f 30%, #d4af37 100%);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  transition: 0.2s;
}

.march-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px gold;
}

/* --- MISSION SCROLL HUD --- */
.mission-scroll {
  position: fixed;
  left: 10px;
  top: 100px; /* Pindah ke posisi atas */
  width: 220px; /* Lebih ramping */
  height: 60px;
  background: radial-gradient(circle at 50% 50%, #f4e4bc 0%, #d2b48c 50%, #8b4513 100%);
  border: 1px solid #3e2723;
  border-radius: 5px;
  z-index: 5500;
  display: flex;
  align-items: center;
  padding: 5px 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.8), inset 0 0 15px rgba(62,39,35,0.4);
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.5));
  animation: missionEntry 1s ease-out;
  cursor: pointer;
  transition: transform 0.3s;
}

.mission-scroll:hover {
  transform: scale(1.05) rotate(-1deg);
}

.mission-scroll-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #3e2723;
}

#mission-title {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0.7;
}

#mission-text {
  font-size: 0.85rem;
  font-weight: 800;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-reward {
  font-size: 0.65rem;
  background: rgba(39, 174, 96, 0.2);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
  color: #1b5e20;
  border: 0.5px solid #27ae60;
  width: fit-content;
}

/* --- KINGDOM CHRONICLE TICKER --- */
.chronicle-wrapper {
  position: fixed;
  top: clamp(65px, 8vh, 85px);
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border-bottom: 1.5px solid rgba(212, 175, 55, 0.4);
  z-index: 4900;
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.chronicle-content {
  white-space: nowrap;
  font-size: 0.8rem;
  color: #f1f1f1;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding-left: 100%;
  text-shadow: 0 2px 4px #000;
  font-family: 'Cinzel', serif;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: tickerScroll 100s linear infinite;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-150%); } /* Berkurang agar durasi JS lebih akurat */
}

@keyframes missionEntry {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- WORLD BROADCAST OVERLAY --- */
.broadcast-overlay {
  position: fixed;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 800px;
  height: 120px;
  background: radial-gradient(ellipse at center, rgba(184, 134, 11, 0.95) 0%, rgba(0,0,0,0.8) 70%, transparent 100%);
  color: #fff;
  text-align: center;
  padding: 20px;
  z-index: 10000;
  pointer-events: none;
  font-family: 'Cinzel', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-top: 2px solid gold;
  border-bottom: 2px solid gold;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.4), inset 0 0 30px rgba(0,0,0,0.8);
  animation: broadcastPop 5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.broadcast-overlay .announcer {
  font-size: 0.8rem;
  color: gold;
  letter-spacing: 4px;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-shadow: 0 0 10px gold;
}

.broadcast-overlay .msg {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 2px 2px 5px #000, 0 0 20px rgba(255,255,255,0.3);
}

@keyframes broadcastPop {
  0% { transform: translate(-50%, -100%) scale(0.5); opacity: 0; }
  10% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  15% { transform: translate(-50%, -50%) scale(1); }
  85% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -150%) scale(0.8); opacity: 0; }
}

/* Responsive adjustments */
@media screen and (max-height: 500px) {
  .mission-scroll {
    bottom: 85px;
    width: 200px;
    height: 50px;
  }
  #mission-text { font-size: 0.75rem; }
}

/* --- VOLCANIC ASH PARTICLES --- */
.particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15; /* Above map content, below HUD */
  overflow: hidden;
}

.ash-particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  filter: blur(1px);
  animation: ashFall linear infinite;
}

@keyframes ashFall {
  0% { transform: translate(0, -10px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translate(100px, 100vh) rotate(360deg); opacity: 0; }
}
/* PREMIUM EMBLEM GLOW & COLORS */
@keyframes premiumEmblemGlow {
  0% { filter: drop-shadow(0 0 3px #f1c40f) drop-shadow(0 0 8px rgba(255,165,0,0.5)) brightness(1); }
  50% { filter: drop-shadow(0 0 10px #f1c40f) drop-shadow(0 0 20px #ff0000) brightness(1.4); }
  100% { filter: drop-shadow(0 0 3px #f1c40f) drop-shadow(0 0 8px rgba(255,165,0,0.5)) brightness(1); }
}

.premium-emblem-glow {
  animation: premiumEmblemGlow 3s infinite ease-in-out;
  display: inline-block;
  position: relative;
  z-index: 2;
}

.premium-tag-glow {
  background: linear-gradient(90deg, #f1c40f, #ff0000, #f1c40f);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shineText 3s linear infinite;
  font-weight: 900 !important;
  filter: drop-shadow(0 0 5px rgba(241, 196, 15, 0.4));
}

@keyframes shineText {
  to { background-position: 200% center; }
}

.premium-emblem-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.premium-emblem-container::after {
    content: "";
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    z-index: -1;
    animation: premiumPulse 2s infinite alternate;
}

@keyframes premiumPulse {
    from { opacity: 0.3; transform: scale(0.8); }
    to { opacity: 0.7; transform: scale(1.2); }
}


@keyframes premiumGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 204, 0, 0.4); filter: brightness(1); border-color: #ffcc00; }
  50% { box-shadow: 0 0 30px rgba(255, 204, 0, 0.8), inset 0 0 15px rgba(255, 204, 0, 0.3); filter: brightness(1.4); border-color: #ffffff; }
}
.premium-glow { animation: premiumGlow 2.5s infinite ease-in-out; border-width: 2px !important; background: radial-gradient(circle at center, rgba(255, 204, 0, 0.25) 0%, rgba(20, 20, 20, 0.95) 100%) !important; }

/* WORKER HUD & HAMMER STYLES */
.worker-hud-container {
    position: fixed;
    left: 10px;
    top: 280px; /* Adjust if overlapping with missions */
    z-index: 5000;
    width: 200px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hammer-slot {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.9), rgba(0, 0, 0, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid #666;
    border-radius: 8px;
    padding: 10px 12px;
    pointer-events: auto;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.hammer-slot:hover {
    transform: translateX(5px);
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(30, 30, 30, 0.95);
}

.hammer-slot.working {
    border-left-color: #27ae60;
}

.hammer-slot.locked {
    opacity: 0.7;
    filter: grayscale(0.5);
    border-left-color: #444;
}

.hammer-slot.locked:hover {
    filter: grayscale(0);
    border-color: #00e5ff;
}

.hammer-icon-box {
    width: 44px;
    height: 44px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.3) 100%);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.hammer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.hammer-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: #eee;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hammer-status {
    font-size: 0.7rem;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hammer-slot.working .hammer-name {
    color: gold;
}

.hammer-slot.working .hammer-status {
    color: #27ae60;
}

/* --- UI MODAL CARDS --- */
.scroll-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.scroll-card:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: gold;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.scroll-card b {
  color: gold;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-icon-container {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  margin-bottom: 4px;
}

.building-slot.is-locked {
  filter: grayscale(1) brightness(0.5);
  cursor: not-allowed;
}

.building-slot.is-locked .building-content {
  border-color: #444;
  background: rgba(0,0,0,0.4);
}

.lock-icon {
  animation: lockPulse 2s infinite ease-in-out;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

@keyframes lockPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.scroll-card.disabled {
  border-color: #555 !important;
  background: rgba(30, 30, 30, 0.8) !important;
}
/* ACADEMY PREMIUM UI */
.research-card-premium {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.research-card-premium::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212,175,55,0.05) 0%, transparent 70%);
    pointer-events: none;
    animation: rotateGlow 10s linear infinite;
}

.research-card-premium.military {
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.research-card-premium.economy {
    border-color: rgba(39, 174, 96, 0.4);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.1);
}

.research-card-premium:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.research-icon-wrapper {
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.research-progress-bg {
    width: 100%;
    height: 6px;
    background: #111;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.research-progress-fill {
    height: 100%;
    transition: width 1s ease-out;
    background: linear-gradient(90deg, gold, #fff);
    box-shadow: 0 0 10px gold;
}

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.floating-icon {
    animation: floatingIcon 3s ease-in-out infinite;
}

@keyframes floatingIcon {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 5px gold); }
    50% { transform: translateY(-8px); filter: drop-shadow(0 0 15px gold); }
}

/* DEWAN RAKYAT UI */
.dewan-rakyat-container { padding: 15px; color: #fff; }
.ministry-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid gold; padding-bottom: 10px; margin-bottom: 15px; }
.social-fund-display { background: rgba(0,0,0,0.5); padding: 5px 12px; border-radius: 20px; border: 1px solid gold; font-size: 0.8rem; font-weight: bold; color: gold; display: flex; align-items: center; gap: 5px; }
.sub-tab-navigation { display: flex; gap: 10px; margin-bottom: 20px; }
.dr-sub-btn { flex: 1; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid #444; color: #aaa; cursor: pointer; border-radius: 5px; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; transition: 0.3s; }
.dr-sub-btn.active { background: gold; color: #000; border-color: #fff; box-shadow: 0 0 10px rgba(212,175,55,0.5); }
.dr-section-box { background: rgba(0,0,0,0.4); border: 1px solid #333; padding: 20px; border-radius: 10px; margin-bottom: 15px; }
.dr-form-group { margin-bottom: 15px; }
.dr-form-group label { display: block; font-size: 0.7rem; color: #888; text-transform: uppercase; margin-bottom: 5px; font-weight: bold; }
.dr-form-group input, .dr-form-group textarea { width: 100%; background: #111; border: 1px solid #444; color: #fff; padding: 10px; border-radius: 5px; font-family: inherit; }
.dr-status-selector { display: flex; gap: 5px; margin-bottom: 20px; }
.status-opt { flex: 1; padding: 8px; font-size: 0.7rem; border: 1px solid #444; background: #222; color: #666; cursor: pointer; border-radius: 4px; }
.status-opt.selected { border-color: #27ae60; color: #27ae60; background: rgba(39,174,96,0.1); }
.dr-audit-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.dr-audit-table th { text-align: left; padding: 10px; border-bottom: 1px solid #444; color: gold; font-size: 0.7rem; }
.dr-audit-table td { padding: 12px 10px; border-bottom: 1px solid #222; vertical-align: middle; }
.badge-active { color: #2ecc71; font-weight: bold; font-size: 0.7rem; }
.badge-lazy { color: #e74c3c; font-weight: bold; font-size: 0.7rem; }
.btn-warn-icon, .btn-kick-icon { background: none; border: 1px solid #444; padding: 5px 8px; border-radius: 4px; cursor: pointer; margin-right: 5px; transition: 0.2s; }
.btn-warn-icon:hover { border-color: gold; }
.btn-kick-icon:hover { border-color: #e74c3c; background: rgba(231,76,60,0.1); }
.salary-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 15px 0; }
.sal-grp { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; }
.sal-grp input { width: 60px; background: #000; border: 1px solid #333; color: gold; padding: 5px; border-radius: 4px; text-align: center; }
.btn-gold-large { width: 100%; padding: 15px; background: linear-gradient(135deg, #d4af37, #b8860b); border: none; color: #000; font-weight: 900; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: 0.3s; }
.btn-gold-large:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,175,55,0.4); }
.dr-info { font-size: 0.65rem; color: #888; font-style: italic; margin-bottom: 15px; }

.dr-separator { height: 1px; background: rgba(212,175,55,0.2); margin: 25px 0; border: none; }

/* DEWAN RAKYAT PREMIUM UI */
.dr-section-box { background: rgba(0,0,0,0.4); border: 1px solid #333; padding: 25px; border-radius: 12px; margin-bottom: 20px; transition: 0.3s; }
.dr-section-box.shadow-gold { border-top: 3px solid #d4af37; box-shadow: 0 5px 20px rgba(212,175,55,0.05); }
.dr-section-box.shadow-blue { border-top: 3px solid #3498db; box-shadow: 0 5px 20px rgba(52,152,219,0.05); }
.dr-section-box.shadow-green { border-top: 3px solid #2ecc71; box-shadow: 0 5px 20px rgba(46,204,113,0.05); }

.dr-title { margin: 0 0 20px 0; font-family: 'Cinzel', serif; font-size: 1rem; color: #f0e6cc; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 10px; }
.dr-status-selector { display: flex; gap: 8px; margin-top: 5px; }
.status-opt { flex: 1; padding: 10px; font-size: 0.65rem; border: 1px solid #444; background: #222; color: #777; font-weight: 900; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.status-opt.selected { border-color: gold; color: gold; background: rgba(212,175,55,0.1); box-shadow: 0 0 10px rgba(212,175,55,0.2); }

.dr-input { width: 100%; background: #000; border: 1px solid #444; color: #fff; padding: 12px; border-radius: 8px; font-size: 0.9rem; }
.dr-textarea { width: 100%; height: 80px; background: #000; border: 1px solid #444; color: #ccc; padding: 12px; border-radius: 8px; font-size: 0.8rem; line-height: 1.5; resize: none; margin-top: 10px; }
.btn-primary-gold { width: 100%; padding: 12px; background: linear-gradient(180deg, gold, #b8860b); border: none; font-weight: 900; color: #000; border-radius: 8px; margin-top: 15px; cursor: pointer; transition: 0.2s; }
.btn-primary-gold:hover { transform: translateY(-2px); box-shadow: 0 5px 15px gold; }

/* Applicant Cards */
.dr-applicant-container { max-height: 300px; overflow-y: auto; padding: 5px; }
.dr-applicant-card { background: rgba(255,255,255,0.03); border: 1px solid #444; border-radius: 8px; padding: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.app-actions { display: flex; gap: 10px; }
.btn-app { border: none; border-radius: 4px; padding: 8px 15px; font-size: 0.7rem; font-weight: bold; cursor: pointer; }
.btn-app.accept { background: #27ae60; color: white; }
.btn-app.reject { background: #c0392b; color: white; }

/* Audit Rows */
.audit-member-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.03); align-items: center; }
.badge { font-size: 0.6rem; padding: 2px 8px; border-radius: 4px; font-weight: bold; }
.badge.active { background: rgba(46,204,113,0.1); color: #2ecc71; border: 1px solid #2ecc71; }
.badge.lazy { background: rgba(231,76,60,0.1); color: #e74c3c; border: 1px solid #e74c3c; }
.badge.recommend { background: rgba(52,152,219,0.1); color: #3498db; border: 1px solid #3498db; }
.btn-mini-dr { background: rgba(255,255,255,0.1); border: 1px solid #555; border-radius: 4px; padding: 5px; cursor: pointer; transition: 0.2s; }
.btn-mini-dr:hover { background: #d4af37; color: #000; }
.btn-mini-dr.danger:hover { background: #e74c3c; color: #fff; }

/* Salary Section */
.salary-setup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; overflow-x: auto; }
.sal-card { background: rgba(0,0,0,0.5); border: 1px solid #333; padding: 15px; border-radius: 10px; text-align: center; }
.sal-rank { font-size: 0.6rem; font-weight: bold; color: #888; margin-bottom: 10px; letter-spacing: 1px; }
.dr-input-sal { width: 100%; background: #000; border: none; border-bottom: 1px solid gold; color: gold; font-size: 1.2rem; text-align: center; font-weight: 900; margin-bottom: 5px; }
.sal-res { font-size: 0.5rem; color: #555; }
.btn-salary-execute { padding: 15px 30px; background: linear-gradient(135deg, #2ecc71, #27ae60); border: none; color: #fff; border-radius: 50px; font-weight: 900; letter-spacing: 1px; cursor: pointer; box-shadow: 0 5px 20px rgba(46,204,113,0.3); }
.btn-salary-execute:hover { transform: scale(1.05); }

.dr-empty-state { padding: 40px; text-align: center; color: #444; font-style: italic; font-size: 0.8rem; }
.dr-separator { height: 1px; background: linear-gradient(90deg, transparent, gold, transparent); margin: 30px 0; border: none; opacity: 0.3; }


/* CHAT SYSTEM STYLING - RESTORED FROM ARCHIVE */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.chat-header {
  flex-shrink: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 1);
  border-bottom: 2px solid #333;
}

.chat-tabs {
  display: flex;
  padding-right: 50px;
}

.chat-tab {
  flex: 1;
  padding: 18px 20px;
  background: transparent;
  color: #888;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  transition: all 0.3s;
}

.chat-tab:hover {
  background: rgba(212, 175, 55, 0.05);
  color: gold;
}

.chat-tab.active {
  color: gold;
  border-color: gold;
  background: rgba(212, 175, 55, 0.15);
}

.chat-messages-container {
  flex: 1;
  padding: 20px 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at center, rgba(10, 15, 20, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
  scrollbar-width: thin;
}

.chat-load-more {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  color: gold;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  margin-bottom: 5px;
  transition: 0.2s;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-input-area {
  flex-shrink: 0;
  display: flex;
  padding: 15px;
  gap: 10px;
  background: rgba(0, 0, 0, 1);
  border-top: 1px solid #333;
}

#chat-input-field {
  flex: 1;
  background: #111;
  border: 1px solid #444;
  border-radius: 25px;
  padding: 12px 25px;
  color: white;
  font-size: 1rem;
}

.chat-send-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, gold, #b8860b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}
.close-btn { width: 44px !important; height: 44px !important; font-size: 1.5rem !important; display: flex !important; align-items: center; justify-content: center; z-index: 999999 !important; }
#nav-btn-chat img { width: 54px !important; height: 44px !important; filter: drop-shadow(0 2px 10px gold) !important; }

/* --- RESPONSIVE UTILITIES (TITAH BAGINDA) --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.flex-split { display: flex; gap: 20px; }

@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; gap: 10px; }
  .flex-split { flex-direction: column; }
  
  /* Khusus dashboard atau yang butuh 2 kolom di mobile agar tidak terlalu panjang */
  .grid-mobile-2 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 480px) {
  .grid-mobile-2 { grid-template-columns: 1fr !important; }
}
