/* Presenter page: control panel + stage + phone frames + scenario caption */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: #EFE6DB; display: grid; grid-template-columns: 340px 1fr; overflow: hidden; -webkit-font-smoothing: antialiased; }
[data-theme="dark"] body { background: #0E0B09; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Panel ---------- */
#panel { height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 18px 28px; scrollbar-width: thin; }
.pn-brand { display: flex; align-items: center; gap: 10px; }
.pn-brand b { font-size: 20px; letter-spacing: -.02em; display: block; }
.pn-brand small { color: var(--muted); font-size: 12px; }
.pn-close { display: none; margin-left: auto; border: 0; background: var(--bg2); border-radius: 50%; width: 34px; height: 34px; }
.pn-tag { margin: 10px 0 4px; font-size: 13px; color: var(--ember-ink); font-weight: 600; }
#panel h4 { margin: 20px 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
#panel h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 4px; }
.pn-hh { display: grid; gap: 6px; }
.hhb { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; transition: .2s var(--ease); }
.hhb b { display: block; font-size: 14px; } .hhb small { color: var(--muted); font-size: 11.5px; }
.hhb.on, .pn-seg button.on { border-color: var(--ember); background: var(--ember-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 15%, transparent); }
.pn-seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.pn-seg button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 13px; font-weight: 600; text-align: center; }
.pn-seg small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; }
.pn-sim { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pn-sim button { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); font-size: 12.5px; text-align: left; transition: .15s; }
.pn-sim button:hover, .pn-sc button:hover, .hhb:hover { border-color: var(--line2); background: var(--bg2); }
.pn-sim .ic { color: var(--ember); flex: none; }
.pn-pro { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pn-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.pn-row:first-child { border-top: 0; } .pn-row.all { background: var(--amber-soft); }
.pn-row span { flex: 1; } .pn-row .ic { color: var(--muted); }
.pn-sc { display: grid; gap: 6px; }
.pn-sc button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.pn-sc button > b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ember-soft); color: var(--ember-ink); font-size: 12.5px; }
.pn-sc button.on { border-color: var(--ember); background: var(--ember-soft); }
.pn-sc span { flex: 1; min-width: 0; } .pn-sc em { font-style: normal; font-weight: 600; font-size: 13px; display: block; }
.pn-sc small { color: var(--muted); font-size: 11.5px; display: block; line-height: 1.35; }
.pn-reset { margin-top: 18px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; border-radius: 14px; border: 1px dashed var(--line2); background: transparent; color: var(--ink2); font-weight: 600; }
.pn-foot { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ---------- Stage & phones ---------- */
#stage-wrap { position: relative; height: 100vh; overflow: hidden; background: radial-gradient(80% 60% at 50% 30%, #F8EFE4 0%, #EADCCB 100%); }
[data-theme="dark"] #stage-wrap { background: radial-gradient(80% 60% at 50% 30%, #2A1F18 0%, #0E0B09 100%); }
#stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
body.playing #stage { bottom: 150px; }
.phones { display: flex; gap: 48px; align-items: flex-start; }
.phone-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.phone-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); background: color-mix(in srgb, var(--surface) 75%, transparent); padding: 5px 12px 5px 6px; border-radius: 99px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.phone-label span { color: var(--muted); font-size: 12px; }
.phone-scale { position: relative; }
.phone { overflow: hidden; position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 414px; height: 868px; border-radius: 64px; padding: 12px; background: linear-gradient(145deg, #3B3330, #1C1715 60%, #2E2623); box-shadow: inset 0 0 0 2px #4A403B, inset 0 0 0 5px #0E0B0A, var(--shadow-lg); }
.phone .screen { position: relative; width: 390px; height: 844px; border-radius: 52px; overflow: hidden; background: var(--bg); isolation: isolate; }
.spot { position: absolute; z-index: 60; border-radius: 16px; pointer-events: none; box-shadow: 0 0 0 3px var(--amber), 0 0 0 2000px rgba(30, 18, 10, .32); transition: all .35s var(--ease); }
.spot.pulse { animation: spot 1.6s var(--ease) 2; }
@keyframes spot { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--amber) 55%, transparent), 0 0 0 2000px rgba(30, 18, 10, .32); } }

