/* Scanomat Onboarding
 * Look taken from the other Scanomat tools: warm off-white canvas, white hairline cards, near-black
 * ink, charcoal (#2C2B27) for the header and hero, gold (#D9A441) as the accent, Scanomat green for
 * emphasis. Helvetica Neue, like the TopBrewer app. Dark theme follows the phone or the setting.
 */

:root {
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #EFECE7;
  --surface-3: #E6E2DB;
  --line: #E4E0D9;
  --line-2: #D2CDC4;
  --ink: #1A1A1A;
  --ink-2: #45423D;
  --muted: #6B665F;

  --dark: #2C2B27;
  --hero: #2C2B27;
  --on-dark: #F5F3EC;
  --on-dark-2: rgba(245, 243, 236, .68);
  --on-dark-line: rgba(245, 243, 236, .22);

  --gold: #D9A441;
  --gold-ink: #7A5712;
  --gold-soft: #F6ECD2;
  --green: #2D5016;
  --green-2: #49AE68;
  --green-soft: #E6EFDF;
  --red: #AF4949;
  --red-soft: #F6E3E3;
  --bubble-user: #2C2B27;
  --accent-bg: #2C2B27;
  --on-accent: #F5F3EC;
  --on-accent-2: rgba(245, 243, 236, .68);
  --toast-action: #D9A441;

  --radius: 16px;
  --radius-s: 11px;
  --maxw: 640px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: calc(56px + var(--safe-t));
  --tabbar-h: 62px;
  --kb: 0px;
  --dock-h: 130px;
  --shadow: 0 1px 2px rgba(26, 26, 26, .05), 0 8px 24px rgba(26, 26, 26, .07);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1C1B19; --surface-2: #262522; --surface-3: #302E2A;
    --line: #2F2D29; --line-2: #403D38;
    --ink: #F2EFE9; --ink-2: #CFCBC3; --muted: #A39E95;
    --dark: #1B1A18; --hero: #2C2B27;
    --gold: #E2B054; --gold-ink: #E2B054; --gold-soft: #2D2718;
    --green: #92D4A2; --green-2: #5BBF7B; --green-soft: #1C2A1E;
    --red: #E08585; --red-soft: #2F1D1D;
    --bubble-user: #3A3833; --accent-bg: #3A3833; --toast-action: #8A6313;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1C1B19; --surface-2: #262522; --surface-3: #302E2A;
  --line: #2F2D29; --line-2: #403D38;
  --ink: #F2EFE9; --ink-2: #CFCBC3; --muted: #A39E95;
  --dark: #1B1A18; --hero: #2C2B27;
  --gold: #E2B054; --gold-ink: #E2B054; --gold-soft: #2D2718;
  --green: #92D4A2; --green-2: #5BBF7B; --green-soft: #1C2A1E;
  --red: #E08585; --red-soft: #2F1D1D;
  --bubble-user: #3A3833; --accent-bg: #3A3833; --toast-action: #8A6313;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); overscroll-behavior-y: none; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 16px/1.45 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}
/* From the home screen, iOS sizes the viewport to a page that is shorter than the screen once the keyboard
   has been up, and leaves a blank strip under the tab bar. A full screen of height always (the large
   viewport, which the keyboard does not change) keeps that from happening. */
@media (display-mode: standalone) { body { min-height: 100vh; min-height: 100lvh; } }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
a { color: var(--green); text-underline-offset: 3px; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--gold-soft); }

.ic { flex: none; vertical-align: -0.2em; }
.logo { display: block; }
.muted { color: var(--muted); }
.muted-p { color: var(--muted); font-size: 14.5px; margin: 8px 0; }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.page-title { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; margin: 6px 0 16px; }
.ok-line { display: flex; gap: 8px; align-items: center; color: var(--green); font-weight: 600; margin: 8px 0; }
.note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; margin: 10px 0; }
.note .ic { margin-top: 2px; }
.about { text-align: center; color: var(--muted); font-size: 12.5px; margin: 28px 0 8px; line-height: 1.6; }
.sheet-text { color: var(--ink-2); margin: 4px 0 14px; }

