/* Bot Moods for iPhone. Same tokens as the Mac window (resources/botmoods-v3.html): system blue,
   grouped gray, gray incoming bubbles, the face as the only brand mark. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, .12);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --teal: #30b0c7;
  --pink: #ff2d55;
  --gray: #8e8e93;
  --bg: #ffffff;
  --grouped: #f2f2f7;
  --card: #ffffff;
  --label: rgba(0, 0, 0, .88);
  --label2: rgba(60, 60, 67, .62);
  --label3: rgba(60, 60, 67, .32);
  --sep: rgba(60, 60, 67, .16);
  --fill: rgba(120, 120, 128, .12);
  --fill2: rgba(120, 120, 128, .2);
  --bubble-in: #e9e9eb;
  --bar: #f9f9fb;
  --btn-gray: #ececf0;
  --btn-red: #ffe7e5;
  --sheet: #ffffff;
  --scrim: rgba(0, 0, 0, .32);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .06);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --tabh: 50px;
  --toph: 52px;
  --dock: 0px;
  --kb: 0px;
  color-scheme: light;
}
body.dark {
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, .2);
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --teal: #40c8e0;
  --pink: #ff375f;
  --gray: #98989d;
  --bg: #000000;
  --grouped: #000000;
  --card: #1c1c1e;
  --label: rgba(255, 255, 255, .92);
  --label2: rgba(235, 235, 245, .6);
  --label3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .6);
  --fill: rgba(120, 120, 128, .24);
  --fill2: rgba(120, 120, 128, .36);
  --bubble-in: #262628;
  --bar: #141416;
  --btn-gray: #2c2c2e;
  --btn-red: #3b1f1d;
  --sheet: #1c1c1e;
  --scrim: rgba(0, 0, 0, .55);
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  body:not(.light) {
    --accent: #0a84ff; --bg: #000; --grouped: #000; --card: #1c1c1e; --label: rgba(255,255,255,.92);
    --label2: rgba(235,235,245,.6); --sep: rgba(84,84,88,.6); --bubble-in: #262628; --bar: #141416; --btn-gray: #2c2c2e; --btn-red: #3b1f1d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.32;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
p, h1, h2, h4, ul, ol, dl, dd { margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
#root { height: 100%; }
.sym { width: 22px; height: 22px; display: block; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* MARK: frame */

