:root {
  --bg: #0b1a2e;
  --bg2: #16304d;
  --panel: #1b3454;
  --accent: #e63946;     /* merah — aksen utama */
  --accent2: #ff6b6b;    /* merah muda untuk gradien */
  --good: #2ec4b6;
  --text: #eef4fb;       /* putih kebiruan */
  --muted: #9db4d0;      /* biru-abu lembut */
  --p1: #e63946;         /* Pemain 1: merah */
  --p2: #3ca8ff;         /* Pemain 2: biru */
  --blue: #4ea3ff;       /* aksen biru terang */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: radial-gradient(circle at 50% 0%, #16304d, #081320 70%);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

#app { width: 100vw; height: 100vh; position: relative; }

.mute-btn {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 50;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.45);
  font-size: 18px; color: #fff; backdrop-filter: blur(4px);
}
.mute-btn:hover { background: rgba(0,0,0,.6); }
.mute-btn.muted { opacity: .55; }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  padding: 20px;
  animation: fade .25s ease;
}
.screen.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-weight: 600; font-size: 16px;
  border: none; border-radius: 12px; padding: 12px 22px;
  cursor: pointer; transition: transform .08s, filter .15s;
  color: #fff;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px rgba(230,57,70,.4); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: rgba(255,255,255,.08); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.16); }

/* ---------- Auth ---------- */
.auth-card {
  background: rgba(27,52,84,.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 36px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.logo {
  font-family: 'Bangers', cursive;
  font-size: 44px; letter-spacing: 2px;
  text-align: center; line-height: 1;
  color: var(--accent2);
}
.logo span { color: var(--text); display:block; font-size: 22px; }
.tagline { text-align: center; color: var(--muted); margin: 8px 0 22px; font-size: 14px; }

.tabs { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font-family: inherit; font-weight: 600; padding: 10px; border-radius: 9px; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }

.auth-form { display: none; flex-direction: column; gap: 12px; }
.auth-form.active { display: flex; }
.auth-form input {
  font-family: inherit; font-size: 15px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px; padding: 13px 15px; color: var(--text);
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
/* Checkbox persetujuan (baca kebijakan privasi & ketentuan) */
.consent {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
  text-align: left; cursor: pointer; margin: 2px 0 2px;
}
.consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.consent a { color: var(--accent2); text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }
.btn:disabled:active { transform: none; }
.form-msg { font-size: 13px; min-height: 18px; text-align: center; }
.form-msg.err { color: #ff7a6b; }
.form-msg.ok { color: var(--good); }

/* Tautan beranda di halaman auth */
.auth-home {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  padding: 7px 14px; border-radius: 20px; margin-bottom: 16px;
  transition: background .15s, border-color .15s, transform .08s;
}
.auth-home:hover { background: rgba(230,57,70,.25); border-color: var(--accent); }
.auth-home:active { transform: scale(.96); }

/* ---------- Homepage / Profil ---------- */
#screen-menu { justify-content: flex-start; overflow-y: auto; }
.profile-page { width: 100%; max-width: 900px; padding-bottom: 40px; }
.topbar {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px; margin-top: 6px;
}
.brand { font-family: 'Bangers', cursive; font-size: 24px; letter-spacing: 1.5px; color: var(--accent2); }
.brand-mark { color: var(--text); }

.profile-hero {
  position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08); margin-top: 8px;
}
.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, #4ea3ff33, #3ca8ff22 40%, #e6394622),
              radial-gradient(circle at 80% -10%, #e6394655, transparent 50%);
  background-color: var(--panel);
}
.hero-content { position: relative; display: flex; align-items: center; gap: 22px; padding: 26px; }
.profile-avatar {
  width: 92px; height: 92px; border-radius: 24px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; font-size: 46px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(230,57,70,.4); border: 3px solid rgba(255,255,255,.18);
}
.profile-name { font-size: 28px; font-weight: 700; line-height: 1.1; }
.profile-rank { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.rank-badge {
  background: linear-gradient(135deg, #ff6b6b, #e63946); color: #fff;
  font-weight: 700; font-size: 14px; padding: 4px 14px; border-radius: 20px;
}
.rank-jp { color: var(--muted); font-size: 15px; }
.rank-progress { max-width: 320px; }
.rank-progress-bar { height: 8px; background: rgba(0,0,0,.3); border-radius: 6px; overflow: hidden; }
.rank-progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--good)); transition: width .4s; }
.rank-progress-label { color: var(--muted); font-size: 12px; margin-top: 5px; }

.stat-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0 6px;
}
.stat-box {
  background: var(--panel); border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px; padding: 16px 8px; text-align: center;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--accent2); }
