:root {
  color-scheme: dark;
  --bg: #161616; --side: #1b1b1b; --card: #222222; --card2: #2a2a2a; --line: #2f2f2f;
  --tx: #ededed; --mu: #9a9a9a; --gold: #f5b833; --gold2: #e89a14; --blue: #2d6bb3; --blue2: #3a7cc7;
  --green: #22c55e; --red: #e5534b; --pink: #ec4899; --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: #1a1a1a; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #555; }
.muted { color: var(--mu); }
.pix { image-rendering: pixelated; }
canvas { image-rendering: pixelated; }
.hide { display: none !important; }

/* tombol */
.btn { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: #333; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover:not(:disabled) { background: var(--blue2); }
.btn.gold { background: linear-gradient(#f7c64a, var(--gold2)); border-color: var(--gold2); color: #3a2600; }
.btn.green { background: #15803d; border-color: #15803d; color: #fff; }
.btn.red { background: transparent; border-color: #5a2a28; color: #f08a84; }
.btn.wide { width: 100%; padding: 13px; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.warn { background: #7f1d1d; border-color: #991b1b; color: #fff; }

/* kerangka */
.app { display: flex; min-height: 100vh; }
.side { width: 280px; flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: #f2f2f2; color: #161616; display: grid; place-items: center; font-weight: 800; }
.navlbl { color: var(--mu); font-size: 13px; padding: 14px 12px 8px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 10px; color: #d6d6d6; font-size: 16px; position: relative; }
.nav a:hover { background: #242424; }
.nav a.on { background: #2a2a2a; color: #fff; font-weight: 600; }
.ic { width: 21px; height: 21px; flex: none; }
.badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.sidefoot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 2px; display: flex; align-items: center; gap: 10px; color: var(--mu); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; }
.dot.off { background: var(--red); }
.sidefoot img { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; background: #2c2c2c; object-fit: cover; object-position: top; }
main { flex: 1; min-width: 0; padding: 26px 36px 40px; max-width: 1260px; }
.bottom { display: none; }

/* header halaman */
.ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.ph-t { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.ph h1 { margin: 0; font-size: 34px; letter-spacing: -.02em; }
.ph .sub { color: var(--mu); font-size: 18px; }
.ph-r { display: flex; align-items: center; gap: 10px; }
.mepill { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px 6px 8px; font-weight: 600; }
.mepill img { width: 30px; height: 30px; object-fit: cover; object-position: top; }
.coinpill { display: flex; align-items: center; gap: 8px; border: 2px solid var(--gold); border-radius: 14px; padding: 6px 14px; font-weight: 800; font-size: 17px; }
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe28a, #f5b02a 55%, #c97a06); box-shadow: inset 0 0 0 1px #b56f05; vertical-align: -.12em; flex: none; }

/* kartu */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 18px 20px; }
.h2 { font-weight: 700; font-size: 17px; margin: 0 0 12px; }
.empty { padding: 28px; text-align: center; color: var(--mu); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #333; color: #ddd; }
.chip.ok { background: #14361f; color: #6ee79b; } .chip.wait { background: #3a3013; color: #f5c95a; } .chip.no { background: #3d1a18; color: #f6928b; }
.bar { height: 8px; border-radius: 99px; background: #333; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold2), var(--green)); }
.stack > * + * { margin-top: 14px; }

/* kumpul */
.room { overflow: hidden; background: #191919; padding: 0; }
.room canvas { display: block; width: 100%; max-width: calc(72vh * 680 / 530); height: auto; margin: 0 auto; cursor: pointer; }
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 140px; }
.stat:hover { border-color: #444; }
.stat .lbl { color: var(--mu); }
.stat .big { font-size: 26px; display: flex; align-items: center; gap: 8px; }
.ann { padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; white-space: pre-wrap; word-break: break-word; }
.chat { display: flex; flex-direction: column; height: 430px; }
.chat-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 8px 20px; }
.msg { display: flex; gap: 12px; padding: 9px 0; }
.msg img { width: 40px; height: 40px; border-radius: 50%; background: #333; object-fit: cover; object-position: top; flex: none; }
.msg .t { word-break: break-word; }
.msg .who { font-weight: 700; } .msg .who.g { color: var(--gold); }
.msg .tm { color: var(--mu); font-size: 13px; margin-left: 6px; font-weight: 400; }
.msg .x { margin-left: auto; background: none; border: 0; color: var(--mu); cursor: pointer; }
.chat-f { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }

/* aku */
.aku { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 20px; align-items: start; }
.stage { padding: 14px; }
.stage canvas { width: 100%; height: auto; border-radius: 10px; display: block; margin-bottom: 12px; }
.statusbox { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.statusbox b { display: block; }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cats button { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; font-size: 14px; }
.cats button span { font-size: 22px; }
.cats button.on { border: 2px solid var(--gold); background: #262420; }
.tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 12px 0; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-radius: 9px; padding: 8px 14px; color: var(--mu); cursor: pointer; white-space: nowrap; font-weight: 600; }
.tabs button.on { background: #333; color: #fff; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.item { position: relative; background: var(--card); border: 2px solid transparent; border-radius: 14px; aspect-ratio: 1; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; }
.item:hover { background: #2a2a2a; }
.item.on { border-color: var(--green); background: #1f2b22; }
.item .sw { width: 52%; aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(0,0,0,.35); position: relative; }
.item .sw::after { content: ""; position: absolute; left: 10%; top: 6%; width: 38%; height: 38%; background: #fff; border-radius: 50%; }
.item img { height: 62%; image-rendering: pixelated; }
.item .nm { font-size: 12px; color: var(--mu); text-align: center; line-height: 1.1; }
.item .lock { position: absolute; left: 8px; top: 6px; font-size: 13px; }
.item .price { position: absolute; right: 6px; top: 6px; background: #3a1d0a; color: #ffd27a; border-radius: 99px; padding: 1px 7px 1px 4px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 3px; }

/* arena */
.arena { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 20px; align-items: start; }
.gift { padding: 26px 20px; text-align: center; background: radial-gradient(circle at 50% 25%, #3a2c4f, var(--card) 70%); }
.gift svg { width: 140px; height: 128px; }
.gift.shake svg { animation: shake .5s ease-in-out 2; }
@keyframes shake { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.gift h3 { margin: 8px 0 4px; }
.gift .btn { border-radius: 99px; padding: 14px 40px; font-size: 17px; margin: 14px 0; }
.sq { display: flex; justify-content: center; gap: 8px; }
.sq i { width: 34px; height: 34px; border-radius: 8px; background: #2f2f2f; display: grid; place-items: center; font-style: normal; font-size: 15px; }
.sq i.on { background: linear-gradient(#fb923c, #ea580c); box-shadow: 0 3px 0 #9a3412; }
.won { font-size: 22px; font-weight: 800; color: var(--gold); margin-top: 6px; }
.shop-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 6px; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 14px; }
.rw { background: #282828; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.rw .em { font-size: 34px; line-height: 1; }
.rw .tt { font-weight: 700; font-size: 17px; }
.rw .pr { font-size: 26px; font-weight: 800; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.rw .btn { margin-top: auto; padding: 13px; }

/* peringkat */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; padding: 20px 20px 0; }
.pod { text-align: center; }
.pod img { width: 72px; image-rendering: pixelated; }
.pod .blk { border-radius: 12px 12px 0 0; margin-top: 6px; padding: 10px 4px; font-weight: 800; font-size: 22px; }
.pod .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb { padding: 6px 0; }
.lbr { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.lbr.me { background: #2a2620; }
.lbr .rk { width: 28px; text-align: center; font-weight: 800; color: var(--mu); }
.lbr img { width: 36px; height: 36px; object-fit: cover; object-position: top; border-radius: 50%; background: #333; }
.lbr .bar { margin-top: 5px; }

/* daftar */
.list > div { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.list > div:first-child { border-top: 0; }
.mis { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.misgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mu); }
.reward-c { color: var(--gold); font-weight: 800; display: flex; align-items: center; gap: 6px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.bdg { background: #282828; border-radius: 14px; padding: 14px; text-align: center; }
.bdg .e { font-size: 30px; }

/* absen */
.codein { font-size: 34px; letter-spacing: .4em; text-align: center; font-weight: 800; padding: 14px; }
.bigok { font-size: 22px; font-weight: 800; text-align: center; padding: 30px 10px; }
.code { font-size: clamp(56px, 12vw, 140px); font-weight: 900; letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.1; }
.codebox { padding: 26px 20px; text-align: center; }
.codebox:fullscreen { background: #111; display: flex; flex-direction: column; justify-content: center; }
.codebox:fullscreen .code { font-size: 22vw; }

/* guru */
.gtabs { display: flex; gap: 4px; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.gtabs button { background: none; border: 0; border-radius: 9px; padding: 9px 16px; color: var(--mu); cursor: pointer; white-space: nowrap; font-weight: 600; }
.gtabs button.on { background: #333; color: #fff; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--mu); }
.form .full { grid-column: 1 / -1; }
.sub-img { width: 100%; max-height: 320px; object-fit: contain; background: #111; border-radius: 10px; cursor: zoom-in; }
.subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td, .tbl th { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); }
.tbl th { color: var(--mu); font-weight: 600; border-top: 0; }
.scroll { overflow-x: auto; }
.creds { font-family: ui-monospace, Consolas, monospace; background: #111; border-radius: 10px; padding: 12px; white-space: pre; overflow-x: auto; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 360px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.login .brand { padding: 0 0 8px; justify-content: center; font-size: 20px; }
.err { color: #f6928b; font-size: 14px; min-height: 1.2em; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #f2f2f2; color: #161616; padding: 11px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--red); color: #fff; }
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: grid; place-items: center; z-index: 60; cursor: zoom-out; padding: 16px; }
.zoom img { max-width: 100%; max-height: 100%; }

@media (max-width: 1100px) {
  .kgrid, .aku, .arena { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { display: none; }
  main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #1b1b1b; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto; z-index: 20; scrollbar-width: none; }
  .bottom a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--mu); padding: 4px 2px; position: relative; }
  .bottom a.on { color: #fff; }
  .bottom .badge { position: absolute; top: 0; right: 10px; min-width: 18px; height: 18px; font-size: 11px; }
  .ph h1 { font-size: 26px; }
  .ph .sub { font-size: 15px; }
  .mepill span { display: none; }
  .coinpill { font-size: 15px; padding: 5px 10px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; min-height: 0; }
  .stat .big { font-size: 20px; }
  .stat .muted { font-size: 12px; }
  .items { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .item .nm { display: none; }
  .podium { padding: 14px 10px 0; gap: 6px; }
  .pod img { width: 54px; }
}
