/* UnBlink dashboard. Dark-first; light theme follows the device unless chosen in Settings.
   Layout: phones get a bottom tab bar and sheets; >= 1024px gets a rail, the main view and a detail pane. */

@font-face {
  font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/instrument-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/instrument-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url(/static/fonts/geist-mono-latin.woff2) format("woff2");
}

@layer tokens, base, layout, components, views, utilities;

@layer tokens {
  :root {
    --bg: oklch(0.165 0.01 255);
    --rail: oklch(0.145 0.009 255);
    --raised: oklch(0.205 0.012 255);
    --raised-2: oklch(0.245 0.013 255);
    --line: oklch(0.31 0.012 255);
    --line-soft: oklch(0.26 0.011 255);
    --fg: oklch(0.96 0.004 255);
    --muted: oklch(0.7 0.014 255);
    --faint: oklch(0.55 0.014 255);
    --accent: oklch(0.8 0.11 210);
    --on-accent: oklch(0.2 0.03 220);
    --person: oklch(0.82 0.14 75);
    --vehicle: oklch(0.76 0.11 245);
    --animal: oklch(0.76 0.12 305);
    --ok: oklch(0.78 0.13 155);
    --alert: oklch(0.7 0.17 28);
    --scrim: oklch(0.08 0.01 255 / 0.62);
    --glass: oklch(0.165 0.01 255 / 0.78);
    --shadow: 0 24px 60px -28px oklch(0.05 0.02 255 / 0.8);

    --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
    --t-xs: 0.75rem; --t-s: 0.844rem; --t-m: 0.94rem; --t-l: 1.125rem;
    --t-xl: clamp(1.25rem, 1rem + 1vw, 1.4rem); --t-2xl: clamp(1.6rem, 1.2rem + 1.6vw, 1.95rem);
    --r-s: 8px; --r-m: 14px; --r-l: 22px;
    --tab-h: 64px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    color-scheme: dark;
  }
  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
      --bg: oklch(0.975 0.004 255); --rail: oklch(0.955 0.005 255);
      --raised: oklch(1 0 0); --raised-2: oklch(0.955 0.006 255);
      --line: oklch(0.88 0.008 255); --line-soft: oklch(0.92 0.006 255);
      --fg: oklch(0.22 0.015 255); --muted: oklch(0.48 0.015 255); --faint: oklch(0.62 0.012 255);
      --accent: oklch(0.52 0.13 228); --on-accent: oklch(0.99 0 0);
      --person: oklch(0.6 0.15 62); --vehicle: oklch(0.52 0.14 250); --animal: oklch(0.52 0.15 305);
      --ok: oklch(0.58 0.14 155); --alert: oklch(0.58 0.19 28);
      --scrim: oklch(0.2 0.02 255 / 0.4); --glass: oklch(0.975 0.004 255 / 0.8);
      --shadow: 0 24px 60px -30px oklch(0.3 0.03 255 / 0.45);
      color-scheme: light;
    }
  }
  :root[data-theme="light"] {
    --bg: oklch(0.975 0.004 255); --rail: oklch(0.955 0.005 255);
    --raised: oklch(1 0 0); --raised-2: oklch(0.955 0.006 255);
    --line: oklch(0.88 0.008 255); --line-soft: oklch(0.92 0.006 255);
    --fg: oklch(0.22 0.015 255); --muted: oklch(0.48 0.015 255); --faint: oklch(0.62 0.012 255);
    --accent: oklch(0.52 0.13 228); --on-accent: oklch(0.99 0 0);
    --person: oklch(0.6 0.15 62); --vehicle: oklch(0.52 0.14 250); --animal: oklch(0.52 0.15 305);
    --ok: oklch(0.58 0.14 155); --alert: oklch(0.58 0.19 28);
    --scrim: oklch(0.2 0.02 255 / 0.4); --glass: oklch(0.975 0.004 255 / 0.8);
    --shadow: 0 24px 60px -30px oklch(0.3 0.03 255 / 0.45);
    color-scheme: light;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; height: 100%; }
  body {
    margin: 0; min-height: 100%; background: var(--bg); color: var(--fg);
    font: 400 var(--t-m)/1.45 var(--sans); -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
  }
  h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; letter-spacing: -0.012em; }
  p { margin: 0; }
  img, video { max-width: 100%; display: block; }
  button, input, select { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  a { color: var(--accent); text-underline-offset: 2px; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
  [hidden] { display: none !important; }
  ::selection { background: color-mix(in oklch, var(--accent) 35%, transparent); }
}

@layer layout {
  .shell { min-height: 100dvh; }
  .main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px); min-width: 0; }
  .view { max-width: 760px; margin-inline: auto; padding-inline: 16px; }
  .view-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    padding-block: calc(18px + env(safe-area-inset-top, 0px)) 10px;
  }
  .view-head h1 { font-size: var(--t-2xl); font-weight: 650; }
  .eyebrow { font: 500 var(--t-xs)/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }

  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line-soft);
  }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0; font-size: 0.7rem; font-weight: 500; color: var(--muted); border-radius: 12px; text-decoration: none; }
  .tab svg { width: 22px; height: 22px; }
  .tab[aria-current="page"] { color: var(--accent); }

  .rail { display: none; }
  .detail { display: none; }

  @media (min-width: 1024px) {
    .shell { display: grid; grid-template-columns: 216px minmax(0, 1fr) minmax(340px, 400px); height: 100dvh; }
    .tabbar { display: none; }
    .main { padding-bottom: 32px; overflow-y: auto; }
    .rail {
      display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; background: var(--rail);
      border-right: 1px solid var(--line-soft); overflow-y: auto;
    }
    .rail .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.02rem; padding: 4px 10px 18px; }
    .rail .brand img { width: 24px; height: 24px; }
    .rail a {
      display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted);
      text-decoration: none; font-weight: 500;
    }
    .rail a svg { width: 18px; height: 18px; }
    .rail a:hover { background: var(--raised); color: var(--fg); }
    .rail a[aria-current="page"] { background: var(--raised); color: var(--fg); }
    .rail .kbd { margin-left: auto; }
    .rail .search-btn { margin: 0 0 14px; }
    .rail .foot { margin-top: auto; padding: 10px; color: var(--faint); font-size: var(--t-xs); }
    .detail { display: block; border-left: 1px solid var(--line-soft); overflow-y: auto; background: var(--bg); }
    .detail-empty { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; gap: 6px; color: var(--muted); padding: 24px; }
    .detail-empty svg { width: 26px; height: 26px; opacity: 0.6; margin-bottom: 4px; }
    .view-head .icon-btn.search { display: none; }
    .view { max-width: 980px; padding-inline: 28px; }
    .sheet-wrap.player-sheet { display: none; }
  }
}