/* ---------- Caption ---------- */
#caption { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(760px, calc(100% - 40px)); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 14px 18px; z-index: 30; animation: capIn .35s var(--ease); border: 1px solid var(--line); }
@keyframes capIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.cap-h { display: flex; align-items: center; gap: 10px; }
.cap-n { width: 26px; height: 26px; border-radius: 50%; background: var(--ember); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.cap-h b { flex: 1; font-size: 15px; } .cap-k { color: var(--muted); font-size: 12.5px; }
.cap-x { border: 0; background: var(--bg2); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; }
#caption p { margin: 8px 0 10px; font-size: 14.5px; line-height: 1.55; color: var(--ink2); }
.cap-f { display: flex; align-items: center; gap: 8px; }
.cap-dots { flex: 1; display: flex; gap: 5px; } .cap-dots i { width: 7px; height: 7px; border-radius: 9px; background: var(--line2); transition: .3s; }
.cap-dots i.done { background: var(--amber); } .cap-dots i.on { width: 22px; background: var(--ember); }
#pn-msg { position: absolute; top: 16px; left: 50%; transform: translate(-50%, -80px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 13.5px; max-width: 520px; z-index: 40; transition: .35s var(--ease); box-shadow: var(--shadow-lg); }
#pn-msg.in { transform: translate(-50%, 0); }
#fab-panel { display: none; }

/* ---------- Mobile: app full-screen + floating control button ---------- */
body.mobile { display: block; }
body.mobile #panel { position: fixed; inset: auto 0 0 0; height: 82vh; z-index: 100; border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); border: 0; }
body.mobile.panel-open #panel { transform: none; }
body.mobile .pn-close { display: grid; place-items: center; }
body.mobile #stage-wrap { height: 100dvh; }
body.mobile #stage { padding: 0; inset: 0; } body.mobile.playing #stage { bottom: 0; }
body.mobile .phones, body.mobile .phone-wrap { width: 100%; height: 100%; gap: 0; }
body.mobile .phone-label { display: none; }
body.mobile .phone-scale { width: 100% !important; height: 100% !important; }
body.mobile .phone { position: relative; width: 100%; height: 100%; padding: 0; border-radius: 0; background: none; box-shadow: none; transform: none !important; }
body.mobile .phone .screen { width: 100%; height: 100%; border-radius: 0; }

body.mobile .status { display: none; }
body.mobile #fab-panel { display: grid; place-items: center; position: fixed; right: 14px; bottom: 96px; z-index: 90; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); }
body.mobile #caption { bottom: 84px; width: calc(100% - 20px); padding: 12px 14px; z-index: 80; }
body.mobile #caption p { font-size: 13.5px; }

/* Bezel clipping hardening: clip-path clips composited children (backdrop-filter, transforms) that border-radius+overflow miss at fractional scales */
.phone { clip-path: inset(0 round 64px); }
.phone .screen { clip-path: inset(0 round 52px); }
.phone::after { content: ""; position: absolute; inset: 10px; border-radius: 54px; box-shadow: 0 0 0 3px #15110F; pointer-events: none; z-index: 50; }
body.mobile .phone, body.mobile .phone .screen { clip-path: none; -webkit-mask-image: none; }
body.mobile .phone::after { display: none; }
.phone-scale { filter: drop-shadow(0 24px 40px rgba(60,35,20,.22)) drop-shadow(0 4px 10px rgba(60,35,20,.12)); }
[data-theme="dark"] .phone-scale { filter: drop-shadow(0 24px 40px rgba(0,0,0,.5)); }
body.mobile .phone-scale { filter: none; }
.pn-seg.mode { grid-template-columns: 1fr 1fr; }
.pn-seg.mode button { flex-direction: row; justify-content: flex-start; text-align: left; padding: 10px; gap: 8px; } .pn-seg.mode .ic { color: var(--ember); flex: none; }
.nb-ctl { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.nb-day { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink2); } .nb-day b { color: var(--ember-ink); }
#nb-day { width: 100%; accent-color: var(--ember); margin: 8px 0 2px; }
.nb-ticks { display: grid; grid-template-columns: repeat(8, 1fr); font-size: 10.5px; color: var(--muted); text-align: center; } .nb-ticks i { font-style: normal; } .nb-ticks i.on { color: var(--ember-ink); font-weight: 700; }
.nb-unl { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; } .nb-unl small { width: 100%; font-size: 11px; color: var(--muted); }
.nb-unl span { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 8px; border-radius: 99px; background: var(--bg2); color: var(--muted); }
.nb-unl span.on { background: var(--ember-soft); color: var(--ember-ink); }
.nb-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg2); font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.nb-timer span.run b, .nb-timer span.done b, .nb-timer span.over b { margin-right: 2px; } .nb-timer span.done { color: var(--sage); font-weight: 600; } .nb-timer span.run { color: var(--ember-ink); }
.pn-mini { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); background: transparent; border: 0; padding: 2px 0; }
.pn-sc button > b.nb { background: var(--sage-soft); color: var(--sage); }

/* ---------- Embedded in the website (?embed=1): no control panel, single phone ---------- */
body.embed { display: block; }
body.embed #panel, body.embed #fab-panel { display: none !important; }
body.embed #stage-wrap { height: 100%; }