.stat-lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }

.section-title { font-size: 20px; margin: 26px 0 14px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 18px; }

/* watermark kanji di hero */
.profile-hero::after {
  content: '力'; position: absolute; right: 18px; bottom: -28px;
  font-family: 'Bangers', cursive; font-size: 180px; line-height: 1;
  color: rgba(255,255,255,.05); pointer-events: none;
}

/* Tombol Mainkan Sekarang */
.home-actions { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: 30px; }
.btn-play {
  width: 100%; max-width: 460px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: 'Bangers', cursive; letter-spacing: 2px; font-size: 30px;
  color: #fff; border: none; border-radius: 18px; padding: 20px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 30px rgba(230,57,70,.45);
  animation: glow 1.8s ease-in-out infinite alternate;
  transition: transform .1s;
}
.btn-play:hover { transform: translateY(-2px); }
.btn-play:active { transform: scale(.97); }
.play-icon { font-family: system-ui; font-size: 22px; }
@keyframes glow {
  from { box-shadow: 0 10px 26px rgba(230,57,70,.35); }
  to   { box-shadow: 0 14px 40px rgba(78,163,255,.55); }
}
.home-board { max-width: 460px; width: 100%; }

/* Modal pilih lawan */
.modal {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,6,14,.7); backdrop-filter: blur(4px);
}
.modal.show { display: flex; animation: fade .2s ease; }
.modal-card {
  position: relative; background: var(--panel); border-radius: 22px; padding: 30px;
  width: 100%; max-width: 560px; border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.modal-card h2 { font-size: 24px; }
.modal-card .mode-grid { margin-top: 18px; grid-template-columns: 1fr 1fr; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 16px;
  background: rgba(255,255,255,.1); color: var(--text);
}
.modal-close:hover { background: rgba(255,255,255,.2); }
@media (max-width: 520px) { .modal-card .mode-grid { grid-template-columns: 1fr; } }

/* ---------- Koin & loadout ---------- */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,206,60,.15); border: 1px solid rgba(255,206,60,.4);
  color: #ffce3c; font-weight: 700; border-radius: 20px; padding: 8px 14px; font-size: 15px;
}
.coin-chip.big { font-size: 18px; padding: 10px 18px; }

.loadout-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.loadout-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600;
}
.lc-label { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--muted); }
.lc-swatch { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(255,255,255,.3); }

.home-sub-actions { display: flex; gap: 12px; width: 100%; max-width: 460px; }
.home-sub-actions .btn { flex: 1; }

.danger-zone { text-align: center; margin-top: 30px; }
.btn-danger-link {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: #ff7a6b; font-size: 13px; opacity: .8; text-decoration: underline;
}
.btn-danger-link:hover { opacity: 1; }

