@font-face { font-family: Caveat; src: url(fonts/Caveat.ttf); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Overpass; src: url(fonts/Overpass-var.ttf); font-weight: 100 900; font-display: swap; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #1d1611; overflow: hidden; overscroll-behavior: none; }
body { font-family: Overpass, ui-rounded, system-ui, sans-serif; color: #3b2a14; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
#app { position: relative; height: 100%; width: min(100vw, calc(100vh * 9 / 16)); margin: 0 auto; overflow: hidden; background: #3b2a14; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hide { display: none !important; }

#top { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.bars { display: flex; gap: 6px; }
.bar { width: 46px; background: rgba(255,255,255,.72); border-radius: 12px; padding: 4px 4px 5px; text-align: center; font-size: 18px; line-height: 1.1; box-shadow: 0 2px 0 rgba(0,0,0,.12); transition: transform .2s; }
.bar.low { animation: goyang .6s infinite; background: #ffe0d6; }
.bar i { display: block; height: 6px; border-radius: 3px; background: rgba(0,0,0,.12); margin-top: 3px; overflow: hidden; }
.bar i b { display: block; height: 100%; border-radius: 3px; width: 50%; transition: width .4s; }
.bar[data-k=lapar] b { background: #f39a2b; } .bar[data-k=bersih] b { background: #4bb3e8; } .bar[data-k=energi] b { background: #8a6be0; } .bar[data-k=senang] b { background: #5cc55c; }
@keyframes goyang { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.pill { background: #3b2a14; color: #ffd34d; font-weight: 800; border-radius: 20px; padding: 6px 11px; font-size: 15px; box-shadow: 0 2px 0 rgba(0,0,0,.25); white-space: nowrap; }
.pill.kecil { font-size: 12px; padding: 4px 9px; background: rgba(255,255,255,.9); color: #7a4a12; }
#sub { position: absolute; top: calc(66px + env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; }
#jajan { background: #fff3c4; }

.bub { position: absolute; left: 16px; top: calc(102px + env(safe-area-inset-top)); max-width: 72%; background: #fff; border-radius: 16px; padding: 9px 12px; font-size: 14px; line-height: 1.3; box-shadow: 0 3px 0 rgba(0,0,0,.15); animation: muncul .3s ease-out; }
.bub small { display: block; color: #a08a70; font-size: 11px; margin-bottom: 2px; font-weight: 700; }
.say { position: absolute; transform: translate(-50%, -100%); background: #fff; border-radius: 14px; padding: 6px 10px; font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 3px 0 rgba(0,0,0,.15); pointer-events: none !important; }
.say:after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-top-color: #fff; border-bottom: 0; }
@keyframes muncul { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#aksi { position: absolute; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 10px; padding: 0 12px; }
.btn { background: #ffd34d; color: #3b2a14; font-weight: 800; border-radius: 22px; padding: 11px 18px; font-size: 16px; box-shadow: 0 4px 0 #b8901f; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b8901f; }
.btn.biru { background: #7fd0f5; box-shadow: 0 4px 0 #3a93bf; }
.btn.abu { background: #eee; box-shadow: 0 4px 0 #aaa; }
.tray { display: flex; gap: 8px; background: rgba(59,42,20,.88); border-radius: 18px; padding: 8px; width: 100%; justify-content: center; }
.it { width: 23%; max-width: 78px; aspect-ratio: .9; background: rgba(255,255,255,.14); border-radius: 13px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 30px; touch-action: none; }
.it small { font-size: 10px; line-height: 1.15; text-align: center; margin-top: 2px; }
.it em { font-style: normal; font-size: 11px; color: #ffd34d; font-weight: 800; }
.it.punya { outline: 2px solid #5cc55c; }
.it.pakai { background: #ffd34d55; outline: 2px solid #ffd34d; }
.it svg { width: 36px; height: 30px; }
.ghost { position: absolute; font-size: 46px; transform: translate(-50%, -60%); pointer-events: none; z-index: 5; transition: transform .25s, opacity .25s; }

#nav { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); height: calc(70px + env(safe-area-inset-bottom)); background: #3b2a14; display: flex; justify-content: space-around; align-items: center; }
#nav button { width: 58px; height: 54px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #f4e3c8; font-size: 10px; font-weight: 700; }
#nav button span { font-size: 23px; line-height: 1.1; }
#nav button.on { background: #ffd34d; color: #3b2a14; }

#mg .mgtop, #sg .mgtop { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 54px; display: flex; gap: 6px; justify-content: space-between; }
#mgx, #sgx { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 38px; text-align: center; padding: 6px 0; }
#mgjudul { position: absolute; top: calc(60px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #ffd34d; font-weight: 900; font-size: 22px; text-shadow: 0 2px 0 #000; pointer-events: none; }
#mgtip { position: absolute; top: 40%; left: 30px; right: 30px; text-align: center; color: #fff; font-weight: 800; font-size: 17px; text-shadow: 0 2px 4px #000; pointer-events: none; }

#modal { position: absolute; inset: 0; background: rgba(20,12,4,.6); display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 10; }
.card { background: #fffaf0; border-radius: 22px; padding: 22px 20px; width: 100%; max-width: 330px; max-height: calc(100% - 24px); overflow-y: auto; overscroll-behavior: contain; text-align: center; animation: muncul .25s; }
.card h2 { font-size: 22px; margin-bottom: 8px; }
.card p { font-size: 15px; line-height: 1.45; margin-bottom: 14px; color: #5a4128; }
.card .besar { font-size: 44px; font-weight: 900; color: #e09a12; margin: 4px 0 10px; }
.card .row { display: flex; flex-direction: column; gap: 10px; }
.card small { display: block; color: #a08a70; font-size: 11px; margin-top: 10px; }

#toast { position: absolute; left: 50%; top: 21%; transform: translateX(-50%); background: rgba(30,20,10,.88); color: #fff; padding: 10px 16px; border-radius: 16px; font-size: 14px; font-weight: 700; text-align: center; max-width: 80%; z-index: 11; animation: muncul .2s; pointer-events: none; }

#loading { position: absolute; inset: 0; background: #3b2a14; color: #ffd34d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 20; transition: opacity .4s; }
#loading .logo { font-size: 26px; font-weight: 800; text-align: center; line-height: 1; color: #f4e3c8; }
#loading .logo b { font-size: 58px; color: #ffd34d; }
#loading .ld { font-size: 14px; color: #f4e3c8; opacity: .8; }

input { font: inherit; user-select: text; -webkit-user-select: text; touch-action: auto; }
.kirim { background: #fff3c4; border-radius: 16px; padding: 12px; margin-bottom: 12px; text-align: left; }
.kirim label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.kirim .ig { display: flex; align-items: center; background: #fff; border: 2px solid #e0c56a; border-radius: 12px; padding: 0 10px; margin-bottom: 10px; }
.kirim .ig span { font-weight: 800; color: #a08a70; }
.kirim input { border: 0; outline: 0; padding: 10px 4px; width: 100%; font-size: 16px; background: transparent; color: #3b2a14; }
.kirim .btn { width: 100%; }
.kirim small { margin-top: 8px; }
.kirim .hasil { margin: 0; text-align: center; color: #3b2a14; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; padding: 8px; border-radius: 12px; background: #eee; font-weight: 800; font-size: 13px; }
.tab.on { background: #ffd34d; }
.rank { list-style: none; text-align: left; max-height: 46vh; overflow-y: auto; margin-bottom: 12px; touch-action: pan-y; }
.rank li { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #f0e4cc; font-size: 14px; }
.rank li span { width: 26px; text-align: center; font-weight: 800; }
.rank li b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li em { font-style: normal; font-weight: 800; color: #b07a12; }
.rank li.aku { background: #fff3c4; border-radius: 10px; }
.rank li.muat { justify-content: center; color: #a08a70; }

#sub .kanan { display: flex; gap: 6px; }
#bisu { min-width: 34px; }

.pendukung { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-height: 40vh; overflow-y: auto; margin-bottom: 12px; touch-action: pan-y; }
.pendukung li { background: #fff3c4; border-radius: 12px; padding: 5px 10px; font-family: Caveat, cursive; font-size: 21px; font-weight: 700; }
.pendukung li.lain { background: #f0e4cc; }

#susun { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); touch-action: none; overflow: hidden; }
#susun .lantai { position: absolute; left: 0; top: 0; background: rgba(59,42,20,.86); box-shadow: 0 0 0 4px rgba(59,42,20,.86); border-radius: 6px; }
#susun .sel { position: absolute; left: 0; top: 0; transition: transform .18s ease-out; }
#susun .sel i { display: flex; align-items: center; justify-content: center; position: absolute; inset: 3px; border-radius: 11px; transition: transform .2s, opacity .2s; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
#susun .sel svg { width: 90%; height: 90%; pointer-events: none; }
#susun .sel.pilih i { transform: scale(1.08); box-shadow: 0 0 0 3px #ffd34d, inset 0 -3px 0 rgba(0,0,0,.12); }
#susun .sel.pecah i { transform: scale(0); opacity: 0; }
#susun .sel.baris i, #susun .sel.kolom i { box-shadow: 0 0 0 3px #e2552f, inset 0 -3px 0 rgba(0,0,0,.12); }
#susun .sel.baris i::after, #susun .sel.kolom i::after { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: 900; color: #e2552f; }
#susun .sel.baris i::after { content: "↔"; } #susun .sel.kolom i::after { content: "↕"; }
#susun .sel.semua i { animation: kilau .8s infinite alternate; box-shadow: 0 0 0 3px #ffd34d; }
#susun .sel.baru i { animation: tumbuh .4s; }
@keyframes kilau { from { filter: brightness(1); } to { filter: brightness(1.25) drop-shadow(0 0 6px #ffd34d); } }
@keyframes tumbuh { 0% { transform: scale(.3); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.pilihan { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pilihan button { display: flex; align-items: center; gap: 12px; text-align: left; background: #fff3c4; border-radius: 16px; padding: 12px; box-shadow: 0 3px 0 #e0c56a; }
.pilihan button b { display: block; font-size: 16px; } .pilihan button small { margin: 0; font-size: 12px; color: #7a644a; }
.pilihan button span { font-size: 34px; }

.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0 14px; }
.levels button { aspect-ratio: 1; border-radius: 14px; background: #ffd34d; box-shadow: 0 3px 0 #c9961a; font-weight: 900; font-size: 18px; color: #3b2a14; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.levels button small { font-size: 10px; margin: 2px 0 0; color: #7a5a10; }
.levels button.kunci { background: #e8dcc6; box-shadow: 0 3px 0 #cbbda2; color: #a99a80; }
.levels button.lulus { background: #9fdc7c; box-shadow: 0 3px 0 #5ea845; }
#sgk svg { width: 20px; height: 20px; vertical-align: -5px; }
.rank li em small { display: block; font-size: 10px; font-weight: 700; color: #a08a70; text-align: right; margin: 0; }
.misi { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; }
.misi svg { width: 30px; height: 30px; }
.card p.kecil { font-size: 12px; color: #8a7458; margin: -4px 0 8px; }
#sg .sgbar { position: absolute; left: 16px; right: 16px; top: calc(54px + env(safe-area-inset-top)); height: 10px; border-radius: 6px; background: rgba(0,0,0,.35); overflow: hidden; }
#sg .sgbar i { display: block; height: 100%; width: 0; background: #ffd34d; border-radius: 6px; transition: width .3s; }
