/* Demo shell — launcher, configurator, floating controls, event mode. Outside the app; not app UI.
   Colours come from the --stage-* / --panel-* tokens so both themes work. */
:root { --device-shadow: rgba(18,18,27,.28); }
:root[data-theme="dark"] { --device-shadow: rgba(0,0,0,.6); }
html, body { overscroll-behavior: none; }
body { transition: background-color var(--m-base); overflow: hidden; -webkit-tap-highlight-color: transparent; }
.stage { height: 100vh; height: 100dvh; min-height: 0; padding: 0; }

/* ---------- kiosk lockdown (showcase view): no zoom, no selection, no long-press menus */
html.kiosk, html.kiosk body { touch-action: pan-x pan-y; }
html.kiosk .device { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.kiosk .device input[type=text] { -webkit-user-select: text; user-select: text; }
html.kiosk .device * { touch-action: manipulation; }
html.kiosk .device input[type=range] { touch-action: pan-y; }
html.kiosk img { -webkit-user-drag: none; pointer-events: none; }

/* ---------- phone form factor: the app IS the screen */
body[data-ff="phone"] .stage { display: block; }
body[data-ff="phone"] .device-col { zoom: 1; width: 100vw; height: 100vh; height: 100dvh; }
body[data-ff="phone"] .device-col::before { display: none; }
body[data-ff="phone"] .device { left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; clip-path: none; }
body[data-ff="phone"] .statusbar > * { visibility: hidden; }   /* the real phone has its own; the strip stays as spacing + staff tap zone */
body[data-ff="phone"] .home-ind { display: none; }

/* ---------- configurator, docked beside the phone (wide landscape) */
.panel-col { flex: 0 0 auto; zoom: var(--pz, 1); width: 420px; margin-left: 40px; display: flex; align-items: center; overflow: hidden;
  transition: width 460ms cubic-bezier(.32,.72,0,1), margin 460ms cubic-bezier(.32,.72,0,1), opacity 300ms var(--ease-out); }
.panel-col .panel { flex: 0 0 420px; max-height: calc((100vh - 48px) / var(--pz, 1)); transition: transform 460ms cubic-bezier(.32,.72,0,1);
  box-shadow: 0 1px 2px rgba(18,18,27,.04), 0 12px 32px rgba(18,18,27,.08); }
:root[data-theme="dark"] .panel-col .panel { box-shadow: none; }
body:not(.panel-open) .panel-col { width: 0; margin-left: 0; opacity: 0; pointer-events: none; }
body:not(.panel-open) .panel-col .panel { transform: translateX(40px); }

/* ---------- configurator as a drawer (portrait screens, tablets, phones) */
body[data-dock="drawer"] .panel-col { position: fixed; z-index: 600; left: 0; right: 0; bottom: 0; width: auto; margin: 0; opacity: 1;
  display: flex; justify-content: center; align-items: flex-end; pointer-events: none; overflow: visible; transition: none; }
body[data-dock="drawer"] .panel-col .panel { pointer-events: auto; flex: 0 1 640px; width: 640px; max-width: 100%;
  max-height: calc(70vh / var(--pz, 1)); max-height: calc(70dvh / var(--pz, 1));
  border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(0); padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(18,18,27,.18); transition: transform 460ms cubic-bezier(.32,.72,0,1); }
body[data-dock="drawer"]:not(.panel-open) .panel-col { width: auto; }
body[data-dock="drawer"]:not(.panel-open) .panel-col .panel { transform: translateY(105%); }
.drawer-scrim { position: fixed; inset: 0; z-index: 590; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 360ms var(--ease-out); }
body[data-dock="drawer"].panel-open .drawer-scrim { opacity: 1; pointer-events: auto; }

/* panel header + controls added for the shell */
.panel .pn-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel .pn-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.panel .pn-btn { height: 36px; padding: 0 12px; border-radius: 10px; background: var(--panel-ctrl); color: var(--panel-ink); font-size: 13px; transition: background var(--m-fast); }
.panel .pn-btn:hover { background: var(--panel-row); }
.panel .pn-btn.icon { width: 36px; padding: 0; display: grid; place-items: center; }
.panel .pn-btn svg { width: 18px; height: 18px; }
body[data-dock="drawer"] .panel .pn-btn.icon svg { transform: rotate(90deg); }
.panel select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; background: var(--panel-ctrl); color: var(--panel-ink-strong); border: 1px solid var(--panel-line); margin-left: 6px; }
.panel .seg2 button, .panel .jump button, .panel .btnp { min-height: 34px; }