.app { position: fixed; inset: 0; display: block; background: var(--bg); }
.app.mode-tab, .app.mode-pair, .app.mode-live { background: var(--grouped); }
.top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding-top: var(--sat);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
}
.app.mode-chat .top { background: var(--bg); }
.app.mode-tab .top, .app.mode-pair .top { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; transition: background .2s; }
.app.mode-tab.scrolled .top, .app.mode-pair.scrolled .top { background: var(--bar); border-bottom-color: var(--sep); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.bar {
  height: var(--toph);
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto minmax(64px, 1fr);
  align-items: center;
  padding: 0 8px;
}
.bar-title {
  font-size: 17px;
  font-weight: 600;
  max-width: 62vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .18s;
}
.bar-title.on, .scrolled .bar-title { opacity: 1; }
.link {
  color: var(--accent);
  font-size: 17px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
}
.link.left { justify-self: start; }
.link.right { justify-self: end; }
.link .sym { width: 20px; height: 20px; margin-left: -4px; }
.link:active { opacity: .4; }

.chat-bar { display: flex; gap: 8px; padding: 0 4px; }
.round.menu, .round.compose { color: var(--accent); }
.round.menu .sym, .round.compose .sym { width: 24px; height: 24px; }
.me { position: relative; flex: none; }
.me .dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--bg); width: 12px; height: 12px; }
.who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.who b { font-size: 16px; font-weight: 600; line-height: 1.2; }
.who small { font-size: 12.5px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex: none;
}
.round.stop { color: var(--red); }
.round.stop .sym { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: color-mix(in srgb, var(--red) 14%, transparent); }
.round:active { opacity: .5; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.dot.on { background: var(--green); }
.dot.busy { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.dot.off { background: var(--label3); }

.face { border-radius: 50%; object-fit: cover; flex: none; background: #1b1b1b; }
.face.sm { width: 32px; height: 32px; }
.face.md { width: 52px; height: 52px; }
.face.lg { width: 76px; height: 76px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.msg .face.sm { width: 26px; height: 26px; }

.scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-top: calc(var(--toph) + var(--sat));
  padding-bottom: calc(var(--tabh) + var(--sab) + 24px);
}
.mode-chat .scroll { padding-bottom: calc(var(--tabh) + var(--sab) + var(--dock) + 8px); }
.mode-live .scroll { padding-bottom: calc(var(--sab) + var(--dock) + 24px); }
.mode-pair .scroll { padding-bottom: calc(var(--sab) + 32px); }
.kb.mode-chat .scroll { padding-bottom: calc(var(--kb) + var(--dock) + 8px); }

/* MARK: tab bar */

.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  height: calc(var(--tabh) + var(--sab));
  padding: 0 4px var(--sab);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.mode-pair .tabbar, .mode-live .tabbar, .kb .tabbar { display: none; }
.tabbar button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--gray);
  font-size: 10.5px;
  font-weight: 500;
}
.tabbar button .sym { width: 26px; height: 26px; }
.tabbar button.on { color: var(--accent); }
.tabbar button:active { opacity: .5; }
.tabbar .count {
  position: absolute;
  top: 3px;
  left: calc(50% + 7px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-style: normal;
  line-height: 18px;
  text-align: center;
}

/* MARK: chat */

.thread { padding: 12px 12px 4px; display: flex; flex-direction: column; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msg + .msg { margin-top: 3px; }
.msg.first { margin-top: 14px; }
.thread > .msg:first-child { margin-top: 0; }
.msg.out { justify-content: flex-end; padding-left: 48px; }
.msg.in { padding-right: 28px; }
.face-gap { width: 26px; flex: none; }
.bubble {
  min-width: 0;
  max-width: 100%;
  padding: 8px 13px;
  border-radius: 19px;
  font-size: 16.5px;
  line-height: 1.36;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}
.msg.out .bubble { background: var(--accent); color: #fff; }
.msg.out.last .bubble { border-bottom-right-radius: 6px; }
.msg.in .bubble { background: var(--bubble-in); color: var(--label); }
.msg.in.last .bubble { border-bottom-left-radius: 6px; }
.msg.last .bubble { position: relative; }
.msg.last .bubble::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-bottom: 9px solid transparent;
}
.msg.in.last .bubble::after { left: -6px; border-right: 8px solid var(--bubble-in); }
.msg.out.last .bubble::after { right: -6px; border-left: 8px solid var(--accent); }
.stamp {
  display: block;
  margin: 3px 8px 8px 46px;
  color: var(--label2);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.msg.out + .stamp { margin-left: 48px; margin-right: 8px; text-align: right; }
.msg.pending .bubble { opacity: .7; }
.bubble p { white-space: pre-wrap; }
.md p { white-space: normal; }
.md > * + * { margin-top: 8px; }
.md h4 { font-size: 16.5px; font-weight: 700; margin-top: 12px; }
.md h4:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 22px; }
.md li + li { margin-top: 3px; }
.md li::marker { color: var(--label2); }
.md strong { font-weight: 650; }
.md a { color: var(--accent); text-decoration: none; word-break: break-all; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--fill); border-radius: 5px; padding: 1px 4px; }
.md pre { background: var(--fill); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 13px; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--label3); padding-left: 10px; color: var(--label2); }
.md hr { border: 0; border-top: .5px solid var(--sep); }
.photo { border-radius: 12px; margin-top: 6px; }
.typing { display: flex; gap: 5px; align-items: center; height: 38px; padding: 0 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--label2); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }

