* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Fredoka', system-ui, sans-serif; color: #3b0764; background: #fdf2f8; overflow-x: hidden; user-select: none; -webkit-user-select: none; }
#bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 20% 10%, #fbcfe8 0, transparent 40%), radial-gradient(circle at 90% 30%, #ddd6fe 0, transparent 40%), radial-gradient(circle at 50% 100%, #fde68a 0, transparent 45%), #fdf2f8; transition: background .6s; }
.screen { display: none; min-height: 100vh; min-height: 100dvh; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }
.card { width: 100%; max-width: 420px; background: rgba(255,255,255,.88); border-radius: 32px; padding: 24px 20px; box-shadow: 0 20px 50px -20px rgba(190,24,93,.45); backdrop-filter: blur(6px); }
.card.wide { max-width: 640px; }
.center { text-align: center; }
h1 { font-size: 34px; margin: 8px 0 4px; line-height: 1.1; }
h2 { font-size: 28px; margin: 4px 0; }
.pink { color: #ec4899; }
.sub { margin: 0 0 12px; color: #7e22ce; font-size: 17px; }
.rules { text-align: left; margin: 12px 0 16px; padding: 12px 14px 12px 34px; background: #fdf4ff; border-radius: 18px; font-size: 16px; line-height: 1.6; }
input#name { width: 100%; font: inherit; font-size: 20px; text-align: center; padding: 14px; border-radius: 18px; border: 3px solid #f9a8d4; outline: none; margin-bottom: 12px; color: #3b0764; }
input#name:focus { border-color: #ec4899; }
.btn { display: block; width: 100%; font: inherit; font-size: 20px; font-weight: 700; border: 0; border-radius: 20px; padding: 14px; margin-top: 10px; cursor: pointer; color: #fff; background: linear-gradient(135deg, #ec4899, #a855f7); box-shadow: 0 8px 0 #9d174d; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #9d174d; }
.btn.big { font-size: 24px; padding: 16px; }
.btn.ghost { background: #fff; color: #9333ea; box-shadow: 0 6px 0 #e9d5ff; border: 2px solid #e9d5ff; }
.btn.danger { background: #fff; color: #e11d48; box-shadow: 0 6px 0 #fecdd3; border: 2px solid #fecdd3; font-size: 16px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

.avatar { border-radius: 50%; border: 5px solid #fff; box-shadow: 0 8px 20px rgba(0,0,0,.18); display: block; }
.avatar.big { width: 140px; height: 140px; margin: 0 auto; }
.avatar.small { width: 64px; height: 64px; border-width: 3px; }
.avatar-wrap { position: relative; width: 140px; margin: 0 auto; }
.hat { position: absolute; top: -26px; right: -14px; font-size: 52px; transform: rotate(18deg); z-index: 2; }
.bounce { animation: bounce 1.6s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }

/* GAME */
#game { justify-content: flex-start; gap: 8px; }
.hud { width: 100%; max-width: 560px; display: flex; gap: 8px; justify-content: space-between; }
.pill { background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 20px; box-shadow: 0 4px 0 #f9a8d4; border: 0; font-family: inherit; color: inherit; }
.btnpill { cursor: pointer; }
.timebar { position: relative; width: 100%; max-width: 560px; height: 22px; background: #fff; border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.08); }
#time { height: 100%; width: 100%; background: linear-gradient(90deg, #22c55e, #facc15); border-radius: 999px; transition: width .2s linear, background .3s; }
#time.low { background: linear-gradient(90deg, #ef4444, #f97316); }
#timeTxt { position: absolute; inset: 0; text-align: center; font-size: 15px; font-weight: 700; line-height: 22px; }
.msg { margin: 2px 0; font-size: 22px; font-weight: 700; min-height: 30px; text-align: center; color: #86198f; }
#scene { position: relative; width: 100%; max-width: 560px; height: calc(100vh - 175px); height: calc(100dvh - 175px); max-height: 680px; min-height: 320px; border-radius: 32px; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 4px rgba(255,255,255,.8), 0 16px 40px -18px rgba(88,28,135,.5); overflow: hidden; }
.spot { position: absolute; display: grid; place-items: center; transition: left .32s cubic-bezier(.5,0,.3,1), top .32s cubic-bezier(.5,0,.3,1); cursor: pointer; touch-action: manipulation; }
.spot .obj { position: relative; z-index: 2; line-height: 1; transition: transform .25s; filter: drop-shadow(0 6px 4px rgba(0,0,0,.18)); }
.spot .who { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -10%) scale(.4); opacity: 0; transition: transform .25s, opacity .2s; pointer-events: none; text-align: center; }
.spot .who img { width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.spot .who .decoy { line-height: 1; }
.spot.peek .who, .spot.open .who { opacity: 1; transform: translate(-50%, -105%) scale(1); }
.spot.open .obj { transform: translateY(18%) scale(.9); }
.spot.wrong .obj { animation: shake .35s; }
.spot.hint .obj { animation: wiggle .6s ease-in-out infinite; }
.spot.lifted .obj { opacity: .45; }
.locked .spot { cursor: default; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }
@keyframes wiggle { 0%,100% { transform: rotate(-7deg) } 50% { transform: rotate(7deg) } }
.float { position: absolute; z-index: 5; font-size: 28px; font-weight: 700; pointer-events: none; animation: floatUp 1s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 0 8px #fff; white-space: nowrap; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) } to { opacity: 0; transform: translate(-50%, -60px) } }
.bubble { position: absolute; z-index: 6; background: #fff; border-radius: 14px; padding: 2px 8px; font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.15); transform: translate(-50%, -100%); pointer-events: none; }

/* OVER */
.final { font-size: 64px; font-weight: 700; color: #db2777; margin: 0; line-height: 1; }
.final small { display: block; font-size: 18px; color: #a21caf; }
.rank { font-size: 20px; margin: 10px 0; min-height: 26px; }

/* BOARD */
.boardhead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.board { list-style: none; padding: 0; margin: 8px 0; counter-reset: r; }
.board li { counter-increment: r; display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 8px; background: #fff; border-radius: 18px; font-size: 22px; box-shadow: 0 3px 0 #fbcfe8; }
.board li::before { content: counter(r); width: 36px; text-align: center; font-weight: 700; color: #a855f7; }
.board li:nth-child(1)::before { content: '🥇'; font-size: 30px; }
.board li:nth-child(2)::before { content: '🥈'; font-size: 28px; }
.board li:nth-child(3)::before { content: '🥉'; font-size: 26px; }
.board li:nth-child(1) { background: linear-gradient(90deg, #fef3c7, #fff); font-size: 26px; }
.board .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .s { font-weight: 700; color: #db2777; }
.board .lv { font-size: 14px; color: #a78bfa; }
.board li.me { outline: 3px solid #ec4899; }
.board li.new { animation: pop .6s; }
.board .del { border: 0; background: #ffe4e6; color: #e11d48; border-radius: 10px; font-size: 14px; padding: 4px 8px; cursor: pointer; font-family: inherit; }
.board.small li { font-size: 17px; padding: 6px 12px; margin-bottom: 5px; }
.board.small li:nth-child(1) { font-size: 18px; }
.board.small li::before { width: 28px; }
.board .empty { justify-content: center; color: #a78bfa; font-size: 18px; }
.board .empty::before { content: none; }
@keyframes pop { 0% { transform: scale(.8) } 60% { transform: scale(1.05) } 100% { transform: scale(1) } }
.hint { text-align: center; color: #a78bfa; font-size: 14px; margin: 4px 0 8px; }
/* Tampilan TV / layar besar */
@media (min-width: 900px) {
  #board .card { max-width: 820px; }
  .board li { font-size: 30px; padding: 14px 20px; }
  .board li:nth-child(1) { font-size: 36px; }
}
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

/* Pop-up game over */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(59,7,100,.55); backdrop-filter: blur(3px); overflow-y: auto; touch-action: none; }
.overlay .card { max-height: calc(100dvh - 32px); overflow-y: auto; touch-action: pan-y; }
.pop { animation: pop .4s; }
.lose { margin: 0; font-size: 22px; font-weight: 700; color: #e11d48; }
.btn:disabled { opacity: .45; filter: grayscale(.4); transform: none; cursor: not-allowed; }

/* Pendaftaran pemain */
.step { font-size: 20px; font-weight: 700; margin: 4px 0 10px; }
.photo-pick { display: grid; place-items: center; width: 150px; height: 150px; margin: 0 auto 14px; border-radius: 50%; background: #fdf4ff; border: 4px dashed #f0abfc; cursor: pointer; overflow: hidden; font-size: 44px; color: #a21caf; line-height: 1.1; }
.photo-pick small { font-size: 15px; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick.has { border-style: solid; border-color: #ec4899; }
.me-card { display: flex; align-items: center; gap: 14px; text-align: left; background: #fdf4ff; border-radius: 22px; padding: 12px 14px; }
.me-card .avatar { width: 72px; height: 72px; }
.me-name { margin: 0; font-size: 24px; font-weight: 700; }
.me-left { margin: 0; font-size: 16px; color: #7e22ce; }
.hint a { color: #a855f7; }
.center-img { margin: -6px auto 4px; width: 72px; height: 72px; }
.board .ph { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); flex-shrink: 0; background: #f5d0fe; display: grid; place-items: center; font-size: 20px; color: #86198f; font-weight: 700; }
.board.small .ph { width: 30px; height: 30px; font-size: 14px; }
.board .adm { display: flex; gap: 4px; }
@media (min-width: 900px) { .board .ph { width: 60px; height: 60px; } }
#adminList h3 { margin: 16px 0 6px; font-size: 18px; }