/* ---------- floating controls: mouse users only (touch visitors never see them) */
.ui-fab { position: fixed; right: 20px; bottom: 20px; z-index: 500; display: none; gap: 8px; zoom: var(--pz, 1); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); }
/* v7 (Mihir): floating Configure / full-screen buttons hidden by default. Open the configurator by triple-clicking or
   triple-tapping the phone's header, or press C. ?fab=1 brings the buttons back. */
html.show-fab body.has-mouse .ui-fab, html.show-fab body[data-mode="config"] .ui-fab { display: flex; }
.fab-btn { height: 40px; padding: 0 14px 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-bg); color: var(--panel-ink-strong); border: 1px solid var(--panel-line); font-size: 13px;
  box-shadow: 0 6px 20px rgba(18,18,27,.10); transition: background var(--m-fast), transform var(--m-fast); }
.fab-btn:hover { background: var(--panel-ctrl); }
.fab-btn:active { transform: scale(.96); }
.fab-btn svg { width: 18px; height: 18px; }
.fab-btn.icon { width: 40px; padding: 0; justify-content: center; }
kbd { font: 500 11px/1 var(--font-default); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--panel-line); background: var(--panel-ctrl); color: var(--panel-muted); }
body.panel-open .ui-fab { opacity: 0; pointer-events: none; }
body.ui-idle .ui-fab, body.attract .ui-fab { opacity: 0; transform: translateY(8px); pointer-events: none; }
body.ui-idle .ui-fab:hover { opacity: 1; transform: none; pointer-events: auto; }
body[data-mode="launcher"] .ui-fab { display: none; }

/* ---------- attract loop: ghost fingertip + call to action (inside the phone, demo layer) */
.ghost { position: absolute; left: 0; top: 0; z-index: 95; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(18,18,27,.18); box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 6px 18px rgba(18,18,27,.25);
  pointer-events: none; opacity: 0; transition: opacity 260ms var(--ease-out), scale 200ms var(--ease-out); scale: 1.15; }