@layer components {
  .mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: 0; font-variant-numeric: tabular-nums; }
  .muted { color: var(--muted); }
  .small { font-size: var(--t-s); }

  .icon-btn {
    width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
    background: var(--raised); border: 1px solid var(--line-soft); color: var(--fg);
  }
  .icon-btn svg { width: 18px; height: 18px; }
  .icon-btn:hover { background: var(--raised-2); }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px;
    padding: 8px 16px; border-radius: 12px; font-weight: 600; background: var(--raised-2);
    border: 1px solid var(--line-soft); color: var(--fg); text-decoration: none;
  }
  .btn:hover { border-color: var(--line); }
  .btn svg { width: 17px; height: 17px; }
  .btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
  .btn.danger { color: var(--alert); }
  .btn.ghost { background: none; border-color: transparent; color: var(--accent); padding-inline: 6px; }
  .btn:disabled { opacity: 0.5; cursor: default; }
  .btn.block { width: 100%; }

  .kbd { font: 400 0.68rem/1 var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; color: var(--faint); }

  .card { background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--r-m); }
  .section { margin-top: 26px; }
  .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
  .section-head h2 { font-size: var(--t-l); font-weight: 650; }
  .section-head .btn.ghost { min-height: 0; font-size: var(--t-s); }

  .tag {
    display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 600; line-height: 1;
    padding: 4px 7px; border-radius: 6px; background: var(--raised-2); color: var(--muted); white-space: nowrap;
  }
  .tag.person { color: var(--person); background: color-mix(in oklch, var(--person) 15%, transparent); }
  .tag.vehicle { color: var(--vehicle); background: color-mix(in oklch, var(--vehicle) 15%, transparent); }
  .tag.animal { color: var(--animal); background: color-mix(in oklch, var(--animal) 15%, transparent); }
  .tag.unusual { color: var(--alert); background: color-mix(in oklch, var(--alert) 15%, transparent); }
  .tag.face { color: var(--accent); background: color-mix(in oklch, var(--accent) 15%, transparent); }
  .tags { display: flex; flex-wrap: wrap; gap: 4px; }

  .chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
    background: var(--raised); border: 1px solid var(--line-soft); font-size: var(--t-s); font-weight: 500; white-space: nowrap;
  }
  .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in oklch, var(--accent) 10%, var(--raised)); }
  .chip .x { opacity: 0.7; }
  .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }

  .seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--raised-2); border: 1px solid var(--line-soft); }
  .seg button { padding: 6px 11px; border-radius: 8px; font-size: var(--t-s); font-weight: 500; color: var(--muted); }
  .seg button[aria-pressed="true"] { background: var(--raised); color: var(--fg); box-shadow: 0 1px 2px oklch(0 0 0 / 0.25); }

  .thumb { position: relative; aspect-ratio: 16 / 10; background: var(--raised-2); overflow: hidden; }
  .thumb img { width: 100%; height: 100%; object-fit: cover; }
  .thumb .stamp {
    position: absolute; left: 6px; bottom: 6px; font: 500 0.66rem/1 var(--mono); color: oklch(0.98 0 0);
    background: oklch(0.1 0 0 / 0.5); padding: 4px 6px; border-radius: 6px; backdrop-filter: blur(6px);
  }

  .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
  .dot.ok { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in oklch, var(--ok) 20%, transparent); }
  .dot.off { background: var(--alert); box-shadow: 0 0 0 4px color-mix(in oklch, var(--alert) 20%, transparent); }

  .pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); padding: 5px 9px; border-radius: 999px; background: var(--raised-2); color: var(--muted); }
  .pill.warn { color: var(--person); background: color-mix(in oklch, var(--person) 13%, transparent); }
  .pill.bad { color: var(--alert); background: color-mix(in oklch, var(--alert) 13%, transparent); }
  .pills { display: flex; flex-wrap: wrap; gap: 6px; }

  /* press-and-hold */
  .hold {
    position: relative; overflow: hidden; width: 100%; min-height: 46px; border-radius: 13px; font-weight: 600;
    background: var(--raised-2); border: 1px solid var(--line-soft); user-select: none; -webkit-user-select: none; touch-action: none;
  }
  .hold .fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0)); background: color-mix(in oklch, var(--accent) 32%, transparent); }
  .hold span { position: relative; }
  .hold.busy { opacity: 0.7; }

  /* event rows */
  .events { display: grid; gap: 2px; }
  .event {
    display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left;
    padding: 8px; margin-inline: -8px; border-radius: 12px; width: calc(100% + 16px);
  }
  .event:hover, .event.on { background: var(--raised); }
  .event .thumb { border-radius: 10px; aspect-ratio: 16 / 11; }
  .event .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .event .sub { display: grid; gap: 5px; min-width: 0; }
  .event .when { align-self: start; padding-top: 2px; color: var(--muted); }
  .hour { font: 500 var(--t-xs)/1 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 0 6px; }

  .empty { text-align: center; color: var(--muted); padding: 40px 12px; display: grid; gap: 6px; justify-items: center; }
  .empty svg { width: 28px; height: 28px; opacity: 0.6; }

  /* sheets (phones) */
  .sheet-wrap { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; }
  .sheet-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade 0.2s var(--ease); }
  .sheet {
    position: relative; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
    background: var(--bg); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: var(--shadow);
    padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px)); animation: rise 0.28s var(--ease);
    width: 100%; max-width: 640px; margin-inline: auto;
  }
  .sheet.full { height: calc(100dvh - 12px - env(safe-area-inset-top, 0px)); }
  .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 6px; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0 12px; }
  .sheet-head h3 { font-size: var(--t-l); font-weight: 650; }
  @media (min-width: 700px) {
    .sheet-wrap { align-items: center; padding: 24px; }
    .sheet { border-radius: var(--r-l); padding-bottom: 20px; }
    .sheet.full { height: auto; max-height: calc(100dvh - 48px); }
  }

  .field { display: grid; gap: 6px; font-size: var(--t-s); color: var(--muted); }
  .input {
    width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px; font-size: 1rem; color: var(--fg);
    background: var(--raised); border: 1px solid var(--line);
  }
  .input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
  input[type="time"].input { min-height: 40px; padding: 6px 10px; width: auto; }

  .switch { position: relative; width: 44px; height: 26px; flex: none; }
  .switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
  .switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--raised-2); border: 1px solid var(--line); transition: background 0.2s; }
  .switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); transition: transform 0.2s var(--ease); }
  .switch input:checked + i { background: var(--accent); border-color: transparent; }
  .switch input:checked + i::after { transform: translateX(18px); background: var(--on-accent); }
  .switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

  .toast {
    position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px;
    font-weight: 600; font-size: var(--t-s); box-shadow: var(--shadow); animation: rise 0.25s var(--ease); max-width: calc(100vw - 32px);
  }
  @media (min-width: 1024px) { .toast { bottom: 24px; } }

  .face-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--raised-2); }
  .avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--raised-2); flex: none; }

  .list { display: grid; }
  .row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-soft); min-width: 0; }
  .row:first-child { border-top: 0; }
  .row .grow { flex: 1; min-width: 0; }
  .row .title { font-weight: 600; }
}

