:root {
  --cream: #f6f0e4; --cream-2: #fbf8f2; --ink: #1e2b25; --emerald: #0f3d2e; --emerald-2: #17513e;
  --gold: #c9a24b; --gold-soft: #e2c887; --line: rgba(15, 61, 46, .16); --muted: #74807a; --track: #2ecc71; --crimson: #8c2f39;
  --sans: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: Didot, "Bodoni 72", "Playfair Display", Georgia, "Times New Roman", serif;
  --aw: min(94vw, 1100px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--cream); color: var(--ink); font-family: var(--sans); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; padding: clamp(8px, 1.4vh, 22px) clamp(14px, 3vw, 40px); }
#sparkles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#sparkles i { position: absolute; color: var(--gold); font-style: normal; opacity: 0; animation: tw 4.5s ease-in-out infinite; font-size: clamp(10px, 2vh, 26px); }
@keyframes tw { 0%, 100% { opacity: 0; transform: scale(.5) rotate(0deg); } 50% { opacity: .85; transform: scale(1) rotate(25deg); } }
#video { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: -10px; top: -10px; }

.brand { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 22px); height: clamp(40px, 5.5vh, 80px); flex: none; width: 100%; z-index: 1; }
.brand-hotel { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.hotel-name { font-weight: 600; letter-spacing: .28em; font-size: clamp(12px, 1.9vh, 24px); }
.hotel-sub { font-weight: 500; letter-spacing: .32em; font-size: clamp(8px, 1.1vh, 13px); color: var(--muted); }
.brand-sep { width: 1px; height: 70%; background: var(--line); }
.brand-campaign { font-family: var(--serif); font-style: italic; font-size: clamp(16px, 2.6vh, 34px); color: var(--emerald); }

.screen { display: none; flex: 1; min-height: 0; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 1.2vh, 16px); position: relative; z-index: 1; }
.screen.show { display: flex; }
.title { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 5.2vh, 64px); margin: 0; text-align: center; line-height: 1.1; }
.title.small { font-size: clamp(22px, 3.4vh, 44px); }
.subtitle { margin: 0; color: var(--muted); font-size: clamp(14px, 1.9vh, 24px); text-align: center; }
.subtitle.small { font-size: clamp(12px, 1.5vh, 19px); }
.h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 3.6vh, 46px); margin: 0; text-align: center; }
.sub { margin: 0; color: var(--muted); font-size: clamp(13px, 1.8vh, 22px); text-align: center; }
.btn { font: inherit; border: 1.5px solid var(--emerald); border-radius: 999px; padding: clamp(10px, 1.6vh, 18px) clamp(24px, 4vw, 44px); font-size: clamp(16px, 2.2vh, 26px); font-weight: 600; cursor: pointer; background: transparent; color: var(--emerald); transition: transform .12s, background .15s, opacity .2s; }
.btn.primary { background: var(--emerald); color: #fff; }
.btn.big { padding: clamp(14px, 2.2vh, 24px) clamp(44px, 8vw, 90px); font-size: clamp(20px, 2.8vh, 34px); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(15, 61, 46, .25); } 50% { box-shadow: 0 0 0 14px rgba(15, 61, 46, 0); } }
.btn:active { transform: scale(.97); }
.btn.ghost { color: var(--muted); border-color: var(--line); }
.btn.small { font-size: clamp(12px, 1.6vh, 18px); padding: clamp(6px, 1vh, 10px) clamp(14px, 2vw, 24px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row { display: flex; gap: clamp(10px, 2vw, 24px); flex-wrap: wrap; justify-content: center; align-items: center; }
.hidden { display: none !important; }
.note { margin: 0; color: var(--muted); font-size: clamp(12px, 1.6vh, 20px); text-align: center; }
.privacy { margin: 0; font-size: clamp(10px, 1.3vh, 15px); color: var(--muted); text-align: center; max-width: var(--aw); opacity: .8; }
.status { font-size: clamp(11px, 1.4vh, 16px); color: var(--muted); }

/* welcome */
.howto { display: flex; flex-direction: column; gap: clamp(4px, .7vh, 10px); width: var(--aw); max-width: 760px; }
.step { display: flex; align-items: center; gap: clamp(8px, 1.4vw, 18px); background: var(--cream-2); border: 1px solid var(--line); border-radius: 14px; padding: .55em 1em; font-size: clamp(13px, 1.9vh, 22px); }
.step .ic { font-size: 1.4em; width: 1.6em; text-align: center; flex: none; }
.welcome-art { width: var(--aw); max-width: 760px; flex: 1; min-height: 0; max-height: 34vh; aspect-ratio: 4 / 3; }
.welcome-art canvas { width: 100%; height: 100%; display: block; border-radius: 20px; border: 1px solid var(--line); background: var(--cream-2); }

/* game */
.round-row { width: var(--aw); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(8px, 1.5vw, 20px); }
.round-row .round { justify-self: start; }
.round-row .timer { justify-self: end; }
.round { font-weight: 600; font-size: clamp(13px, 1.8vh, 22px); }
.dots { display: flex; align-items: center; margin-top: .3em; }
.dots i { width: clamp(10px, 1.4vh, 18px); height: clamp(10px, 1.4vh, 18px); border-radius: 50%; border: 2px solid var(--emerald); background: transparent; display: block; }
.dots i.done { background: var(--emerald); }
.dots i.cur { background: var(--emerald); box-shadow: 0 0 0 4px rgba(15, 61, 46, .18); }
.dots b { width: clamp(18px, 3vw, 40px); height: 2px; background: var(--line); display: block; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: clamp(16px, 2.4vh, 30px); border: 1px solid var(--line); border-radius: 12px; padding: .3em .8em; background: var(--cream-2); }
.timer.urgent { color: var(--crimson); border-color: var(--crimson); }
.arena { position: relative; width: var(--aw); flex: 1; min-height: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--cream-2); box-shadow: 0 12px 34px -20px rgba(15, 61, 46, .5); }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pip { position: relative; justify-self: center; width: min(300px, max(150px, 24vw), calc(17vh * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .95); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .45); background: #cfc8ba; }
.pip canvas { width: 100%; height: 100%; display: block; }
.badge { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: rgba(255, 255, 255, .9); color: var(--ink); font-size: clamp(10px, 1.25vh, 14px); font-weight: 600; padding: .25em .7em; border-radius: 999px; display: flex; align-items: center; gap: .4em; white-space: nowrap; }
.badge::before { content: ''; width: .6em; height: .6em; border-radius: 50%; background: #bbb; }
.badge.on::before { background: var(--track); box-shadow: 0 0 8px var(--track); }
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); text-align: center; background: rgba(255, 255, 255, .94); border-radius: 22px; padding: .9em 2.4em 1.1em; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner-title { font-family: var(--serif); font-size: clamp(30px, 5.4vh, 68px); color: var(--emerald); line-height: 1.1; }
.banner-sub { color: var(--muted); font-size: clamp(14px, 2vh, 24px); margin-top: .2em; }
.score-row { width: var(--aw); display: flex; align-items: center; gap: clamp(14px, 3vw, 36px); padding: 0 1vw; }
.score-row .star { color: var(--gold); font-size: clamp(22px, 3.4vh, 42px); }
.score { display: flex; flex-direction: column; }
.score .lbl { font-size: clamp(11px, 1.5vh, 18px); color: var(--muted); }
.score b { font-size: clamp(20px, 3vh, 38px); font-weight: 700; font-variant-numeric: tabular-nums; }
.feedback { flex: 1; text-align: right; color: var(--emerald); font-weight: 700; font-size: clamp(14px, 2.2vh, 26px); opacity: 0; transition: opacity .25s; }
.feedback.show { opacity: 1; }
.feedback.gold { color: var(--gold); }
.feedback.bad { color: #4f86b8; }
.strip-hint { width: var(--aw); background: var(--cream-2); border: 1px solid var(--line); border-radius: 12px; padding: .6em 1em; font-size: clamp(12px, 1.6vh, 20px); color: var(--muted); text-align: center; }

/* final */
.final-card { text-align: center; background: var(--cream-2); border: 1px solid var(--line); border-radius: 26px; padding: 3vh 6vw; width: var(--aw); max-width: 760px; box-shadow: 0 16px 40px -28px rgba(15, 61, 46, .6); }
.eyebrow { letter-spacing: .3em; text-transform: uppercase; font-size: clamp(11px, 1.5vh, 16px); color: var(--muted); }
.final-score { font-size: clamp(60px, 12vh, 150px); font-weight: 700; color: var(--emerald); line-height: 1; margin: .1em 0; font-variant-numeric: tabular-nums; }
.final-msg { font-family: var(--serif); font-size: clamp(18px, 3vh, 36px); margin-top: .2em; }
.final-rounds { display: flex; gap: 1vw; justify-content: center; flex-wrap: wrap; margin-top: 1.6vh; }
.final-rounds span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .3em .9em; font-size: clamp(12px, 1.6vh, 18px); }

/* camera error */
.cam-error { background: #fff; border: 1px solid var(--crimson); color: var(--crimson); border-radius: 14px; padding: .8em 1.2em; max-width: var(--aw); text-align: center; font-size: clamp(13px, 1.8vh, 22px); }

/* admin */
#admin { position: fixed; inset: 0; background: rgba(30, 43, 37, .55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.admin-box { background: #fff; border-radius: 16px; width: min(94vw, 760px); max-height: 92vh; overflow: auto; padding: 18px 22px 22px; font-size: 15px; color: var(--ink); }
.admin-box h3 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.admin-box h4 { margin: 16px 0 6px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.admin-box label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.admin-box label.full { grid-column: 1 / -1; }
.admin-box select, .admin-box input[type=number] { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; max-width: 60%; }
.admin-box input[type=range] { width: 45%; }
.admin-box .btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.admin-box .btn { font-size: 15px; padding: 8px 16px; }
.admin-box .mini { font-size: 12px; color: var(--muted); }
