/* WNI Simulator - Dark Glassmorphism Indonesia Board Game */
:root {
  --bg: #090b14;
  --bg2: #0f1322;
  --panel: rgba(18, 22, 38, 0.75);
  --glass: rgba(255, 255, 255, 0.06);
  --glass2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --txt: #f1f3f9;
  --mut: #8f96a9;
  --dim: #5c6275;
  --ac: #f0b955; /* Gold */
  --ac-glow: rgba(240, 185, 85, 0.35);
  --indo-red: #ef4444; /* Merah Putih */
  --indo-glow: rgba(239, 68, 68, 0.4);
  --ok: #10b981;
  --err: #f87171;
  --rad: 18px;
  --rad-sm: 12px;

  /* Player Colors */
  --p1: #ef4444; /* Merah */
  --p2: #10b981; /* Hijau */
  --p3: #3b82f6; /* Biru */
  --p4: #f59e0b; /* Kuning */
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  user-select: none;
}

/* Ambient Glow Blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(95px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.blob.b1 { width: 500px; height: 500px; background: #991b1b; top: -140px; left: -140px; }
.blob.b2 { width: 520px; height: 520px; background: #1e3a8a; bottom: -150px; right: -150px; }
.blob.b3 { width: 440px; height: 440px; background: #854d0e; top: 40%; left: 55%; }

/* Glass Containers */
.screen-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.screen-wrap.hide { display: none !important; }

.glass {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.glass-pill {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 99px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--rad-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--txt);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.btn.pri {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 4px 18px var(--indo-glow);
}
.btn.pri:hover {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.6);
}
.btn.gold {
  background: linear-gradient(135deg, #f0b955 0%, #d97706 100%);
  color: #111;
  border-color: #f0b955;
  box-shadow: 0 4px 18px var(--ac-glow);
}
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Form Inputs */
.input-glass {
  width: 100%;
  padding: 12px 16px;
  background: rgba(10, 14, 25, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--rad-sm);
  color: var(--txt);
  font-size: 14px;
  outline: none;
}
.input-glass:focus {
  border-color: var(--indo-red);
  box-shadow: 0 0 14px var(--indo-glow);
}

/* Auth Screen */
#screen-auth {
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box {
  width: 100%;
  max-width: 460px;
  padding: 32px 28px;
  text-align: center;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(240, 185, 85, 0.2));
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 36px;
  margin-bottom: 16px;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Lobby Screen */
#screen-lobby {
  padding: 14px 20px;
  max-width: 1080px;
  margin: 0 auto;
}
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  margin-bottom: 16px;
}
.lobby-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}
@media (max-width: 820px) {
  .lobby-grid { grid-template-columns: 1fr; }
}
.lobby-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================== GAME ARENA BOARD ==================== */
#screen-game {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 12px;
}
.arena-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  height: 48px;
  flex-shrink: 0;
  margin-bottom: 6px;
}

.arena-main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 12px;
  min-height: 0;
}
@media (max-width: 960px) {
  .arena-main-content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    overflow-y: auto;
  }
}

/* BOARD LAYOUT: 6x6 Grid for 20 Perimeter Tiles */
.board-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  padding: 10px;
  height: 100%;
  position: relative;
  background: rgba(10, 14, 25, 0.5);
  border-radius: var(--rad);
  border: 1px solid var(--line);
}

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.2s ease;
  font-size: 11px;
  overflow: hidden;
}
.tile.corner {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
}
.tile.property {
  border-top: 3px solid #64748b;
}
.tile.property.owned-0 { border-top-color: var(--p1); }
.tile.property.owned-1 { border-top-color: var(--p2); }
.tile.property.owned-2 { border-top-color: var(--p3); }
.tile.property.owned-3 { border-top-color: var(--p4); }

.tile-icon { font-size: 18px; }
.tile-name {
  font-weight: 700;
  color: var(--txt);
  line-height: 1.1;
  margin: 2px 0;
  font-size: 10px;
}
.tile-price {
  font-size: 9px;
  color: var(--ac);
  font-weight: 600;
}

/* Player Pins on Tiles */
.tile-pawns-row {
  display: flex;
  gap: 3px;
  position: absolute;
  bottom: 4px;
  right: 4px;
}
.pawn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pawn.p0 { background: var(--p1); }
.pawn.p1 { background: var(--p2); }
.pawn.p2 { background: var(--p3); }
.pawn.p3 { background: var(--p4); }

/* Center Felt of Board */
.board-center-area {
  grid-column: 2 / 6;
  grid-row: 2 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  position: relative;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.08) 0%, rgba(10, 14, 25, 0.75) 100%);
  border-radius: 14px;
  border: 1px dashed var(--line);
}

.center-title {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, #ef4444, #f0b955);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.center-sub {
  font-size: 11px;
  color: var(--mut);
  margin-bottom: 12px;
}

/* Dice Container */
.dice-container {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.die {
  width: 48px;
  height: 48px;
  background: #ffffff;
  color: #111;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  transition: transform 0.25s ease;
}
.die.rolling {
  animation: rollAnim 0.5s linear infinite;
}
@keyframes rollAnim {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.9); }
}

/* SIDEBAR: Players Info & Action Panel */
.arena-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.player-status-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid #64748b;
  transition: all 0.2s ease;
}
.player-status-card.turn {
  box-shadow: 0 0 16px var(--ac-glow);
  transform: translateX(-2px);
}
.player-status-card.p0 { border-left-color: var(--p1); }
.player-status-card.p1 { border-left-color: var(--p2); }
.player-status-card.p2 { border-left-color: var(--p3); }
.player-status-card.p3 { border-left-color: var(--p4); }

.stat-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}
.stat-bar-fill.sanity {
  background: linear-gradient(90deg, #ec4899, #8b5cf6);
}

/* Event Logs Box */
.event-log-box {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}
.log-item {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.4;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hide { display: none !important; }
.modal-content {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  text-align: center;
}