/* Welcome: a greeting, four starters that send a real request, and the chats to pick up again. */
.hello { padding: max(4vh, 20px) 16px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hello-face { position: relative; }
.hello-face::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent); }
.hello-face .face { position: relative; }
.hello h2 { font-size: 27px; font-weight: 700; letter-spacing: -.01em; margin-top: 18px; text-wrap: balance; }
.hello > p { color: var(--label2); font-size: 15.5px; margin-top: 6px; max-width: 30ch; text-wrap: balance; }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 26px; width: 100%; max-width: 420px; }
.starters button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 108px;
  padding: 14px;
  border-radius: 18px;
  background: var(--grouped);
  text-align: left;
}
body.dark .starters button { background: var(--card); }
.starters .tile { margin-bottom: 10px; }
.starters b { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.starters small { font-size: 13px; color: var(--label2); line-height: 1.3; }
.starters button:active { transform: scale(.97); opacity: .8; }
.hello .section { align-self: stretch; margin: 28px 4px 8px; text-align: left; max-width: 420px; width: 100%; margin-inline: auto; }
.hello .recent { margin: 0; width: 100%; max-width: 420px; background: var(--grouped); text-align: left; }
body.dark .hello .recent { background: var(--card); }
.recent .chat-row { border-radius: 0; padding: 12px 14px; position: relative; }
.recent .chat-row + .chat-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid var(--sep); }
.opening { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22vh 32px 0; text-align: center; }
.opening .spin { width: 26px; height: 26px; margin: 0 0 10px; }
.opening b { font-size: 17px; }
.opening small { color: var(--label2); font-size: 14px; }
.chat-title { margin: 12px 40px 0; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--label2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-wrap: balance; }

/* The dock sits above the tab bar (or the keyboard): what's waiting, what's running, then the composer. */
.dock {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--tabh) + var(--sab));
  z-index: 18;
  display: none;
}
.mode-chat .dock, .mode-live .dock { display: block; }
/* The thread fades out under the tray and composer instead of showing through between them. */
.mode-chat .dock { padding-top: 14px; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 14px); }
.mode-live .dock { bottom: 0; padding-bottom: var(--sab); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.kb .dock { bottom: var(--kb); }
.mode-live .composer, .mode-live .tray, .mode-chat .toolbar { display: none; }
.tray { display: flex; flex-direction: column; gap: 6px; padding: 0 10px; }
.tray:empty { display: none; }
.tray-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px 8px 8px;
  text-align: left;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 0 0 .5px var(--sep), 0 6px 20px rgba(0, 0, 0, .08);
}
body.dark .tray-card { background: #1f1f22; box-shadow: 0 0 0 .5px var(--sep); }
.tray-card:active { transform: scale(.985); }
.tray-card .main, .row .main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.tray-card b, .row b { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.tray-card b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-card small, .row small { font-size: 13px; color: var(--label2); line-height: 1.3; }
.tray-card small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 8px 10px 8px;
  padding: 4px 4px 4px 14px;
  background: var(--bg);
  border-radius: 22px;
  box-shadow: 0 0 0 .5px var(--sep), 0 6px 20px rgba(0, 0, 0, .07);
}
body.dark .composer { background: #1c1c1e; box-shadow: 0 0 0 .5px var(--sep); }
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 132px;
  padding: 7px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 17px;
  line-height: 22px;
}
.composer textarea::placeholder { color: var(--label3); }
.send {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fill2);
  color: #fff;
  flex: none;
  transition: background .15s, transform .1s;
}
.send .sym { width: 20px; height: 20px; }
.send:disabled { background: var(--fill); color: var(--label3); }
.send.ready { background: var(--accent); color: #fff; }
.send:active { transform: scale(.92); }

/* MARK: shared rows */

.large-title { font-size: 34px; font-weight: 700; letter-spacing: .01em; line-height: 1.15; padding: 6px 20px 6px; }
.section { margin: 26px 20px 7px 36px; font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: .02em; }
.group { margin: 0 16px; background: var(--card); border-radius: 12px; overflow: hidden; list-style: none; }
.group.gap { margin-top: 28px; }
.row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  position: relative;
}
.row + .row::before, .kv + .kv::before, .step + .step::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  left: 58px;
  border-top: .5px solid var(--sep);
}
.group > .row:not(:has(.tile)) + .row::before { left: 16px; }
button.row:active { background: var(--fill); }
.row.danger { color: var(--red); justify-content: center; font-weight: 500; }
.row .when { color: var(--label2); font-size: 14px; flex: none; font-variant-numeric: tabular-nums; }
.chev { color: var(--label3); flex: none; }
.chev .sym { width: 18px; height: 18px; }
.tile {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  flex: none;
}
.tile .sym { width: 19px; height: 19px; }
.tile.blue { background: var(--accent); }
.tile.orange { background: var(--orange); }
.tile.green { background: var(--green); }
.tile.gray { background: var(--gray); }
.tile.purple { background: var(--purple); }
.tile.teal { background: var(--teal); }
.tile.pink { background: var(--pink); }
.pill {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
}
.pill.orange { color: #c45f00; background: color-mix(in srgb, var(--orange) 18%, transparent); }
body.dark .pill.orange { color: var(--orange); }
.meter { display: block; height: 4px; border-radius: 2px; background: var(--fill2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.meter.big { height: 6px; border-radius: 3px; margin: 14px 20px 0; }
.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2.2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  display: block;
}
.footnote { margin: 10px 20px 0 36px; font-size: 13px; color: var(--label2); line-height: 1.4; }
.footnote .sym { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }
.banner {
  margin: 10px 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--orange) 14%, transparent);
  color: var(--label);
  font-size: 14px;
  text-align: center;
}
.empty { margin: 56px 32px; text-align: center; color: var(--label2); display: flex; flex-direction: column; align-items: center; }
.empty .sym { width: 40px; height: 40px; color: var(--label3); }
.empty b { color: var(--label); font-size: 19px; margin: 12px 0 4px; }
.empty p { font-size: 15px; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.ptr.on { height: 44px; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--fill2); border-top-color: var(--label2); animation: spin .7s linear infinite; margin-bottom: 10px; }

