/* Non-critical styles: loaded without blocking render (see inc/setup.php). */
/* Dialogs */
.dlg{border:0;border-radius:24px;padding:28px 22px 22px;width:min(460px,calc(100vw - 32px));background:var(--surface);color:var(--ink);box-shadow:0 30px 80px rgb(0 0 0/.35)}
.dlg-wide{width:min(760px,calc(100vw - 32px))}
.dlg::backdrop{background:rgb(15 11 28/.55);backdrop-filter:blur(3px)}
.dlg[open]{animation:pop .35s cubic-bezier(.2,1.4,.4,1)}
@keyframes pop{from{transform:scale(.85);opacity:0}}
.dlg-x{position:absolute;top:10px;right:10px;width:40px;height:40px;border-radius:50%;border:0;background:var(--surface2);cursor:pointer;display:grid;place-items:center}
.dlg-h{display:flex;align-items:center;gap:8px;font-size:20px;font-weight:500;margin-bottom:10px;padding-right:40px}
.dlg-act{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.dlg-act .btn{flex:1}
.dlg-win{text-align:center}
.win-kicker{display:inline-flex;gap:8px;align-items:center;color:var(--pri);font-weight:700;margin:0}
@media (prefers-color-scheme:dark){.win-kicker{color:#d6caff}}
.win-name{font-size:clamp(30px,7vw,48px);font-weight:500;line-height:1.15;margin:10px 0;word-break:break-word}
.win-name.multi{font-size:clamp(20px,4vw,26px)}
.win-msg{color:var(--muted)}
.share-in{width:100%;min-height:46px;padding:0 12px;border:1px solid var(--line);border-radius:12px;background:var(--bg);font-size:14px}
.saved{list-style:none;margin:0;padding:0;display:grid;gap:8px;max-height:60vh;overflow:auto}
.saved li{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--line);border-radius:12px}
.saved a{flex:1;font-weight:700;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.saved time{color:var(--muted);font-size:12px}
.teams{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin-top:14px;max-height:60vh;overflow:auto}
.teams div{padding:12px;border-radius:14px;background:var(--surface2)}
.teams b{display:block;margin-bottom:6px}
.teams ul{margin:0;padding-left:18px}
.toast{position:fixed;left:50%;bottom:90px;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:var(--ink);color:var(--bg);padding:10px 18px;border-radius:999px;font-weight:700;z-index:90;transition:.25s;margin:0}
.toast.show{opacity:1;transform:translate(-50%,0)}
.confetti{position:fixed;inset:0;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:none;overflow:visible;pointer-events:none;z-index:100}

/* Chips (toggle / image per entry) */
.help-box{margin:8px 0;font-size:13px;color:var(--muted)}
.help-box summary{cursor:pointer;font-weight:700;display:flex;align-items:center;gap:6px;min-height:32px}
.help-box ul{margin:6px 0 0;padding-left:18px}
.chips-list{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0;max-height:180px;overflow:auto}
.chip{display:inline-flex;align-items:stretch;border:1px solid var(--line);border-radius:999px;background:var(--surface);overflow:hidden;font-size:13px}
.chip button{border:0;background:none;cursor:pointer;padding:4px 10px;min-height:32px;display:inline-flex;align-items:center;gap:4px;font-weight:600;color:var(--ink);max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip small{color:var(--muted);font-weight:700}
.chip .chip-img{border-left:1px solid var(--line);padding:0 8px;color:var(--muted)}
.chip .chip-img img{width:22px;height:22px;border-radius:50%;object-fit:cover}
.chip.off{opacity:.55;border-style:dashed}
.chip.off button:first-child{text-decoration:line-through}
.hash{display:block;word-break:break-all;font-size:12px;margin:6px 0;padding:6px 8px}
.share-grid,.room-grid{display:grid;gap:18px;grid-template-columns:1fr}
@media (min-width:640px){.share-grid{grid-template-columns:1fr 200px}.room-grid{grid-template-columns:1fr 1fr}}
.qr{margin:0;background:#fff;border-radius:14px;padding:8px;max-width:220px;aspect-ratio:1;display:grid;place-items:center}
.qr svg{width:100%;height:auto}
.qr:empty::after{content:"";width:40%;height:40%;border-radius:50%;border:4px solid #e3ddf3;border-top-color:#5b2fd6;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.warn{color:var(--danger)}
.code{font-family:ui-monospace,Consolas,monospace;font-size:13px;min-height:100px}
.fair-out .ok{color:#15803d}.fair-out .bad{color:var(--danger)}
.win-img{margin:8px auto 0}
.win-img img{width:120px;height:120px;border-radius:50%;object-fit:cover;margin:auto;box-shadow:0 8px 24px rgb(0 0 0/.2)}

/* Event themes (stage) */
.amb{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit}
.stage{overflow:hidden}
.stage>:not(.amb){position:relative;z-index:1}
.th-tet .stage{background:linear-gradient(160deg,#fff4e0,#ffe0e0);color:#1d1633}
.th-trungthu .stage{background:radial-gradient(circle at 85% 8%,#ffe08a 0 5%,transparent 5.5%),linear-gradient(160deg,#1b1f4b,#3b2a6b)}
.th-halloween .stage{background:linear-gradient(160deg,#1a1026,#3a1d0e)}
.th-noel .stage{background:linear-gradient(160deg,#0f3d2e,#173b5c)}
.th-yep .stage{background:radial-gradient(circle at 50% 0,#4b1d8f,transparent 60%),linear-gradient(160deg,#0b0820,#2a0f4d)}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage{color:#fff;border-color:transparent}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage .ibtn{background:rgb(255 255 255/.12);border-color:rgb(255 255 255/.2);color:#fff}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage-hint{color:#e8e4ff}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage-hint kbd{background:rgb(255 255 255/.12);color:#fff;border-color:rgb(255 255 255/.25)}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .mode-switch{background:rgb(255 255 255/.12)}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .mode-switch a{color:#fff}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage-pen{color:#d9d3f5}
:is(.th-trungthu,.th-halloween,.th-noel,.th-yep) .stage-title:focus{background:rgb(0 0 0/.25)}

/* Trust badge */
.trust{position:fixed;left:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:35;min-width:212px;padding:12px 14px 10px;border-radius:14px;background:#1c1830;color:#f1eefb;box-shadow:0 12px 32px rgb(0 0 0/.3);transition:opacity .25s,transform .25s}
.trust.away{opacity:0;transform:translateY(12px);pointer-events:none}
.trust p{margin:0}
.trust .trust-h{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;margin-bottom:6px;padding-right:26px;white-space:nowrap}
.trust-logo{flex:none;width:22px;height:22px;border-radius:6px;background:conic-gradient(#ff5d8f 0 25%,#ffd166 0 50%,#06d6a0 0 75%,#7b61ff 0)}
.trust-l{font-size:12px;color:#c9c2e6}
.trust-n{font:500 30px/1.1 var(--font);color:#4ade80;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.trust-x{position:absolute;top:6px;right:6px;width:28px;height:28px;border-radius:50%;border:0;background:rgb(255 255 255/.08);color:#f1eefb;display:grid;place-items:center;cursor:pointer}
@media (max-width:959px){.trust{width:auto;min-width:168px;padding:8px 40px 8px 12px;bottom:calc(84px + env(safe-area-inset-bottom))}.trust-n{font-size:22px}.trust .trust-h{font-size:13px;margin-bottom:2px}}

/* Print report */
#vq-print{display:none}
@media print{
	body>*:not(#vq-print){display:none!important}
	#vq-print{display:block;font:14px/1.5 var(--font);color:#000}
	#vq-print table{width:100%;border-collapse:collapse;margin:12px 0}
	#vq-print th,#vq-print td{border:1px solid #999;padding:6px 8px;text-align:left}
	#vq-print .sign{display:flex;justify-content:space-around;margin-top:60px;font-weight:700}
}

/* Embed */
body.embed{background:transparent}
.embed-main{padding:8px}
.embed-main .app{margin:0}
.embed-credit{text-align:center;font-size:13px;margin:10px 0 0}
.embed-credit a{display:inline-flex;align-items:center;gap:6px;color:var(--muted)}

/* 3D + background image: the waving flag fills the whole stage */
.stage.has-bgimg:has(.wheel.is3d){background-image:none!important;padding:0;overflow:hidden}
.stage.has-bgimg .wheel.is3d{width:100%;max-width:none;margin:0;aspect-ratio:16/10}
@media (max-width:700px){.stage.has-bgimg .wheel.is3d{aspect-ratio:4/3}}
.stage.has-bgimg:has(.wheel.is3d) .stage-top{position:absolute;top:12px;right:12px;width:auto;z-index:3;margin:0}
.stage.has-bgimg:has(.wheel.is3d) .stage-hint,.stage.has-bgimg:has(.wheel.is3d) .mode-switch{position:relative;z-index:2;margin:10px auto}
.stage.has-bgimg:has(.wheel.is3d) .mode-switch{margin-bottom:14px}
.dd-list{position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:60;margin:0;padding:6px;list-style:none;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 18px 40px rgb(20 10 50/.22);max-height:280px;overflow:auto;outline:0;animation:ddIn .16s ease-out}
.dd-list li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border-radius:10px;cursor:pointer;font-size:15px;font-weight:500;color:var(--ink)}
.dd-list li.act{background:var(--pri-soft)}
.dd-list li[aria-selected=true]{color:var(--link);font-weight:700}
.dd-list li[aria-selected=true] .dd-ok{visibility:visible}
.dd.up .dd-list{top:auto;bottom:calc(100% + 6px)}
.inline .dd-list,.tool-row .dd-list{min-width:180px}
@keyframes ddIn{from{opacity:0;transform:translateY(-4px)}}
.dd-ok{visibility:hidden;color:var(--link)}
