/* Ari-Up — styles. Colours come from the supplied artwork: Ari's navy sky, sneaker orange, pillow cream. */

:root {
  color-scheme: light;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;

  /* brand */
  --sky: #0A2D50;
  --sky-raised: #10385F;
  --spine-off: #2A5078;
  --sneaker: #F28C28;
  --pillow: #F6EBD9;
  --pillow-2: #C9D6E4;
  --ink: #13203B;
  --bark: #8A4A1F;
  --spine: #B8612A;
  --on-navy-line: #6F93B8;
  --on-navy-link: #F6A55A;

  /* light theme */
  --bg: #FBF7F0;
  --surface: #FFFDF9;
  --text: #13203B;
  --text-2: #3F4B63;
  --text-3: #5B6579;
  --line: #E7DCCB;
  --line-strong: #CDBDA3;
  --field-border: #8F7A5C;
  --link: #8A4A1F;
  --dot-off: #F1E7D6;
  --dot-ring: #8F7A5C;
  --dot-on-ring: #B8612A;
  --switch-off: #EADFCD;
  --switch-on: #13203B;
  --knob: #FFFDF9;
  --seg-on-bg: #13203B;
  --seg-on-text: #FFFDF9;
  --mark: #B8612A;
  --mark-2: #7C8597;
  --grid: #E9E0D2;
  --safety-bg: #FCEFE1;
  --safety-line: #D9A270;
  --tip-bg: #F3ECE0;
  --danger: #A3311E;
  --focus: #13203B;
  --toast-bg: #13203B;
  --toast-text: #FFFDF9;
  --tab-pill: #F28C28;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #061D33;
    --surface: #0A2D50;
    --text: #F6EBD9;
    --text-2: #C9D6E4;
    --text-3: #A9B8C9;
    --line: #1C426A;
    --line-strong: #2C5680;
    --field-border: #6F93B8;
    --link: #F6A55A;
    --dot-off: #12385F;
    --dot-ring: #6F93B8;
    --dot-on-ring: #F28C28;
    --switch-off: #12385F;
    --switch-on: #F28C28;
    --knob: #F6EBD9;
    --seg-on-bg: #F6EBD9;
    --seg-on-text: #0A2D50;
    --mark: #F28C28;
    --mark-2: #8FA7C2;
    --grid: #163C63;
    --safety-bg: #2B2A2E;
    --safety-line: #D9A270;
    --tip-bg: #0E3459;
    --danger: #FF8A70;
    --focus: #F28C28;
    --toast-bg: #F6EBD9;
    --toast-text: #0A2D50;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061D33;
  --surface: #0A2D50;
  --text: #F6EBD9;
  --text-2: #C9D6E4;
  --text-3: #A9B8C9;
  --line: #1C426A;
  --line-strong: #2C5680;
  --field-border: #6F93B8;
  --link: #F6A55A;
  --dot-off: #12385F;
  --dot-ring: #6F93B8;
  --dot-on-ring: #F28C28;
  --switch-off: #12385F;
  --switch-on: #F28C28;
  --knob: #F6EBD9;
  --seg-on-bg: #F6EBD9;
  --seg-on-text: #0A2D50;
  --mark: #F28C28;
  --mark-2: #8FA7C2;
  --grid: #163C63;
  --safety-bg: #2B2A2E;
  --safety-line: #D9A270;
  --tip-bg: #0E3459;
  --danger: #FF8A70;
  --focus: #F28C28;
  --toast-bg: #F6EBD9;
  --toast-text: #0A2D50;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  /* keep focused fields clear of the fixed tab bar (WCAG 2.4.11) */
  scroll-padding-top: 16px;
  scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
body.is-welcome { background: var(--sky); }
#main { min-height: 100dvh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); outline: none; }
body.is-welcome #main { padding-bottom: 0; }
h1, h2, h3 { line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
p { margin: 8px 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hero :focus-visible, .welcome :focus-visible, .hero-lite :focus-visible { outline-color: var(--sneaker); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -80px; z-index: 50;
  background: var(--toast-bg); color: var(--toast-text); padding: 10px 14px; border-radius: 10px; font-weight: 700;
}
.skip:focus { top: calc(env(safe-area-inset-top) + 8px); }

.screen { max-width: 600px; margin: 0 auto; padding: 4px 16px 24px; }
.hint { color: var(--text-3); font-size: 0.95rem; }
.muted { color: var(--text-3); }
.small { font-size: 0.875rem; }
.lead { font-size: 1.1rem; font-weight: 700; }
.ico { width: 24px; height: 24px; flex: none; }
.ico-s { width: 18px; height: 18px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- hero (Ari's sky) ---------- */
.hero {
  background: var(--sky);
  color: var(--pillow);
  padding: calc(env(safe-area-inset-top) + 6px) 12px 22px;
  text-align: center;
}
.hero-top, .hero .day-nav, .hero-lite > * { max-width: 600px; margin-left: auto; margin-right: auto; }
.wordmark { margin: 4px 0 0 4px; text-align: left; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.01em; }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-label { margin: 0; font-size: 1.55rem; font-weight: 800; display: flex; flex-direction: column; align-items: center; }
.day-date { font-size: 0.95rem; font-weight: 600; color: var(--pillow-2); }
.hero a { color: inherit; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 22px;
  border: 0; background: transparent; color: inherit; flex: none; text-decoration: none;
}
.icon-btn:hover { background: rgba(127, 150, 180, 0.16); }
.icon-btn.is-placeholder { visibility: hidden; }

.meter { display: block; width: 100%; max-width: 380px; height: auto; margin: -6px auto 0; }
.spike {
  fill: var(--spine-off); stroke: var(--spine-off); stroke-width: 2; stroke-linejoin: round;
  transition: fill 0.25s ease, stroke 0.25s ease;
  transform-box: fill-box; transform-origin: 50% 50%;
}
.spike.on { fill: var(--sneaker); stroke: var(--sneaker); }
.spike.pop { animation: spike-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes spike-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.hero-count { margin: -8px 0 0; color: var(--pillow-2); font-size: 1rem; }
.hero-count strong { display: block; color: var(--pillow); font-size: 3.25rem; font-weight: 800; line-height: 1; }
.ari-line { margin: 10px auto 0; max-width: 30ch; font-size: 1.05rem; color: var(--pillow); }

.hero-lite { padding-bottom: 16px; }
.hero-sub { margin: 6px 0 0; color: var(--pillow-2); }

/* ---------- blocks ---------- */
.block { margin-top: 28px; }
.block > h2, .block-head h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 800; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.callout { background: var(--tip-bg); border-radius: 14px; padding: 12px 14px; }
.callout.safety, .safety-mini {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--safety-bg); border: 1.5px solid var(--safety-line); border-radius: 14px; padding: 12px 14px;
}
.callout.safety p { margin: 0 0 6px; }
.row-note { grid-column: 1 / -1; display: flex; gap: 6px; align-items: flex-start; margin: 2px 0 0; font-size: 0.9rem; color: var(--text-2); }

/* ---------- food groups ---------- */
.groups { list-style: none; margin: 6px 0 0; padding: 0; border-top: 1px solid var(--line); }
.grow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.g-main { min-width: 0; }
.g-name {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; margin: 0;
  background: none; border: 0; font-weight: 800; text-align: left; color: var(--text); min-height: 34px; position: relative;
}
.g-name::after { content: ""; position: absolute; inset: -5px 0; } /* 44 px touch area, compact look */
.g-name .ico-s { color: var(--text-3); }
.g-hint { display: block; color: var(--text-3); font-size: 0.85rem; line-height: 1.35; }
.dots { display: flex; gap: 7px; }
.dot {
  position: relative; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 2px solid var(--dot-ring); background: var(--dot-off);
  transition: background-color 0.15s ease;
}
.dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.dot.on { background: var(--sneaker); border-color: var(--dot-on-ring); }
@media (max-width: 370px) {
  .grow { grid-template-columns: 1fr; }
  .dots { margin-top: 4px; }
}

.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1.5px solid var(--field-border); border-radius: 24px; padding: 2px; }
.step { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 20px; border: 0; background: transparent; color: var(--text); }
.step:disabled { opacity: 0.35; cursor: default; }
.stepper output { min-width: 2.2ch; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- segmented choices (native radios) ---------- */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.seg input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg label {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--field-border); border-radius: 22px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.seg input:checked + label { background: var(--seg-on-bg); color: var(--seg-on-text); border-color: var(--seg-on-bg); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg-field { border: 0; padding: 0; margin: 8px 0; }
.seg-field legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.meal { border: 0; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meal legend { font-weight: 800; padding: 0; margin-bottom: 6px; }
.meal .seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.meal .seg label { justify-content: center; text-align: center; padding: 6px 4px; font-size: 0.9rem; line-height: 1.15; }

/* ---------- habits ---------- */
.habit { padding: 14px 0; border-bottom: 1px solid var(--line); }
.habit:first-of-type { border-top: 1px solid var(--line); }
.habit h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1.1rem; font-weight: 800; }
.h-sum { margin-left: auto; font-weight: 700; font-size: 0.95rem; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 0.95rem; }
.field small { font-weight: 600; color: var(--text-3); }
.field input, .field select, textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; font-size: 1.0625rem;
  border: 1.5px solid var(--field-border); border-radius: 12px; background: var(--surface); color: var(--text);
}
textarea { resize: vertical; line-height: 1.4; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.field.inline input, .field.inline select { width: auto; min-width: 128px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; padding: 0; }
.chip-item { display: flex; }
.chip {
  display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 10px;
  min-height: 48px; padding: 6px 12px; text-align: left;
  border: 1.5px solid var(--field-border); border-radius: 14px; background: var(--surface); color: var(--text);
}
.chip-name { font-weight: 800; font-size: 0.95rem; grid-column: 1; }
.chip-meta { font-size: 0.8rem; color: var(--text-3); grid-column: 1; }
.chip-count { grid-column: 2; grid-row: 1 / span 2; font-weight: 800; font-variant-numeric: tabular-nums; }
.chip.has { background: var(--tip-bg); border-color: var(--dot-on-ring); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.chip-minus {
  display: grid; place-items: center; min-width: 44px; padding: 0;
  border: 1.5px solid var(--dot-on-ring); border-left: 0; border-radius: 0 14px 14px 0;
  background: var(--tip-bg); color: var(--text);
}

.safety-qs { border: 0; padding: 0; margin: 0; min-width: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.switch-row label { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 12px 0; cursor: pointer; }
.switch-row.is-disabled label { cursor: default; }
.sw-label { display: block; font-weight: 700; }
.sw-desc { display: block; font-size: 0.875rem; color: var(--text-3); }
input[type="checkbox"][role="switch"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 0;
  width: 54px; height: 32px; border-radius: 16px; border: 2px solid var(--field-border);
  background: var(--switch-off); cursor: pointer; transition: background-color 0.2s ease;
}
input[type="checkbox"][role="switch"]::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--knob); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: transform 0.2s ease;
}
input[type="checkbox"][role="switch"]:checked { background: var(--switch-on); border-color: var(--switch-on); }
input[type="checkbox"][role="switch"]:checked::before { transform: translateX(22px); background: var(--bg); }
input[type="checkbox"][role="switch"]:disabled { opacity: 0.45; cursor: default; }

.checks { list-style: none; margin: 4px 0 0; padding: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--switch-on); }

/* ---------- Ari's notes & focus ---------- */
.note { margin: 10px 0; padding: 14px 16px; border-radius: 16px; background: var(--tip-bg); }
.note.safety { background: var(--safety-bg); border: 1.5px solid var(--safety-line); }
.note h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1.05rem; font-weight: 800; }
.note p { margin: 4px 0; }
.note details summary, .chart-table summary, .pick-focus summary {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--link); font-weight: 700; cursor: pointer;
}
.focus-list { list-style: none; margin: 6px 0; padding: 0; }
.focus-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.focus-list li > div { flex: 1; }
.focus-list p { margin: 2px 0 0; color: var(--text-2); }
.pill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0; }
.pill { min-height: 44px; padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--field-border); background: var(--surface); color: var(--text); font-weight: 700; }

.install { display: flex; align-items: flex-start; gap: 6px; margin-top: 16px; padding: 10px 4px 10px 14px; border-radius: 14px; background: var(--tip-bg); }
.install p { flex: 1; margin: 4px 0; }
.motto-foot { margin: 40px 0 8px; text-align: center; font-weight: 800; color: var(--text-3); }
.catchphrase { margin: 24px auto 8px; max-width: 34ch; text-align: center; color: var(--text-2); }

/* ---------- week ---------- */
.tiles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 16px 0 0;
  background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.tile { background: var(--surface); padding: 12px 14px; }
.tile dt { font-size: 0.875rem; font-weight: 700; color: var(--text-3); }
.tile dd { margin: 0; }
.tile-value { margin-top: 2px; font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.tile-sub { font-size: 0.85rem; color: var(--text-2); }
.wlist { list-style: none; margin: 6px 0 0; padding: 0; }
.wrow { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.4rem; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.whead { padding: 0 0 2px; border-bottom: 0; }
.w-name { font-weight: 700; min-width: 0; }
.w-dots { display: grid; grid-template-columns: repeat(7, 16px); gap: 5px; justify-items: center; }
.w-dots.is-count { display: block; text-align: center; }
.wd-head { font-size: 0.75rem; font-weight: 700; color: var(--text-3); }
.wd { display: block; width: 14px; height: 14px; border-radius: 50%; }
.wd.hit { background: var(--mark); }
.wd.miss { border: 2px solid var(--mark); }
.wd.none { background: var(--grid); width: 8px; height: 8px; margin: 3px; }
.wd.future { border: 1.5px solid var(--line-strong); }
.wd-count { font-weight: 800; }
.w-score { text-align: right; font-size: 0.9rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- trends & charts ---------- */
.seg-range { margin: 12px 0 0; }
.chart-block > h2 { margin-bottom: 0; }
.chart-sub { margin: 2px 0 8px; color: var(--text-2); }
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.chart-svg .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-svg .ref { stroke: var(--text-3); stroke-width: 1.25; }
.chart-svg .ref-label { fill: var(--text-2); font-weight: 700; }
.chart-svg .mark-1 .col, .chart-svg .mark-1 .dot { fill: var(--mark); }
.chart-svg .mark-2 .dot { fill: var(--mark-2); }
.chart-svg .line { fill: none; stroke: var(--mark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .ring { stroke: var(--bg); stroke-width: 2; }
.chart-svg .crosshair { stroke: var(--text-2); stroke-width: 1; }
.chart-tip {
  position: absolute; top: 0; min-width: 150px; padding: 6px 10px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(6, 29, 51, 0.16); font-size: 0.9rem;
}
.tip-date { font-size: 0.8rem; color: var(--text-3); }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-key { width: 12px; height: 3px; border-radius: 2px; background: var(--mark); }
.tip-key.mark-2 { background: var(--mark-2); }
.tip-name { color: var(--text-3); font-size: 0.85rem; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0 0; padding: 0; font-size: 0.9rem; color: var(--text-2); }
.legend-key { display: inline-block; margin-right: 6px; vertical-align: middle; background: var(--mark); }
.legend-key.is-line { width: 16px; height: 3px; border-radius: 2px; }
.legend-key.is-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-key.mark-2 { background: var(--mark-2); }
.chart-empty { padding: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }

/* ---------- learn, me, legal ---------- */
.page-head { padding: calc(env(safe-area-inset-top) + 10px) 0 4px; }
.page-head h1 { margin: 4px 0; font-size: clamp(1.5rem, 6vw + 0.4rem, 1.9rem); font-weight: 800; }
.page-sub { margin: 4px 0 0; color: var(--text-2); }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px; color: var(--link); font-weight: 700; text-decoration: none; }
.link-list { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line); }
.link-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.link-row > .ico:first-child { color: var(--text-2); }
.lr-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lr-label { font-weight: 800; }
.lr-desc { font-size: 0.9rem; color: var(--text-3); }
.chev { color: var(--text-3); }
.list-title { margin: 32px 0 0; font-size: 1.15rem; font-weight: 800; }
.prose { max-width: 65ch; }
.prose h2 { margin: 26px 0 6px; font-size: 1.25rem; font-weight: 800; }
.prose h3 { margin: 18px 0 4px; font-size: 1.05rem; font-weight: 800; }
.prose-list { padding-left: 1.2em; margin: 6px 0; }
.prose-list li { margin: 5px 0; }
.ext { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.badge {
  display: inline-block; padding: 1px 8px; border: 1.5px solid var(--field-border); border-radius: 10px;
  font-size: 0.78rem; font-weight: 800; color: var(--text-2); vertical-align: middle; white-space: nowrap;
}
.tweak-list { list-style: none; margin: 8px 0; padding: 0; }
.tweak-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tweak-list h2 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 800; }
.me-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--sky); object-fit: cover; }
.version { margin-top: 28px; font-size: 0.9rem; color: var(--text-3); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.day-chip { position: relative; display: block; min-width: 0; }
.day-chip input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; }
.day-chip span {
  display: grid; place-items: center; min-height: 44px; padding: 0 2px;
  border: 1.5px solid var(--field-border); border-radius: 20px; font-weight: 700; cursor: pointer;
}
.day-chip input:checked + span { background: var(--seg-on-bg); color: var(--seg-on-text); border-color: var(--seg-on-bg); }
.day-chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 24px; border: 2px solid transparent;
  font-weight: 800; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--sneaker); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--field-border); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 0.95rem; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.15rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.file-btn { position: relative; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar ul { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 600px; margin: 0 auto; padding: 0; list-style: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px; padding: 6px 0 6px;
  color: var(--text-3); text-decoration: none; font-size: 0.75rem; font-weight: 800;
}
.tab .ico { width: 52px; height: 30px; padding: 3px 14px; border-radius: 15px; }
.tab.is-active { color: var(--text); }
.tab.is-active .ico { background: var(--tab-pill); color: var(--ink); }

/* ---------- sheets, toasts, update ---------- */
dialog.sheet {
  width: 100%; max-width: 600px; max-height: 88dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(4, 16, 30, 0.55); }
.sheet-inner { max-height: 88dvh; overflow: auto; padding: 0 18px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0 6px; background: var(--surface); }
.sheet-head h2 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.sheet-body h3 { margin: 16px 0 4px; font-size: 1.05rem; font-weight: 800; }
.toast-region {
  position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; justify-content: center; pointer-events: none;
}
.toast { margin: 0 16px; padding: 10px 16px; border-radius: 20px; background: var(--toast-bg); color: var(--toast-text); font-weight: 700; box-shadow: 0 6px 20px rgba(6, 29, 51, 0.22); }
.update-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 576px; margin: 0 auto; padding: 8px 8px 8px 16px; border-radius: 18px;
  background: var(--toast-bg); color: var(--toast-text); font-weight: 700;
}

