/* ============================================================
   Monopoli New Gen — stylesheet utama
   Tema: muslim (emas gelap) / sains (teal bersih), via data-genre
   ============================================================ */

:root {
  --bg: #0f1420;
  --bg2: #171e2e;
  --card: #1c2536;
  --card2: #232e44;
  --line: #2e3a55;
  --text: #eef2f7;
  --muted: #9aa7bd;
  --accent: #d4a544;        /* default: emas muslim */
  --accent-soft: rgba(212,165,68,.16);
  --danger: #e5484d;
  --ok: #46c96b;
  --radius: 14px;
}
body[data-genre="science"] { --accent: #38b6d8; --accent-soft: rgba(56,182,216,.15); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, var(--bg2), var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}
body[data-genre="muslim"] {
  background-image:
    radial-gradient(900px 600px at 80% -20%, rgba(212,165,68,.10), transparent 60%),
    radial-gradient(1200px 800px at 70% -10%, var(--bg2), var(--bg) 60%);
}
body[data-genre="science"] {
  background-image:
    radial-gradient(900px 600px at 80% -20%, rgba(56,182,216,.10), transparent 60%),
    radial-gradient(1200px 800px at 70% -10%, var(--bg2), var(--bg) 60%);
}

.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; }

h1, h2, h3 { font-weight: 700; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 18px; font-size: 15px; font-weight: 600;
  transition: transform .06s, background .15s, border-color .15s;
}
.btn:hover { background: #2a3750; }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--accent);
  border-color: transparent; color: #14120c;
  box-shadow: 0 4px 18px var(--accent-soft);
}
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn-danger { background: rgba(229,72,77,.15); border-color: rgba(229,72,77,.5); color: #ff8f93; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ===================== MENU ===================== */
#screen-menu { justify-content: center; gap: 26px; padding: 24px; text-align: center; position: relative; }
.lang-toggle {
  position: absolute; top: 18px; right: 18px;
  display: flex; gap: 6px; z-index: 5;
}
.lang-toggle button {
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px;
}
.lang-toggle button.on { color: #14120c; background: var(--accent); border-color: transparent; }

.menu-logo { font-size: 64px; filter: drop-shadow(0 6px 24px rgba(212,165,68,.35)); }
.menu-title {
  font-size: clamp(34px, 6vw, 56px); letter-spacing: 1px; line-height: 1.05;
  background: linear-gradient(135deg, var(--accent), #f7dd9b 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.menu-sub { color: var(--muted); font-size: 16px; margin-top: 6px; }
.menu-actions { display: flex; flex-direction: column; gap: 12px; width: min(320px, 84vw); margin-top: 18px; }
.menu-actions .btn { padding: 13px 18px; font-size: 16px; }
.menu-foot { color: var(--muted); font-size: 12px; opacity: .7; }

/* ===================== PANEL GENERIK ===================== */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.screen-body { width: min(880px, 94vw); display: flex; flex-direction: column; gap: 16px; padding: 24px 0 60px; }
.screen-head { display: flex; align-items: center; gap: 14px; width: min(880px, 94vw); padding-top: 22px; }
.screen-head h2 { font-size: 24px; }
.back-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px;
}

/* ===================== SETUP ===================== */
.genre-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.genre-cards.single { grid-template-columns: 1fr; }
.genre-card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: left; color: var(--text); transition: border-color .15s, background .15s;
}
.genre-card .gc-icon { font-size: 40px; }
.genre-card h3 { margin: 8px 0 4px; font-size: 18px; }
.genre-card p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.genre-card.sel { border-color: var(--accent); background: var(--accent-soft); }

.player-row {
  display: grid; grid-template-columns: 46px 1fr 110px 110px 40px; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.avatar-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.avatar-pick button {
  background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: 20px; padding: 3px;
}
.avatar-pick button.sel { border-color: var(--accent); background: var(--accent-soft); }

/* ===================== GAME ===================== */
#screen-game { min-height: 100vh; }
#game-header {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: rgba(12,16,26,.72); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 150; backdrop-filter: blur(6px);
}
#game-header .gh-title { font-weight: 800; font-size: 16px; letter-spacing: .5px; color: var(--accent); }
#game-header .gh-right { margin-left: auto; display: flex; gap: 8px; }

#game-main {
  flex: 1; display: flex; gap: 18px; padding: 18px;
  align-items: flex-start; justify-content: center; flex-wrap: wrap;
}
#board-wrap { position: relative; width: min(78vh, 660px, 94vw); flex: 0 1 auto; }
#board {
  display: grid; grid-template-columns: repeat(11, 1fr); grid-template-rows: repeat(11, 1fr);
  aspect-ratio: 1; background: var(--bg2); border: 2px solid var(--line); border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

/* Tile papan */
.tile {
  position: relative; border: 1px solid rgba(255,255,255,.06);
  background: var(--card); overflow: hidden; cursor: default;
}
.tile .tbar { height: 12%; background: #666; }
.tile .tname {
  font-size: clamp(6px, 1.15vw, 10.5px); font-weight: 700; line-height: 1.15;
  padding: 2px 3px 0; text-align: center; word-break: keep-all;
}
.tile .tprice { font-size: clamp(5.5px, .95vw, 9px); color: var(--muted); text-align: center; }
.tile .temoji { font-size: clamp(8px, 1.6vw, 15px); text-align: center; display: block; padding-top: 2px; }
.tile.corner .temoji { font-size: clamp(12px, 2.4vw, 24px); }
.tile.corner .tname { font-size: clamp(7px, 1.3vw, 12px); padding-top: 4px; }
.tile.owned { box-shadow: inset 0 0 0 2.5px var(--owner, #fff); }
.tile.tile-click { cursor: pointer; }
.tile.tile-click:hover { background: var(--card2); }
.tile.flash { animation: tileFlash .5s ease 2; }
@keyframes tileFlash { 50% { background: var(--accent-soft); } }

.houses-row { display: flex; gap: 1.5px; justify-content: center; padding: 1px 0 0; height: 9px; }
.houses-row .h { width: 6px; height: 6px; background: #4caf50; border-radius: 1.5px; }
.houses-row .hotel { width: 10px; background: #e5484d; }

/* Rotasi teks tile kiri & kanan */
.tile.rot-l .trot, .tile.rot-r .trot {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
}
.tile.rot-l .trot { transform: rotate(90deg); }
.tile.rot-r .trot { transform: rotate(-90deg); }
.tile.rot-l .tbar, .tile.rot-r .tbar { height: auto; width: 12%; position: absolute; top: 0; bottom: 0; }
.tile.rot-l .tbar { right: 0; }
.tile.rot-r .tbar { left: 0; }
.tile.rot-l, .tile.rot-r { padding-left: 0; }
.tile .trot { display: contents; }
.tile.rot-l .trot, .tile.rot-r .trot { display: flex; }
.tile.rot-l .tbar, .tile.rot-r .tbar { top: 0; }

/* Pusat papan */
#center {
  grid-area: 2 / 2 / 11 / 11;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background:
    radial-gradient(420px 420px at 50% 40%, var(--accent-soft), transparent 70%);
}
#center .c-emblem { font-size: clamp(40px, 9vw, 84px); filter: drop-shadow(0 4px 18px rgba(0,0,0,.5)); }
#center .c-title {
  font-size: clamp(16px, 3.4vw, 30px); font-weight: 900; letter-spacing: 2px; color: var(--accent);
  text-align: center; line-height: 1.15;
}
#center .c-sub { color: var(--muted); font-size: clamp(10px, 1.8vw, 14px); text-align: center; max-width: 70%; }
#center .c-stats { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
#center .c-stat {
  background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 14px; text-align: center;
}
#center .c-stat b { color: var(--accent); font-size: clamp(13px, 2.4vw, 20px); display: block; }
#center .c-stat span { font-size: clamp(8px, 1.4vw, 11px); color: var(--muted); }

#center .c-rule {
  color: var(--muted); font-size: clamp(8px, 1.5vw, 12px); margin-top: 2px;
  text-align: center; max-width: 80%;
}

/* Kartu aturan menang di setup */
.rule-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rule-cards .genre-card { padding: 14px; }
.rule-cards .genre-card h3 { font-size: 15px; margin: 0 0 4px; }
.rule-cards .genre-card p { font-size: 12.5px; }

/* Tabel riwayat transaksi */
.tx-scroll { max-height: 55vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.tx-table td { font-size: 13px; }

/* Token pemain */
#tokens-layer { position: absolute; inset: 0; pointer-events: none; }
.token {
  position: absolute; font-size: clamp(14px, 2.6vw, 22px);
  transition: left .24s ease, top .24s ease;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.6));
}
.token .ring {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid var(--pc, #fff); opacity: .85;
}

/* Sidebar */
#sidebar { width: 300px; display: flex; flex-direction: column; gap: 12px; flex: 0 0 300px; }
.pcard {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
}
.pcard.active { border-color: var(--accent); background: var(--accent-soft); }
.pcard.dead { opacity: .38; text-decoration: line-through; }
.pcard .pc-emoji { font-size: 22px; }
.pcard .pc-name { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.pcard .pc-money { font-weight: 800; color: var(--accent); font-size: 14px; text-align: right; }
.pcard .pc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.pcard .pc-tags .tag { font-size: 10px; background: var(--bg2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--muted); }
.tag.q { color: #ff9c5b; border-color: rgba(255,156,91,.4); }
.tag.bot { color: #8fd3ff; }

#log-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; max-height: 220px; overflow-y: auto; font-size: 12.5px;
}
#log-panel .ll { padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.05); color: var(--muted); }
#log-panel .ll.hl { color: var(--text); }
#log-panel .ll b { color: var(--accent); }

/* ===================== MODAL ===================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,8,14,.72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.6);
  animation: popIn .22s cubic-bezier(.2,1.4,.4,1);
}
@keyframes popIn { from { transform: scale(.92); opacity: 0; } }
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal .m-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal .m-actions .btn { flex: 1; }

/* Modal soal */
.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.q-meta .steps-chip { margin-left: auto; }
.q-text { font-size: 16.5px; line-height: 1.5; font-weight: 600; margin-bottom: 16px; }
.qopts { display: grid; gap: 9px; }
.qopt {
  text-align: left; background: var(--bg2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 11px 14px; font-size: 14.5px; line-height: 1.4;
  transition: border-color .12s, background .12s;
}
.qopt:hover { border-color: var(--accent); }
.qopt .key {
  display: inline-block; width: 22px; height: 22px; border-radius: 6px; margin-right: 9px;
  background: var(--card2); text-align: center; line-height: 22px; font-weight: 800; font-size: 12px;
}
.qopt.right { border-color: var(--ok); background: rgba(70,201,107,.14); }
.qopt.wrong { border-color: var(--danger); background: rgba(229,72,77,.13); }
.qopt.dim { opacity: .55; }
.timerbar-wrap { height: 7px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin: 10px 0 4px; }
.timerbar { height: 100%; width: 100%; background: var(--accent); border-radius: 6px; transition: width 1s linear; }
.timerbar.low { background: var(--danger); }
.timer-num { font-size: 12px; color: var(--muted); text-align: right; }
.q-hint-row { margin: 8px 0 4px; }
.q-hint-row .btn { padding: 6px 14px; font-size: 13px; }
.q-explain {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
}
.q-explain b { color: var(--accent); }

/* Kartu properti */
.propcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.propcard-head .pc-emoji { font-size: 34px; }
.rent-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.rent-table td { padding: 5px 8px; border-bottom: 1px dashed rgba(255,255,255,.08); }
.rent-table td:last-child { text-align: right; font-weight: 700; color: var(--accent); }

/* Kartu kejadian */
.eventcard {
  border: 2px solid var(--accent); border-radius: 14px; padding: 18px; text-align: center;
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%);
}
.eventcard .ec-icon { font-size: 38px; }
.eventcard h4 { font-size: 16px; margin: 8px 0 6px; color: var(--accent); }
.eventcard p { color: var(--text); font-size: 14.5px; line-height: 1.5; }

/* ===================== TOAST ===================== */
#toast-root {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: rgba(18,24,38,.95); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .25s ease;
  max-width: min(92vw, 560px); text-align: center;
}
.toast.err { border-color: rgba(229,72,77,.6); color: #ffb1b4; }
.toast.ok { border-color: rgba(70,201,107,.5); color: #b8f0c9; }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } }

/* ===================== EDITOR ===================== */
.ed-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.ed-list { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ed-item {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; cursor: pointer; font-size: 13px;
}
.ed-item:hover { border-color: var(--accent); }
.ed-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.ed-item .ei-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.ed-item .ei-meta .tag { font-size: 10px; background: var(--card2); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.ed-form .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.ed-form label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.ed-form textarea { width: 100%; resize: vertical; min-height: 56px; }
.ed-form input[type="text"] { width: 100%; }
.opt-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-grid input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.opt-grid input[type="text"] { width: 100%; }
.ed-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ed-tabs button {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 13px;
}
.ed-tabs button.on { color: #14120c; background: var(--accent); border-color: transparent; }

/* ===================== HELP ===================== */
.help-body { line-height: 1.7; font-size: 14.5px; color: var(--text); }
.help-body h3 { color: var(--accent); margin: 14px 0 6px; font-size: 16px; }
.help-body li { margin: 4px 0 4px 18px; }

/* ===================== OVERLAY JEDA ===================== */
#pause-overlay {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(5,8,14,.82); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.pause-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 40px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.6);
  max-width: 420px;
}
.pause-card .p-icon { font-size: 46px; margin-bottom: 8px; }
.pause-card h2 { color: var(--accent); margin-bottom: 8px; }
.pause-card p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; }
.pause-card .btn { width: 100%; padding: 13px; font-size: 16px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 980px) {
  #sidebar { flex: 1 1 100%; width: 100%; max-width: 660px; }
  .ed-layout { grid-template-columns: 1fr; }
  .ed-list { max-height: 40vh; }
}
@media (max-width: 640px) {
  .genre-cards { grid-template-columns: 1fr; }
  .player-row { grid-template-columns: 40px 1fr 90px 90px 34px; }
  .modal { padding: 16px; }
}