:root[data-theme="dark"] .ghost { background: rgba(255,255,255,.28); box-shadow: 0 0 0 2px rgba(255,255,255,.6), 0 6px 18px rgba(0,0,0,.5); }
.ghost.on { opacity: 1; scale: 1; }
.ghost.press { scale: .82; background: rgba(22,159,159,.35); }
.attract-cta { position: absolute; left: 50%; bottom: 30px; z-index: 96; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px 12px 16px; border-radius: 999px;
  background: rgba(18,18,27,.86); color: #fff; font-size: 15px; font-weight: var(--weight-medium); white-space: nowrap;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(18,18,27,.3);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out); }
.attract-cta.show { opacity: 1; transform: translate(-50%, 0); }
.attract-cta .dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: #15c18f; }
.attract-cta .dot::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #15c18f; animation: ctaPing 1.8s var(--ease-out) infinite; }
@keyframes ctaPing { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
body.attract .device .screen .scroll { scroll-behavior: auto; }

/* ---------- launcher */
.launcher { position: fixed; inset: 0; z-index: 1000; background: var(--stage-bg); color: var(--stage-ink);
  display: grid; place-items: center; padding: 32px 20px; overflow-y: auto; opacity: 0; transition: opacity 420ms var(--ease-out); }
.launcher[hidden] { display: none; }
.launcher.in { opacity: 1; }
.launcher.out { opacity: 0; pointer-events: none; }
.ln-inner { width: min(760px, 100%); text-align: center; zoom: var(--pz, 1); transition: transform 520ms cubic-bezier(.32,.72,0,1); }
.launcher.out .ln-inner { transform: scale(1.03); }
.ln-eyebrow { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--stage-ink-2); }
.launcher h1 { margin: 0; font-size: 40px; line-height: 1.1; font-weight: var(--weight-medium); letter-spacing: -.01em; }
.ln-sub { margin: 12px auto 36px; max-width: 460px; font-size: 15px; line-height: 1.5; color: var(--stage-ink-2); }
.ln-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ln-opt { position: relative; text-align: left; padding: 20px; border-radius: 20px; background: var(--panel-bg); border: 1px solid var(--panel-line);
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(18,18,27,.04);
  transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 260ms var(--ease-out); }
.ln-opt:hover, .ln-opt:focus-visible { transform: translateY(-3px); border-color: var(--slider-fill); box-shadow: 0 16px 40px rgba(18,18,27,.10); outline: none; }
.ln-opt:active { transform: translateY(-1px) scale(.99); }
.ln-t { font-size: 18px; font-weight: var(--weight-medium); color: var(--panel-ink-strong); margin-top: 8px; }
.ln-d { font-size: 14px; line-height: 1.5; color: var(--panel-muted); }
.ln-k { position: absolute; top: 16px; right: 16px; }
.launcher.in .ln-opt { animation: lnIn 560ms cubic-bezier(.2,0,0,1) both; }
.launcher.in .ln-opt + .ln-opt { animation-delay: 70ms; }
@keyframes lnIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.ln-art { height: 168px; border-radius: 14px; background: var(--stage-bg); display: flex; align-items: center; justify-content: center; gap: 12px; overflow: hidden; }
.ln-phone { width: 66px; height: 136px; border-radius: 14px; background: var(--bg-page); box-shadow: 0 0 0 3px #1b1b22, 0 10px 24px rgba(18,18,27,.18);
  display: flex; flex-direction: column; align-items: center; padding: 16px 9px 0; gap: 6px; transition: transform 360ms var(--ease-out); }
.ln-phone .ln-orb { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #15c18f; box-shadow: 0 0 14px rgba(21,193,143,.45) inset; margin-bottom: 4px; }
.ln-l { display: block; height: 4px; border-radius: 2px; background: var(--card-stroke); align-self: stretch; }
.ln-l.w40 { width: 40%; } .ln-l.w50 { width: 50%; align-self: center; } .ln-l.w60 { width: 60%; } .ln-l.w70 { width: 70%; align-self: center; } .ln-l.w80 { width: 80%; }
.ln-card { display: block; align-self: stretch; height: 26px; border-radius: 6px; background: var(--card-bg); margin-top: 4px; }
.ln-panel { width: 92px; height: 120px; border-radius: 10px; background: var(--panel-bg); border: 1px solid var(--panel-line);
  display: flex; flex-direction: column; gap: 7px; padding: 12px 10px; transition: transform 360ms var(--ease-out); }
.ln-panel .ln-l { align-self: flex-start; }
.ln-seg { display: block; height: 10px; border-radius: 4px; background: var(--panel-ctrl); }
.ln-opt:hover .ln-phone { transform: translateY(-3px); }
.ln-opt:hover .ln-panel { transform: translateX(3px); }
.ln-fs { display: inline-flex; gap: 8px; align-items: center; margin-top: 24px; font-size: 14px; color: var(--stage-ink-2); cursor: pointer; }
.ln-fs input { width: 18px; height: 18px; accent-color: var(--slider-fill); }
.ln-hint { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--stage-ink-2); }
@media (max-width: 640px) { .ln-opts { grid-template-columns: 1fr; } .launcher h1 { font-size: 30px; } .ln-art { height: 140px; } .ln-k { display: none; } }
@media (hover: none) { .ln-k { display: none; } }

/* phone entrance after choosing a view */
body.device-enter .device-col { animation: devIn 620ms cubic-bezier(.2,0,0,1) both; }
@keyframes devIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel-col, .panel-col .panel, .launcher, .ln-inner, .ln-opt { transition: none !important; animation: none !important; } }

/* phone: the configurator button shrinks to a single icon so it covers as little of the app as possible */
body[data-ff="phone"] .ui-fab { right: 12px; bottom: 76px; }
body[data-ff="phone"] .fab-btn span, body[data-ff="phone"] .fab-btn kbd, body[data-ff="phone"] .fab-btn.icon { display: none; }
body[data-ff="phone"] .fab-btn { width: 44px; height: 44px; padding: 0; justify-content: center; opacity: .92; }
@media (hover: none) { .fab-btn kbd { display: none; } }

/* ---------- v3: launcher profile step + custom profile form (demo shell, not app UI) */
.ln-step { margin: 0 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--stage-ink-2); text-align: start; }
.ln-prof { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; align-items: stretch; }
.lp { flex: 1 1 180px; text-align: start; padding: 12px 14px; border-radius: 14px; background: var(--panel-bg); border: 1px solid var(--panel-line); display: flex; flex-direction: column; gap: 2px; transition: border-color var(--m-fast), transform var(--m-fast); }
.lp b { font-weight: var(--weight-medium); font-size: 15px; color: var(--panel-ink-strong); }
.lp span { font-size: 13px; color: var(--panel-muted); }
.lp:hover { transform: translateY(-2px); }
.lp.on { border-color: var(--slider-fill); box-shadow: 0 0 0 1px var(--slider-fill) inset; }
.lp.mine:not(.on) b { color: var(--link); }
.lp-edit { flex: 0 0 auto; align-self: center; font-size: 13px; color: var(--link); text-decoration: underline; padding: 6px; }