/* ---------- Toko ---------- */
#screen-shop { justify-content: flex-start; overflow-y: auto; }
.shop-card {
  background: var(--panel); border-radius: 22px; padding: 28px;
  width: 100%; max-width: 760px; border: 1px solid rgba(255,255,255,.07); margin: 16px 0;
}
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.shop-head h2 { font-size: 26px; }
.shop-tabs { margin: 16px 0; }
.shop-msg { min-height: 18px; font-size: 13px; color: var(--accent2); text-align: center; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; margin-bottom: 20px; }
.shop-item {
  background: rgba(0,0,0,.22); border: 2px solid rgba(255,255,255,.06);
  border-radius: 16px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.shop-item.equipped { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }
.shop-item.owned:not(.equipped) { border-color: rgba(255,255,255,.18); }
.shop-skin-preview { width: 56px; height: 56px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); }
.shop-skin-preview .belt { display: block; height: 10px; margin-top: 23px; background: rgba(0,0,0,.5); }
.shop-weapon-icon { width: 56px; height: 56px; }
.wsvg { display: block; width: 100%; height: 100%; }
.shop-weapon-icon .wsvg { width: 56px; height: 56px; }
.wpick .wsvg { width: 32px; height: 32px; }
.lw-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; vertical-align: middle; }
.lw-ic .wsvg { width: 22px; height: 22px; }
.shop-item-name { font-weight: 700; font-size: 15px; }
.shop-item-desc { font-size: 11.5px; color: var(--muted); line-height: 1.4; min-height: 32px; }
.shop-item .btn { padding: 8px 12px; font-size: 13px; width: 100%; }
.shop-item .btn[disabled] { opacity: .55; cursor: default; }
.btn-buy { background: rgba(255,206,60,.18); color: #ffce3c; border: 1px solid rgba(255,206,60,.4); }
.btn-buy.locked { color: var(--muted); border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.05); }
.btn-equipped { background: var(--good); color: #0c2a12; }
.mode-card {
  background: var(--panel); border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px; padding: 28px 22px; cursor: pointer; text-align: left;
  color: var(--text); font-family: inherit; transition: transform .12s, box-shadow .12s;
}
.mode-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.35); border-color: var(--accent); }
.mode-icon { font-size: 40px; }
.mode-name { font-size: 20px; font-weight: 700; margin-top: 10px; }
.mode-desc { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Setup ---------- */
#screen-setup { justify-content: flex-start; overflow-y: auto; }
.setup-card, .board-card {
  background: var(--panel); border-radius: 22px; padding: 32px;
  width: 100%; max-width: 480px; border: 1px solid rgba(255,255,255,.07); margin: 16px 0;
}
.setup-card h2, .board-card h2 { font-size: 26px; margin-bottom: 6px; }
.setup-sub { color: var(--muted); margin-bottom: 18px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.diff-btn {
  font-family: inherit; font-size: 15px; font-weight: 600;
  background: rgba(0,0,0,.25); border: 2px solid transparent; color: var(--text);
  border-radius: 12px; padding: 14px; cursor: pointer;
}
.diff-btn.active { border-color: var(--accent); background: rgba(230,57,70,.18); }
.setup-input {
  font-family: inherit; font-size: 15px; width: 100%;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px; padding: 12px 14px; color: var(--text); margin-bottom: 18px;
}
.setup-input:focus { outline: none; border-color: var(--accent); }
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; padding: 0; transition: transform .1s;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: #fff; transform: scale(1.12); }
.weapon-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.wpick {
  width: 46px; height: 46px; border-radius: 12px; cursor: pointer; font-size: 22px;
  background: rgba(0,0,0,.25); border: 2px solid transparent; color: #fff;
  display: grid; place-items: center; transition: transform .1s;
}
.wpick:hover { transform: scale(1.08); }
.wpick.active { border-color: var(--accent); background: rgba(230,57,70,.18); }
.rounds-row { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 24px; }
.rounds-row select {
  font-family: inherit; background: rgba(0,0,0,.3); color: var(--text);
  border: 1px solid rgba(255,255,255,.15); border-radius: 9px; padding: 8px 10px;
}
.setup-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ---------- Board ---------- */
.board-table { width: 100%; border-collapse: collapse; margin: 14px 0 22px; }
.board-table th, .board-table td { padding: 10px 8px; text-align: left; font-size: 14px; }
.board-table thead th { color: var(--muted); border-bottom: 1px solid rgba(255,255,255,.12); font-weight: 600; }
.board-table tbody tr { border-bottom: 1px solid rgba(255,255,255,.05); }
.board-table tbody tr.me { background: rgba(230,57,70,.16); }
.board-table td:first-child, .board-table th:first-child { text-align: center; width: 36px; }
.board-rank { color: var(--accent2); font-size: 12px; font-weight: 600; }

/* ---------- Game ---------- */
#screen-game { justify-content: flex-start; padding: 12px; }
.hud {
  width: 100%; max-width: 900px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 10px;
}
.hud-player { flex: 1; }
.hud-right { text-align: right; }
.hud-name { font-weight: 700; font-size: 16px; margin-bottom: 5px; }
.hud-left .hud-name { color: var(--p1); }
.hud-right .hud-name { color: var(--p2); }
.bar-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.bar-row.right { flex-direction: row; justify-content: flex-end; }
.bar-tag { font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--muted); width: 42px; flex-shrink: 0; }
.bar-row.right .bar-tag { text-align: right; }
.bar-wrap { position: relative; height: 12px; flex: 1; background: rgba(0,0,0,.35); border-radius: 8px; overflow: hidden; }
.bar { height: 100%; width: 100%; transition: width .12s linear; }
.bar-hp { background: linear-gradient(90deg, #4cd964, #aef27a); }
.bar-hp.low { background: linear-gradient(90deg, #ff3b30, #ffb13c); }
.bar-stamina { background: linear-gradient(90deg, var(--accent2), var(--accent)); }
/* sisi kanan: bar menempel ke kanan, menyusut ke arah tengah */
.bar.right { position: absolute; right: 0; top: 0; bottom: 0; height: auto; }
.score-dots { display: flex; gap: 6px; margin-top: 7px; }
.hud-right .score-dots { justify-content: flex-end; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.18); }
.dot.win { background: var(--good); box-shadow: 0 0 8px var(--good); }
.hud-center { text-align: center; min-width: 90px; }
.round-label { font-size: 13px; color: var(--muted); }
.timer { font-family: 'Bangers', cursive; font-size: 38px; letter-spacing: 2px; }
.timer.danger { color: var(--accent); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

#arena {
  background: #0a1626; border-radius: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,.5);
  max-width: 100%; max-height: 70vh;
  touch-action: none;
}
.controls-hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; text-align: center; line-height: 1.7; }
.controls-hint b { color: var(--text); }
.quit-btn { position: absolute; top: 14px; right: 16px; }

/* ---------- Tombol kontrol layar (hanya perangkat mobile/sentuh) ---------- */
/* Mengambang di atas arena: joystick kiri-bawah, PUKUL kanan-bawah. */
.touch-controls {
  display: none;               /* default: sembunyi (desktop pakai keyboard) */
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 0 24px calc(env(safe-area-inset-bottom, 0px) + 16px);
  align-items: flex-end; justify-content: space-between;
  pointer-events: none;        /* container tembus; anak-anaknya aktif */
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.touch-controls .touch-side { pointer-events: auto; }
/* tampil di perangkat sentuh — via kelas JS (andal) atau media query (fallback) */
body.has-touch .touch-controls { display: flex; }
body.has-touch .controls-hint { display: none; }
@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
  .controls-hint { display: none; }   /* hemat ruang; kontrol sudah jelas */
}
.touch-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.touch-label { color: var(--muted); font-size: 12px; }

/* Joystick analog */
.joystick {
  position: relative; width: 150px; height: 150px;
  touch-action: none; cursor: grab;
}
.joy-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.18), rgba(0,0,0,.5));
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: inset 0 4px 14px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
}
.joy-knob {
  position: absolute; top: 50%; left: 50%;
  width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border: 2px solid rgba(255,255,255,.25);
  box-shadow: 0 6px 16px rgba(0,0,0,.4);
  transition: transform .04s linear;
  will-change: transform;
}
.joystick.active .joy-knob { transition: none; }

