/* The app bar (index.html #tabBar, app.js "the tab bar") and the two pages it adds: Practice (#v-practice,
   tools/practice-view.js) and Account (#v-account, the settings page). style.css's tokens, so both colour schemes
   follow; flat; motion is colour and transform only, and none of it runs with reduced motion.

   Phones: a full-width bar at the foot of the screen, a translucent blurred surface (solid var(--bg) where blur isn't
   supported) with a top hairline, safe-area padded, three even columns of a 24 px icon over a 12 px label, 64 px tall.
   From 820 px: the same three tabs as one floating pill, centred near the foot of the window, icon beside label.
   The current tab: the accent pill behind its icon, its label in ink (aria-current="page"). */
:root{--tab-h:64px}
.tab-bar{display:none}
html[data-tabs]:has(#v-home:not([hidden]),#v-practice:not([hidden]),#v-account:not([hidden])) .tab-bar{display:block}
.tab-bar{position:fixed;z-index:6;left:0;right:0;bottom:0;box-sizing:border-box;
  background:var(--bg);border-top:1px solid var(--line-strong);
  padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
@supports ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  .tab-bar{background:color-mix(in srgb,var(--bg) 84%,transparent);-webkit-backdrop-filter:blur(18px) saturate(1.3);backdrop-filter:blur(18px) saturate(1.3)}
}
.tab-list{list-style:none;margin:0 auto;padding:0 4px;max-width:480px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
.tab-list li{display:flex;min-width:0}
.tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;min-width:0;min-height:var(--tab-h);padding:8px 0 7px;
  color:var(--muted);text-decoration:none;-webkit-tap-highlight-color:transparent;
  font-size:.75rem;font-weight:500;letter-spacing:.005em;line-height:1.2;
  transition:color var(--dur-quick) var(--ease-calm)}
.tab-l{white-space:nowrap}
.tab-ico{position:relative;display:grid;place-items:center;width:60px;height:32px;border-radius:999px;
  transition:background-color var(--dur-quick) var(--ease-calm),transform var(--dur-press) var(--ease-calm)}
.tab-ico svg{display:block;width:24px;height:24px}
@media (hover:hover){.tab:hover{color:var(--ink)}.tab:hover .tab-ico{background:var(--surface)}}
.tab:active .tab-ico{background:var(--surface-2);transform:scale(.94)}
.tab:focus-visible{outline:none}
.tab:focus-visible .tab-ico{outline:2px solid var(--accent);outline-offset:2px}
.tab[aria-current="page"]{color:var(--ink);font-weight:600}
.tab[aria-current="page"] .tab-ico{background:var(--accent-soft);color:var(--accent)}
/* A calm mark: a small dot at the icon's top right. Never a number. */
.tab-dot{position:absolute;top:3px;left:calc(50% + 9px);width:8px;height:8px;border-radius:50%;background:var(--later);outline:2px solid var(--bg)}
.tab-dot[hidden]{display:none}
@media (min-width:820px){
  .tab-bar{left:50%;right:auto;bottom:max(18px,env(safe-area-inset-bottom,0px));transform:translateX(-50%);padding:4px;
    border:1px solid var(--line-strong);border-radius:999px}
  .tab-list{padding:0;display:flex;gap:2px}
  .tab{flex-direction:row;gap:2px;min-height:48px;padding:0 18px 0 6px;border-radius:999px;font-size:var(--step--2)}
  .tab-ico{width:40px;height:36px;background:none!important}
  .tab[aria-current="page"]{background:var(--accent-soft);color:var(--accent)}
  .tab:active{transform:scale(.97)}
  .tab:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
  .tab:focus-visible .tab-ico{outline:0}
  @media (hover:hover){.tab:hover{background:var(--surface)}.tab[aria-current="page"]:hover{background:var(--accent-soft)}}
}
@media (max-width:340px){.tab-list{padding:0}.tab-ico{width:52px}}
/* The bar stays put while the page under it changes (style.css's view transitions). */
@media (prefers-reduced-motion: no-preference){.tab-bar{view-transition-name:tab-bar}}
::view-transition-group(tab-bar){animation-duration:0s}
::view-transition-old(tab-bar),::view-transition-new(tab-bar){animation-duration:var(--dur-quick)}
/* Room at the foot of the page for the bar, so the last line and anything focused stay clear of it. */
html[data-tabs]:has(#v-home:not([hidden]),#v-practice:not([hidden]),#v-account:not([hidden])) .wrap{padding-bottom:calc(var(--tab-h) + 40px + env(safe-area-inset-bottom,0px))}
html[data-tabs]:has(#v-home:not([hidden]),#v-practice:not([hidden]),#v-account:not([hidden])){scroll-padding-bottom:calc(var(--tab-h) + 24px + env(safe-area-inset-bottom,0px))}
html[data-tabs]:has(#v-home:not([hidden]),#v-practice:not([hidden]),#v-account:not([hidden])) #offlineNote{bottom:calc(var(--tab-h) + 14px + env(safe-area-inset-bottom,0px))!important}
@media (min-width:820px){
  html[data-tabs]:has(#v-home:not([hidden]),#v-practice:not([hidden]),#v-account:not([hidden])) .wrap{padding-bottom:132px}
}
/* With the tab bar, Account is a tab: the header's account chip (first visit only) and the page's ← Back go. */
html[data-tabs] #setBtn{display:none}
html[data-tabs] .view-back{display:none}
@media print{.tab-bar{display:none!important}}
@media (forced-colors:active){.tab-bar{border:1px solid CanvasText}.tab-dot{background:CanvasText}.tab[aria-current="page"] .tab-ico,.tab[aria-current="page"]{outline:1px solid CanvasText}}

/* ---------- a tab's page ---------- */
.tab-view{display:grid;align-content:start;gap:24px;min-width:0;padding-top:clamp(20px,5vw,32px)}
.tab-h{font-size:var(--step-4);line-height:var(--lh-heading)}
.tab-h:focus{outline:none}
.tab-h:focus-visible{outline:2px solid var(--accent);outline-offset:4px;border-radius:4px}
.view-back{justify-self:start;min-height:44px}

/* ---------- Practice ---------- */
.prac-body{display:grid;gap:40px;min-width:0}
.pv-sec{display:grid;gap:12px;min-width:0}
.prac-h{font-family:var(--display);font-weight:400;font-size:var(--step-3);line-height:var(--lh-heading);letter-spacing:var(--ls-heading)}
.pv-sec > .muted{margin:-4px 0 0;font-size:var(--step--1)}
.prac-all{gap:22px}
.prac-today .tcard{border-top:0;padding-top:0}
.prac-today .tcard + .practice-line{margin-top:4px}
/* "Caught a loop": the one used most, so the biggest thing here. */
.prac-now{gap:12px}
.loop-cta{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:4px 16px;width:100%;min-height:76px;padding:14px 20px 14px 14px;
  border:1px solid var(--accent);border-radius:var(--r);background:var(--accent);color:var(--accent-ink);text-align:left;cursor:pointer;font:inherit;
  -webkit-tap-highlight-color:transparent;transition:filter var(--dur-press) var(--ease-calm),transform var(--dur-press) var(--ease-calm)}
.loop-cta-ico{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--accent-ink) 16%,transparent)}
.loop-cta-ico svg{width:28px;height:28px}
.loop-cta-text{display:grid;gap:2px;min-width:0}
.loop-cta-t{font-size:var(--step-1);font-weight:600;line-height:var(--lh-snug)}
.loop-cta-d{font-size:var(--step--1);line-height:var(--lh-snug)}
@media (hover:hover){.loop-cta:hover{filter:brightness(1.06)}}
.loop-cta:active{transform:scale(.985)}
.loop-cta:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
/* The worry window: where it stands, and Change. */
.win-card{display:flex;align-items:center;gap:8px 16px;padding:0 16px 0 0;border-radius:var(--r);background:var(--surface);border:1px solid var(--line);min-width:0}
.win-card.is-open{background:var(--later-soft);border-color:color-mix(in srgb,var(--later) 35%,transparent)}
.win-card-main{flex:1 1 auto;display:grid;gap:2px;min-width:0;min-height:64px;padding:12px 0 12px 16px;border:0;background:none;color:var(--ink);text-align:left;cursor:pointer;font:inherit;border-radius:var(--r)}
.win-card-main .t{font-size:var(--step-0);font-weight:500;line-height:var(--lh-snug);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.win-card-main .d{font-size:var(--step--1);color:var(--muted);line-height:var(--lh-snug)}
.win-card.is-open .win-card-main .d{color:var(--ink)}
.win-card-main:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.win-open{padding:1px 8px;border-radius:999px;background:var(--later);color:var(--bg);font-size:var(--step--3);font-weight:600;letter-spacing:var(--ls-ui)}
.win-change{flex:none;min-height:48px;padding:0 4px;display:inline-flex;align-items:center;font-size:var(--step--1)}
.due-dot{display:inline-block;width:8px;height:8px;margin-left:8px;border-radius:50%;background:var(--later);vertical-align:middle}
.prac-more{margin:0;color:var(--muted)}
.prac-empty{display:grid;gap:14px;justify-items:start;max-width:46ch}
.prac-empty .art{width:120px;height:90px}
.prac-empty .muted{margin:0}

/* ---------- Account ---------- */
/* The settings page (app-extra.css styles its sections and rows): the width of a comfortable column. */
#v-account .set-card{max-width:640px;gap:0;padding-bottom:8px}
#v-account .set-card > .tab-h{margin-bottom:4px}
#v-account .view-back{margin-bottom:8px}