.pf { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(18,18,27,.45); opacity: 0; transition: opacity 240ms var(--ease-out); }
.pf[hidden] { display: none; }
.pf.in { opacity: 1; }
.pf-card { zoom: var(--pz, 1); width: min(720px, 100%); max-height: calc((100vh - 48px) / var(--pz, 1)); display: flex; flex-direction: column; border-radius: 22px; background: var(--panel-bg); color: var(--panel-ink); box-shadow: 0 30px 80px rgba(0,0,0,.25); transform: translateY(12px); transition: transform 300ms cubic-bezier(.32,.72,0,1); }
.pf.in .pf-card { transform: none; }
.pf-head { display: flex; justify-content: space-between; gap: 16px; padding: 24px 24px 12px; border-bottom: 1px solid var(--panel-line); }
.pf-head h2 { margin: 0; font-size: 24px; font-weight: var(--weight-medium); color: var(--panel-ink-strong); }
.pf-sub { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--panel-muted); }
.pf-sub b { font-weight: var(--weight-medium); color: var(--panel-ink); }
.pf-x { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-ctrl); font-size: 22px; line-height: 1; color: var(--panel-ink); flex: 0 0 auto; }
.pf-body { overflow-y: auto; padding: 16px 24px; overscroll-behavior: contain; }
.pf-basics { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.pf-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--panel-muted); }
.pf-field input { width: 120px; }
.pf input[type=number] { font: inherit; font-size: 15px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--panel-line); background: var(--panel-bg); color: var(--panel-ink-strong); font-variant-numeric: tabular-nums; }
.pf input[type=number]:focus { outline: 2px solid var(--slider-fill); outline-offset: 0; border-color: transparent; }
.pf-seg { display: inline-flex; background: var(--panel-ctrl); border-radius: 10px; padding: 3px; }
.pf-seg button { padding: 7px 16px; border-radius: 8px; font-size: 14px; color: var(--panel-ink); }
.pf-seg button.on { background: var(--panel-ctrl-on); color: var(--panel-bg); }
.pf-count { margin-inline-start: auto; font-size: 13px; color: var(--panel-muted); padding-bottom: 10px; }
.pf-tools { margin: 14px 0 4px; text-align: end; }
.pf-tools button { font-size: 13px; color: var(--link); text-decoration: underline; }
.pf-grp { border: 0; margin: 12px 0 0; padding: 0; }
.pf-grp legend { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--panel-muted); font-weight: var(--weight-medium); padding: 0; margin-bottom: 6px; }
.pf-row { display: grid; grid-template-columns: 1fr 160px 112px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--panel-line); }
.pf-name { font-size: 14px; color: var(--panel-ink-strong); display: flex; flex-direction: column; gap: 2px; }
.pf-name small { font-size: 12px; color: var(--panel-muted); }
.pf-in { display: flex; align-items: center; gap: 6px; }
.pf-in input { width: 92px; }
.pf-u { font-size: 12px; color: var(--panel-muted); white-space: nowrap; }
.pf-row.unk .pf-in input { color: var(--panel-muted); background: var(--panel-ctrl); border-style: dashed; }
.pf-dk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--panel-ink); cursor: pointer; }
.pf-dk input { width: 16px; height: 16px; accent-color: var(--slider-fill); }
.pf-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--panel-line); flex-wrap: wrap; }
.pf-err { margin: 0 auto 0 0; font-size: 13px; color: var(--tag-error-text); flex: 1 1 200px; }
.pf-btn { height: 42px; padding: 0 20px; border-radius: 999px; background: var(--panel-ctrl-on); color: var(--panel-bg); font-size: 15px; font-weight: var(--weight-medium); }
.pf-btn.alt { background: var(--panel-ctrl); color: var(--panel-ink); }
@media (max-width: 600px) {
  .pf { padding: 0; align-items: flex-end; }
  .pf-card { border-radius: 22px 22px 0 0; max-height: 92vh; }
  .pf-row { grid-template-columns: 1fr auto; }
  .pf-row .pf-dk { grid-column: 2; }
  .pf-row .pf-in { grid-column: 1 / -1; grid-row: 2; }
}

/* v6.7 — launcher toggles side by side */
.ln-toggles { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }

/* v7 — drag-to-scroll: no text selection while dragging; header taps never select text */
html.vdragging, html.vdragging * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing; }
.device .appbar, .device .statusbar { user-select: none; -webkit-user-select: none; }
