@font-face {
  font-family: "Jakarta";
  src: url("fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  accent-color: var(--brand);
  --bg: #f3f7f4;
  --surface: #ffffff;
  --surface-2: #f5f9f6;
  --ink: #0f1f17;
  --ink-2: #4b5f54;
  --ink-3: #566a5f;      /* 5:1 or better on every light surface */
  --line: #dfe9e2;       /* decorative dividers only */
  --line-2: #cbdcd1;
  --line-ctl: #748e80;   /* borders of controls: 3:1 or better */
  --brand: #0b7a4e;
  --brand-strong: #075a3a;
  --brand-ink: #ffffff;
  --brand-soft: #e4f3ea;
  --brand-soft-2: #cfe9da;
  --gold: #c99a2e;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --rec: #b3261b;
  --on-strong: #ffffff;  /* text on danger / record buttons */
  --rec-soft: #fdeeec;
  --shadow-sm: 0 1px 2px rgba(15, 40, 25, .06);
  --shadow: 0 1px 2px rgba(15, 40, 25, .05), 0 8px 24px -12px rgba(15, 40, 25, .18);
  --shadow-lg: 0 24px 48px -20px rgba(10, 40, 25, .35);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Theme: follows the phone unless the user picked one (the theme button sets <meta name="color-scheme">).
   The meta is mapped back to CSS here, so this works with or without JavaScript. */
html:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
html:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  html:not(:has(> head > meta[name="color-scheme"][content="light"])) {
  --bg: #0b1510;
  --surface: #111e17;
  --surface-2: #15261d;
  --ink: #e6f1ea;
  --ink-2: #a2b8ab;
  --ink-3: #8fa598;
  --line: #213428;
  --line-2: #2c4535;
  --line-ctl: #5d7e6a;
  --brand: #2fb37a;
  --brand-strong: #49c78f;
  --brand-ink: #04160d;
  --brand-soft: #143224;
  --brand-soft-2: #1b4431;
  --danger: #f3786d;
  --danger-soft: #3a1714;
  --rec: #f0675b;
  --rec-soft: #2e1714;
  --on-strong: #2a0a06;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -18px rgba(0,0,0,.8);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7);
  }
}
html:has(> head > meta[name="color-scheme"][content="dark"]) {
  --bg: #0b1510;
  --surface: #111e17;
  --surface-2: #15261d;
  --ink: #e6f1ea;
  --ink-2: #a2b8ab;
  --ink-3: #8fa598;
  --line: #213428;
  --line-2: #2c4535;
  --line-ctl: #5d7e6a;
  --brand: #2fb37a;
  --brand-strong: #49c78f;
  --brand-ink: #04160d;
  --brand-soft: #143224;
  --brand-soft-2: #1b4431;
  --danger: #f3786d;
  --danger-soft: #3a1714;
  --rec: #f0675b;
  --rec-soft: #2e1714;
  --on-strong: #2a0a06;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -18px rgba(0,0,0,.8);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem; /* relative, so the phone's text-size setting applies */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand img { border-radius: 10px; display: block; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.pill .icon { width: 15px; height: 15px; }
.pill-ok { background: var(--brand-soft); color: var(--brand-strong); }
.pill-warn { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 420px) { .pill span { display: none; } .pill { padding: 6px; } }

/* ---------- layout ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; }
.intro { padding: 22px 4px 18px; }
.intro h1 { font-size: clamp(1.6rem, 5.5vw, 2.15rem); font-weight: 780; line-height: 1.15; }
.intro p { color: var(--ink-2); margin-top: 8px; max-width: 34em; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head h2 { font-size: 1.2rem; font-weight: 720; }
.card-head p { color: var(--ink-2); font-size: .92rem; margin-top: 2px; }
.step {
  min-width: 2.1rem; height: 2.1rem; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--brand-soft); color: var(--brand-strong);
  font-weight: 750; font-size: .95rem;
}
.count {
  flex: none; margin-top: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .8rem; font-weight: 600; color: var(--ink-2);
}
.muted { color: var(--ink-2); }
.fine { font-size: .84rem; color: var(--ink-3); margin-top: 10px; }
.center { text-align: center; }
.busy { margin-top: 10px; font-weight: 600; color: var(--brand); font-size: .92rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 10px 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 650; font-size: 1rem;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .tile input:focus-visible + span, .seg input:focus-visible + span, .song-name:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px;
}
.btn-lg { min-height: 56px; font-size: 1.02rem; padding: 12px 20px; }
.btn-sm { min-height: 44px; padding: 6px 12px; font-size: .9rem; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-soft-2); }
.btn-soft:hover { background: var(--brand-soft-2); }
.btn-ghost { background: var(--surface); border-color: var(--line-ctl); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-rec { background: var(--rec-soft); color: var(--rec); border-color: var(--rec); }
.btn-rec-solid { background: var(--rec); color: var(--on-strong); width: 100%; margin-top: 14px; }
.btn-danger { background: var(--danger); color: var(--on-strong); }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); cursor: pointer; padding: 0;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.actions-2 { display: grid; gap: 10px; margin-top: 4px; }
@media (min-width: 34em) { .actions-2 { grid-template-columns: 1fr 1fr; } }
.actions-2.subtle { margin-top: 14px; }
#mediaAdd { width: 100%; }

/* ---------- alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--r);
  margin-bottom: 16px; border: 1px solid;
}
.alert > .icon { margin-top: 2px; }
.alert > div { flex: 1; }
.alert p { font-size: .92rem; margin-top: 2px; }
.alert-ok { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-strong); }
.alert-ok p { color: var(--ink-2); }
.alert-warn { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert .btn { align-self: center; }

.lastvideo {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.lv-text { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.lv-text span { font-size: .85rem; }
.lv-actions { display: flex; gap: 8px; }
.tile-icon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--brand-soft); color: var(--brand);
}
.tile-icon.ok { background: var(--brand); color: var(--brand-ink); }

/* ---------- songs ---------- */
.songs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.songs:empty { display: none; }
.song {
  display: grid; align-items: center; gap: 8px 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "play meta del" "field field order";
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.play-btn {
  grid-area: play;
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand); color: var(--brand-ink);
}
.play-btn .icon { width: 20px; height: 20px; }
.song-meta { grid-area: meta; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.song-meta strong { font-weight: 650; overflow-wrap: anywhere; }
.song-meta span { font-size: .85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.song .del { grid-area: del; }
.song-field { grid-area: field; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.song-field span { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.song-name {
  width: 100%; min-height: 44px;
  border: 1px solid var(--line-ctl); background: var(--surface);
  border-radius: 10px; padding: 8px 10px;
  font-size: 1rem; color: var(--ink);
}
.song-name::placeholder { color: var(--ink-3); }
.song-name:focus { border-color: var(--brand); outline: none; }
.reorder { grid-area: order; display: flex; gap: 2px; align-self: end; }

/* ---------- recorder ---------- */
.recpanel {
  margin-top: 14px; padding: 18px;
  border-radius: var(--r);
  background: var(--rec-soft);
  border: 1px solid color-mix(in srgb, var(--rec) 25%, transparent);
}
.rec-top { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rec) 60%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.rec-label { font-weight: 650; color: var(--rec); flex: 1; }
.rec-time { font-size: 1.7rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.rec-bars { display: flex; align-items: center; gap: 3px; height: 56px; margin-top: 12px; }
.rec-bars span { flex: 1; min-width: 2px; border-radius: 2px; background: var(--rec); opacity: .8; height: 6%; transition: height .08s; }

/* ---------- media grid ---------- */
.grid {
  list-style: none; padding: 0; margin: 0 0 12px;
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}
.grid:empty { display: none; }
.grid li { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.grid img, .grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .idx, .grid .vid {
  position: absolute; bottom: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(8, 20, 14, .62); color: #fff;
  font-size: .72rem; font-weight: 650;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.grid .idx { left: 6px; }
.grid .vid { right: 6px; }
.grid .vid .icon { width: 12px; height: 12px; }
.grid .rm {
  position: absolute; top: 5px; right: 5px; overflow: visible;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: none; cursor: pointer;
  background: rgba(8, 20, 14, .6); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.grid .rm .icon { width: 17px; height: 17px; }
.grid .rm::before { content: ""; position: absolute; inset: -5px; } /* 44px tap area around the 34px circle */

/* ---------- style options ---------- */
.preview-wrap { position: relative; margin: 0 auto 6px; border-radius: 16px; overflow: hidden; background: #050b08; box-shadow: var(--shadow); }
.preview-wrap.tall { max-width: 280px; }
.preview-wrap.square { max-width: 400px; }
.preview { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; background: #050b08; }
.preview-tag {
  position: absolute; top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(8, 20, 14, .55); color: #fff; font-size: .72rem; font-weight: 650;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.preview-tag .icon { width: 12px; height: 12px; }

.opt { border: none; padding: 0; margin: 20px 0 0; min-width: 0; }
.opt legend { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .95rem; margin-bottom: 10px; padding: 0; }
.opt legend .icon { width: 17px; height: 17px; color: var(--brand); }
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); }
.tile { position: relative; }
.tile input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.tile span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 76px; padding: 10px 6px;
  border: 1.5px solid var(--line-ctl); border-radius: var(--r);
  background: var(--surface);
  font-size: .86rem; font-weight: 600; color: var(--ink-2); text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.tile span .icon { width: 22px; height: 22px; color: var(--ink-3); }
.tile span:hover { border-color: var(--ink-3); background: var(--surface-2); }
.tile input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); box-shadow: 0 0 0 1px var(--brand) inset; }
.tile input:checked + span .icon { color: var(--brand); }

.settings { display: grid; gap: 0 20px; }
@media (min-width: 38em) { .settings { grid-template-columns: 1fr 1fr; } }
.seg {
  display: flex; padding: 4px; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line-ctl); border-radius: var(--r);
}
.seg label { flex: 1; position: relative; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 6px 8px; border-radius: 10px;
  font-size: .9rem; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: center;
}
.seg span .icon { width: 16px; height: 16px; }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); }

.foot {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 6px 0; color: var(--ink-3); font-size: .84rem;
}
.foot .icon { color: var(--brand); width: 18px; height: 18px; margin-top: 1px; }

/* ---------- action bar ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.actionbar-inner { max-width: 720px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; }
.summary { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.summary strong { font-size: .98rem; }
.summary span { font-size: .8rem; }
.actionbar .btn { flex: none; }

/* ---------- making / done ---------- */
.sheet { margin-top: 20px; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 1.25rem; font-weight: 740; }
.sheet-head p { font-size: .9rem; }
.spin-slow .icon { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px) rotate(-6deg); } }
.progress-label { display: block; margin-top: 18px; }
progress {
  appearance: none; border: 0 solid; overflow: clip;
  display: block; width: 100%; height: 10px; margin-top: 6px;
  border-radius: 999px; background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--line-ctl);
}
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; transition: inline-size .3s; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font-weight: 650; font-variant-numeric: tabular-nums; }
.progress-meta .muted { font-weight: 500; font-size: .9rem; }
#making .btn, #done .actions-2 { width: 100%; }
#making .btn { margin-top: 14px; }
#done .actions-2 { margin-top: 16px; }

/* ---------- toast & dialog ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); max-height: calc(100dvh - 140px); overflow: auto;
  bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 40;
  width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 12px 16px; border-radius: var(--r);
  background: #1d1414; color: #fff; box-shadow: var(--shadow-lg);
  font-size: .92rem;
  animation: rise .2s ease-out;
}
.toast > .icon { color: #ff9b91; }
.toast > span { flex: 1; }
.toast .icon-btn { color: #d8cccc; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
body.no-bar .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }

.dialog {
  border: none; border-radius: var(--r-lg); padding: 22px;
  width: min(420px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog:modal { overscroll-behavior: contain; }
.dialog::backdrop { overflow: hidden; overscroll-behavior: contain; background: rgba(5, 15, 10, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dialog h1 { font-size: 1.15rem; }
.dialog p { margin-top: 6px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#stage { position: fixed; left: 0; top: 0; width: 2px; height: 2px; overflow: hidden; opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- format picker ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.formats { border: none; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.format { position: relative; }
.format input { position: absolute; opacity: 0; pointer-events: none; }
.format > span {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  height: 100%; padding: 14px 8px 12px;
  border: 1.5px solid var(--line-ctl); border-radius: var(--r); background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.format > span:hover { border-color: var(--ink-3); background: var(--surface-2); }
.format strong { font-size: .95rem; font-weight: 700; margin-top: 6px; }
.format small { font-size: .76rem; color: var(--ink-3); line-height: 1.35; }
.frame { display: block; border: 2px solid var(--ink-3); border-radius: 5px; background: var(--surface-2); }
.frame-wide { width: 50px; height: 28px; margin: 7px 0; }
.frame-tall { width: 24px; height: 42px; }
.frame-square { width: 34px; height: 34px; margin: 4px 0; }
.format input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.format input:checked + span .frame { border-color: var(--brand); background: var(--brand-soft-2); }
.format input:checked + span strong { color: var(--brand-strong); }
.format input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* ---------- inline problems, takeover screen, install ---------- */
.problems {
  margin-top: 12px; padding: 12px 8px 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--r); border: 1px solid var(--danger);
  background: var(--danger-soft); color: var(--ink);
}
.problems > .icon { color: var(--danger); margin-top: 2px; }
.problems > div { flex: 1; min-width: 0; }
.problems strong { color: var(--danger); }
.problems ul { margin: 4px 0 0; padding-left: 1.1em; font-size: .92rem; overflow-wrap: anywhere; }
.problems .icon-btn { margin: -6px 0; }
h1:focus, h2:focus { outline: none; }
.elsewhere { text-align: center; margin-top: 12vh; }
.elsewhere .tile-icon { margin: 0 auto 14px; }
.elsewhere p { color: var(--ink-2); margin: 8px auto 18px; max-width: 28em; }
.install-hint { margin-top: 8px; }
@media (max-width: 26em) { .topbar .btn-sm span { display: none; } }
.top-actions { display: flex; align-items: center; gap: 8px; }
.busy:empty { margin: 0; }

/* ---------- how-to guide (help.html) ---------- */
body.guide-page { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.guide .card > h2, .guide .card-head h2 { font-size: 1.2rem; font-weight: 720; }
.guide .card > h2 + p { margin-top: 6px; color: var(--ink-2); }
.guide h3 { font-size: 1rem; font-weight: 700; margin: 18px 0 6px; }
.guide .card-head + h3 { margin-top: 0; }
.guide a:not(.btn) { color: var(--brand-strong); text-underline-offset: 2px; }
.toc h2 { font-size: 1rem; }
.toc ol { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 6px; }
.toc a { display: inline-block; padding: 4px 0; }
.steps, .points { margin: 10px 0 0; padding-left: 1.3em; display: grid; gap: 8px; }
.steps li::marker { font-weight: 750; color: var(--brand); }
.points li::marker { color: var(--brand); }
.choices { margin: 0; display: grid; gap: 12px; }
.choices > div { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.choices dt { font-weight: 700; }
.choices dd { margin: 2px 0 0; color: var(--ink-2); }
.tip { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--brand-soft); color: var(--ink); font-size: .95rem; }
.tip .icon { color: var(--brand-strong); margin-top: 2px; }
.guide .center { margin: 24px 0 8px; }
.guide section[id], .guide .toc { scroll-margin-top: 72px; }
@media (max-width: 26em) {
  .topbar-inner { gap: 8px; padding-inline: 12px; }
  .top-actions { gap: 4px; }
  .topbar .btn-sm { min-width: 44px; padding: 6px; }
}
.topbar .guide-back span { display: inline; }
.topbar .guide-back { padding-inline: 12px; }

/* theme button: show the action for the scheme that is NOT showing now */
.theme-btn .to-light { display: none; }
@media (prefers-color-scheme: dark) {
  html:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-btn .to-dark { display: none; }
  html:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-btn .to-light { display: contents; }
}
html:has(> head > meta[name="color-scheme"][content="dark"]) .theme-btn .to-dark { display: none; }
html:has(> head > meta[name="color-scheme"][content="dark"]) .theme-btn .to-light { display: contents; }
.theme-btn { width: 44px; height: 44px; border: 1px solid var(--line-ctl); background: var(--surface); color: var(--ink); }
@media (max-width: 22em) { .brand span { display: none; } }
.theme-btn .to-dark { display: contents; }
