@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');
:root {
  --bg: #150a37; --ink: #1c1238; --muted: #766a96; --line: #ece6f7; --soft: #f6f2fd;
  --brand: #7c3aed; --brand2: #ec4899;
  --red: #ef4466; --green: #20b255; --accent: #ffd23f;
  --c0: #e0359a; --c1: #0fa3a3; --c2: #f28c0f; --c3: #4f5bd5;
  --glass: rgba(255,255,255,.08); --glass-b: rgba(255,255,255,.16);
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 24px 60px -16px rgba(6,2,28,.6);
  --shadow-sm: 0 10px 24px -10px rgba(6,2,28,.55);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; min-height: 100vh; overflow-x: hidden;
  background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
/* latar: cahaya lembut + pola titik halus */
body::before { content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vmax 60vmax at 12% 8%, rgba(124,58,237,.55), transparent 62%),
    radial-gradient(52vmax 52vmax at 92% 88%, rgba(236,72,153,.32), transparent 62%),
    radial-gradient(40vmax 40vmax at 85% 4%, rgba(15,163,163,.22), transparent 62%); }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1.2px); background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); }
.bg { display: none; }

h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.18; letter-spacing: -.01em; font-weight: 800; }
a { color: inherit; }
.logo { font-weight: 800; letter-spacing: .04em; font-size: 2.3rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: .45rem; }
.logo .mark { display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; border-radius: 30%; background: linear-gradient(135deg, var(--accent), var(--brand2)); color: var(--ink); font-size: .85em; box-shadow: 0 6px 16px -4px rgba(255,92,168,.6); transform: rotate(-6deg); }
.logo b { background: linear-gradient(90deg, var(--accent), #ffa24a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { text-align: center; opacity: .8; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 22px 18px 70px; }
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px 70px; text-align: center; }
.top { justify-content: flex-start; }
.card { background: #fff; color: var(--ink); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
.card.narrow { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: left; }
.glass { background: var(--glass); border: 1px solid var(--glass-b); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 20px; padding: 18px; }

input, select, textarea { font: inherit; padding: 13px 15px; border-radius: 14px; border: 1.5px solid #e2daf2; width: 100%; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124,58,237,.15); }
input.big { font-size: 1.25rem; text-align: center; font-weight: 700; }

button { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 14px; padding: 12px 20px; background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); transition: transform .12s, filter .15s, box-shadow .15s; }
button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.primary { background: linear-gradient(135deg, #2dd36a, #12a14a); box-shadow: 0 10px 22px -8px rgba(32,178,85,.7); }
button.big { font-size: 1.2rem; padding: 15px 34px; border-radius: 16px; }
button.danger { background: linear-gradient(135deg, #f35b78, var(--red)); box-shadow: 0 10px 22px -8px rgba(239,68,102,.6); }
button.ghost { background: var(--glass); color: #fff; box-shadow: none; border: 1px solid var(--glass-b); backdrop-filter: blur(8px); }
button.ghost:hover:not(:disabled) { background: var(--glass-b); }
button.ghost.dark { background: #fff; color: var(--ink); border: 1.5px solid #e2daf2; backdrop-filter: none; }
button.ghost.dark:hover:not(:disabled) { background: var(--soft); }
button.icon { padding: 8px 12px; }
.err { color: #ffc1cd; font-weight: 600; min-height: 1.2em; }
.card .err { color: var(--red); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.row.c { justify-content: center; }
.muted { color: var(--muted); }
.on-dark { color: rgba(255,255,255,.75); }

@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.pop { animation: pop .4s cubic-bezier(.2,.9,.3,1.2) both; }
.slide { animation: slideUp .35s ease both; }
.shake { animation: shake .35s; }

/* top bar & judul halaman host */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0 22px; }
.topbar .logo { font-size: 1.45rem; justify-content: flex-start; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--glass); border: 1px solid var(--glass-b); border-radius: 999px; padding: 5px 14px 5px 5px; font-weight: 600; font-size: .9rem; }
.pill .avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand2), var(--brand)); display: grid; place-items: center; font-weight: 800; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.pagehead h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0; }
.pagehead p { margin: 4px 0 0; }
.count { background: rgba(255,255,255,.18); border-radius: 99px; padding: 1px 9px; margin-left: 6px; font-size: .78rem; }

/* lobby */
.pin { display: flex; gap: clamp(6px, 1.4vw, 12px); justify-content: center; }
.pin span { width: clamp(46px, 11vw, 84px); height: clamp(62px, 14vw, 108px); display: grid; place-items: center; background: #fff; color: var(--ink); border-radius: 18px; font-size: clamp(2rem, 7vw, 4.4rem); font-weight: 800; box-shadow: var(--shadow-sm); animation: pop .45s both; }
.pin span:nth-child(2) { animation-delay: .05s; } .pin span:nth-child(3) { animation-delay: .1s; } .pin span:nth-child(4) { animation-delay: .15s; } .pin span:nth-child(5) { animation-delay: .2s; } .pin span:nth-child(6) { animation-delay: .25s; }
.lobby { display: flex; gap: 32px; align-items: center; justify-content: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 10px; border-radius: 16px; width: 148px; height: 148px; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.qr svg { width: 100%; height: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 860px; }
.chip { background: var(--glass); border: 1px solid var(--glass-b); padding: 7px 16px 7px 10px; border-radius: 999px; font-weight: 600; display: flex; align-items: center; gap: 8px; animation: pop .35s both; }
.chip .av { font-size: 1.4rem; animation: bob 2.6s ease-in-out infinite; }
.chip.k { cursor: pointer; transition: background .15s; }
.chip.k:hover { background: rgba(239,68,102,.7); }

.avs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avs button { padding: 4px 0; font-size: 1.45rem; background: var(--soft); box-shadow: none; border: 2px solid transparent; border-radius: 12px; }
.avs button.sel { border-color: var(--brand); background: #ece3fc; transform: scale(1.08); }

/* jawaban */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.ans { display: flex; align-items: center; gap: 14px; padding: 20px 20px; border-radius: 18px; font-weight: 600; font-size: 1.15rem; color: #fff; text-align: left; min-height: 88px; box-shadow: 0 14px 28px -12px rgba(6,2,28,.6), 0 1px 0 rgba(255,255,255,.35) inset; position: relative; overflow: hidden; animation: slideUp .35s both; }
.ans:nth-child(2) { animation-delay: .05s; } .ans:nth-child(3) { animation-delay: .1s; } .ans:nth-child(4) { animation-delay: .15s; }
.ans .sym { font-size: 1.6rem; width: 2.4rem; height: 2.4rem; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.22); border-radius: 12px; }
.ans .sym svg { width: 55%; height: 55%; }
.a0 { background: linear-gradient(160deg, #f058b0, var(--c0)); } .a1 { background: linear-gradient(160deg, #25c4c4, var(--c1)); }
.a2 { background: linear-gradient(160deg, #ffa938, var(--c2)); } .a3 { background: linear-gradient(160deg, #7580ee, var(--c3)); }
.sym svg { fill: currentColor; display: block; }
button.ans { transition: transform .12s, filter .15s; }
button.ans:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.06); }
button.ans:active:not(:disabled) { transform: scale(.98); }
.ans.dim { opacity: .25; filter: grayscale(.6); }
.ans.right { box-shadow: 0 0 0 4px #fff, 0 14px 28px -12px rgba(6,2,28,.6); animation: pulse .8s 2; }
.ans.right::after { content: '✓'; position: absolute; right: 18px; font-size: 2rem; font-weight: 800; }
.ans .cnt { margin-left: auto; font-size: 1.4rem; font-weight: 800; }
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; max-width: 720px; height: 58vh; }
.pad .ans { justify-content: center; min-height: 0; padding: 0; }
.pad .ans .sym { width: 5.2rem; height: 5.2rem; border-radius: 24px; background: rgba(255,255,255,.2); }

.qbox { background: #fff; color: var(--ink); border-radius: 20px; padding: 22px 28px; font-size: clamp(1.2rem, 2.8vw, 2rem); font-weight: 700; width: 100%; text-align: center; box-shadow: var(--shadow); animation: pop .35s both; }
.qimg { max-width: 100%; max-height: 34vh; border-radius: 18px; box-shadow: var(--shadow-sm); object-fit: contain; background: #fff; }

/* timer + progres */
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: rgba(0,0,0,.25); stroke-width: 8; }
.ring .bgc { stroke: rgba(255,255,255,.16); fill: rgba(10,4,32,.4); }
.ring .fg { stroke: var(--accent); fill: none; stroke-linecap: round; transition: stroke .3s; }
.ring.low .fg { stroke: var(--red); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; }
.ring.low { animation: pulse .5s infinite; }
.bar { height: 10px; width: 100%; background: rgba(255,255,255,.14); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--brand2)); width: 100%; border-radius: 99px; }
.prog { display: flex; gap: 4px; width: 100%; margin-bottom: 16px; }
.prog i { flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,.16); }
.prog i.done { background: rgba(255,255,255,.7); } .prog i.cur { background: linear-gradient(90deg, var(--accent), var(--brand2)); }
.stat { background: var(--glass); border: 1px solid var(--glass-b); border-radius: 16px; padding: 8px 18px; text-align: center; font-weight: 700; min-width: 92px; backdrop-filter: blur(8px); }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; font-weight: 800; }
.stat small { opacity: .75; font-weight: 500; }

/* histogram */
.hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; height: 190px; width: 100%; }
.hist .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; font-weight: 800; }
.hist .b { width: 100%; border-radius: 14px 14px 4px 4px; min-height: 8px; transition: height .8s cubic-bezier(.2,.9,.3,1.1); height: 0; display: grid; place-items: end center; padding-bottom: 6px; font-size: 1.3rem; box-shadow: 0 10px 24px -10px rgba(6,2,28,.6); }
.hist .col.dim { opacity: .35; }

/* papan peringkat */
.board { width: min(600px, 100%); display: flex; flex-direction: column; gap: 8px; }
.board .r { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.96); color: var(--ink); padding: 11px 18px; border-radius: 16px; font-weight: 700; box-shadow: var(--shadow-sm); animation: slideUp .4s both; }
.board .r .n { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: .85rem; color: var(--muted); flex: none; }
.board .r.t1 .n { background: #ffe58a; color: #7a5a00; } .board .r.t2 .n { background: #e5e9f0; color: #4a5568; } .board .r.t3 .n { background: #f6cfa8; color: #7a4a1e; }
.board .r .av { font-size: 1.5rem; }
.board .r .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .r.me { outline: 3px solid var(--accent); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; height: 320px; }
.podium .p { width: clamp(92px, 24vw, 150px); border-radius: 18px 18px 6px 6px; text-align: center; padding: 10px 4px; font-weight: 800; color: var(--ink); animation: rise 1s cubic-bezier(.2,.9,.3,1.1) both; transform-origin: bottom; position: relative; box-shadow: var(--shadow-sm); }
.podium .p .av { font-size: 2.6rem; display: block; margin-top: -2.9rem; animation: bob 2s infinite; }
.podium .p .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.podium .p small { display: block; font-weight: 600; }
.podium .p.r1 { background: linear-gradient(180deg, #ffe680, #f5a800); animation-delay: 1.4s; }
.podium .p.r2 { background: linear-gradient(180deg, #f1f4f8, #aab4c2); animation-delay: .8s; }
.podium .p.r3 { background: linear-gradient(180deg, #f5c79a, #c07a3e); animation-delay: .2s; }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

/* hasil di HP peserta */
.full { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; z-index: 5; }
.full.ok { background: radial-gradient(80vmax 60vmax at 50% 0, #34d977, #0f8a3d); } .full.no { background: radial-gradient(80vmax 60vmax at 50% 0, #f56a85, #a8142e); } .full.wait { background: radial-gradient(80vmax 60vmax at 50% 0, #6d4fd0, #24105f); }
.full .big-ico { font-size: 5.5rem; animation: pop .6s both; }
.full h1 { font-size: 2.1rem; } .full .pts { font-size: 2.3rem; font-weight: 800; background: rgba(0,0,0,.2); padding: 6px 26px; border-radius: 999px; }
.flame { display: inline-block; animation: pulse .6s infinite; }
.flash { padding: 28px; border-radius: 20px; font-size: 1.8rem; font-weight: 800; width: min(420px, 100%); }
.flash.wait { background: var(--glass); border: 1px solid var(--glass-b); }
.hud { position: fixed; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: rgba(21,10,55,.7); border: 1px solid var(--glass-b); border-radius: 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-weight: 700; z-index: 10; }
.mute { position: fixed; top: 12px; right: 12px; z-index: 20; padding: 8px 12px; font-size: 1.05rem; }
canvas#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* kartu kuis (menu host) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.qc { background: #fff; color: var(--ink); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slideUp .4s both; transition: transform .2s, box-shadow .2s; }
.qc:hover { transform: translateY(-4px); }
.qc .cover { height: 104px; display: flex; align-items: flex-end; padding: 12px 16px; font-size: 2.1rem; position: relative; overflow: hidden; }
.qc .cover::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.28) 1.5px, transparent 1.8px); background-size: 16px 16px; }
.qc .cover .deco { position: absolute; right: -14px; top: -14px; width: 108px; height: 108px; fill: rgba(255,255,255,.22); transform: rotate(14deg); }
.qc .cover .deco svg { width: 100%; height: 100%; fill: inherit; }
.qc .cover .emo { position: relative; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.qc .body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.qc h3 { font-size: 1.05rem; }
.qc .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.qc .meta span { background: var(--soft); color: var(--muted); border-radius: 99px; padding: 2px 11px; font-size: .78rem; font-weight: 600; }
.qc .acts { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.qc .acts button { padding: 9px 13px; font-size: .85rem; border-radius: 12px; }
.qc .acts .primary { flex: 1; }
.qc.add { background: transparent; color: #fff; border: 2px dashed var(--glass-b); align-items: center; justify-content: center; min-height: 220px; cursor: pointer; font-weight: 700; gap: 10px; box-shadow: none; }
.qc.add .plus { width: 56px; height: 56px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-b); display: grid; place-items: center; font-size: 1.8rem; transition: transform .2s; }
.qc.add:hover { background: var(--glass); }
.qc.add:hover .plus { transform: rotate(90deg) scale(1.08); }
.tplbadge { background: #ece3fc; color: #5b21b6; border-radius: 99px; padding: 2px 10px; font-size: .7rem; font-weight: 700; margin-left: 6px; vertical-align: middle; }

/* mode game */
.modes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.mode { background: var(--glass); border: 1.5px solid var(--glass-b); color: #fff; box-shadow: none; text-align: left; width: 250px; padding: 14px 16px; font-weight: 500; backdrop-filter: blur(8px); }
.mode b { display: block; font-size: 1.05rem; margin-bottom: 2px; font-weight: 700; }
.mode small { opacity: .8; display: block; line-height: 1.4; }
.mode.sel { background: #fff; color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,210,63,.35); }

/* editor */
.qcard { border: 1.5px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; background: #fdfbff; }
.opt { display: flex; align-items: center; gap: 8px; }
.opt .sym { width: 38px; height: 38px; border-radius: 12px; color: #fff; display: grid; place-items: center; flex: none; font-size: 1rem; }
.opt .sym svg { width: 50%; height: 50%; }
.opt input[type=radio] { width: 22px; height: 22px; flex: none; accent-color: var(--green); }
.thumb { max-height: 110px; border-radius: 12px; border: 1.5px solid var(--line); }
.hidden { display: none !important; }
@media (max-width: 600px) {
  .answers { grid-template-columns: 1fr; } .logo { font-size: 1.9rem; } .ans { min-height: 68px; padding: 14px; } .podium { height: 260px; } .hist { height: 150px; }
  .mute { top: auto; bottom: 78px; right: 12px; opacity: .85; padding: 6px 10px; }
  .pad .ans .sym { width: 4rem; height: 4rem; border-radius: 20px; } .topbar .logo { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