@keyframes flash { 0% { background: var(--gold-soft); box-shadow: 0 0 0 8px var(--gold-soft); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }
.flash { animation: flash 2s ease-out; border-radius: 6px; }

/* ---------------------------------------------------------------- header */

/* Fixed, not sticky: with the keyboard open iOS stops pinning sticky elements, while fixed ones follow the
   visible area. The page content starts below it. */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: var(--dark); color: var(--on-dark);
  padding-top: var(--safe-t);
}
body.kb-open .top { transform: translateY(var(--vv-top, 0px)); }
#app { padding-top: var(--header-h); }
.top-row { max-width: var(--maxw); margin: 0 auto; height: 56px; padding: 0 10px 0 16px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.brand-logo { display: grid; place-items: center; flex: none; color: var(--on-dark); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text strong { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand-text span { font-size: 12.5px; color: var(--on-dark-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.top-chip {
  min-width: 36px; height: 32px; padding: 0 9px; border-radius: 16px;
  border: 1px solid var(--on-dark-line); color: var(--on-dark);
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-align: center;
  display: inline-grid; place-items: center; position: relative;
}
.top-chip::after { content: ""; position: absolute; inset: -6px -4px; } /* a 44 pt tap area around the 32 pt chip */
.top-chip.who { background: var(--gold); color: #2C2B27; border-color: var(--gold); }

.icon-btn { width: 44px; height: 44px; border-radius: 22px; display: inline-grid; place-items: center; color: inherit; }
.icon-btn:active { background: rgba(127, 127, 127, .16); }
.icon-btn.on-dark { color: var(--on-dark); width: 40px; }

/* ---------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 160px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-align: center;
}
.tab.on { color: var(--ink); }
.tab.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
body.kb-open .tabbar { display: none; }

/* ---------------------------------------------------------------- views */

.view { max-width: var(--maxw); margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.boot { display: grid; place-items: center; min-height: 50vh; }
.boot span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--gold); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-error { text-align: center; padding: 56px 24px; display: grid; gap: 14px; justify-items: center; }
.boot-error h1 { font-size: 22px; }
.boot-error p { color: var(--muted); max-width: 32ch; }

/* ---------------------------------------------------------------- shared components */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  font-size: 15px; font-weight: 600; text-decoration: none; border: 1px solid transparent;
  white-space: nowrap; text-align: center;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-light { background: var(--on-dark); color: #2C2B27; }
.btn-ghost-dark { border-color: var(--on-dark-line); color: var(--on-dark); background: rgba(245, 243, 236, .08); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-text { color: var(--red); border-color: transparent; }
.btn:disabled { opacity: .45; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.link-btn { color: var(--green); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }

.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 28px; padding: 3px 11px; border-radius: 14px;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500; line-height: 1.2;
}
.chip-btn { min-height: 38px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; padding: 4px 14px; border-radius: 19px; white-space: nowrap; }
.chip-btn:active { background: var(--surface-2); }
.chip-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-primary:active { background: var(--ink-2); }
.chip-green { background: var(--green-soft); color: var(--green); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); }
.pill-who.who-peter { background: var(--gold-soft); color: var(--gold-ink); }
.pill-who.who-kim { background: var(--green-soft); color: var(--green); }

.seg { display: flex; gap: 2px; background: var(--surface-2); border-radius: 13px; padding: 3px; }
.seg-btn { flex: 1; min-height: 44px; padding: 0 10px; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg-small .seg-btn { min-height: 40px; font-size: 13.5px; }

.kvs { margin: 4px 0 6px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv span { color: var(--muted); flex: none; }
.kv b { font-weight: 600; text-align: right; }
.bullets { list-style: none; display: grid; gap: 8px; margin: 6px 0 10px; }
.bullets li { position: relative; padding-left: 18px; }
.bullets li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

.rows { list-style: none; margin: 6px 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 16px; color: var(--ink); }
.row-btn:active { background: var(--surface-2); }
.row-btn .ic:last-child { margin-left: auto; color: var(--muted); }
.row-when { font-size: 12.5px; color: var(--muted); flex: none; min-width: 6.5em; }
.row-title { font-weight: 600; font-size: 15.5px; }
.row-stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.row-stack small { font-size: 13px; color: var(--muted); font-weight: 400; }
.row-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.card-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.more-list { display: grid; gap: 10px; margin: 12px 0; }
.field { display: grid; gap: 6px; margin: 10px 0; font-size: 14px; font-weight: 600; }
.field input, .code-form input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--bg); font-size: 16px; font-weight: 400; }

/* ---------------------------------------------------------------- sheet, toast */

body.sheet-open, body.searching { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(20, 20, 18, .5); opacity: 0; transition: opacity .22s ease; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
  max-width: var(--maxw); margin: 0 auto;
  max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
  transform: translateY(105%); transition: transform .28s var(--ease);
  outline: none;
}
.sheet.open { transform: translateY(0); }
.sheet-grab { padding: 10px 0 2px; display: grid; place-items: center; }
.sheet-grab span { width: 38px; height: 4px; border-radius: 2px; background: var(--line-2); }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px 8px 20px; }
.sheet-heading { flex: 1; min-width: 0; padding-top: 4px; }
.sheet-heading .eyebrow { margin: 0 0 3px; }
.sheet-title { font-size: 21px; line-height: 1.2; letter-spacing: -.01em; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 20px; -webkit-overflow-scrolling: touch; }
.sheet:not(.has-foot) .sheet-body { padding-bottom: calc(20px + var(--safe-b)); }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); }
.sheet-foot .btn { flex: 1; }
.sheet-body .eyebrow:first-child { margin-top: 6px; }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 90; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
body.kb-open #toasts { bottom: calc(var(--kb) + 14px); }
/* On the Coach tab the chat dock sits above the tab bar, so toasts go above the dock. */
body[data-tab="coach"] #toasts { bottom: calc(var(--dock-h) + var(--tabbar-h) + var(--safe-b) + 8px); }
body[data-tab="coach"].kb-open #toasts { bottom: calc(var(--kb) + var(--dock-h) + 8px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 460px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast-action { font-weight: 700; color: var(--toast-action); padding: 4px 2px; }

/* ---------------------------------------------------------------- plan */

.plan-top { margin-bottom: 12px; }
.seg-person .seg-btn { min-height: 44px; font-size: 15px; }
.seg-sub { margin: 16px 0 14px; }
.seg-week { margin-bottom: 10px; }

.hero {
  position: relative; overflow: hidden;
  background: var(--hero); color: var(--on-dark);
  border-radius: 22px; padding: 20px 18px 18px;
}
.hero .eyebrow { color: var(--gold); margin: 0 0 6px; position: relative; }
.hero-art { position: absolute; right: 14px; bottom: -34px; width: 84px; height: 140px; color: var(--gold); opacity: .2; pointer-events: none; }
.hero-art .arch { width: 100%; height: 100%; }
.hero-title { font-size: 24px; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; position: relative; }
.who-inline { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 8px; background: rgba(245, 243, 236, .16); vertical-align: 2px; }
.hero-sub { margin-top: 8px; color: var(--on-dark-2); font-size: 15px; position: relative; }
.hero-count { margin-top: 10px; font-size: 15px; color: var(--on-dark-2); position: relative; }
.hero-count b { color: var(--gold); font-size: 21px; font-weight: 700; margin-left: 2px; font-variant-numeric: tabular-nums; }
.hero-place { margin-top: 8px; display: flex; gap: 6px; align-items: center; font-size: 14.5px; color: var(--on-dark); position: relative; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; }
.hero-actions .btn { min-height: 42px; padding: 0 15px; font-size: 14.5px; }
.hero-now { list-style: none; margin: 0 0 14px; padding: 0 0 10px; border-bottom: 1px solid var(--on-dark-line); position: relative; }
.hero-now button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 15px; color: var(--on-dark); }
.hero-now .tag { color: #8EE0A5; font-weight: 800; margin-right: 7px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.hero-now .rest { color: var(--on-dark-2); white-space: nowrap; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.hero-done .hero-title { font-size: 21px; }

.day-pills { display: flex; gap: 8px; margin: 4px 0 4px; }
.day-pill {
  flex: 1; min-width: 0; height: 64px; border-radius: 15px; border: 1px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  position: relative; text-align: center;
}
.day-pill span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.day-pill b { font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.day-pill.on { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--on-accent); }
.day-pill.on span { color: var(--on-accent-2); }
.day-pill.today::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.day-head { margin: 18px 0 10px; }
.day-head h2 { font-size: 22px; line-height: 1.15; letter-spacing: -.015em; }
.day-head p { margin-top: 2px; font-size: 14px; }

.welcome-card { display: grid; gap: 12px; justify-items: start; }
.welcome-card p { font-size: 15.5px; }

.uk-card { padding: 0; overflow: hidden; }
.uk-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; }
.uk-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); display: grid; place-items: center; flex: none; }
.uk-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.uk-text b { font-size: 15.5px; }
.uk-text small { color: var(--muted); font-size: 13px; }
.uk-chev { color: var(--muted); transition: transform .2s; display: grid; }
.uk-chev.open { transform: rotate(180deg); }
.uk-body { padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 15px; }

.tl { list-style: none; display: grid; gap: 8px; margin: 12px 0 0; }
.tl-row {
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: 64px; padding: 11px 12px 11px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; text-align: left;
}
.tl-row:active { background: var(--surface-2); }
.tl-time { display: flex; flex-direction: column; align-items: center; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tl-time b { font-size: 16px; font-weight: 700; }
.tl-time small { font-size: 12px; color: var(--muted); }
.tl-time b.all { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; text-align: center; color: var(--muted); }
.tl-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-title { font-size: 16px; font-weight: 600; line-height: 1.25; letter-spacing: -.005em; }
.tl-ic { color: var(--muted); margin-right: 6px; vertical-align: -2px; }
.tl-sub { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tl-status { font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.tl-status.live { color: var(--green); }
.tl-status.next { color: var(--gold-ink); }
.tl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.tl-side .chip { font-size: 12px; min-height: 24px; max-width: 118px; text-align: right; justify-content: flex-end; }

.tl-row.st-done { opacity: .52; }
.tl-row.st-live { background: var(--green-soft); border-color: var(--green-2); box-shadow: inset 4px 0 0 var(--green-2); }
.tl-row.is-next { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.tl-row.kind-meal { background: transparent; border-style: dashed; min-height: 52px; }
.tl-row.kind-meal .tl-title { font-weight: 500; color: var(--ink-2); }
.tl-row.is-tbd { background: transparent; border-style: dashed; }
.tl-row.is-tbd .tl-title { color: var(--ink-2); }

.wk { margin: 6px 0 22px; }
.wk-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 14px 0 8px; }
.wk-head h3 { font-size: 20px; letter-spacing: -.01em; }
.wk-head span { color: var(--muted); font-size: 14px; }
.wk-days { list-style: none; display: grid; gap: 8px; margin-top: 8px; }
.wk-day { display: grid; grid-template-columns: 62px minmax(0, 1fr) 20px; gap: 12px; align-items: start; width: 100%; padding: 12px 12px 12px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.wk-day:active { background: var(--surface-2); }
.wk-day.today { border-color: var(--gold); }
.wk-date { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.wk-date b { font-size: 15px; }
.wk-date span { font-size: 12.5px; color: var(--muted); }
.wk-date em { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); margin-top: 3px; }
.wk-lines { display: grid; gap: 3px; font-size: 14px; min-width: 0; }
.wk-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-line i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 7px; font-size: 13px; }
.wk-line em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.wk-line.tbd { color: var(--muted); }
.wk-more { font-size: 12.5px; color: var(--muted); }
.wk-go { color: var(--muted); align-self: center; }

.ci { padding: 0; overflow: hidden; margin: 10px 0; }
.ci-head { display: grid; grid-template-columns: 1fr 22px; gap: 2px 12px; width: 100%; padding: 14px 16px; align-items: center; }
.ci-month { grid-column: 1; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.ci-title { grid-column: 1; font-size: 17px; font-weight: 600; }
.ci-head .uk-chev { grid-column: 2; grid-row: 1 / span 2; }
.ci-body { padding: 0 16px 14px; border-top: 1px solid var(--line); }
.muted-p + .muted-p { margin-top: 0; }

/* ---------------------------------------------------------------- handbook home */

.search-bar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 16px; }
.search-bar .ic { color: var(--ink-2); }
.cont-card { position: relative; display: block; width: 100%; text-align: left; padding: 14px 44px 14px 16px; }
.cont-card .eyebrow { margin: 0 0 4px; }
.cont-card b { display: block; font-size: 17px; }
.cont-card small { color: var(--muted); font-size: 14px; }
.cont-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.hb-block { margin: 22px 0 6px; }
.blk-head h2 { font-size: 20px; letter-spacing: -.01em; }
.blk-head p { color: var(--muted); font-size: 14px; margin-top: 1px; }
.pocket-scroll { display: flex; gap: 10px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 16px 8px; scroll-snap-type: x proximity; scroll-padding: 0 16px; scrollbar-width: none; }
.pocket-scroll::-webkit-scrollbar { display: none; }
.pocket { flex: none; width: 156px; min-height: 108px; scroll-snap-align: start; padding: 14px 14px 12px; border-radius: 16px; background: var(--accent-bg); color: var(--on-accent); display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; position: relative; overflow: hidden; }
.pocket::before { content: ""; position: absolute; left: 14px; top: 14px; width: 26px; height: 3px; border-radius: 2px; background: var(--gold); }
.pocket b { font-size: 15.5px; line-height: 1.2; font-weight: 600; }
.pocket small { font-size: 12.5px; line-height: 1.3; color: var(--on-accent-2); }
.pocket:active { transform: scale(.98); }
.hb-progress { margin: 26px 0 4px; display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.hb-progress i, .prog-row i { display: block; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hb-progress b, .prog-row b { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.hb-part { margin: 20px 0; }
.part-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.part-head h2 { font-size: 20px; letter-spacing: -.01em; }
.part-head p { font-size: 13.5px; color: var(--muted); }
.part-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ch-row { display: flex; align-items: center; gap: 13px; width: 100%; padding: 11px 14px 11px 11px; }
.ch-row + .ch-row { border-top: 1px solid var(--line); }
.ch-row:active { background: var(--surface-2); }
.ch-thumb { position: relative; width: 58px; height: 58px; border-radius: 12px; overflow: hidden; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.ch-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ch-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ch-main b { font-size: 16px; line-height: 1.25; }
.ch-main small { font-size: 13.5px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ch-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ch-state { color: var(--muted); display: grid; flex: none; }
.ch-state.done { width: 26px; height: 26px; border-radius: 13px; background: var(--green-soft); color: var(--green); place-items: center; }

/* ---------------------------------------------------------------- reader */

body.reading .view[data-view="handbook"] { padding-top: 0; }
.reader-bar {
  position: sticky; top: var(--header-h); z-index: 20;
  display: flex; align-items: center; gap: 4px; height: 50px;
  margin: 0 -16px; padding: 0 10px 0 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.reader-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-prog { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.reader-prog b { display: block; height: 100%; width: 0; background: var(--gold); transition: width .12s linear; }
.reader { padding-top: 16px; }
.reader-hero { margin: 0 0 16px; border-radius: 18px; overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 2; }
.reader-hero img { width: 100%; height: 100%; object-fit: cover; }
.reader .eyebrow:first-child, .reader-hero + .eyebrow { margin: 0 0 6px; }
.reader-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.reader h1 { font-size: 30px; line-height: 1.1; letter-spacing: -.025em; margin-bottom: 8px; }
.lede { font-size: 18px; line-height: 1.4; color: var(--muted); margin-bottom: 4px; }
.toc-chips { display: flex; gap: 8px; overflow-x: auto; margin: 14px -16px 4px; padding: 2px 16px 6px; scroll-padding: 0 16px; scrollbar-width: none; }
.toc-chips::-webkit-scrollbar { display: none; }
.hb-sec { padding: 6px 0 10px; scroll-margin-top: calc(var(--header-h) + 58px); }
.hb-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.hb-sec-head h2 { font-size: 22px; line-height: 1.2; letter-spacing: -.015em; }
.star { color: var(--muted); flex: none; margin-top: -6px; }
.star.on { color: var(--gold); }
.hb-sec > * + *:not(.hb-sec-head) { margin-top: 14px; }
.hb-p { font-size: 17px; line-height: 1.58; color: var(--ink); }
.hb-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.term { color: inherit; font: inherit; text-decoration: underline dotted var(--gold); text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: help; padding: 0; display: inline; }

.hb-list { list-style: none; display: grid; gap: 9px; }
.hb-list li { position: relative; padding-left: 20px; font-size: 16.5px; line-height: 1.5; }
.hb-list li::before { content: ""; position: absolute; left: 4px; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.hb-list.check li::before { left: 3px; top: .35em; width: 6px; height: 11px; border-radius: 0; background: none; border: solid var(--green-2); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.hb-lists { display: grid; gap: 12px; }
.hb-listgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.hb-listgroup h4 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.hb-steps, .hb-stages { list-style: none; display: grid; gap: 12px; counter-reset: s; }
.hb-steps li, .hb-stages li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.n { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-bg); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.hb-steps b { display: block; font-size: 16.5px; line-height: 1.35; padding-top: 6px; }
.hb-steps p { font-size: 15.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.hb-stages b { display: block; font-size: 17px; padding: 5px 0 8px; }
.hb-quote { border-left: 4px solid var(--gold); padding: 4px 0 4px 16px; }
.hb-quote p { font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.hb-stats { display: grid; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--gold); }
.stat b { font-size: 42px; line-height: 1; letter-spacing: -.03em; color: var(--green); font-variant-numeric: tabular-nums; }
.stat span { font-size: 15px; color: var(--ink-2); line-height: 1.4; }
.hb-callout { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border-left: 4px solid var(--line-2); }
.hb-callout .co-ic { color: var(--ink-2); padding-top: 1px; }
.co-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.hb-callout b { display: block; font-size: 16px; margin-bottom: 2px; }
.hb-callout p:last-child { font-size: 16px; line-height: 1.5; }
.hb-callout.k-remember { background: var(--gold-soft); border-left-color: var(--gold); }
.hb-callout.k-remember .co-ic { color: var(--gold-ink); }
.hb-callout.k-tip { background: var(--green-soft); border-left-color: var(--green-2); }
.hb-callout.k-tip .co-ic { color: var(--green); }
.hb-callout.k-warning { background: var(--red-soft); border-left-color: var(--red); }
.hb-callout.k-warning .co-ic { color: var(--red); }

.acc-list { display: grid; gap: 8px; }
.acc { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px 10px 16px; }
.acc-head:active { background: var(--surface-2); }
.acc-num { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; margin-right: 8px; }
.acc-head .acc-num { margin-right: 0; }
.acc-title { font-weight: 600; font-size: 16.5px; flex: 1; line-height: 1.3; }
.acc-title small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.acc-chev { color: var(--muted); display: grid; transition: transform .2s; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { padding: 2px 16px 16px; display: grid; gap: 10px; }
.acc-body p { font-size: 16px; line-height: 1.55; }
.card-grid { display: grid; gap: 10px; }
.hb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 10px; }
.hb-card h4 { font-size: 17.5px; display: flex; align-items: center; gap: 0; }
.hb-card p { font-size: 16px; line-height: 1.55; }
.hb-note { font-size: 14px !important; color: var(--muted); border-top: 1px solid var(--line); padding-top: 9px; }

.hb-fig { border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.hb-fig img { width: 100%; height: auto; }
.hb-fig figcaption { padding: 9px 14px 11px; font-size: 13.5px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
.hb-fig.contain { background: transparent; text-align: center; }
.hb-fig.contain img { max-height: 320px; width: auto; margin: 0 auto; }
.hb-fig.portrait img { max-height: 480px; width: auto; margin: 0 auto; }
.hb-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hb-gallery img { border-radius: 12px; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; background: var(--surface-2); }
.hb-gallery.n2 img { aspect-ratio: 3 / 4; }
.hb-links { list-style: none; display: grid; gap: 8px; }
.hb-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15.5px; }
.hb-links a .ic { color: var(--muted); }
.hb-selling { display: grid; gap: 4px; padding: 6px 0; }
.hb-selling .lead { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin-bottom: 10px; }
.hb-selling .big { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--green); margin-top: 8px; }
.hb-selling .small { font-style: italic; color: var(--muted); font-size: 17px; }
.hb-pairs { display: grid; gap: 10px; counter-reset: p; }
.hb-pairs > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; }
.hb-pairs dt { font-size: 17px; font-weight: 700; }
.hb-pairs dd { color: var(--ink-2); font-size: 15.5px; margin-top: 2px; line-height: 1.45; }
.hb-pairs.numbered > div { counter-increment: p; position: relative; padding-left: 52px; }
.hb-pairs.numbered > div::before { content: counter(p); position: absolute; left: 14px; top: 13px; width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.hb-eq { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 14px; }
.eq-part { font-size: 17px; font-weight: 600; }
.eq-op { font-size: 22px; color: var(--gold-ink); font-weight: 700; line-height: 1; }
.eq-result { font-size: 19px; font-weight: 700; color: var(--green); }

/* sector table */
.sectors .hb-label { margin-bottom: 10px; }
.sector { border-left: 6px solid var(--sc, var(--gold)); }
.sector-code { width: 30px; height: 30px; border-radius: 9px; background: var(--sc); color: #1A1A1A; font-weight: 800; display: grid; place-items: center; flex: none; font-size: 15px; }
.sector-rows { list-style: none; display: grid; gap: 10px; }
.sector-rows li { display: grid; grid-template-columns: 34px 1fr; gap: 8px; font-size: 15.5px; line-height: 1.45; }
.sector-rows b { color: var(--muted); font-variant-numeric: tabular-nums; }
.sector-rows em { display: block; font-style: normal; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }

/* personas */
.persona-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.persona-tab { border-radius: 14px; overflow: hidden; border: 3px solid transparent; opacity: .55; transition: opacity .15s, border-color .15s; background: var(--surface-2); }
.persona-tab.on { opacity: 1; border-color: var(--gold); }
.persona-tab img { width: 100%; aspect-ratio: 260 / 308; object-fit: cover; }
.persona-panel { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.persona-panel h4 { font-size: 19px; margin-bottom: 12px; }

/* journey, trends */
.journey-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.jstage { padding: 12px 6px 10px; border-radius: 12px; text-align: center; background: var(--surface-2); color: var(--ink); display: grid; gap: 3px; min-height: 66px; align-content: center; border: 2px solid transparent; }
.jstage b { font-size: 14px; }
.jstage small { font-size: 10.5px; line-height: 1.2; color: var(--muted); }
.jstage.on { background: var(--accent-bg); color: var(--on-accent); border-color: var(--gold); }
.jstage.on small { color: var(--on-accent-2); }
.journey-panel, .trend-panel, .compare-panel { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.trend-centre { display: grid; place-items: center; margin-bottom: 12px; }
.trend-centre span { padding: 9px 22px; border: 2px dashed var(--line-2); border-radius: 14px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.trend-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.trend { padding: 9px 16px; border-radius: 20px; background: var(--surface-2); font-weight: 600; font-size: 14.5px; border: 2px solid transparent; }
.trend.on { background: var(--accent-bg); color: var(--on-accent); border-color: var(--gold); }
.compare-panel .hb-list li { padding-right: 4px; }
.with { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.is-shared::before { background: var(--green-2) !important; }

/* coffee line-up */
.bag-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.bag { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 10px 12px; display: grid; gap: 2px; text-align: left; position: relative; }
.bag:active { background: var(--surface-2); }
.bag-img { display: flex; align-items: center; justify-content: center; height: 150px; overflow: hidden; margin-bottom: 8px; border-radius: 12px; background: color-mix(in srgb, var(--disc, #ccc) 14%, var(--surface)); }
.bag-img img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.bag-img.empty { color: var(--muted); background: var(--surface-2); }
.bag b { font-size: 15.5px; }
.bag small { color: var(--muted); font-size: 13px; }
.bag.soon { opacity: .6; border-style: dashed; }
.bag-dots { margin-top: 6px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink-2); display: block; }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.bag-hero { display: flex; align-items: center; justify-content: center; height: 230px; overflow: hidden; border-radius: 16px; margin: 4px 0 6px; background: color-mix(in srgb, var(--disc, #ccc) 16%, var(--surface-2)); }
.bag-hero img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }

/* coffee compass */
.compass-svg { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto; }
.c-ring { fill: none; stroke: var(--ink); stroke-width: 5; }
.c-axis { stroke: var(--ink); stroke-width: 4; fill: none; }
.c-lab { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; fill: var(--ink); font-family: inherit; }
.bean { cursor: pointer; outline: none; }
.bean .b3 { fill: var(--bean); opacity: .38; }
.bean .b2 { fill: var(--bean); opacity: .7; }
.bean .b1 { fill: var(--bean); }
.bean .hit { fill: transparent; }
.bean text { font-size: 9.5px; fill: var(--ink); font-family: inherit; font-weight: 500; pointer-events: none; paint-order: stroke fill; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round; }
.bean.on .b3 { opacity: .8; stroke: var(--ink); stroke-width: 2.4; }
.bean.on text { font-weight: 800; }
.bean:focus-visible .b3 { stroke: var(--gold); stroke-width: 3; opacity: .8; }
.compass-detail { margin-top: 12px; min-height: 84px; }
.bean-card { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.bean-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--bean); box-shadow: 0 0 0 5px color-mix(in srgb, var(--bean) 35%, transparent); margin-top: 2px; }
.bean-card b { font-size: 17px; }
.bean-card small { margin-left: 8px; color: var(--muted); font-size: 13.5px; }
.bean-card .quad { font-weight: 700; color: var(--green); margin-top: 3px; font-size: 15px; }
.bean-meta { color: var(--ink-2); font-size: 14.5px; margin-top: 2px; }

/* reader end */
.reader-end { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
.reader-end > .btn { flex: 1 1 180px; }
.reader-nav { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.reader-nav > * { flex: 1; min-width: 0; }
.reader-nav button { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; font-weight: 600; font-size: 14.5px; line-height: 1.25; min-height: 58px; }
.reader-nav button.next { justify-content: space-between; text-align: right; }
.reader-nav small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.reader-nav .ic { flex: none; color: var(--muted); }
.sheet-reader > * + * { margin-top: 14px; }

/* ---------------------------------------------------------------- search */

.search-screen {
  position: fixed; inset: 0; z-index: 80; background: var(--bg);
  display: flex; flex-direction: column; padding-top: var(--safe-t);
  opacity: 0; transform: translateY(10px); transition: opacity .18s ease, transform .22s var(--ease);
}
.search-screen.open { opacity: 1; transform: none; }
.search-top { display: flex; align-items: center; gap: 4px; padding: 10px 8px 8px 14px; max-width: var(--maxw); width: 100%; margin: 0 auto; }
.search-field { flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 4px 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; height: 100%; -webkit-appearance: none; appearance: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field .icon-btn { width: 40px; height: 40px; }
.search-scope { max-width: var(--maxw); width: calc(100% - 28px); margin: 4px auto 6px; }
.search-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(24px + var(--safe-b)); max-width: var(--maxw); width: 100%; margin: 0 auto; }
.res-group h3 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.res-group h3 span { font-weight: 500; }
.res { display: grid; gap: 3px; width: 100%; padding: 12px 14px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.res:active { background: var(--surface-2); }
.res-ctx { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.res-title { font-size: 16px; font-weight: 600; }
.res-snip { font-size: 14.5px; color: var(--ink-2); line-height: 1.4; }
.res-snip mark, .res-title mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px var(--gold-soft); }
.more { margin: 2px 0 8px; }

/* ---------------------------------------------------------------- coach */

.view[data-view="coach"] { padding-bottom: 0; }
.coach { min-height: calc(100vh - var(--header-h) - 16px); min-height: calc(100dvh - var(--header-h) - 16px); display: flex; flex-direction: column; }
.coach-bar { position: sticky; top: var(--header-h); z-index: 15; margin: -16px -16px 0; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.coach-stat { flex: 1; min-width: 0; display: grid; gap: 6px; text-align: left; }
.coach-stat-text { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.coach-stat i { display: block; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.coach-stat b { display: block; height: 100%; background: var(--gold); border-radius: 3px; transition: width .4s var(--ease); width: 0; }
.ai-chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 calc(var(--dock-h) + var(--tabbar-h) + var(--safe-b) + 18px); flex: 1; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 94%; animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-bg); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 11px 14px; min-width: 0; font-size: 16px; line-height: 1.5; }
.bubble > * + * { margin-top: 9px; }
.msg.user .bubble { background: var(--bubble-user); color: var(--on-dark); border-color: transparent; border-radius: 18px 18px 6px 18px; }
.bubble p { font-size: 16px; }
.bubble .bullets { margin: 4px 0; }
.bubble .chip-btn { white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.25; padding-top: 7px; padding-bottom: 7px; max-width: 100%; border-radius: 18px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

.chat-dock { position: fixed; left: 0; right: 0; z-index: 35; bottom: calc(var(--tabbar-h) + var(--safe-b)); padding: 10px 14px 10px; background: linear-gradient(to top, var(--bg) 78%, color-mix(in srgb, var(--bg) 0%, transparent)); }
body.kb-open .chat-dock { bottom: var(--kb); padding-bottom: 8px; }
body.kb-open .chat-log { padding-bottom: calc(var(--dock-h) + 18px); }
.chat-quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 9px; scrollbar-width: none; max-width: var(--maxw); margin: 0 auto; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-input { display: flex; gap: 8px; max-width: var(--maxw); margin: 0 auto; }
.chat-input input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid var(--line-2); background: var(--surface); font-size: 16px; outline: none; }
.chat-input input:focus { border-color: var(--ink-2); }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }

.q-card { display: grid; gap: 10px; }
.q-card.flash { padding: 2px 0; }
.q-meta { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.q-text { font-size: 17px; font-weight: 600; line-height: 1.4; }
.blank { display: inline-block; width: 4.5em; border-bottom: 2.5px solid var(--ink); margin: 0 3px; transform: translateY(2px); }
.q-hint { font-size: 14px; color: var(--muted); display: flex; gap: 7px; align-items: center; }
.q-options { display: grid; gap: 8px; }
.q-options.two { grid-template-columns: 1fr 1fr; }
.q-opt { display: flex; gap: 11px; align-items: flex-start; width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 13px; background: var(--bg); font-size: 15.5px; line-height: 1.35; text-align: left; min-height: 48px; }
.q-options.two .q-opt { justify-content: center; text-align: center; font-weight: 600; }
.q-opt:active:not(:disabled) { background: var(--surface-2); }
.q-opt .k { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 0; }
.q-opt.right { background: var(--green-soft); border-color: var(--green-2); }
.q-opt.right .k { background: var(--green-2); color: #fff; }
.q-opt.wrong { background: var(--red-soft); border-color: var(--red); }
.q-opt.wrong .k { background: var(--red); color: #fff; }
.q-opt.struck { opacity: .4; text-decoration: line-through; }
.q-opt:disabled:not(.right):not(.wrong):not(.struck) { opacity: .55; }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.order-item { padding: 9px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--bg); font-size: 15px; font-weight: 600; }
.order-item:disabled { opacity: .3; }
.order-chosen { list-style: decimal; padding-left: 22px; display: grid; gap: 6px; margin: 4px 0; font-weight: 600; font-size: 15.5px; }
.order-chosen:empty { display: none; }
.order-chosen.right { color: var(--green); }
.order-chosen.wrong { color: var(--red); }
.order-answer { padding-left: 22px; display: grid; gap: 4px; font-size: 15px; }
.fb b { font-size: 18px; }
.fb.ok b { color: var(--green); }
.fb.no b { color: var(--red); }
.model-answer { font-size: 15px !important; background: var(--surface-2); padding: 10px 12px; border-radius: 11px; }
.score-card { display: flex; gap: 14px; align-items: center; }
.score-ring { --p: 0; width: 72px; height: 72px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.score-ring b { position: relative; font-size: 17px; font-variant-numeric: tabular-nums; }
.flash-answer { padding-top: 6px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.flash-answer .eyebrow { margin: 4px 0 0; }
.flash-a { font-size: 17px !important; font-weight: 700; color: var(--green); }
.ans-card { display: grid; gap: 4px; width: 100%; text-align: left; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 13px; background: var(--bg); }
.ans-card:active { background: var(--surface-2); }
.ans-ctx { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ans-text { font-size: 15px; line-height: 1.45; }
.prog-list { list-style: none; display: grid; gap: 6px; margin: 10px 0; }
.prog-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; width: 100%; padding: 10px 2px; align-items: center; }
.prog-row i { grid-column: 1 / -1; }
.prog-name { font-weight: 600; font-size: 15px; }
.prog-n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- more */

.set { margin: 14px 0; }
.set .eyebrow { margin: 0 0 10px; }
.set .seg { margin-bottom: 4px; }
.install-steps { list-style: none; display: grid; gap: 10px; margin: 12px 0; }
.install-steps li { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; }
.install-steps li span { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; }
.code-form { display: flex; gap: 8px; margin: 12px 0 6px; }
.code-form input { flex: 1; }
.adv summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 28px; display: flex; align-items: center; }
.adv-body { margin-top: 10px; }
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 16px; }
.who-btn { display: grid; gap: 2px; padding: 18px 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--bg); text-align: center; }
.who-btn b { font-size: 22px; letter-spacing: -.01em; }
.who-btn small { color: var(--muted); font-size: 13.5px; }
.who-btn.both { grid-column: 1 / -1; padding: 14px; }
.who-btn.both b { font-size: 18px; }
.who-btn.on, .who-btn:active { border-color: var(--gold); background: var(--gold-soft); }
.who-lang { margin-bottom: 6px; }

@media (min-width: 700px) {
  .view { padding-top: 24px; }
  .hero-title { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .top, .tabbar, .chat-dock { display: none !important; }
  #app { padding-top: 0; }
}
