/* LIVEGO21 design system — merah cabai + kuning. Teks putih di latar gelap, hitam di latar kuning/terang. */
:root {
  --chili: #D7141A;
  --chili-600: #B30F14;
  --chili-700: #8E0B10;
  --chili-soft: rgba(215, 20, 26, .16);
  --yellow: #FFC20E;
  --yellow-600: #E6A800;
  --yellow-soft: rgba(255, 194, 14, .16);
  --ok: #22C55E;
  --warn: #F59E0B;
  --danger: #EF4444;

  --bg: #0E0B0B;
  --s1: #171212;
  --s2: #211A1A;
  --s3: #2D2323;
  --line: rgba(255, 255, 255, .09);
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, .72);
  --text-3: rgba(255, 255, 255, .48);
  --on-yellow: #111111;
  --on-chili: #FFFFFF;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --nav-h: 64px;
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="light"] {
  --bg: #FFF8E6;
  --s1: #FFFFFF;
  --s2: #FFF1C9;
  --s3: #FFE59A;
  --line: rgba(0, 0, 0, .1);
  --text: #111111;
  --text-2: rgba(0, 0, 0, .7);
  --text-3: rgba(0, 0, 0, .5);
  --shadow: 0 8px 24px rgba(120, 60, 0, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- layout */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; padding-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
.app.wide { max-width: none; }
.page { padding: 12px 16px 24px; }
.section { margin-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { font-size: 16px; margin: 0; font-weight: 800; }
.section-head a { color: var(--yellow); font-weight: 600; font-size: 13px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 800; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 700; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(14, 11, 11, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); min-height: 56px; }
:root[data-theme="light"] .topbar { background: rgba(255, 248, 230, .9); }
.topbar .title { font-weight: 800; font-size: 16px; flex: 1; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 18px; letter-spacing: -.02em; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--chili), var(--yellow)); display: grid; place-items: center; color: #fff; font-size: 14px; box-shadow: 0 4px 14px rgba(215, 20, 26, .45); }
.brand b { color: var(--yellow); }

.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(23, 18, 18, .96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 30; }
:root[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, .96); }
.bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding-bottom: 10px; font-size: 11px; line-height: 1; color: var(--text-3); font-weight: 600; }
.bottom-nav a svg { width: 22px; height: 22px; flex: none; }
.bottom-nav a.active { color: var(--yellow); }
/* Tombol tengah (Go Live): bubble melayang, label tetap sejajar dengan menu lain */
.bottom-nav a.go { color: var(--text); }
.bottom-nav a.go .bubble { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, var(--chili), #FF4B2B); display: grid; place-items: center; color: #fff; border: 4px solid var(--bg); box-shadow: 0 6px 18px rgba(215, 20, 26, .5); }
.bottom-nav a.go .bubble svg { width: 24px; height: 24px; }
.bottom-nav a.go::before { content: ""; width: 22px; height: 22px; }
.bottom-nav a.go.active { color: var(--yellow); }
.bottom-nav a.go.active .bubble { box-shadow: 0 0 0 3px var(--yellow), 0 6px 18px rgba(215, 20, 26, .5); }

/* ---------- komponen */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.flat { background: var(--s2); border: 0; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: 0; cursor: pointer; font-weight: 800; font-size: 14px; background: var(--s3); color: var(--text); transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--chili), #F0302F); color: var(--on-chili); box-shadow: 0 6px 18px rgba(215, 20, 26, .35); }
.btn.yellow { background: var(--yellow); color: var(--on-yellow); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; min-height: 48px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; min-height: 40px; }
.btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); outline: none; }
.input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
textarea.input { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--chili); margin-top: 1px; }
.help { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12px; color: #FF7A7A; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 800; background: var(--s3); color: var(--text); letter-spacing: .02em; }
.badge.live { background: var(--chili); color: #fff; }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.badge.yellow { background: var(--yellow); color: var(--on-yellow); }
.badge.ok { background: rgba(34, 197, 94, .18); color: #4ADE80; }
.badge.warn { background: rgba(245, 158, 11, .18); color: #FBBF24; }
.badge.bad { background: rgba(239, 68, 68, .18); color: #F87171; }
.badge.dark { background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px); }
@keyframes pulse { 50% { opacity: .35; } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); background: var(--s2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text-2); }
.chip.active { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.chip .count { font-size: 11px; opacity: .75; }

.pill-balance { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill); background: var(--s2); border: 1px solid var(--line); font-weight: 800; }
.coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #FFE680, var(--yellow) 55%, var(--yellow-600)); display: grid; place-items: center; color: var(--on-yellow); font-size: 11px; font-weight: 900; }
.diamond { color: #7DD3FC; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--s2); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.segmented button { border: 0; background: transparent; min-height: 36px; border-radius: var(--r-pill); font-weight: 700; color: var(--text-2); cursor: pointer; }
.segmented button.active { background: var(--chili); color: #fff; }

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 0; font-weight: 700; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--yellow); }

.stat { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 900; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--s3); flex: none; border: 2px solid var(--chili); }
.avatar.lg { width: 84px; height: 84px; border-width: 3px; }
.avatar.sm { width: 28px; height: 28px; border-width: 1.5px; }

/* kartu live 9:16 */
.live-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.live-card { position: relative; aspect-ratio: 9 / 16; border-radius: var(--r); overflow: hidden; background: var(--s2) center / cover no-repeat; display: block; }
.live-card img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.live-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .35) 0, transparent 28%, transparent 55%, rgba(0, 0, 0, .85)); }
.live-card .top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; z-index: 2; gap: 6px; }
.live-card .bottom { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; color: #fff; }
.live-card .bottom .name { font-weight: 800; font-size: 14px; }
.live-card .bottom .t { font-size: 12px; opacity: .85; }
.live-card .lock { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; backdrop-filter: blur(3px); }
.live-card .lock span { width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, .55); display: grid; place-items: center; font-size: 20px; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.hscroll > * { scroll-snap-align: start; }

/* kartu game */
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.game-card { display: block; border-radius: var(--r); overflow: hidden; background: var(--s2); }
.game-card img { aspect-ratio: 1; width: 100%; object-fit: cover; }
.game-card .n { padding: 6px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.banner { border-radius: var(--r-lg); padding: 18px; background: linear-gradient(120deg, var(--chili-700), var(--chili) 55%, #FF6A1A); position: relative; overflow: hidden; color: #fff; }
.banner::after { content: "👄"; position: absolute; right: -6px; bottom: -14px; font-size: 92px; opacity: .25; transform: rotate(-18deg); }
.banner.yellow { background: linear-gradient(120deg, var(--yellow), #FFD95A); color: var(--on-yellow); }
.banner h2 { font-size: 20px; margin: 0 0 4px; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--s2) 25%, var(--s3) 50%, var(--s2) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: var(--r); }
@keyframes skel { to { background-position: -200% 0; } }

/* sheet / modal / toast */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.overlay.center { align-items: center; padding: 16px; }
.sheet { width: 100%; max-width: 480px; background: var(--s1); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--s3); margin: 4px auto 12px; }
.modal { width: 100%; max-width: 420px; background: var(--s1); border-radius: var(--r-lg); padding: 20px; border: 1px solid var(--line); animation: pop .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 420px; pointer-events: none; }
.toast { background: var(--s3); color: var(--text); border-left: 4px solid var(--yellow); padding: 12px 14px; border-radius: var(--r); box-shadow: var(--shadow); font-weight: 600; animation: pop .15s; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

.empty { text-align: center; padding: 40px 16px; color: var(--text-3); }
.empty .ic { font-size: 40px; margin-bottom: 8px; }
.banner-status { padding: 10px 14px; border-radius: var(--r); background: var(--yellow-soft); color: var(--yellow); font-weight: 700; font-size: 13px; }
.banner-status.bad { background: var(--chili-soft); color: #FF8A8A; }

/* PIN 4 kotak */
.pin { display: flex; gap: 10px; justify-content: center; }
.pin input { width: 54px; height: 62px; text-align: center; font-size: 26px; font-weight: 900; text-transform: uppercase; background: var(--s2); border: 2px solid var(--line); border-radius: var(--r); }
.pin input:focus { border-color: var(--yellow); outline: none; }

/* tabel (admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--s2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }

/* login portal */
.auth-hero { min-height: 100dvh; display: flex; flex-direction: column; padding: 28px 20px; background:
  radial-gradient(120% 60% at 100% 0, rgba(215, 20, 26, .55), transparent 60%),
  radial-gradient(90% 50% at 0 100%, rgba(255, 194, 14, .28), transparent 60%), var(--bg); }
.role-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--s1); cursor: pointer; text-align: left; transition: transform .08s, border-color .15s; }
.role-btn:hover { border-color: var(--yellow); }
.role-btn:active { transform: scale(.98); }
.role-btn .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex: none; }
.role-btn.member .ic { background: var(--chili); }
.role-btn.studio .ic { background: var(--yellow); color: var(--on-yellow); }
.role-btn.admin .ic { background: #fff; color: #111; }
.role-btn .t { font-weight: 800; font-size: 16px; }
.role-btn .d { font-size: 12px; color: var(--text-3); }
.demo-box { margin-top: 18px; border: 1px dashed rgba(255, 194, 14, .5); border-radius: var(--r); padding: 12px; font-size: 12px; background: rgba(255, 194, 14, .06); }
.demo-box button { all: unset; cursor: pointer; display: inline-block; padding: 4px 8px; margin: 3px 2px; border-radius: 6px; background: var(--s2); font-weight: 700; font-size: 12px; }
.demo-box button:hover { background: var(--yellow); color: var(--on-yellow); }

/* responsif lebih lebar */
@media (min-width: 720px) {
  .live-grid { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
