@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/fraunces-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/fraunces-latin-600.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-600.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* ---- PALETTE ---- swapped as one block to change the theme ---- */
  /* Surfaces, darkest to lightest */
  --paper: #14110F;
  --paper-2: #1E1A17;
  --tabbar: #171412;
  --field: #241F1B;
  --press: #2C2621;
  --note-bg: #241C16;

  /* Text */
  --ink: #F2E8DA;
  --muted: #A3948A;
  --on-accent: #FFF8F4;

  /* Strokes */
  --line: #736358;
  --hairline: rgba(242, 232, 218, 0.13);
  --hairline-soft: rgba(242, 232, 218, 0.09);

  /* Accents */
  --red: #DD1E38;
  --red-ink: #E74C60;
  --blue: #4A97DB;
  --blue-deep: #0066B1;
  --blue-tint: rgba(74, 151, 219, 0.14);
  --caution: #D9A046;
  --green: #5F9E77;
  --danger: #8E2A36;

  /* Depth */
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 -10px 28px rgba(0, 0, 0, 0.5);
  --emboss: #0B0908;
  --focus-ring: rgba(231, 76, 96, 0.30);

  /* Atmosphere */
  --glow-1: rgba(228, 56, 79, 0.07);
  --glow-2: rgba(217, 160, 70, 0.08);
  --glow-3: rgba(0, 102, 177, 0.10);
  --grain-blend: screen;
  --grain-opacity: 0.07;

  /* Manual plates keep the cream the rest of the app gave up */
  --figure-paper: #EFE6D6;
  --figure-ink: #4A4038;

  /* Photography */
  --photo-bg: #2A211C;
  --hero-wash: linear-gradient(180deg,
    rgba(20, 17, 15, 0.12) 0%,
    rgba(20, 17, 15, 0.30) 42%,
    rgba(20, 17, 15, 0.74) 76%,
    rgba(20, 17, 15, 0.96) 100%);
  --hero-ink: #F2E8DA;
  --hero-ink-strong: #FFFBF4;
  --hero-ink-dim: rgba(242, 232, 218, 0.72);
  --hero-ink-soft: rgba(242, 232, 218, 0.86);
  --hero-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);

  /* Chat */
  --toast-bg: #F2E8DA;
  --toast-ink: #14110F;
  --code-bg: rgba(242, 232, 218, 0.10);
  --bubble-user: var(--blue-tint);
  /* ---- END PALETTE ---- */

  --tab-h: 62px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Avenir Next", "Segoe UI", sans-serif;
  --card-radius: 18px 22px 16px 20px;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  min-height: 100%;
}

html, body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100%;
  background: var(--paper);
  padding: max(18px, env(safe-area-inset-top)) 16px calc(var(--tab-h) + 36px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

body.garage {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 40% at 10% -10%, var(--glow-1), transparent 60%),
    radial-gradient(ellipse 70% 40% at 100% 0%, var(--glow-2), transparent 55%),
    radial-gradient(ellipse 90% 45% at 50% 108%, var(--glow-3), transparent 60%);
}

body.dusk {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  background: var(--paper);
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Paper grain — workshop pages and the sheet under a dusk photo */
body.garage::before,
.sheet::before {
  content: "";
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  mix-blend-mode: var(--grain-blend);
  opacity: var(--grain-opacity);
}

body.garage::before {
  position: fixed;
  inset: 0;
  z-index: 0;
}

body.garage > * { position: relative; z-index: 1; }
body.garage > .tabbar { position: fixed; z-index: 50; }
body.garage > .toast { position: fixed; z-index: 60; }

.stamp {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 3px 8px 2px;
  border: 1.5px solid var(--line);
  border-radius: 2px 4px 2px 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.3;
}

.stamp::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 1px;
  flex-shrink: 0;
}

h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

h2 {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 18px 0 10px;
  padding: 3px 8px 2px;
  border: 1.5px solid var(--line);
  border-radius: 2px 4px 2px 3px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

h2::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 1px;
  flex-shrink: 0;
}

.sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  max-width: 36em;
}

.page-header { margin-bottom: 8px; }

.sheet {
  position: relative;
  margin-top: -28px;
  background: var(--paper);
  border-radius: 26px 22px 0 0;
  padding: 20px 16px 4px;
  box-shadow: var(--shadow-sheet);
}

.sheet::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
}

.sheet > * { position: relative; z-index: 1; }
.sheet > h2:first-child { margin-top: 2px; }

/* Dusk Dust hero */
.hero {
  position: relative;
  min-height: 46vh;
  max-height: 460px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--photo-bg);
}

