/* Vesper Link demo · "Kanaal" interface (thriller setting, see concept/mockups-spelschermen.md) */

:root {
  --ink-0: #0b0b0c;
  --ink-1: #121214;
  --ink-2: #1b1b1e;
  --ink-3: #26262a;
  --ink-4: #3a3a40;
  --text: #ecebe6;
  --text-2: #b9b7b0;
  --muted: #85837c;
  --signal: #ff6a1a;
  --signal-2: #ff9a5c;
  --signal-ghost: rgba(255, 106, 26, .14);
  --signal-line: rgba(255, 106, 26, .38);
  --alarm: #e5383b;
  --ok: #8fd694;
  --paper: #ece4d3;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  margin: 0;
  background: #060607;
  color: var(--text);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.small { font-size: .82rem; color: var(--muted); }

/* ---------- Stage: phone frame on desktop, full screen on a phone ---------- */
.stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 56px 24px 24px;
  background:
    radial-gradient(900px 600px at 30% 40%, rgba(255, 106, 26, .07), transparent 60%),
    radial-gradient(700px 500px at 80% 70%, rgba(80, 90, 120, .08), transparent 60%),
    #060607;
}
.device {
  position: relative;
  width: 390px;
  height: min(844px, calc(100vh - 90px));
  flex: none;
  border-radius: 48px;
  padding: 12px;
  background: linear-gradient(145deg, #1c1c1f, #050506);
  box-shadow: 0 0 0 1px #2a2a2e, 0 40px 90px rgba(0, 0, 0, .7), inset 0 0 0 2px #0a0a0b;
}
.device::before { /* speaker / island */
  content: ''; position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; border-radius: 20px; background: #000; z-index: 30;
}
.screen {
  position: relative;
  height: 100%;
  border-radius: 37px;
  overflow: hidden;
  background: var(--ink-0);
  isolation: isolate;
}

.presenter {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
}
.presenter__brand { letter-spacing: .04em; }
.presenter__brand em { font-style: normal; color: #5d5b56; }
.presenter__controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  border: 1px solid var(--ink-3); background: rgba(18, 18, 20, .8); color: var(--text-2);
  border-radius: 999px; padding: 6px 12px; font: 500 .74rem/1 var(--mono); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.pill:hover { border-color: var(--ink-4); color: var(--text); }
.pill[aria-pressed="true"] { border-color: var(--signal-line); color: var(--signal-2); }

@media (max-width: 720px) {
  .stage { padding: 0; display: block; }
  .device { width: 100%; height: 100%; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .device::before { display: none; }
  .screen { border-radius: 0; height: var(--app-height, 100dvh); }
  .presenter { display: none; }
}

/* ---------- Views ---------- */
.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .6s var(--ease);
}
.view.is-active { opacity: 1; pointer-events: auto; }

/* Landing */
.view--landing { justify-content: flex-end; }
.landing__photo {
  position: absolute; inset: 0;
  background: url(/assets/ellen-street.jpg) center/cover no-repeat;
  filter: saturate(.8) brightness(.75);
  animation: drift 30s ease-in-out infinite alternate;
}
.landing__photo::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 11, 12, .2) 0%, rgba(11, 11, 12, .55) 40%, var(--ink-0) 88%);
}
@keyframes drift { from { transform: scale(1.08) translateX(-2%); } to { transform: scale(1.14) translateX(2%); } }
.landing__content { position: relative; padding: 0 28px calc(44px + env(safe-area-inset-bottom)); }
.landing__kicker {
  font: 500 .72rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--signal);
  display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
}
.landing__kicker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.landing__title { font-weight: 600; font-size: 2rem; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.landing__lead { color: var(--text-2); margin: 0 0 28px; }
.landing__note { font: .74rem/1.4 var(--mono); color: var(--muted); margin: 14px 0 0; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  border-radius: 14px; padding: 15px 22px; font-weight: 600; font-size: 1rem;
  transition: transform .15s var(--ease), background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn--primary { background: var(--signal); color: #1a0b03; width: 100%; box-shadow: 0 10px 30px rgba(255, 106, 26, .25); }
.btn--primary:hover { background: #ff7a30; }
.btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--ink-3); }
.btn--ghost:hover { border-color: var(--ink-4); color: var(--text); }
.btn--small { padding: 10px 14px; font-size: .88rem; border-radius: 12px; }

/* ---------- The hook: signal ---------- */
.view--signal { padding: 64px 24px calc(28px + env(safe-area-inset-bottom)); background: radial-gradient(circle at 50% 35%, #17110d, var(--ink-0) 70%); }
.signal__brand { font: 600 .8rem/1 var(--mono); letter-spacing: .3em; color: var(--text-2); display: flex; justify-content: space-between; }
.signal__brand span:last-child { color: var(--signal); letter-spacing: .08em; font-weight: 500; }
.signal__text {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  font: 500 1.25rem/1.5 var(--mono); min-height: 180px; word-break: break-word;
}
.signal__text p { margin: 0; color: var(--text); transition: color .3s; }
.signal__text p.dim { color: var(--muted); }
.signal__wave { width: 100%; height: 90px; display: block; margin-bottom: 18px; }
.signal__readout { display: flex; justify-content: space-between; font: .74rem/1 var(--mono); color: var(--muted); margin-bottom: 10px; }
.signal__readout strong { color: var(--signal-2); font-weight: 500; }
.tuner { position: relative; height: 64px; touch-action: none; }
.tuner__scale {
  position: absolute; inset: 14px 0; border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, var(--ink-4) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, var(--muted) 0 1px, transparent 1px 60px),
    var(--ink-1);
  background-size: 100% 40%, 100% 70%, auto; background-position: bottom, bottom, 0 0; background-repeat: no-repeat;
  border: 1px solid var(--ink-3);
}
.tuner input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: grab; margin: 0; }
.tuner__needle {
  position: absolute; top: 4px; bottom: 4px; width: 3px; margin-left: -1.5px; border-radius: 2px;
  background: var(--signal); box-shadow: 0 0 14px var(--signal); pointer-events: none;
}
.signal__hint { text-align: center; font-size: .9rem; color: var(--text-2); margin: 16px 0 0; min-height: 1.4em; }
.view--signal.is-locked .tuner__needle { background: var(--ok); box-shadow: 0 0 18px var(--ok); }

/* ---------- Chat ---------- */
.view--chat { background: var(--ink-0); }
.chat__header {
  display: flex; align-items: center; gap: 12px;
  padding: calc(52px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: linear-gradient(var(--ink-1), rgba(18, 18, 20, .92));
  border-bottom: 1px solid var(--ink-2);
  position: relative; z-index: 2;
}
@media (max-width: 720px) { .chat__header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); } }
.chat__back { font-size: 1.8rem; line-height: 1; color: var(--signal); width: 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font: 600 .95rem/1 var(--mono);
  background: var(--ink-3); color: var(--text); border: 1px solid var(--ink-4);
}
.chat__who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat__who strong { font-weight: 600; font-size: 1rem; }
.chat__who span { font: .72rem/1.3 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__who span.is-live { color: var(--ok); }
.chat__who span.is-typing { color: var(--signal-2); }
.chat__lock { color: var(--muted); }
.chat__banner {
  font: .74rem/1.3 var(--mono); color: var(--text-2); text-align: center; padding: 8px 16px;
  background: var(--signal-ghost); border-bottom: 1px solid var(--signal-line);
}
.chat__banner strong { color: var(--signal-2); font-weight: 500; }
.chat__stream {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 14px 12px; display: flex; flex-direction: column; gap: 6px;
  scroll-behavior: smooth;
}
.chat__stream::-webkit-scrollbar { width: 0; }

.day {
  align-self: center; margin: 14px 0 6px;
  font: 500 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.sys {
  align-self: center; max-width: 88%; text-align: center; margin: 6px 0;
  font: .74rem/1.4 var(--mono); color: var(--text-2);
  padding: 6px 12px; border-radius: 10px; background: var(--ink-2); border: 1px solid var(--ink-3);
}
.sys--alarm { color: #ffb3b4; border-color: rgba(229, 56, 59, .45); background: rgba(229, 56, 59, .1); }
.sys--ok { color: #c7f0ca; border-color: rgba(143, 214, 148, .35); background: rgba(143, 214, 148, .08); }

.msg { display: flex; flex-direction: column; max-width: 80%; animation: pop .28s var(--ease) both; }
.msg + .msg.same { margin-top: -2px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.msg--in { align-self: flex-start; }
.msg--out { align-self: flex-end; align-items: flex-end; }
.msg__from { font: 500 .66rem/1 var(--mono); color: var(--muted); margin: 4px 0 4px 12px; letter-spacing: .04em; }
.bubble {
  padding: 9px 13px 7px; border-radius: 18px; font-size: .96rem; line-height: 1.4;
  overflow-wrap: anywhere;
}
.bubble time { display: block; text-align: right; font: .62rem/1 var(--mono); color: var(--muted); margin-top: 4px; }
.msg--in .bubble { background: var(--ink-2); border: 1px solid var(--ink-3); border-bottom-left-radius: 5px; }
.msg--out .bubble { background: var(--signal-ghost); border: 1px solid var(--signal-line); color: #ffeadf; border-bottom-right-radius: 5px; }
.msg--out .bubble time { color: #b9805e; }
.msg--history { opacity: .78; }
.msg--unknown .bubble {
  background: rgba(229, 56, 59, .1); border-color: rgba(229, 56, 59, .5); color: #ffd6d6;
  font-family: var(--mono); font-size: .9rem; text-shadow: 1px 0 rgba(255, 0, 60, .5), -1px 0 rgba(0, 200, 255, .3);
}
.msg--unknown .msg__from { color: var(--alarm); }
.msg--ellen .msg__from { color: var(--signal-2); }
.msg--deleted .bubble { font-style: italic; color: var(--muted); background: transparent; border-style: dashed; }
.msg--photo .bubble { padding: 4px; }
.msg--photo img { border-radius: 14px; cursor: zoom-in; width: 240px; aspect-ratio: 4/3; object-fit: cover; }
.msg--photo figcaption { font: .7rem/1.3 var(--mono); color: var(--muted); padding: 6px 8px 2px; }
.msg--hidden .bubble { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-ghost); }

.typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.taskcard {
  align-self: stretch; margin: 10px 0; padding: 12px 14px; border-radius: 14px;
  background: var(--ink-1); border: 1px solid var(--ink-3);
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: center;
}
.taskcard__num { grid-row: span 2; font: 600 .78rem/1 var(--mono); color: var(--signal); border: 1px solid var(--signal-line); border-radius: 8px; padding: 8px 7px; }
.taskcard__title { font-weight: 600; font-size: .92rem; }
.taskcard__meta { font: .7rem/1.3 var(--mono); color: var(--muted); }
.taskcard__check { grid-row: span 2; color: var(--ok); font-size: 1.2rem; }

/* Composer: choices and free text */
.chat__composer {
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ink-2); background: var(--ink-1);
  min-height: 62px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.chat__composer:empty::before { content: 'Kanaal is open'; font: .72rem/1 var(--mono); color: var(--ink-4); text-align: center; }
.choices { display: flex; flex-direction: column; gap: 8px; animation: pop .3s var(--ease) both; }
.choice {
  text-align: left; border: 1px solid var(--signal-line); background: var(--signal-ghost); color: #ffeadf;
  border-radius: 14px; padding: 11px 14px; font-size: .95rem; cursor: pointer; transition: background .2s, transform .15s;
}
.choice:hover { background: rgba(255, 106, 26, .22); }
.choice:active { transform: scale(.98); }
.choice--quiet { border-color: var(--ink-3); background: transparent; color: var(--text-2); }
.inputrow { display: flex; gap: 8px; animation: pop .3s var(--ease) both; }
.inputrow input {
  flex: 1; min-width: 0; border: 1px solid var(--ink-3); background: var(--ink-0); color: var(--text);
  border-radius: 22px; padding: 11px 16px; font-size: 1rem; outline: none; transition: border-color .2s;
}
.inputrow input:focus { border-color: var(--signal-line); }
.send {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--signal); color: #1a0b03; display: grid; place-items: center;
}
.send:disabled { background: var(--ink-3); color: var(--muted); }

/* ---------- Task sheet ---------- */
.sheet {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: rgba(5, 5, 6, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade .3s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }
.sheet__panel {
  background: var(--ink-1); border-top: 1px solid var(--ink-3); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 92%; overflow-y: auto;
  animation: rise .45s var(--ease) both;
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--ink-4); margin: 0 auto 14px; }
.sheet__label { font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--signal); margin: 0 0 6px; }
.sheet__title { font-size: 1.35rem; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
.sheet__quote { color: var(--text-2); margin: 0 0 16px; font-size: .95rem; }
.sheet__note {
  font: .72rem/1.45 var(--mono); color: var(--muted); border-left: 2px solid var(--ink-4); padding: 2px 0 2px 10px; margin: 14px 0;
}
.sheet__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.sheet__feedback { min-height: 1.4em; text-align: center; font-size: .92rem; color: var(--text-2); margin: 10px 0 0; }
.sheet__feedback.is-bad { color: #ffb3b4; }
.sheet__feedback.is-good { color: var(--ok); }

/* Task 1: connection */
.netstatus { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.netstatus div { border: 1px solid var(--ink-3); border-radius: 14px; padding: 12px; background: var(--ink-0); }
.netstatus b { display: block; font: 500 .68rem/1 var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px; }
.netstatus span { font: 500 .95rem/1 var(--mono); display: inline-flex; align-items: center; gap: 8px; }
.netstatus span::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--alarm); box-shadow: 0 0 10px var(--alarm); }
.netstatus span.is-off::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.watchers { font: .78rem/1.4 var(--mono); color: #ffb3b4; margin: 10px 0 0; display: flex; align-items: center; gap: 8px; }
.watchers::before { content: '●'; animation: blink 1s infinite; }
.hold {
  position: relative; width: 132px; height: 132px; margin: 8px auto 0; border-radius: 50%;
  display: grid; place-items: center; text-align: center; font-size: .82rem; color: var(--text-2);
  border: 1px dashed var(--ink-4); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
}
.hold svg { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); }
.hold.is-holding { border-color: var(--signal-line); color: var(--text); }
.reveal { animation: fade .8s var(--ease) both; }
.reveal__photo { border-radius: 14px; overflow: hidden; border: 1px solid var(--ink-3); margin: 10px 0; position: relative; }
.reveal__photo img { width: 100%; aspect-ratio: 4/3.2; object-fit: cover; object-position: center 20%; }
.reveal__text { font-family: var(--mono); font-size: .92rem; line-height: 1.55; color: var(--paper); background: #18140f; border: 1px solid #3a3023; border-radius: 12px; padding: 12px 14px; }
.reveal__text small { display: block; color: #a48d6c; margin-top: 8px; font-size: .7rem; }
.sheet--dark { background: rgba(0, 0, 0, .85); }
.sheet--dark .sheet__panel { background: #070708; border-color: #1a1a1c; }

/* Task 2: dial lock */
.lock { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lock__slots { display: flex; gap: 10px; }
.lock__slots span {
  width: 46px; height: 56px; border-radius: 12px; display: grid; place-items: center;
  font: 500 1.6rem/1 var(--mono); background: var(--ink-0); border: 1px solid var(--ink-3); color: var(--text);
  transition: border-color .2s, transform .2s;
}
.lock__slots span.is-current { border-color: var(--signal-line); box-shadow: 0 0 0 3px var(--signal-ghost); }
.lock__slots span.is-filled { border-color: var(--ink-4); }
.lock.is-wrong .lock__slots { animation: shake .45s; }
.lock.is-open .lock__slots span { border-color: rgba(143, 214, 148, .6); color: var(--ok); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.dial { width: 260px; height: 260px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.dial:active { cursor: grabbing; }
.dial__face { transition: none; }
.dial__digit { font: 500 22px var(--mono); fill: var(--text-2); }
.dial__digit.is-active { fill: var(--signal); }
.lock__mode { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.codeinput { display: flex; gap: 8px; justify-content: center; }
.codeinput input {
  width: 160px; text-align: center; letter-spacing: .5em; font: 500 1.4rem/1 var(--mono);
  background: var(--ink-0); border: 1px solid var(--ink-3); color: var(--text); border-radius: 12px; padding: 10px;
}

/* Task 3: draw the sign */
.draw { position: relative; width: 100%; max-width: 320px; margin: 0 auto; aspect-ratio: 1; }
.draw canvas {
  width: 100%; height: 100%; border-radius: 18px; touch-action: none; display: block;
  background: radial-gradient(circle at 50% 40%, #2a1d1a, #120d0c 75%); border: 1px solid #3a2a24; cursor: crosshair;
}
.draw__guide { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; }
.draw__guide.is-visible { opacity: .18; }
.draw__hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font: .74rem/1 var(--mono); color: #8f7a70; pointer-events: none; }
.symbols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.symbols button { aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--ink-3); background: var(--ink-0); cursor: pointer; display: grid; place-items: center; }
.symbols button:hover { border-color: var(--signal-line); }
.symbols svg { width: 60%; height: 60%; }

/* ---------- Lightbox, glitch, end card ---------- */
.lightbox { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; animation: fade .25s both; }
.lightbox img { max-height: 90%; border-radius: 10px; }
.glitch-layer { position: absolute; inset: 0; z-index: 25; pointer-events: none; opacity: 0; mix-blend-mode: screen; }
.screen.is-glitching .glitch-layer {
  opacity: 1;
  background: repeating-linear-gradient(0deg, rgba(255, 0, 60, .12) 0 2px, transparent 2px 5px);
  animation: glitch-bars .12s steps(2) infinite;
}
.screen.is-glitching .view.is-active { animation: glitch-shift .18s steps(2) infinite; }
@keyframes glitch-bars { 50% { transform: translateY(3px); } }
@keyframes glitch-shift {
  0% { transform: translate(0); filter: none; }
  33% { transform: translate(-3px, 1px); filter: hue-rotate(-30deg) saturate(2); }
  66% { transform: translate(3px, -1px); filter: hue-rotate(30deg); }
}
/* The interface slowly gets darker as the story goes on (spelverloop.md §6) */
.screen.phase-2 { --ink-0: #09090a; --signal-ghost: rgba(255, 90, 40, .12); }
.screen.phase-3 { --ink-0: #060606; --ink-1: #0d0c0d; --ink-2: #161416; --signal: #ff4d2e; --signal-line: rgba(255, 77, 46, .4); }
.screen.phase-3 .chat__stream { background: radial-gradient(circle at 50% 100%, rgba(229, 56, 59, .06), transparent 60%); }

.endcard {
  position: absolute; inset: 0; z-index: 15; overflow-y: auto;
  background: rgba(6, 6, 7, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 64px 24px calc(28px + env(safe-area-inset-bottom)); animation: fade .8s both;
}
.endcard__label { font: 500 .7rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--signal); margin: 0 0 12px; }
.endcard h2 { font-size: 1.6rem; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
.endcard p { color: var(--text-2); margin: 0 0 14px; font-size: .95rem; }
.endcard ul { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.endcard li { border: 1px solid var(--ink-3); border-radius: 14px; padding: 12px 14px; background: var(--ink-1); font-size: .88rem; color: var(--text-2); }
.endcard li b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.endcard__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.endcard__stats div { text-align: center; border: 1px solid var(--ink-3); border-radius: 12px; padding: 10px 4px; }
.endcard__stats strong { display: block; font: 600 1.25rem/1.2 var(--mono); color: var(--signal-2); }
.endcard__stats span { font: .64rem/1.2 var(--mono); color: var(--muted); }
.endcard .btn { margin-top: 8px; width: 100%; }

/* ---------- Backstage panel ---------- */
.backstage {
  width: 380px; height: min(844px, calc(100vh - 90px)); flex: none;
  display: none; flex-direction: column; gap: 14px;
  background: rgba(14, 14, 16, .92); border: 1px solid var(--ink-2); border-radius: 22px;
  padding: 18px; overflow: hidden;
}
body.show-backstage .backstage { display: flex; }
.backstage__head { display: flex; align-items: center; justify-content: space-between; }
.backstage h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.backstage h3 { margin: 0 0 6px; font-size: .86rem; font-weight: 600; }
.backstage__close { border: 0; background: none; font-size: 1.4rem; color: var(--muted); cursor: pointer; display: none; }
.backstage__intro { margin: 0; font-size: .82rem; color: var(--muted); }
.backstage__log { list-style: none; margin: 0; padding: 0 4px 0 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.backstage__log::-webkit-scrollbar { width: 4px; } .backstage__log::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 2px; }
.logitem { border: 1px solid var(--ink-2); border-radius: 12px; padding: 9px 11px; background: var(--ink-0); animation: pop .3s var(--ease) both; }
.logitem__top { display: flex; align-items: center; gap: 8px; font: .66rem/1 var(--mono); color: var(--muted); margin-bottom: 5px; }
.tag { padding: 3px 6px; border-radius: 5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 500; }
.tag--verhaal { background: rgba(236, 228, 211, .1); color: var(--paper); }
.tag--ai { background: rgba(255, 106, 26, .15); color: var(--signal-2); }
.tag--sensor { background: rgba(110, 170, 255, .14); color: #a9c8ff; }
.tag--privacy { background: rgba(143, 214, 148, .12); color: var(--ok); }
.tag--illusie { background: rgba(200, 140, 255, .13); color: #d9b8ff; }
.logitem__title { font-size: .84rem; font-weight: 600; }
.logitem__detail { font-size: .78rem; color: var(--text-2); margin-top: 2px; }
.logitem code, .model-result code { font: .74rem var(--mono); color: var(--signal-2); }
.backstage__model { border-top: 1px solid var(--ink-2); padding-top: 12px; }
.backstage__model input {
  width: 100%; margin-top: 6px; border: 1px solid var(--ink-3); background: var(--ink-0); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: .9rem; outline: none;
}
.backstage__model input:focus { border-color: var(--signal-line); }
.model-result { margin-top: 8px; font-size: .78rem; color: var(--text-2); min-height: 20px; }
.bars { display: grid; grid-template-columns: 62px 1fr 38px; gap: 4px 8px; align-items: center; margin-top: 6px; font: .7rem var(--mono); }
.bars i { display: block; height: 6px; border-radius: 3px; background: var(--ink-3); position: relative; overflow: hidden; }
.bars i::after { content: ''; position: absolute; inset: 0; width: var(--v); background: var(--c, var(--signal)); border-radius: 3px; transition: width .3s var(--ease); }
.verdict { display: inline-block; font: 500 .7rem var(--mono); padding: 3px 7px; border-radius: 5px; margin-right: 6px; }
.verdict--accept { background: rgba(143, 214, 148, .14); color: var(--ok); }
.verdict--confirm { background: rgba(255, 200, 80, .14); color: #ffd27a; }
.verdict--reject { background: rgba(229, 56, 59, .14); color: #ffb3b4; }
.backstage__controls { display: none; gap: 6px; flex-wrap: wrap; }
.backstage__pwa { border-top: 1px solid var(--ink-2); padding-top: 12px; }
.backstage__pwa .pill:disabled { opacity: .4; cursor: default; }
.backstage__pwa p { margin: 4px 0 8px; }
.backstage__pwa b { color: var(--text); font-weight: 500; }

/* Install instructions and push steps */
.benefits { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--text-2); }
.benefits li { display: flex; gap: 8px; }
.benefits li::before { content: '✓'; color: var(--ok); }
.steps { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ink-3); border-radius: 14px; background: var(--ink-0); font-size: .92rem; color: var(--text-2); }
.steps li b { color: var(--text); font-weight: 600; }
.steps__icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ink-2); color: var(--signal-2); font: 600 .9rem var(--mono); }

/* Hand-off to the phone (laptop / desktop only) */
.handoff {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(800px 500px at 50% 30%, rgba(255, 106, 26, .08), transparent 60%), #060607;
}
.handoff__inner { max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.handoff .landing__kicker { justify-content: center; }
.handoff h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; }
.handoff__lead { color: var(--text-2); margin: 0 0 26px; }
.handoff__qr { background: #fff; padding: 14px; border-radius: 18px; line-height: 0; box-shadow: 0 20px 60px rgba(255, 106, 26, .15); }
.handoff__qr svg { width: 220px; height: 220px; }
.handoff__qr:empty { display: none; }
.handoff__url { font: 500 .9rem/1.4 var(--mono); color: var(--signal-2); margin: 16px 0 4px; word-break: break-all; }
.handoff__tip { font-size: .82rem; color: var(--muted); margin: 0 0 22px; max-width: 400px; }
.handoff__tip code { font: .78rem var(--mono); color: var(--text-2); }

@media (max-width: 1100px) and (min-width: 721px) {
  body.show-backstage .backstage { position: fixed; right: 16px; top: 56px; bottom: 16px; height: auto; z-index: 40; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
}
@media (max-width: 720px) {
  .backstage { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; z-index: 60; padding-top: calc(18px + env(safe-area-inset-top)); background: var(--ink-1); overflow-y: auto; }
  .backstage__log { flex: none; max-height: 45vh; }
  .backstage__close { display: block; }
  .backstage__controls { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
