:root { --ink: #14202b; --muted: #66707b; --bg: #f3f4f8; --card: #fff; --accent: #5b4bd6; --sq: #5b4bd6; --line: rgba(0, 0, 0, .08); }
@media (prefers-color-scheme: dark) { :root { --ink: #eef1f5; --muted: #9aa3ad; --bg: #11161c; --card: #1b2229; --line: rgba(255, 255, 255, .1); } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 24px; }
.muted { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; flex: 1; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: var(--sq); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.top .em { font-size: 28px; }
.top .who { flex: 1; min-width: 0; }
.top .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sqn { font-size: 13px; opacity: .9; }
.top .pts { background: rgba(255, 255, 255, .2); padding: 6px 12px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Kartu */
.card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.eyebrow .right { margin-left: auto; }
.pill { color: #fff; background: var(--pc, var(--accent)); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.q { font-size: 20px; font-weight: 700; line-height: 1.3; }
.timer { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.timer.urgent { color: #e04848; }
.tbar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 10px; }
.tbar i { display: block; height: 100%; background: var(--pc, var(--accent)); transition: width .25s linear; }

.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 15px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 16px; font-weight: 600; cursor: pointer; }
.opt .l { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.opt.sel { border-color: var(--pc, var(--accent)); background: color-mix(in srgb, var(--pc, var(--accent)) 12%, var(--card)); }
.opt.sel .l { background: var(--pc, var(--accent)); color: #fff; }
.opt:active { transform: scale(.98); }

.btn { display: block; width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 17px; font-weight: 700; background: var(--accent); color: #fff; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.sm { padding: 10px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .5; }
.btn:active { transform: scale(.98); }
label { display: block; font-size: 14px; font-weight: 700; margin: 10px 0 6px; }
input, select, textarea { width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 16px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
.err { color: #e04848; font-size: 14px; font-weight: 600; margin-top: 10px; }
.ok { color: #2e9e6b; font-weight: 700; }

/* Join */
.hero { text-align: center; padding: 34px 20px 10px; }
.hero .logo { font-size: 52px; }
.hero h1 { font-size: 26px; margin-top: 6px; }
.hero p { color: var(--muted); margin-top: 6px; }

/* Squad & gaya */
.squadcard { text-align: center; border-radius: 20px; padding: 22px; background: color-mix(in srgb, var(--sq) 14%, var(--card)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sq) 40%, transparent); }
.squadcard .big { font-size: 56px; }
.squadcard .t { font-size: 13px; color: var(--muted); font-weight: 600; }
.squadcard .n { font-size: 26px; font-weight: 800; color: var(--sq); }
.style { text-align: center; }
.style .i { font-size: 46px; }
.style .n { font-size: 22px; font-weight: 800; }
.style .d { color: var(--muted); margin-top: 4px; }
.prog { display: flex; gap: 6px; margin-bottom: 12px; }
.prog i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.prog i.on { background: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stats div { background: var(--bg); border-radius: 14px; padding: 10px 6px; }
.stats b { display: block; font-size: 22px; }
.stats span { font-size: 12px; color: var(--muted); font-weight: 600; }

.listen { text-align: center; padding: 26px 18px; }
.listen .i { font-size: 44px; }
.listen h2 { font-size: 20px; margin-top: 6px; }
.listen p { color: var(--muted); margin-top: 4px; }

/* Kapten, minoritas, dipanggil */
.kapten { background: #fff3cf; color: #5a3f00; border-radius: 20px; padding: 18px; box-shadow: inset 0 0 0 2px #f0b429; }
.kapten h2 { font-size: 20px; }
.reason { border-left: 4px solid var(--sq); padding: 6px 10px; margin-top: 8px; font-size: 15px; background: rgba(255, 255, 255, .6); }
.result { text-align: center; padding: 22px; }
.result .i { font-size: 48px; }
.result h2 { font-size: 22px; margin-top: 4px; }
.calledov { position: fixed; inset: 0; z-index: 50; background: #ffd54a; color: #3e2c00; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; gap: 12px; animation: flash 1s ease-in-out 3; }
.calledov .i { font-size: 80px; }
.calledov h1 { font-size: 30px; }
@keyframes flash { 50% { background: #fff1b8; } }

/* Tangan */
.hand { width: 100%; aspect-ratio: 1.6; border: 0; border-radius: 24px; font-size: 22px; font-weight: 800; background: var(--sq); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.hand .i { font-size: 60px; }
.hand.on { background: #2e9e6b; }
.fab { position: sticky; bottom: 12px; margin: 0 16px 12px; }

/* Kudos */
.kudos .p { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.kudos .p:first-of-type { border-top: 0; }
.kudos .p .n { flex: 1; font-weight: 600; }
.kudos button { border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; background: #fff1d6; color: #7a4f00; cursor: pointer; }
.kudos button:disabled { opacity: .4; }

/* Rapor */
.badgelist { display: grid; gap: 8px; }
.badgelist div { background: #fff8e1; color: #5a3f00; border-radius: 14px; padding: 10px 12px; font-weight: 700; }

#offline { position: fixed; left: 0; right: 0; bottom: 0; background: #e04848; color: #fff; text-align: center; padding: 8px; font-weight: 700; display: none; z-index: 60; }
body.offline #offline { display: block; }

/* ----- Peta 3D di HP ----- */
.top .tg { border: 0; background: rgba(255, 255, 255, .2); border-radius: 999px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; flex: none; }
.top .tg.off { opacity: .45; filter: grayscale(1); }
body.w3d { background: transparent; }
body.w3d #world { z-index: 0; }
body.w3d #app { position: relative; z-index: 4; pointer-events: none; transition: opacity .5s; }
body.w3d #app > *, body.w3d .wrap > * { pointer-events: auto; }
body.w3d #app > .wrap { pointer-events: none; padding-top: 30vh; }
body.w3d #app > .wrap.big { padding-top: 52vh; }
body.w3d .top { background: color-mix(in srgb, var(--sq) 88%, transparent); backdrop-filter: blur(8px); }
body.w3d .card, body.w3d .squadcard { box-shadow: 0 6px 22px rgba(0, 0, 0, .18); }
body.w3d .squadcard { background: color-mix(in srgb, var(--sq) 14%, var(--card)); }
body.cine #app { opacity: 0; pointer-events: none; }
body.cine #app * { pointer-events: none !important; }
.cheers { display: flex; justify-content: center; gap: 6px; background: rgba(20, 32, 43, .55); backdrop-filter: blur(8px); border-radius: 999px; padding: 6px; align-self: center; }
.cheers button { border: 0; background: rgba(255, 255, 255, .14); border-radius: 999px; width: 40px; height: 40px; font-size: 21px; cursor: pointer; transition: transform .15s; }
.cheers button:active { background: rgba(255, 255, 255, .3); }
.chesthint { align-self: center; background: #ffd54a; color: #4a3500; font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); margin-top: -6px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
#fact { position: fixed; inset: 0; z-index: 70; background: rgba(5, 7, 10, .55); display: none; align-items: center; justify-content: center; padding: 24px; }
#fact.show { display: flex; animation: fadein .25s; }
#fact .factcard { background: var(--card); color: var(--ink); border-radius: 24px; padding: 24px 20px 18px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); animation: popin .35s cubic-bezier(.2, 1.4, .4, 1); }
#fact .i { font-size: 56px; }
#fact .k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 0 10px; }
#fact p { font-size: 17px; line-height: 1.45; margin-bottom: 12px; }
#fact .plus { color: #2e9e6b; font-weight: 800; font-size: 20px; margin-bottom: 14px; }
#fact .muted { margin-bottom: 14px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { transform: scale(.7); opacity: 0; } }
.gift { text-align: center; border-radius: 20px; padding: 20px; background: linear-gradient(135deg, #ffd54a, #ff9f43); color: #3e2500; box-shadow: 0 8px 26px rgba(255, 159, 67, .45); animation: popin .5s cubic-bezier(.2, 1.4, .4, 1); }
.gift .i { font-size: 54px; }
.gift h2 { font-size: 22px; margin-top: 4px; }
.gift p { margin-top: 4px; font-weight: 600; }
.sbi { margin-top: 12px; background: color-mix(in srgb, var(--pc, var(--accent)) 10%, var(--card)); border-left: 4px solid var(--pc, var(--accent)); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.sbi span { display: block; }
.sbi span b { color: var(--pc, var(--accent)); font-size: 16px; }

/* Slide gambar di HP */
.slidecard img { display: block; width: 100%; border-radius: 12px; background: #1b2229; cursor: zoom-in; }
.slidecard p { font-size: 12px; text-align: center; margin-top: 6px; }
#slidezoom { position: fixed; inset: 0; z-index: 80; background: rgba(5, 7, 10, .92); display: flex; align-items: center; justify-content: center; padding: 10px; animation: fadein .2s; }
#slidezoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
#slidezoom span { position: absolute; top: 14px; right: 16px; color: #fff; font-size: 26px; font-weight: 700; }
@media (orientation: portrait) { #slidezoom img { transform: rotate(90deg); max-width: 100vh; max-height: 100vw; } }

/* ----- Materi & hasil langsung di HP ----- */
.bars { display: grid; gap: 8px; }
.bar { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--bg); overflow: hidden; font-size: 14px; font-weight: 600; }
.bar i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--pc, var(--accent)) 22%, transparent); transition: width .6s ease; }
.bar > :not(i) { position: relative; }
.bar .l { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--card); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.bar .t { flex: 1; min-width: 0; line-height: 1.3; }
.bar b { font-variant-numeric: tabular-nums; }
.bar.mine { box-shadow: inset 0 0 0 2px var(--pc, var(--accent)); }
.bar.correct i { background: rgba(46, 158, 107, .3); }
.bar.correct .l { background: #2e9e6b; color: #fff; }
.bar.minor i { background: rgba(240, 180, 41, .35); }
.legend { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--pc, var(--accent)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--c, #888); color: #fff; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip.me { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.chip.light { background: #fff3cf; color: #5a3f00; }
.li { padding: 6px 0; font-size: 15px; border-top: 1px solid var(--line); }
.li:first-of-type { border-top: 0; }
.cloud { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: center; line-height: 1.2; font-weight: 800; padding: 6px 0; }
.rank .r { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); font-weight: 600; }
.rank .r:first-child { border-top: 0; }
.rank .r.me { background: color-mix(in srgb, #ffd54a 28%, transparent); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.rank .n { width: 26px; text-align: center; color: var(--muted); }
.rank .d { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.rank .t { flex: 1; min-width: 0; }
.rank small { color: var(--muted); font-weight: 600; }
.rank b { font-variant-numeric: tabular-nums; }
.slidetxt h2 { font-size: 22px; line-height: 1.25; margin-bottom: 12px; }
.slidetxt ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.slidetxt li { position: relative; padding-left: 22px; font-size: 16px; line-height: 1.45; }
.slidetxt li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, var(--accent)); }
.slidetxt .tool { margin-top: 14px; background: #fff8e1; color: #5a3f00; border-radius: 14px; padding: 12px 14px; font-size: 15px; line-height: 1.4; }
.slidetxt .tool b { display: block; margin-bottom: 4px; }
.poscard { text-align: center; padding: 24px 18px; border-top: 5px solid var(--c, var(--accent)); }
.poscard .k { font-size: 12px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.poscard .i { font-size: 52px; margin-top: 6px; }
.poscard h2 { font-size: 26px; margin-top: 4px; }
.poscard p { color: var(--muted); margin-top: 6px; font-style: italic; }
.route { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; font-weight: 700; }
.route span { background: color-mix(in srgb, var(--c) 16%, var(--card)); color: var(--ink); padding: 5px 9px; border-radius: 999px; }
.route i { color: var(--muted); font-style: normal; }
.quote p { font-size: 17px; line-height: 1.45; font-style: italic; }
.quote small { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; }
.wall { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.wall .c { background: var(--bg); border-left: 4px solid var(--c); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
.wall .c small { display: block; color: var(--muted); font-weight: 700; margin-top: 4px; }

/* ----- Login di atas dunia game ----- */
.joinform { display: grid; gap: 14px; }
.joinwrap .hero { padding: 20px 18px; }
.joinwrap .hero .logo { font-size: 42px; }
.joinwrap .hero h1 { font-size: 24px; }
body.w3d #app > .wrap.joinwrap { padding-top: 26vh; }
body.w3d .joinwrap .hero { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); }

/* ----- Sorakan beruntun (seperti like TikTok) ----- */
.cheers button { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cheers button.hit { animation: tapPop .25s ease-out; }
@keyframes tapPop { 40% { transform: scale(1.35); background: rgba(255, 255, 255, .4); } }
.floatemo { position: fixed; z-index: 60; font-size: 30px; pointer-events: none; transform: translate(-50%, 0); animation: floatUp 1.3s cubic-bezier(.2, .7, .3, 1) forwards; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .3)); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  15% { opacity: 1; transform: translate(-50%, -30px) scale(1.25); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -260px) scale(.9) rotate(var(--rot)); }
}
#combo { position: fixed; z-index: 61; pointer-events: none; transform: translateX(-50%); background: #ff3b6b; color: #fff; font-weight: 900; font-size: 16px; padding: 4px 12px; border-radius: 999px; box-shadow: 0 6px 16px rgba(255, 59, 107, .45); opacity: 0; transition: opacity .25s; white-space: nowrap; }
#combo.show { opacity: 1; }
#combo.bump { animation: comboBump .2s ease-out; }
@keyframes comboBump { 50% { transform: translateX(-50%) scale(1.25); } }

/* Tombol mic saat dipanggil (fitur suara) */
.calledov .micbtn { width: auto; background: #e53950; color: #fff; font-size: 20px; padding: 16px 26px; border-radius: 999px; margin-top: 6px; box-shadow: 0 8px 24px rgba(229,57,80,.4); }
/* Ruang untuk bar suara di bawah layar */
body:has(#voicebar:not(:empty)) .fab { margin-right: 66px; }

/* ===== Header menyatu dengan dunia game (tanpa latar penuh) ===== */
body.w3d .top { position: fixed; top: 0; left: 0; right: var(--world-right, 0px); z-index: 6; background: none; backdrop-filter: none; padding: calc(env(safe-area-inset-top) + 10px) 12px 0; gap: 8px; align-items: flex-start; pointer-events: none; }
body.w3d .top > * { pointer-events: auto; }
body.w3d .top .em { display: none; }
body.w3d .top .who { flex: 0 1 auto; display: flex; align-items: center; gap: 8px; background: rgba(15, 22, 30, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 16px; padding: 6px 12px 6px 6px; color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.top .chipem { display: none; }
body.w3d .top .who .chipem { font-size: 22px; width: 32px; height: 32px; border-radius: 11px; background: var(--sq); display: flex; align-items: center; justify-content: center; flex: none; }
body.w3d .top .nm { font-size: 14px; line-height: 1.15; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
body.w3d .top .sqn { font-size: 11.5px; opacity: .9; }
body.w3d .top .pts { margin-left: auto; background: var(--sq); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .22); padding: 8px 13px; font-size: 14px; }
body.w3d #app > .wrap { padding-top: 34vh; }
body.w3d #app > .wrap.big { padding-top: 54vh; }

/* ===== HP landscape: dunia game di kiri, panel form di kanan ===== */
@media (orientation: landscape) and (min-width: 560px) {
  body.w3d { --panel-w: clamp(320px, 38vw, 440px); --world-right: var(--panel-w); }
  body.w3d #app { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: none; margin: 0; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; background: rgba(12, 18, 26, .32); box-shadow: -10px 0 30px rgba(0, 0, 0, .18); }
  body.w3d #app > .wrap, body.w3d #app > .wrap.big, body.w3d #app > .wrap.joinwrap { padding: 12px 12px 16px; gap: 10px; }
  body.w3d .card { padding: 14px; border-radius: 16px; }
  body.w3d .q { font-size: 17px; }
  body.w3d .opt { padding: 11px 12px; font-size: 15px; border-radius: 14px; }
  body.w3d .opt .l { width: 30px; height: 30px; }
  body.w3d .btn { padding: 13px; font-size: 16px; border-radius: 14px; }
  body.w3d input, body.w3d select, body.w3d textarea { padding: 10px 12px; font-size: 15px; }
  body.w3d label { margin: 8px 0 4px; font-size: 13px; }
  body.w3d .joinwrap .hero { padding: 12px 14px; }
  body.w3d .joinwrap .hero .logo { font-size: 30px; }
  body.w3d .joinwrap .hero h1 { font-size: 20px; }
  body.w3d .cheers button { width: 36px; height: 36px; font-size: 19px; }
  body.w3d .fab { position: sticky; bottom: 10px; margin: 0 12px 10px; }
  body:has(#voicebar:not(:empty)).w3d .fab { margin-right: 12px; }
  #cinetitle .t { font-size: clamp(30px, 6vw, 60px); }
}
body.w3d .top .pts { white-space: nowrap; flex: none; }
body.w3d .top .who { max-width: calc(100% - 96px); min-width: 0; }
body.w3d .top .who > div { min-width: 0; }
body.w3d .top .sqn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