.hero-short {
  min-height: 32vh;
  max-height: 300px;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  display: block;
}

.hero-wash {
  position: absolute;
  inset: 0;
  background: var(--hero-wash);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 22px 18px 40px;
  color: var(--hero-ink);
  text-shadow: var(--hero-shadow);
}

.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hero-ink-dim);
}

.hero-copy h1 {
  color: var(--hero-ink-strong);
  font-weight: 500;
  font-size: 36px;
  margin: 0 0 6px;
  text-shadow: var(--hero-shadow);
}

.hero-copy p {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--hero-ink-soft);
}

.grid { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.card {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--card-radius);
  padding: 14px 14px 13px;
  box-shadow: var(--shadow);
}

.card.tap:active { background: var(--press); }

.card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p, .muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.stat {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--red-ink);
}

.stat-unit {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row + .row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

.list { display: grid; gap: 8px; }

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px 18px 14px 17px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  color: inherit;
}

a.list-item:active { background: var(--press); }

.list-item .title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.list-item .meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.35;
}

.km-stamp {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  border-bottom: 1.5px solid var(--blue);
  padding-bottom: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
  margin-bottom: 12px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea { min-height: 88px; resize: vertical; }

input[type="file"] { padding: 8px; }

input[type="file"]::file-selector-button {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--press);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 12px;
  margin-right: 10px;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover { background: var(--field); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px 16px 12px 15px;
  background: var(--red);
  color: var(--on-accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--emboss);
  scroll-margin-bottom: calc(var(--tab-h) + 24px);
}

.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--emboss); }

.btn.secondary {
  width: auto;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  padding: 8px 12px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-wrap { position: relative; margin: 4px 0 14px; }

.search-wrap input {
  margin: 0;
  padding-left: 40px;
  background: var(--paper-2);
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  padding: 0;
  margin: 16px 0 14px;
}

.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 4px;
  border-radius: 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
}

.seg button.active {
  background: transparent;
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.panel { display: none; }
.panel.active { display: block; }

.kv { display: grid; gap: 0; }
.kv .row { padding: 11px 0; margin: 0; border-top: 1px solid var(--hairline); align-items: flex-start; }
.kv .row:first-child { border-top: none; padding-top: 0; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-size: 13px; font-weight: 600; text-align: right; max-width: 62%; }

.approx { color: var(--caution); font-weight: 600; }

.note {
  font-size: 13px;
  color: var(--ink);
  background: var(--note-bg);
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 2px 14px 12px 2px;
  padding: 10px 12px;
  margin: 0 0 16px;
  line-height: 1.45;
}

.steps {
  counter-reset: step;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  counter-increment: step;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px 18px 14px 17px;
  padding: 12px 14px 12px 48px;
  position: relative;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--blue);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back {
  display: inline-block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  border-bottom: 1.5px solid var(--red);
  padding-bottom: 1px;
}

.empty {
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  padding: 18px 16px;
  background: var(--paper-2);
  border: 1.5px dashed var(--line);
  border-radius: var(--card-radius);
}

.empty-title {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.shortcut {
  display: block;
  color: inherit;
  min-height: 96px;
}

.shortcut .ico {
  display: block;
  width: 22px;
  height: 22px;
  margin-bottom: 10px;
  color: var(--ink);
}

.frame {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  padding: 8px;
  border-radius: 20px 24px 18px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.frame img,
.frame .bike-hero {
  width: 100%;
  display: block;
  border-radius: 12px 14px 11px 13px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--photo-bg);
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px 12px 9px 11px;
  border: 1.5px solid var(--line);
  background: var(--paper);
}

.fit-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.fit-list li {
  padding: 6px 0 6px 14px;
  border-top: 1px solid var(--hairline-soft);
  position: relative;
}

.fit-list li:first-child { border-top: none; }

.fit-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--blue);
  border-radius: 1px;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: 520px;
  background: var(--tabbar);
  border-top: 1.5px solid var(--line);
  padding: 6px 6px max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 6px 2px 4px;
  border-radius: 8px;
}

.tabbar a .ico {
  width: 22px;
  height: 22px;
  display: block;
}