.tbtn {
  font-family: inherit; font-weight: 700; color: var(--text);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; cursor: pointer; font-size: 18px;
  display: grid; place-items: center; touch-action: none;
  transition: transform .06s, background .1s;
}
.tbtn:active, .tbtn.pressed { background: var(--accent); transform: scale(.92); }

.punch-btn {
  width: 120px; height: 120px; border-radius: 50%;
  font-size: 22px; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; box-shadow: 0 8px 22px rgba(255,90,60,.4);
}
.punch-btn:active, .punch-btn.pressed { transform: scale(.9); filter: brightness(1.1); }

/* ---------- Overlay ---------- */
.overlay {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(10,6,14,.72); backdrop-filter: blur(3px); z-index: 60;
}
.overlay.show { display: flex; }
.overlay-inner { text-align: center; }
.overlay-big { font-family: 'Bangers', cursive; font-size: 72px; letter-spacing: 3px; color: var(--accent2); }
.overlay-sub { font-size: 20px; color: var(--text); margin-top: 6px; }
.overlay-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }

@media (max-width: 600px) {
  .logo { font-size: 34px; }
  .overlay-big { font-size: 52px; }
  .timer { font-size: 30px; }
}

/* ---------- Ikon mode (aset SVG) ---------- */
.mode-icon { width: 50px; height: 50px; }
.mode-icon .msvg { width: 50px; height: 50px; display: block; }