.switch {
  position: relative;
  width: 51px; height: 31px;
  border-radius: 16px;
  background: var(--fill2);
  flex: none;
  transition: background .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .22s cubic-bezier(.3, .7, .4, 1);
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.mac-card { margin-top: 10px; }
.mac-card .row { min-height: 76px; }
.mac-card b { font-size: 18px; }
.mac-card small { display: flex; align-items: center; gap: 6px; }

/* MARK: live */

.live { padding-top: 8px; }
.still {
  position: relative;
  margin: 0 16px;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--card);
  box-shadow: 0 0 0 .5px var(--sep);
}
.still img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.still-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--label2); font-size: 14px; text-align: center; padding: 20px; }
.still-wait .sym { width: 34px; height: 34px; color: var(--label3); }
.live-badge {
  position: absolute; left: 10px; top: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #ff453a; animation: pulse 1.4s infinite; }
.task-title { font-size: 24px; font-weight: 700; line-height: 1.2; margin: 18px 20px 0; }
.task-sub { margin: 4px 20px 0; color: var(--label2); font-size: 14px; }
.task-sub .status { font-weight: 600; color: var(--label2); }
.task-sub .status.on { color: var(--accent); }
.step-list { counter-reset: none; }
.step { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; }
.step::before { left: 50px !important; }
.step .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.8px solid var(--label3); }
.step .mark .sym { width: 15px; height: 15px; }
.step.done .mark { background: var(--green); border-color: var(--green); color: #fff; }
.step.now .mark { background: var(--accent); border-color: var(--accent); }
.step.now .mark .spinner { width: 12px; height: 12px; border-width: 2px; }
.step.fail .mark { background: var(--red); border-color: var(--red); color: #fff; }
.step .main { flex: 1; font-size: 15.5px; min-width: 0; overflow-wrap: anywhere; }
.step.todo .main { color: var(--label2); }
.step.now .main { font-weight: 600; }
.step .when { color: var(--label2); font-size: 13px; flex: none; }
.toolbar { display: flex; gap: 10px; padding: 10px 16px 10px; }
.toolbar .btn { flex: 1; }

/* MARK: buttons */

.btn {
  min-height: 50px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  width: 100%;
}
.btn .sym { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary.armed { background: var(--green); }
.btn.gray { background: var(--btn-gray); color: var(--accent); }
.btn.danger { background: var(--btn-red); color: var(--red); }
.btn.plain { background: var(--card); color: var(--accent); width: calc(100% - 32px); margin: 12px 16px 0; }
.btn:active { opacity: .7; transform: scale(.985); }

/* MARK: approval sheet */

.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); animation: fade .25s ease; }
.scrim.light { z-index: 40; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 31;
  max-height: calc(100% - var(--sat) - 18px);
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .18);
  animation: rise .42s cubic-bezier(.32, .72, 0, 1);
}
body.dark .sheet { background: #1c1c1e; }
.grabber { height: 20px; display: flex; justify-content: center; padding-top: 6px; flex: none; touch-action: none; }
.grabber i { width: 36px; height: 5px; border-radius: 3px; background: var(--label3); }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.sheet-head { position: relative; padding: 4px 64px 14px 20px; touch-action: none; }
.sheet-head .close {
  position: absolute; top: -6px; right: 12px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--label2);
}
.sheet-head .close .sym { width: 30px; height: 30px; padding: 7px; border-radius: 50%; background: var(--fill); }
.sheet-head h2 { font-size: 22px; font-weight: 700; line-height: 1.22; margin-top: 10px; }
.sheet-head .src { font-size: 14px; color: var(--label2); margin-top: 4px; }
.sheet .group { background: var(--grouped); }
body.dark .sheet .group { background: #2c2c2e; }
.fields { margin-bottom: 12px; }
.kv { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 11px 14px; align-items: baseline; }
.kv::before { left: 14px !important; }
.kv dt { font-size: 13.5px; color: var(--label2); }
.kv dd { font-size: 15.5px; overflow-wrap: anywhere; }
.doc { margin: 0 16px 6px; background: var(--grouped); border-radius: 12px; padding: 12px 14px; position: relative; }
body.dark .doc { background: #2c2c2e; }
.doc-title { font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.doc-text { font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc.clipped .doc-text { max-height: 168px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.doc-more { color: var(--accent); font-size: 15px; font-weight: 600; min-height: 36px; margin-top: 2px; }
.sheet-actions {
  flex: none;
  padding: 10px 16px calc(var(--sab) + 10px);
  border-top: .5px solid var(--sep);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pair-row { display: flex; gap: 8px; }
.pair-row .btn { flex: 1; min-height: 46px; font-size: 16px; }
.assure { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 12.5px; color: var(--label2); }
.assure .sym { width: 13px; height: 13px; }

/* MARK: action sheet, alert, toast */

.action-wrap {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--sab) + 8px);
  z-index: 41;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rise .36s cubic-bezier(.32, .72, 0, 1);
}
.action-card, .action-cancel { background: var(--bar); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border-radius: 14px; overflow: hidden; text-align: center; }
body:not(.dark) .action-card, body:not(.dark) .action-cancel { background: rgba(250, 250, 250, .94); }
.action-card .t { font-size: 13px; font-weight: 600; color: var(--label2); padding: 14px 16px 2px; }
.action-card .m { font-size: 13px; color: var(--label2); padding: 0 16px 14px; }
.action-card button { width: 100%; min-height: 57px; font-size: 20px; color: var(--accent); border-top: .5px solid var(--sep); }
.action-card button.danger { color: var(--red); }
.action-cancel { min-height: 57px; font-size: 20px; font-weight: 600; color: var(--accent); }
.action-card button:active, .action-cancel:active { background: var(--fill); }
.alert-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--scrim); animation: fade .2s ease; }
.alert { width: min(280px, 82vw); background: var(--bar); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 14px; text-align: center; overflow: hidden; }
body:not(.dark) .alert { background: rgba(250, 250, 250, .96); }
.alert b { display: block; font-size: 17px; padding: 18px 16px 2px; }
.alert p { font-size: 13px; color: var(--label2); padding: 4px 16px 16px; }
.alert button { width: 100%; min-height: 44px; color: var(--accent); font-weight: 600; border-top: .5px solid var(--sep); }
.toast {
  position: fixed;
  bottom: calc(var(--tabh) + var(--sab) + var(--dock) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(30, 30, 32, .92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  animation: drop .3s cubic-bezier(.32, .72, 0, 1);
  text-align: center;
}

/* MARK: pairing */

.pair { padding-bottom: 12px; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 32px 20px; }
.hero h1 { font-size: 28px; font-weight: 700; margin-top: 16px; }
.hero p { color: var(--label2); font-size: 15px; margin-top: 6px; }
.finder { position: relative; margin: 0 16px; aspect-ratio: 1; max-height: 52vh; border-radius: 20px; overflow: hidden; background: #111; }
.finder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.finder .frame { position: absolute; inset: 18% 16%; z-index: 1; border-radius: 22px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); border: 3px solid rgba(255, 255, 255, .9); }
.finder:not(.live) .frame { border-style: dashed; border-color: rgba(255, 255, 255, .35); }
.scan-btn {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex; align-items: center; gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  background: #fff;
  color: #000;
  font-size: 17px;
  font-weight: 600;
}
.scan-btn:active { transform: translate(-50%, -50%) scale(.96); }
.finder .hint { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 3; text-align: center; color: #fff; font-size: 15px; font-weight: 500; }
.code-entry { margin: 12px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.code-entry input {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 17px;
  outline: 2px solid transparent;
}
.code-entry input:focus { outline-color: var(--accent); }
.words { margin: 0 16px; padding: 22px 18px; background: var(--card); border-radius: 20px; text-align: center; }
.words .kicker { font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: .04em; }
.words h2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.words h2 span { padding: 12px 6px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 21px; font-weight: 700; }
.words p { font-size: 14px; color: var(--label2); }
.steps li { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; font-size: 15px; }
.steps li + li::before { content: ""; position: absolute; top: 0; right: 0; left: 50px; border-top: .5px solid var(--sep); }
.steps li > b { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }

/* MARK: motion */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -12px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body.shot .sheet, body.shot .scrim, body.shot .action-wrap, body.shot .toast { animation: none; }

@media (max-width: 360px) {
  .large-title { font-size: 30px; }
  .kv { grid-template-columns: 84px 1fr; }
  .words h2 span { font-size: 18px; }
}

/* MARK: chat list (the ☰ menu) */

.drawer-scrim { z-index: 34; opacity: 0; pointer-events: none; animation: none; transition: opacity .3s ease; }
.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 35;
  width: min(86vw, 344px);
  display: flex;
  flex-direction: column;
  padding-top: var(--sat);
  background: var(--bg);
  box-shadow: 0 0 0 .5px var(--sep), 12px 0 40px rgba(0, 0, 0, .14);
  transform: translateX(-104%);
  transition: transform .34s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .34s;
  visibility: hidden;
}
.drawer-open .drawer { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.32, .72, 0, 1), visibility 0s; }
body.dark .drawer { background: #111113; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 6px 18px; min-height: var(--toph); }
.drawer-head h2 { font-size: 28px; font-weight: 700; letter-spacing: .01em; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 14px 6px;
  padding: 0 10px;
  min-height: 40px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--label2);
}
.search .sym { width: 18px; height: 18px; }
.search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--label2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.drawer-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 8px 12px; }
.drawer-section { font-size: 13px; font-weight: 600; color: var(--label2); padding: 16px 10px 6px; }
.chat-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px;
  border-radius: 12px;
  text-align: left;
}
.chat-row .main { min-width: 0; flex: 1; }
.chat-row b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.chat-row .when { flex: none; align-self: flex-start; padding-top: 2px; font-size: 13px; color: var(--label2); font-variant-numeric: tabular-nums; }
.chat-row.on { background: var(--accent-soft); }
.chat-row.on b { font-weight: 600; color: var(--accent); }
.chat-row:active { background: var(--fill); }
.working { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; align-self: flex-start; margin-top: 7px; animation: pulse 1.4s ease-in-out infinite; }
.drawer-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 48px 24px; color: var(--label2); }
.drawer-empty .sym { width: 34px; height: 34px; color: var(--label3); margin-bottom: 6px; }
.drawer-empty b { color: var(--label); font-size: 17px; }
.drawer-empty p { font-size: 14px; }
.drawer-foot { border-top: .5px solid var(--sep); padding: 8px 8px calc(var(--sab) + 8px); }
.drawer-mac { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px; border-radius: 12px; text-align: left; }
.drawer-mac .main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.drawer-mac b { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-mac small { font-size: 13px; color: var(--label2); display: flex; align-items: center; gap: 6px; }
.drawer-mac .chev .sym { width: 20px; height: 20px; }
.drawer-mac:active { background: var(--fill); }
@media (max-width: 360px) {
  .starters button { min-height: 100px; padding: 12px; }
  .hello h2 { font-size: 24px; }
}
