:root {
  --ink: #14213d;
  --soft: #55607a;
  --line: rgba(20, 33, 61, 0.1);
  --accent: #ea580c;
  --accent-bg: rgba(234, 88, 12, 0.12);
  --new-bg: rgba(34, 197, 94, 0.2);
  --new-ink: #14532d;
  --warn-bg: rgba(245, 158, 11, 0.24);
  --warn-ink: #92400e;
  --live: #dc2626;
  --bezel: #0b1220;
  /* the glass: a see-through white pane with a bright edge and a blur behind it */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --edge: rgba(255, 255, 255, 0.8);
  --blur: blur(22px) saturate(170%);
  --lift: 0 10px 30px rgba(20, 33, 61, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(255, 255, 255, 0.3);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100dvh; padding: 24px;
  display: flex; align-items: center; justify-content: center; gap: 64px;
  background:
    radial-gradient(900px 560px at 88% 0, #ffd9b8 0, transparent 70%),
    radial-gradient(900px 560px at 8% 100%, #cdeedd 0, transparent 70%),
    radial-gradient(700px 500px at 50% 50%, #dbe6ff 0, transparent 70%),
    #eceff5;
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Devanagari", "Noto Sans Gurmukhi", "Noto Sans Bengali", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.logo { width: 36px; height: 36px; flex: none; border-radius: 28%; box-shadow: 0 4px 12px rgba(20, 33, 61, 0.3); }

/* what sits beside the phone on a wide screen */
.stage { max-width: 340px; }
.stage .logo { width: 52px; height: 52px; }
.stagename { margin: 16px 0 4px; font-size: 36px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stagetag { margin: 0; font-size: 18px; color: var(--soft); }
.steps { list-style: none; margin: 28px 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.steps li { position: relative; padding-inline-start: 42px; color: var(--soft); counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--glass-strong); border: 1px solid var(--edge); color: var(--accent); font-weight: 700;
  box-shadow: var(--lift);
}
.steps strong { display: block; color: var(--ink); }
.about { margin: 0; font-size: 12px; color: var(--soft); }

/* the phone and its screen */
.phone {
  position: relative; flex: none; width: 400px; height: min(850px, calc(100dvh - 48px)); padding: 12px;
  border-radius: 56px; background: var(--bezel);
  box-shadow: 0 0 0 2px #2a3550, 0 40px 80px rgba(20, 33, 61, 0.35);
}
.phone::before { /* the camera cut-out */
  content: ""; position: absolute; top: 24px; left: 50%; z-index: 9; width: 100px; height: 28px;
  transform: translateX(-50%); border-radius: 999px; background: var(--bezel);
}
.screen {
  position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; border-radius: 44px;
  background: linear-gradient(165deg, #fff3e6 0%, #eef2fb 48%, #e6f6ee 100%);
}
.screen::after { /* the home bar */
  content: ""; position: absolute; bottom: 8px; left: 50%; z-index: 9; width: 124px; height: 4px;
  transform: translateX(-50%); border-radius: 2px; background: var(--bezel);
}
/* soft colour drifting behind the glass, which is what the glass blurs */
.glow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.glow::before, .glow::after, .glow i { content: ""; position: absolute; width: 90%; aspect-ratio: 1; border-radius: 50%; animation: drift 16s ease-in-out infinite alternate; }
.glow::before { top: -18%; left: -30%; background: radial-gradient(circle, rgba(255, 150, 60, 0.6) 0, transparent 65%); }
.glow::after { bottom: 2%; right: -40%; background: radial-gradient(circle, rgba(70, 150, 255, 0.45) 0, transparent 65%); animation-delay: -8s; }
.glow i { top: 34%; left: -25%; background: radial-gradient(circle, rgba(60, 200, 130, 0.4) 0, transparent 65%); animation-delay: -4s; }
@keyframes drift { to { transform: translate(22%, 14%) scale(1.15); } }

/* everything in the app sits above the colour, and fades in after sign-in */
.appbar, .notice, .pages, .dock, .tabs { position: relative; z-index: 1; transition: opacity 0.5s ease 0.15s, transform 0.5s ease 0.15s; }
.instant > * { transition: none; }
.signedout > .appbar, .signedout > .notice, .signedout > .pages, .signedout > .dock, .signedout > .tabs { opacity: 0; transform: translateY(14px); pointer-events: none; }

/* the glass panes */
.appbar, .tabs, .logincard, .welcome, .noted, .box, .person, .says, .turn, #typeBox, button, .lang, .logincard input {
  background: var(--glass); border: 1px solid var(--edge);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--lift);
}

/* sign-in */
.login {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 60px 22px 30px; overflow-y: auto; scrollbar-width: none; text-align: center; transition: opacity 0.45s ease, transform 0.45s ease;
}
.login::-webkit-scrollbar { display: none; }
/* Centred when there is room. On a short screen it starts below the camera cut-out and scrolls. */
.login > :first-child { margin-top: auto; }
.login > :last-child { margin-bottom: auto; }
.login.gone { opacity: 0; transform: translateY(-18px) scale(1.04); pointer-events: none; }
.login > .logo { width: 56px; height: 56px; flex: none; }
.loginname { margin: 8px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.logintag { margin: 0 0 12px; color: var(--soft); }
.logincard { flex: none; width: 100%; display: grid; gap: 10px; padding: 18px; border-radius: 28px; text-align: start; }
.logincard h2 { margin: 0; }
.logincard label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--soft); }
.logincard input, .logincard .lang { width: 100%; max-width: none; padding: 10px 14px; border-radius: 14px; font: inherit; color: var(--ink); }
.logincard .hint { margin: 0; text-align: center; }
.loginabout { margin: 10px 8px 0; font-size: 12px; color: var(--soft); }

.appbar { flex: none; padding: 52px 16px 10px; border-width: 0 0 1px; border-radius: 0; }
.barrow { display: flex; align-items: center; gap: 10px; }
.title { flex: 1; min-width: 0; }
h1 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
.appbar .enumerator { margin: 0; font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .enumerator:empty { display: none; }
.lang { max-width: 112px; padding: 7px 10px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); }
.iconbtn { flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .iconbtn svg { transform: scaleX(-1); }
.meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.track { flex: 1; height: 6px; border-radius: 3px; background: rgba(20, 33, 61, 0.1); overflow: hidden; }
.track span { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #34d399, #16a34a); transition: width 0.5s; }
.notice { flex: none; margin: 8px 12px 0; padding: 8px 12px; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 14px; font-size: 12.5px; line-height: 1.4; cursor: pointer; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.notice::after { content: "  " attr(data-hide); font-weight: 600; white-space: pre; }

/* one page shows at a time, and slides in from the side it lies on */
.pages { flex: 1; min-height: 0; }
.page { height: 100%; overflow-y: auto; padding: 14px 14px 10px; animation: slidein 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }
.pages[data-dir="back"] .page { animation-name: slideback; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideback { from { opacity: 0; transform: translateX(-30px); } }
/* like a phone app, pages scroll without a visible scrollbar */
.page, .heard, .noted, .welcome { scrollbar-width: none; }
.page::-webkit-scrollbar, .heard::-webkit-scrollbar, .noted::-webkit-scrollbar, .welcome::-webkit-scrollbar { display: none; }
h2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; }
.badge { padding: 2px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge:empty { display: none; }
.empty { color: var(--soft); margin: 0; padding: 10px 0; }
.hint { color: var(--soft); font-size: 13px; margin: -4px 0 12px; }
.box { padding: 2px 14px; border-radius: 20px; }

/* Talk: the conversation as chat bubbles, with the typing box under it */
.page.talk { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.heard { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.welcome { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: auto 0; padding: 16px; border-radius: 22px; color: var(--soft); font-size: 13px; }
.welcome p { margin: 0 0 8px; }
.welcome > p:last-child { margin: 0; }
.welcomehead { color: var(--ink); font-size: 17px; font-weight: 700; }
.say { padding: 9px 12px; border-radius: 14px; background: var(--accent-bg); color: var(--ink); font-size: 14px; }
.turn { margin: 0; max-width: 88%; padding: 8px 12px; border-radius: 18px; }
.turn small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.turn.enumerator { align-self: flex-start; border-end-start-radius: 5px; }
.turn.family { align-self: flex-end; background: rgba(255, 205, 165, 0.55); border-end-end-radius: 5px; }
.turn.family small { color: var(--accent); }
.turn.raw { max-width: none; background: rgba(255, 255, 255, 0.3); border-style: dashed; border-color: rgba(20, 33, 61, 0.2); box-shadow: none; color: var(--soft); }
.turn.note { align-self: center; max-width: none; padding: 5px 14px; background: var(--new-bg); color: var(--new-ink); font-size: 13px; font-weight: 600; text-align: center; }
/* what the latest stretch of talk put on the sheet */
.noted { flex: none; max-height: 130px; overflow-y: auto; padding: 8px 10px 2px; border-radius: 18px; }
.noted::before { content: attr(data-title); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--new-ink); }
.noted strong { margin-inline-end: 6px; font-size: 13px; }
/* on the Talk page, the next question to ask */
.next { flex: none; display: block; width: 100%; padding: 10px 14px; border-radius: 18px; background: rgba(20, 33, 61, 0.74); border-color: rgba(255, 255, 255, 0.2); color: #fff; text-align: start; box-shadow: 0 10px 26px rgba(20, 33, 61, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.next small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.7; }
.next span { font-size: 15px; }

form { flex: none; display: flex; gap: 8px; }
#typeBox { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 16px; font: inherit; color: var(--ink); }
button { font: inherit; font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 16px; color: var(--ink); cursor: pointer; transition: transform 0.15s ease, background 0.2s; }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.6; cursor: wait; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#demoBtn { flex: none; background: rgba(255, 205, 165, 0.6); color: #b4410a; }
#readBtn, #printBtn, #nextBtn, #finishBtn, #toSheet, .logincard .primary { width: 100%; margin-top: 10px; padding: 13px 16px; border-radius: 18px; }
.primary {
  background: linear-gradient(180deg, #2a3f6e, #14213d); border-color: rgba(255, 255, 255, 0.18); color: #fff;
  box-shadow: 0 10px 24px rgba(20, 33, 61, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.says { border-radius: 16px; padding: 12px; margin: 10px 0 0; }

.askrow { border-top: 1px solid var(--line); }
.askrow:first-child { border-top: 0; }
.askrow summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; cursor: pointer; list-style: none; }
.askrow summary::-webkit-details-marker { display: none; }
.ask { display: grid; grid-template-columns: 38px 1fr; gap: 0 8px; margin: 0 0 10px; }
.ask .qno { grid-row: span 2; align-self: start; padding: 2px 0; border-radius: 8px; background: rgba(20, 33, 61, 0.07); color: var(--soft); font-size: 11px; font-weight: 700; text-align: center; }
.ask small { color: var(--soft); font-size: 12px; }

/* one fold-away card per person */
.person { margin-bottom: 10px; border-radius: 20px; }
.person summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.person summary::-webkit-details-marker { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #ffd3ad, #ffb37a); color: #9a3412; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.who strong { display: block; line-height: 1.3; }
.who span { color: var(--soft); font-size: 13px; }
.count { padding: 3px 10px; border-radius: 999px; background: rgba(20, 33, 61, 0.07); color: var(--soft); font-size: 12px; font-weight: 700; white-space: nowrap; }
.count.full { background: var(--new-bg); color: var(--new-ink); }
.freshline { grid-column: 1 / -1; }
.person[open] .freshline { display: none; }
.fields { padding: 0 14px 12px; border-top: 1px solid var(--line); }
.person h4 { margin: 12px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--soft); }
.chip {
  display: inline-block; font-size: 13px; font-weight: 400; padding: 5px 10px; margin: 0 0 6px; margin-inline-end: 6px; border-radius: 12px;
  background: transparent; border: 1px dashed rgba(20, 33, 61, 0.25); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--soft); text-align: start;
}
.chip.on { border: 1px solid rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.chip b { font-weight: 600; }
.chip.new { background: var(--new-bg); color: var(--new-ink); animation: pop 0.5s; }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
@keyframes pop { from { transform: scale(0.9); opacity: 0.3; } }
.remove { display: block; margin-top: 6px; padding: 4px 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--soft); font-size: 12px; font-weight: 400; text-decoration: underline; }
.edit { font: inherit; font-size: 13px; padding: 5px 10px; margin: 0 0 6px; margin-inline-end: 6px; border: 2px solid var(--accent); border-radius: 12px; max-width: 100%; background: #fff; }

/* the mic, on every page: a button on its own, with a line of text beside it only when needed */
.dock { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin: 2px 14px 10px; }
.mic {
  --level: 0;
  grid-column: 2; width: 66px; height: 66px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #ffa24d, #ea580c); color: #fff; -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.55), inset 0 -3px 6px rgba(140, 40, 0, 0.25);
}
.mic svg { width: 30px; height: 30px; }
/* While listening the mic is red, and the ring around it grows with the voice.
   The ring is grey for sound too soft to use and green once it counts as speech. */
.mic.on {
  background: linear-gradient(145deg, #ff8a8a, var(--live));
  box-shadow: 0 0 0 calc(5px + var(--level) * 13px) rgba(85, 96, 122, 0.22), 0 8px 18px rgba(220, 38, 38, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.55);
  transition: box-shadow 0.1s linear;
}
.mic.on.heard { box-shadow: 0 0 0 calc(5px + var(--level) * 13px) rgba(22, 163, 74, 0.35), 0 8px 18px rgba(220, 38, 38, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.55); }
.status { grid-column: 1; margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--accent); text-align: end; }
.faint { grid-column: 3; margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--warn-ink); }

/* the page switcher: a floating glass pill */
.tabs { flex: none; display: flex; gap: 4px; margin: 0 12px 22px; padding: 5px; border-radius: 30px; background: var(--glass-strong); }
.tabs button {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; border-radius: 24px;
  background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--soft); font-size: 11px;
}
.tabs button > span:first-of-type { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button.on { background: rgba(255, 255, 255, 0.85); color: var(--accent); box-shadow: 0 4px 12px rgba(20, 33, 61, 0.1), inset 0 1px 0 #fff; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs .badge { position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); padding: 0 6px; background: var(--accent); color: #fff; font-size: 11px; line-height: 17px; }

#qr { margin: 4px 0 12px; text-align: center; }
#qr img { max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 16px; }

@media (prefers-reduced-motion: reduce) {
  .glow::before, .glow::after, .glow i, .page { animation: none; }
  .login, .appbar, .notice, .pages, .dock, .tabs { transition: none; }
}
@media (max-width: 900px) {
  .stage { display: none; }
}
/* on a real phone the app is the whole screen and the drawn phone goes away */
@media (max-width: 520px) {
  body { display: block; padding: 0; }
  .phone { width: 100%; height: 100dvh; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .phone::before, .screen::after { display: none; }
  .screen { border-radius: 0; }
  .appbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .login { padding-top: max(24px, env(safe-area-inset-top)); }
  .tabs { margin-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media print {
  .stage, .glow, .login, .appbar, .notice, .dock, .tabs, .page:not(.share), #printBtn, #nextBtn, #shareNote, .phone::before, .screen::after { display: none !important; }
  body { display: block; padding: 0; background: #fff; }
  .phone { width: auto; height: auto; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .screen, .pages, .page { display: block; height: auto; overflow: visible; border-radius: 0; background: #fff; animation: none; }
  .person, .chip.on { background: #fff; border: 1px solid #d0d5dd; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