/* ---------- welcome (Ari's sky) ---------- */
.welcome {
  display: flex; flex-direction: column; gap: 10px; min-height: 100dvh; max-width: 600px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 20px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--sky); color: var(--pillow);
}
.welcome h1 { margin: 6px 0; font-size: 1.9rem; font-weight: 800; }
.welcome .small-h { margin: 10px 0 0; font-size: 1.1rem; font-weight: 800; }
.welcome a:not(.btn) { color: var(--on-navy-link); }
.welcome .hint, .hint.on-navy, .welcome .sw-desc { color: var(--pillow-2); }
.welcome .switch-row { border-color: rgba(246, 235, 217, 0.18); }
.welcome input[type="checkbox"][role="switch"] { background: #12385F; border-color: var(--on-navy-line); }
.welcome input[type="checkbox"][role="switch"]::before { background: var(--pillow); }
.welcome input[type="checkbox"][role="switch"]:checked { background: var(--sneaker); border-color: var(--sneaker); }
.welcome input[type="checkbox"][role="switch"]:checked::before { background: var(--sky); }
.welcome .field input { background: var(--sky-raised); color: var(--pillow); border-color: var(--on-navy-line); }
.welcome .seg label { border-color: var(--on-navy-line); color: var(--pillow); }
.welcome .seg input:checked + label { background: var(--pillow); color: var(--sky); border-color: var(--pillow); }
.welcome .seg legend { font-weight: 700; margin-bottom: 6px; }
.welcome .callout.safety { background: #12385F; border-color: #D9A270; color: var(--pillow); }
.welcome .btn.ghost, .btn.ghost.on-navy { color: var(--pillow); border-color: var(--on-navy-line); }
.welcome .btn-row { margin-top: auto; padding-top: 16px; }
.steps { display: flex; justify-content: center; gap: 6px; margin: 0; }
.steps span { width: 28px; height: 4px; border-radius: 2px; background: var(--spine-off); }
.steps span.on { background: var(--sneaker); }
.welcome-ari img { display: block; width: min(240px, 62vw); height: auto; margin: 6px auto 0; }
.welcome-ari.small img { width: 140px; }
.brand-title { margin: 0; text-align: center; font-size: 3rem; }
.motto { margin: 0; text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--sneaker); }
.catchphrase.on-navy { margin: 2px auto 12px; color: var(--pillow-2); }
.seg-lang { justify-content: center; margin-bottom: 12px; }
.seg-lang legend { width: 100%; text-align: center; color: var(--pillow-2); }
.ticks { list-style: none; margin: 0; padding: 0; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.ticks .ico { color: var(--sneaker); }
.ticks.no .ico { color: var(--pillow-2); }
.welcome-note { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--sky-raised); }
.links-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.links-inline a { font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.big-check { border: 0; padding: 12px 0 0; }
.big-check input { accent-color: var(--sneaker); width: 26px; height: 26px; }
.ready-list { padding-left: 1.3em; }
.ready-list li { margin: 8px 0; }

@media (prefers-reduced-motion: reduce) {
  .spike, .dot, input[type="checkbox"][role="switch"], input[type="checkbox"][role="switch"]::before { transition: none; }
  .spike.pop { animation: none; }
}

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- installed app: keep the status bar readable on light screens ---------- */
/* With a translucent status bar the page runs under the clock and battery icons, which are white. */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: env(safe-area-inset-top); background: var(--sky); pointer-events: none;
}
.unsupported { padding: 32px 20px; max-width: 40rem; margin: 0 auto; }
