@font-face { font-family: 'Amiri'; src: url('fonts/amiri.woff2') format('woff2'); font-display: swap; }
:root { --navy: #1F3864; --bg: #FFF8EC; --card: #FFFFFF; --ink: #2B2B2B; --mute: #777; --ok: #2E9E4F; --bad: #E03C31; --gold: #F2B705; --line: #E8DFCF; --p1: #E76F51; --p2: #2A9D8F; --p3: #4A7BD0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; }
.ar { font-family: 'Amiri', 'Traditional Arabic', serif; direction: rtl; unicode-bidi: isolate; line-height: 1.9; }
button { font: inherit; cursor: pointer; border: 0; }
.wrap { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
.top { background: var(--navy); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; }
.top img.logo { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.top .t1 { font-weight: 700; font-size: 15px; line-height: 1.15; }
.top .t2 { font-size: 12px; opacity: .85; }
.top .sp { flex: 1; }
.iconbtn { background: rgba(255,255,255,.15); color: #fff; border-radius: 10px; padding: 7px 10px; font-size: 15px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: 0 2px 0 var(--line), 0 6px 18px rgba(0,0,0,.05); margin-bottom: 14px; }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 20px; color: var(--navy); }
.btn { background: var(--navy); color: #fff; border-radius: 14px; padding: 14px 18px; font-weight: 700; font-size: 17px; width: 100%; box-shadow: 0 4px 0 #13264a; transition: transform .05s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #13264a; }
.btn.alt { background: #fff; color: var(--navy); border: 2px solid var(--navy); box-shadow: 0 4px 0 #c9d3e6; }
.btn.green { background: var(--ok); box-shadow: 0 4px 0 #1f6e37; }
.btn.gold { background: var(--gold); color: #3a2a00; box-shadow: 0 4px 0 #b78900; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.muted { color: var(--mute); font-size: 14px; }
.err { background: #FDECEA; color: #8A1C12; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
input.text { width: 100%; font-size: 18px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; }
input.token { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; font-size: 24px; }

/* login */
.hero { text-align: center; padding: 18px 6px 6px; }
.hero img { width: 84px; height: 84px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.hero h1 { font-size: 22px; color: var(--navy); margin-top: 10px; }
.hero .ar { font-size: 30px; color: var(--p1); }
.steps { display: flex; justify-content: center; gap: 6px; margin: 8px 0 14px; }
.steps span { width: 28px; height: 6px; border-radius: 3px; background: #E6DCCB; }
.steps span.on { background: var(--navy); }
.kelasbtn { font-size: 26px; padding: 26px 0; border-radius: 18px; color: #fff; font-weight: 800; box-shadow: 0 5px 0 rgba(0,0,0,.18); }
.namelist { max-height: 52vh; overflow: auto; margin-top: 10px; border-radius: 12px; border: 2px solid var(--line); background: #fff; }
.namelist button { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; background: #fff; padding: 12px 14px; border-bottom: 1px solid #F1EADF; font-size: 16px; }
.namelist button:active, .namelist button.sel { background: #E7EEF9; }
.namelist .jk { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; flex: none; }
.cam { position: relative; width: 240px; height: 240px; margin: 6px auto 12px; border-radius: 50%; overflow: hidden; background: #222; border: 5px solid #fff; box-shadow: 0 3px 12px rgba(0,0,0,.18); }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam img.shot { transform: none; }
.cam .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #ddd; font-size: 14px; text-align: center; padding: 20px; }

/* home */
.me { display: flex; align-items: center; gap: 12px; }
.me img { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); background: #eee; }
.me .n { font-weight: 800; font-size: 17px; color: var(--navy); line-height: 1.2; }
.pills { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.pill { background: #F3EEE4; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.lesson { border-radius: 20px; overflow: hidden; margin-bottom: 16px; background: #fff; box-shadow: 0 2px 0 var(--line), 0 6px 18px rgba(0,0,0,.05); }
.lesson .hd { color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.lesson .hd .ar { font-size: 26px; line-height: 1.5; }
.lesson .hd .sub { font-size: 13px; opacity: .9; font-weight: 600; }
.lesson .hd .sp { flex: 1; }
.lesson .hd button { background: rgba(255,255,255,.22); color: #fff; border-radius: 10px; padding: 7px 10px; font-size: 13px; font-weight: 700; }
.lv { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid #F1EADF; width: 100%; background: #fff; text-align: left; }
.lv .num { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px; flex: none; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.lv.lock .num { background: #C9C2B6 !important; }
.lv .tt { flex: 1; }
.lv .tt b { display: block; font-size: 16px; }
.lv .tt small { color: var(--mute); }
.stars { color: var(--gold); font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #DDD3C2; }
.final { background: linear-gradient(135deg, #F2B705, #E76F51); color: #fff; }

/* play */
.hud { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hud .q { font-weight: 800; color: var(--navy); }
.hud .sc { margin-left: auto; font-weight: 800; background: #fff; border-radius: 999px; padding: 4px 12px; box-shadow: 0 2px 0 var(--line); }
.hud .combo { font-weight: 800; color: var(--p1); }
.timer { height: 10px; background: #EFE6D6; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--gold)); width: 100%; transition: width .1s linear; }
.timer i.low { background: var(--bad); }
.stem { font-size: 17px; font-weight: 600; line-height: 1.45; margin-bottom: 8px; }
.stim { background: #FFF3DC; border-radius: 14px; padding: 8px 14px; font-size: 27px; text-align: center; margin: 6px 0 12px; }
.qimg { display: block; width: 170px; height: 170px; margin: 4px auto 12px; border-radius: 20px; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { background: #fff; border-radius: 16px; padding: 12px 14px; font-size: 17px; font-weight: 600; box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); text-align: center; min-height: 58px; }
.opt.ar { font-size: 27px; font-weight: 400; padding: 4px 10px; }
.opt.pic { padding: 6px; }
.opt.pic img { width: 100%; max-width: 150px; aspect-ratio: 1; border-radius: 12px; display: block; margin: 0 auto; }
.opt.right { background: #E3F6E8; border-color: var(--ok); box-shadow: 0 4px 0 #9fd6ae; }
.opt.wrong { background: #FDECEA; border-color: var(--bad); box-shadow: 0 4px 0 #f0b3ad; animation: shake .35s; }
.opt.dim { opacity: .45; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.mean { background: #E7EEF9; border-radius: 14px; padding: 10px 14px; font-size: 17px; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 10px; }
.slot { min-height: 74px; background: #fff; border: 2px dashed #CDBFA6; border-radius: 16px; padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; direction: rtl; align-items: center; justify-content: flex-start; margin-bottom: 12px; }
.slot.right { border-color: var(--ok); border-style: solid; background: #E3F6E8; }
.slot.wrong { border-color: var(--bad); border-style: solid; background: #FDECEA; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; direction: rtl; margin-bottom: 14px; min-height: 60px; }
.tile { font-family: 'Amiri', serif; font-size: 26px; background: #FFF3DC; border: 2px solid #E9CF9C; border-radius: 12px; padding: 0 14px; box-shadow: 0 3px 0 #E2C68E; line-height: 1.9; }
.fb { margin-top: 14px; border-radius: 16px; padding: 12px 14px; font-size: 16px; line-height: 1.5; }
.fb.ok { background: #E3F6E8; color: #155d2c; }
.fb.no { background: #FDECEA; color: #7c1a12; }
.fb .ar { font-size: 24px; }
.pop { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 34px; font-weight: 900; color: var(--ok); text-shadow: 0 2px 0 #fff, 0 4px 14px rgba(0,0,0,.15); pointer-events: none; animation: pop .9s forwards; z-index: 50; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6) } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) } 100% { opacity: 0; transform: translate(-50%, -90%) scale(1) } }

/* result */
.big-stars { font-size: 56px; text-align: center; letter-spacing: 6px; color: var(--gold); }
.big-stars .off { color: #E3D9C6; }
.big-stars span { display: inline-block; animation: starin .5s both; }
@keyframes starin { from { transform: scale(0) rotate(-90deg); opacity: 0 } to { transform: scale(1) rotate(0); opacity: 1 } }
.stat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat div { background: #F7F1E6; border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 24px; color: var(--navy); }
.badge { display: inline-block; background: var(--gold); color: #3a2a00; border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 13px; }

/* leaderboard */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 10px 0; border-radius: 12px; background: #fff; font-weight: 700; color: var(--navy); box-shadow: 0 2px 0 var(--line); }
.tabs button.on { background: var(--navy); color: #fff; }
.lb { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid #F1EADF; }
.lb .rk { width: 36px; text-align: center; font-weight: 800; font-size: 18px; color: var(--navy); }
.lb .nm { flex: 1; font-weight: 600; }
.lb .nm small { display: block; color: var(--mute); font-weight: 400; }
.lb .pt { font-weight: 800; }
.lb.me { background: #FFF3C4; border-radius: 12px; }
.mybox { background: var(--navy); color: #fff; border-radius: 16px; padding: 14px; text-align: center; margin-top: 12px; }
.mybox b { font-size: 30px; display: block; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 16px; }
.vgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.vcard { background: #fff; border-radius: 16px; padding: 8px; text-align: center; box-shadow: 0 2px 0 var(--line); }
.vcard img { width: 100%; max-width: 130px; aspect-ratio: 1; border-radius: 12px; }
.vcard .ar { font-size: 24px; line-height: 1.6; }
.vcard small { color: var(--mute); display: block; }
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 60; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.center { text-align: center; }
.spin { width: 34px; height: 34px; border: 4px solid #E6DCCB; border-top-color: var(--navy); border-radius: 50%; animation: sp 1s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg) } }