.tabbar a.active { color: var(--red-ink); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 4px 12px 10px 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

footer.hint {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.guide-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 10px 12px 9px 11px;
  border: 1.5px solid var(--line);
  background: var(--figure-paper);
}

.guide-figure {
  margin: 0 0 14px;
  background: var(--figure-paper);
  border: 1.5px solid var(--line);
  border-radius: var(--card-radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.guide-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px 14px 11px 13px;
}

.guide-figure figcaption {
  margin: 8px 4px 2px;
  color: var(--figure-ink);
  font-size: 13px;
  line-height: 1.35;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1.5px solid var(--line);
  border-radius: 16px 18px 14px 17px;
  overflow: hidden;
  background: var(--photo-bg);
  margin: 0 0 8px;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-link {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.video-link a,
.sources a {
  color: var(--ink);
  border-bottom: 1.5px solid var(--blue);
}

.sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.sources li {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 14px 16px 12px 15px;
  padding: 10px 12px;
}

@media (max-width: 380px) {
  h1, .hero-copy h1 { font-size: 30px; }
  .stat { font-size: 34px; }
  .grid-2 { gap: 8px; }
}

.pill {
  display: inline-block;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-accent);
  background: var(--red);
  border: 1.5px solid var(--line);
  border-radius: 2px 4px 2px 3px;
  padding: 3px 7px 2px;
}

.pill.green { background: var(--green); color: var(--paper); }
.pill.warn { background: var(--caution); color: var(--paper); }
.pill.danger { background: var(--red); }
.pill.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.badge {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1.5px solid var(--blue);
  padding-bottom: 1px;
  white-space: nowrap;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.btn-row .btn { width: 100%; }

.btn.tiny {
  width: auto;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn.danger {
  background: var(--danger);
  color: var(--on-accent);
}

.item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.job-item.status-overdue { border-left: 4px solid var(--red); }
.job-item.status-due_soon { border-left: 4px solid var(--caution); }
.job-item.status-ok { border-left: 4px solid var(--green); }
.job-item.status-unknown { border-left: 4px solid var(--blue); }

.photo-actions { margin-top: 10px; display: grid; gap: 8px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.ask-page {
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}

.ask-head {
  flex-shrink: 0;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
}

.ask-head h1 { font-size: 28px; }
.ask-head .sub { margin-top: 4px; margin-bottom: 10px; }

.ask-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.ask-empty { display: grid; gap: 10px; }
.ask-empty .sub { margin: 0; }

.suggest {
  text-align: left;
  background: var(--paper-2);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 14px 16px 12px 15px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.bubble {
  max-width: 92%;
  border-radius: 14px 16px 12px 15px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* The mechanic answers in light markdown; these are the only tags it can emit. */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul,
.bubble ol { margin: 0 0 8px; padding-left: 20px; }
.bubble ul:last-child,
.bubble ol:last-child { margin-bottom: 0; }
.bubble li { margin: 0 0 3px; }
.bubble li:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 700; }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 4px;
}

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  border: 1.5px solid var(--line);
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
}

.bubble.error {
  align-self: stretch;
  max-width: none;
  background: var(--note-bg);
  border: 1.5px solid var(--red);
  color: var(--ink);
}

.bubble a { border-bottom: 1.5px solid var(--blue); }

/* A write the mechanic proposed. Nothing is saved until this is tapped. */
.action-card {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px 12px 9px 11px;
  background: var(--paper);
}
.action-card .action-title {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
}
.action-card .action-what { margin: 0; font-size: 14px; }
.action-card .action-row { display: flex; gap: 8px; margin-top: 10px; }
.action-card.done { border-left-color: var(--green); opacity: 0.85; }
.action-card.done .action-title { color: var(--green); }
.action-card.muted { opacity: 0.55; }
.action-card.muted .action-title { color: var(--muted); }
.action-card.failed { border-left-color: var(--red); }

.bubble.pending::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 3px;
  background: var(--red);
  vertical-align: text-bottom;
  animation: ask-blink 1s steps(1) infinite;
}

@keyframes ask-blink {
  50% { opacity: 0; }
}

.ask-compose {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 16px calc(var(--tab-h) + 8px + env(safe-area-inset-bottom));
  border-top: 1.5px solid var(--line);
  background: var(--paper);
}

.ask-compose textarea {
  width: auto;
  flex: 1;
  margin: 0;
  min-height: 44px;
  max-height: 120px;
  resize: none;
}

.ask-compose .btn {
  width: auto;
  height: 44px;
  padding: 0 16px;
}

/* Click-to-load film facade: no third-party request until he taps play. */
.video-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: var(--paper-2);
  color: var(--ink);
  border: 0;
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.video-play-icon { font-size: 30px; color: var(--red); line-height: 1; }
.video-play-label { font-weight: 700; font-size: 15px; }
.video-play-note { font-size: 12px; color: var(--muted); }