/* ---------- Papan peringkat (responsif) ---------- */
#screen-board { justify-content: flex-start; overflow-y: auto; }
.board-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 22px; }
.board-empty { text-align: center; color: var(--muted); padding: 20px; }
.brow {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid transparent;
}
.brow.me { background: rgba(230,57,70,.16); border-color: rgba(230,57,70,.35); }
.brk { min-width: 30px; text-align: center; font-weight: 700; font-size: 15px; color: var(--muted); }
.binfo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brank { font-size: 12px; color: var(--accent2); }
.bstats { display: flex; gap: 16px; flex-shrink: 0; }
.bs { display: flex; flex-direction: column; align-items: center; font-size: 10.5px; color: var(--muted); min-width: 36px; line-height: 1.3; }
.bs b { font-size: 15px; color: var(--text); }
.bs.xp b { color: var(--accent2); }
@media (max-width: 460px) {
  .board-card { padding: 22px 16px; }
  .bstats { gap: 10px; }
  .bs { min-width: 30px; font-size: 10px; }
  .bs b { font-size: 13px; }
  .brk { min-width: 24px; font-size: 14px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translate(-50%, 20px);
  background: var(--panel); color: var(--text); border: 1px solid rgba(255,255,255,.14);
  padding: 13px 22px; border-radius: 12px; font-weight: 600; font-size: 14px; max-width: 86vw;
  text-align: center; z-index: 60; opacity: 0; transition: all .3s; pointer-events: none;
  box-shadow: 0 12px 34px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tombol ikon (gear pengaturan, jeda) ---------- */
.icon-btn {
  font-family: inherit; font-size: 17px; line-height: 1; color: var(--text);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; width: 40px; height: 40px; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, transform .08s;
}
.icon-btn:hover { background: rgba(255,255,255,.16); }
.icon-btn:active { transform: scale(.94); }
/* tombol jeda di tengah-atas layar, tak menimpa nama pemain */
.pause-btn { width: 40px; height: 30px; font-size: 12px; letter-spacing: 1px; margin: 0 auto 6px; }

/* ---------- Menu jeda ---------- */
.pause-menu { display: flex; flex-direction: column; align-items: center; }
.pause-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; width: min(260px, 78vw); }
.pause-actions .btn { width: 100%; }
.btn-danger { background: linear-gradient(135deg, #e63946, #b02330); color: #fff; box-shadow: 0 6px 18px rgba(230,57,70,.35); }
.btn-danger:hover { filter: brightness(1.08); }

/* ---------- Kartu pengaturan ---------- */
.settings-card { max-width: 430px; text-align: left; }
.settings-card h2 { text-align: center; }
.settings-section { margin-top: 16px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.settings-section:first-of-type { border-top: none; margin-top: 20px; }
.settings-section h3 { font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.set-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.set-row > span:first-child { min-width: 96px; color: var(--muted); flex-shrink: 0; }
.set-row b { color: var(--text); word-break: break-word; }
.set-row input[type=range] { flex: 1; accent-color: var(--accent); height: 4px; }
.set-val { min-width: 44px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.set-check { cursor: pointer; }
.set-check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.set-check span { color: var(--text); }
.set-full { width: 100%; margin-top: 6px; display: block; text-align: center; }

/* ---------- Auto-lanskap (mobile) ----------
   User TIDAK perlu memiringkan HP: saat perangkat sentuh dipegang portrait
   ketika bertanding, seluruh isi game diputar 90° mengisi layar sebagai lanskap.
   Jika user memang memutar HP ke lanskap, rotasi otomatis dilepas (native). */
#rotate-notice { display: none !important; }

body.force-rotate #app,
body.force-rotate .touch-controls {
  position: fixed;
  top: 0; left: 0; right: auto; bottom: auto;
  width: 100vh;                 /* sisi panjang layar -> lebar frame */
  height: 100vw;                /* sisi pendek layar  -> tinggi frame */
  transform-origin: top left;
  transform: rotate(90deg) translateY(-100vw);
}
body.force-rotate .touch-controls {
  display: flex;
  padding: 0 26px calc(env(safe-area-inset-bottom, 0px) + 16px);
}
body.force-rotate #btn-mute { display: none; }
/* Isi game diseimbangkan & arena diperbesar mengisi frame terputar.
   Ingat: di frame terputar, lebar = vh (sisi panjang), tinggi = vw (sisi pendek). */
body.force-rotate #screen-game { justify-content: center; padding: 4px 8px; }
body.force-rotate .hud { max-width: 96vh; margin-bottom: 4px; }
body.force-rotate #arena { max-width: 96vh; max-height: 82vw; border-radius: 10px; }
body.force-rotate .controls-hint { display: none; }

/* ---- Layar non-game (auth/setup/board/toko): boleh scroll dalam frame ---- */
body.force-rotate #screen-auth,
body.force-rotate #screen-setup,
body.force-rotate #screen-board,
body.force-rotate #screen-shop {
  justify-content: flex-start;
  overflow-y: auto; overflow-x: hidden;
  padding: 14px 18px;
}
/* Modal (Pilih Lawan / Pengaturan) yang tinggi bisa scroll di dalam frame */
body.force-rotate .modal { align-items: flex-start; }
body.force-rotate .modal-card { margin: auto; max-height: 94vw; overflow-y: auto; }

/* ---- MENU / PROFIL: tata letak lanskap 2 kolom yang rapi (untuk aplikasi) ---- */
body.force-rotate #screen-menu { justify-content: flex-start; align-items: stretch; padding: 0; overflow: hidden; }
body.force-rotate .profile-page {
  max-width: none; width: 100%; height: 100%;
  padding: 6px 16px 10px;
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas:
    "top     top"
    "hero    stats"
    "hero    loadout"
    "hero    actions";
  column-gap: 16px; row-gap: 7px;
}
body.force-rotate .topbar       { grid-area: top; padding: 6px 2px; margin: 0; }
body.force-rotate .brand        { font-size: 18px; }
body.force-rotate .profile-hero { grid-area: hero; margin: 0; align-self: stretch; display: flex; }
body.force-rotate .hero-content {
  flex-direction: column; text-align: center; justify-content: center;
  gap: 8px; padding: 14px 12px; width: 100%;
}
body.force-rotate .profile-avatar { width: 62px; height: 62px; font-size: 32px; border-radius: 18px; }
body.force-rotate .profile-name { font-size: 21px; }
body.force-rotate .profile-rank { justify-content: center; margin: 3px 0; }
body.force-rotate .rank-progress { max-width: 220px; margin: 0 auto; }
body.force-rotate .profile-hero::after { font-size: 110px; right: 8px; bottom: -16px; }

body.force-rotate .stat-row { grid-area: stats; margin: 0; gap: 6px; }
body.force-rotate .stat-box { padding: 7px 3px; border-radius: 12px; }
body.force-rotate .stat-num { font-size: 17px; }
body.force-rotate .stat-lbl { font-size: 9px; }

body.force-rotate .loadout-row { grid-area: loadout; margin: 0; gap: 8px; }

body.force-rotate .home-actions { grid-area: actions; margin: 0; gap: 8px; justify-content: center; align-self: center; }
body.force-rotate .btn-play { padding: 12px; font-size: 22px; border-radius: 14px; max-width: none; }
body.force-rotate .home-sub-actions { max-width: none; }