@layer views {
  /* home */
  .arm { padding: 16px; display: grid; gap: 14px; }
  .arm + .arm { margin-top: 10px; }
  .arm-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .arm-state { display: flex; align-items: center; gap: 10px; font-size: var(--t-xl); font-weight: 650; }
  .cams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  @media (min-width: 640px) { .cams { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  .cam { overflow: hidden; text-align: left; display: block; width: 100%; }
  .cam .meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 600; gap: 6px; }
  .cam .meta .mono { color: var(--muted); font-weight: 400; }
  .cam .batt { color: var(--person); font-size: var(--t-xs); font-weight: 600; }

  /* timeline */
  .days { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; scroll-snap-type: x proximity; }
  .days::-webkit-scrollbar { display: none; }
  .day {
    flex: none; min-width: 52px; display: grid; justify-items: center; gap: 2px; padding: 7px 8px; border-radius: 12px;
    color: var(--muted); font-size: var(--t-xs); scroll-snap-align: end;
  }
  .day b { font-size: 1.02rem; color: var(--fg); font-weight: 650; }
  .day[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
  .day[aria-pressed="true"] b { color: var(--on-accent); }
  .day.range { min-width: 64px; }
  .filters { display: grid; gap: 8px; margin-top: 10px; }
  .lanes { margin-top: 14px; padding: 12px 12px 10px; display: grid; gap: 8px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
  .lanes-grid { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; }
  .lane-names { display: grid; gap: 8px; font-size: var(--t-xs); color: var(--muted); }
  .lane-names span { height: 16px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar { position: relative; height: 16px; border-radius: 5px; background: var(--raised-2); }
  .bar .tick { position: absolute; top: 2px; bottom: 2px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--faint); padding: 0; }
  .bar .tick.person { background: var(--person); }
  .bar .tick.vehicle { background: var(--vehicle); }
  .bar .tick.animal { background: var(--animal); }
  .bar .tick.unusual { background: var(--alert); }
  .scale { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; font: 400 0.64rem/1 var(--mono); color: var(--faint); }
  .scale div { display: flex; justify-content: space-between; }
  .bars { position: relative; display: grid; gap: 8px; }
  .cursor { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--fg); border-radius: 1px; pointer-events: none; }
  .cursor b { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font: 500 0.66rem/1 var(--mono); background: var(--fg); color: var(--bg); padding: 3px 5px; border-radius: 5px; }
  .legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--t-xs); color: var(--muted); padding-left: 78px; }
  .legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

  /* player */
  .player { display: grid; gap: 12px; padding-block: 4px 16px; }
  .detail .player { padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 24px; }
  .player-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .player-head h3 { font-size: var(--t-l); font-weight: 650; }
  .video-box { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
  .video-box video { width: 100%; height: 100%; object-fit: contain; }
  .video-box svg.boxes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
  .video-box .tap { position: absolute; inset: 0; }
  .video-box .big-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 58px; height: 58px; border-radius: 50%;
    display: grid; place-items: center; background: oklch(0.1 0 0 / 0.5); color: #fff; backdrop-filter: blur(8px); pointer-events: none;
  }
  .video-box .big-play svg { width: 24px; height: 24px; }
  .scrub { position: relative; height: 34px; border-radius: 9px; background: var(--raised); border: 1px solid var(--line-soft); touch-action: none; cursor: pointer; }
  .scrub .done { position: absolute; inset: 0 auto 0 0; background: color-mix(in oklch, var(--fg) 8%, transparent); border-radius: 9px 0 0 9px; pointer-events: none; }
  .scrub i { position: absolute; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; pointer-events: none; }
  .scrub i.person { background: var(--person); }
  .scrub i.vehicle { background: var(--vehicle); }
  .scrub i.animal { background: var(--animal); }
  .scrub .head { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--fg); pointer-events: none; }
  .controls { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
  .controls .icon-btn { width: 44px; height: 44px; }
  .controls .icon-btn.big { width: 54px; height: 54px; background: var(--fg); color: var(--bg); border: 0; }
  .controls .time { font: 400 var(--t-xs)/1 var(--mono); color: var(--muted); min-width: 74px; text-align: center; }
  .angles { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .angle { flex: none; width: 112px; border-radius: 11px; overflow: hidden; background: var(--raised); border: 1px solid var(--line-soft); text-align: left; }
  .angle[aria-pressed="true"] { border-color: var(--accent); }
  .angle .cap { padding: 5px 8px; font-size: var(--t-xs); font-weight: 600; display: flex; justify-content: space-between; }
  .faces-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
  .face-chip { flex: none; display: grid; gap: 4px; width: 76px; text-align: center; font-size: var(--t-xs); font-weight: 600; }
  .face-chip img { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; background: var(--raised-2); }
  .face-chip .guess { color: var(--muted); font-weight: 500; }
  .sub-head { font: 500 var(--t-xs)/1 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }

  /* people */
  .review { display: grid; gap: 12px; max-width: 380px; margin-inline: auto; }
  .review-card { overflow: hidden; border-radius: var(--r-l); box-shadow: var(--shadow); touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform 0.25s var(--ease), opacity 0.25s; }
  .review-card .info { padding: 14px 16px; display: grid; gap: 4px; }
  .review-card .q { font-size: var(--t-xl); font-weight: 650; }
  .review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .review-actions .wide { grid-column: 1 / -1; }
  .people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .person-card { display: flex; align-items: center; gap: 10px; padding: 10px; text-align: left; width: 100%; }
  .person-card .grow { min-width: 0; }
  .person-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .faces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .faces-grid img { border-radius: 12px; }
  .name-choices { display: flex; flex-wrap: wrap; gap: 6px; }

  /* settings */
  .rule { padding: 14px; display: grid; gap: 12px; }
  .rule + .rule { margin-top: 10px; }
  .rule-top { display: flex; gap: 8px; align-items: center; }
  .rule-top .input { font-weight: 600; }
  .rule-line { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: center; font-size: var(--t-s); color: var(--muted); }
  .rule-line .chips { flex-wrap: wrap; }
  .hours { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--fg); }
  .save-bar {
    position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); z-index: 5; margin-top: 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px;
    border-radius: 14px; background: var(--fg); color: var(--bg); box-shadow: var(--shadow);
  }
  @media (min-width: 1024px) { .save-bar { bottom: 16px; } }
  .save-bar .btn { background: var(--bg); color: var(--fg); border: 0; }
  .kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: var(--t-s); }
  .kv dt { color: var(--muted); }
  .kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 0.86em; }

  /* search */
  .palette { padding-top: 6px; }
  .palette .input { font-size: 1.05rem; }
  .parsed { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; min-height: 28px; }
  .suggest { display: grid; gap: 2px; }
  .suggest button { text-align: left; padding: 10px 12px; border-radius: 10px; display: flex; justify-content: space-between; gap: 10px; }
  .suggest button:hover, .suggest button:focus-visible { background: var(--raised); }
  .suggest svg { width: 16px; height: 16px; color: var(--faint); }

  /* login */
  .login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
  .login { width: min(380px, 100%); display: grid; gap: 14px; padding: 26px 22px; }
  .login .brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 1.35rem; margin-bottom: 6px; }
  .login .brand img { width: 32px; height: 32px; }
  .login .error { color: var(--alert); min-height: 1.3em; font-size: var(--t-s); }
}

@layer utilities {
  .stack { display: grid; gap: 10px; }
  .between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .spacer { flex: 1; }
}

@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
