/* TradeInspired app shell and shared components.
   Used by Home, Play, Challenges, Journal and Profile. Mobile first; the
   desktop header nav replaces the bottom dock from 900px. Page-specific
   styles live in arena.css (Play/Challenges/Profile) and practice.css (Journal). */

/* ---------- Base ---------- */
.ti-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.55;
  /* Leave room for the fixed dock so it never covers the footer or last action. */
  padding-bottom: calc(var(--dock-h) + var(--safe-bottom));
}
html { scroll-padding-top: 16px; scroll-padding-bottom: calc(var(--dock-h) + var(--safe-bottom) + 16px); }
.ti-app a { text-underline-offset: 4px; }
.ti-app h1, .ti-app h2, .ti-app h3 {
  margin: 0;
  font-weight: 680;
  letter-spacing: -.025em;
  line-height: 1.15;
  text-wrap: balance;
}
.ti-app h1 { font-size: clamp(30px, 8.4vw, 52px); letter-spacing: -.035em; }
.ti-app h2 { font-size: clamp(22px, 5.6vw, 28px); }
.ti-app h3 { font-size: 18px; letter-spacing: -.015em; }
.ti-app p { margin: 0 0 12px; }

.app-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px max(clamp(16px, 5vw, 32px), var(--safe-right)) 40px max(clamp(16px, 5vw, 32px), var(--safe-left));
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ---------- Type helpers ---------- */
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.lede { color: var(--muted); font-size: 17px; line-height: 1.6; max-width: 640px; }
.arena-muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

.page-head { margin: 8px 0 20px; }
.page-head h1 { margin-bottom: 10px; }
.page-head .lede { margin: 0; }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 14px;
}
.section-heading h2 { margin: 0; }
.section-heading > span { color: var(--muted); font-size: 14px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line-soft); }
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1160px;
  min-height: 60px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(clamp(12px, 4vw, 32px), var(--safe-right)) 8px max(clamp(16px, 5vw, 32px), var(--safe-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin-right: auto;
  color: var(--text);
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -.04em;
  text-decoration: none;
  white-space: nowrap;
}
.brand .logo-mark { color: var(--accent); }
.site-nav { display: none; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.xp-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  text-decoration: none;
}
.xp-chip__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--accent-wash);
  border-radius: 999px;
  background: var(--accent-wash);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.xp-chip .icon { width: 18px; height: 18px; }
.xp-chip:hover .xp-chip__pill { border-color: var(--accent); }

/* ---------- Bottom dock (phones and small tablets) ---------- */
.app-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--dock-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.app-dock a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: var(--dock-h);
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
  letter-spacing: .01em;
  text-decoration: none;
}
.app-dock .icon { width: 23px; height: 23px; }
.app-dock a[aria-current=page] { color: var(--accent); }
.app-dock a[aria-current=page]::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  width: 32px;
  height: 3px;
  margin-left: -16px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}
.app-dock a:focus-visible { outline-offset: -4px; border-radius: 10px; }
/* Keep typing areas clear: hide the dock while a text field has focus (virtual keyboard open). */
.ti-app:has(:is(input:not([type=radio], [type=checkbox], [type=file], [type=button], [type=submit], [type=hidden]), textarea):focus) .app-dock { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  max-width: 1160px;
  margin: 24px auto 0;
  padding: 24px max(clamp(16px, 5vw, 32px), var(--safe-right)) 28px max(clamp(16px, 5vw, 32px), var(--safe-left));
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.site-footer__brand { color: var(--text); font-weight: 700; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 10px 0 12px; }
.site-footer nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--muted); }
.site-footer nav a:hover { color: var(--text); }
.site-footer p { max-width: 720px; margin: 0 0 8px; }

/* ---------- Buttons and links ---------- */
.practice-primary,
.arena-secondary,
.button-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 20px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.practice-primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.arena-secondary { border-color: var(--line); background: var(--surface); color: var(--text); font-weight: 620; }
.arena-secondary:hover { border-color: var(--accent); }
.button-quiet { border-color: transparent; background: transparent; color: var(--accent); font-weight: 620; padding-inline: 8px; }
.button-quiet:hover { text-decoration: underline; }
.practice-primary .icon, .arena-secondary .icon, .button-quiet .icon { width: 20px; height: 20px; }
.practice-primary:disabled,
.arena-secondary:disabled { opacity: .45; cursor: not-allowed; }
.button-block { display: flex; width: 100%; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--accent);
  font-weight: 620;
}
.text-link .icon { width: 18px; height: 18px; }
.arena-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.icon-button:hover { border-color: var(--accent); }
.icon-button .icon { width: 19px; height: 19px; color: var(--accent); }

/* ---------- Pills, cards, progress ---------- */
.arena-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}
.arena-pill .icon { width: 16px; height: 16px; }
.arena-pill.is-positive { background: var(--positive-wash); color: var(--positive); }
.arena-pill.is-stop { background: var(--stop-wash); color: var(--stop); }
.arena-pill.is-muted { background: var(--surface-alt); color: var(--muted); }

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--accent);
  appearance: none;
  -webkit-appearance: none;
}
progress::-webkit-progress-bar { background: var(--line-soft); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.avatar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.avatar[data-avatar=mint] { border-color: var(--positive); background: var(--positive-wash); color: var(--positive); }
.avatar[data-avatar=sand] { border-color: var(--stop); background: var(--stop-wash); color: var(--stop); }

/* ---------- Segmented control (links or tabs) ---------- */
.segmented {
  position: relative;
  display: flex;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented > a,
.segmented > button {
  display: inline-flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 620;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.segmented > a:hover,
.segmented > button:hover { color: var(--text); }
.segmented > [aria-current=page],
.segmented > [aria-selected=true] { background: var(--accent-wash); color: var(--accent); }
.segmented > :focus-visible { outline-offset: -3px; }

/* ---------- Status, warnings and empty states ---------- */
.practice-warning,
.practice-error,
.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--stop);
  border-radius: 10px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 15px;
  line-height: 1.45;
}
.practice-warning::before,
.practice-error::before,
.banner::before {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  background: currentColor;
  mask: url('/assets/icons/alert-triangle.svg') center / contain no-repeat;
  -webkit-mask: url('/assets/icons/alert-triangle.svg') center / contain no-repeat;
}
.practice-error { border-color: var(--negative); background: var(--error-bg); color: var(--error-text); }
.banner { border-color: var(--line); background: var(--surface); color: var(--muted); }
.banner::before { mask-image: url('/assets/icons/info-circle.svg'); -webkit-mask-image: url('/assets/icons/info-circle.svg'); color: var(--accent); }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty-state strong { color: var(--text); font-size: 17px; }
.empty-state p { margin: 0; }
.status-line { min-height: 1.5em; margin: 12px 0 0; color: var(--accent); font-size: 15px; }
.status-line:empty { display: none; }

/* ---------- Forms ---------- */
.ti-app fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.ti-app legend { padding: 0; }
.form-label,
:where(.ti-app form) label:where(:not(.direction-option, .practice-choice, .file-button, .practice-file, .arena-file)) {
  display: block;
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 16px;
  font-weight: 620;
  line-height: 1.35;
}
:where(.ti-app) input:where(:not([type=radio], [type=checkbox], [type=file], [type=hidden])),
:where(.ti-app) select,
:where(.ti-app) textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}
:where(.ti-app) textarea { min-height: 112px; resize: vertical; }
:where(.ti-app) select {
  padding-right: 44px;
  background-image: url('/assets/icons/select-dark.svg');
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  appearance: none;
  -webkit-appearance: none;
}
:root[data-theme=warm] :where(.ti-app) select { background-image: url('/assets/icons/select-warm.svg'); }
.ti-app input::placeholder, .ti-app textarea::placeholder { color: var(--subtle); opacity: 1; }
.ti-app input:hover:not(:disabled), .ti-app select:hover:not(:disabled), .ti-app textarea:hover:not(:disabled) { border-color: var(--muted); }
.ti-app input:focus-visible, .ti-app select:focus-visible, .ti-app textarea:focus-visible { border-color: var(--accent); outline-offset: 1px; }
.ti-app fieldset:disabled input, .ti-app fieldset:disabled select, .ti-app fieldset:disabled textarea { opacity: .6; }
.field-grid { display: grid; gap: 0 16px; }
.field-hint { margin: -2px 0 8px; color: var(--muted); font-size: 14px; }

/* Native file input styled as a button; the real input stays focusable for keyboards. */
.file-button,
.practice-file,
.arena-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  margin: 0;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 620;
  cursor: pointer;
}
.file-button:hover, .practice-file:hover, .arena-file:hover { border-color: var(--accent); }
.file-button .icon, .practice-file .icon, .arena-file .icon { width: 20px; height: 20px; }
.file-button input, .practice-file input, .arena-file input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-button:focus-within, .practice-file:focus-within, .arena-file:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Disclosure ---------- */
.disclosure { border-top: 1px solid var(--line-soft); }
.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  color: var(--text);
  font-size: 16px;
  font-weight: 620;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--muted);
  mask: url('/assets/icons/chevron-right.svg') center / contain no-repeat;
  -webkit-mask: url('/assets/icons/chevron-right.svg') center / contain no-repeat;
  transform: rotate(90deg);
  transition: transform .15s ease;
}
.disclosure[open] > summary::after { transform: rotate(-90deg); }
.disclosure > :not(summary) { color: var(--muted); }

/* ---------- Data and backups panel ---------- */
.data-panel { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.data-panel > p { color: var(--muted); max-width: 680px; }
.backup-item { padding: 18px 0; border-top: 1px solid var(--line-soft); }
.backup-item:first-of-type { border-top: 0; }
.backup-item h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.backup-item h3 .icon { width: 20px; height: 20px; color: var(--accent); }
.backup-item p { color: var(--muted); font-size: 15px; }
.backup-item .arena-actions { margin-top: 12px; }

/* ---------- Home ---------- */
.home .home-hero { display: grid; gap: 28px; padding: 8px 0 32px; }
.home-hero__copy h1 { margin: 4px 0 14px; }
.home-hero__copy .lede { margin-bottom: 22px; }
.home-actions { display: grid; gap: 10px; }
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 18px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  list-style: none;
}
.trust-row li { display: inline-flex; align-items: center; gap: 6px; }
.trust-row .icon { width: 16px; height: 16px; color: var(--positive); }

/* Play showcase: always visible, illustrative only (no controls, nothing saved). */
.play-showcase {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.play-showcase__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; }
.play-showcase__head h2 { font-size: 19px; }
.play-showcase__chart { border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--chart-bg); }
.play-showcase__chart svg { display: block; width: 100%; height: auto; }
.play-showcase__body { display: grid; gap: 12px; padding: 14px 16px 16px; }
.play-showcase__label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.demo-calls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.demo-call {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 10px 4px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}
.demo-call .icon { width: 22px; height: 22px; }
.demo-call strong { color: var(--text); font-size: 15px; }
.demo-call--up .icon { color: var(--positive); }
.demo-call--down .icon { color: var(--negative); }
.demo-call--sideways .icon { color: var(--accent); }
.demo-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.demo-steps li { position: relative; min-height: 24px; padding-left: 32px; color: var(--muted); font-size: 14px; line-height: 1.4; counter-increment: step; }
.demo-steps li::before {
  content: counter(step);
  position: absolute;
  top: -1px;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.demo-steps strong { color: var(--text); }
.demo-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.demo-grid { stroke: var(--line); stroke-width: .7; stroke-dasharray: 3 4; }
.demo-band { fill: var(--accent); opacity: .08; }
.demo-level { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 6 5; }
.demo-hidden { fill: var(--chart-hidden); stroke: var(--line); stroke-dasharray: 4 4; }
.demo-up { fill: var(--positive); stroke: var(--positive); }
.demo-down { fill: var(--negative); stroke: var(--negative); }
.demo-label { fill: var(--muted); font: 650 13.5px var(--font); letter-spacing: .06em; }
.demo-question { fill: var(--accent); font: 700 30px var(--font); }

.progress-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.progress-card__head { display: flex; align-items: center; gap: 14px; }
.progress-card__head h2 { font-size: 22px; overflow-wrap: anywhere; }
.progress-card__head .eyebrow { margin-bottom: 2px; }
.progress-card__today { display: grid; gap: 8px; padding: 14px; border-radius: 10px; background: var(--surface-alt); }
.progress-card__today > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress-card__today strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.progress-card__today p { margin: 0; color: var(--muted); font-size: 14px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mini-stats div { min-width: 0; }
.mini-stats dt { color: var(--muted); font-size: 13px; }
.mini-stats dd { margin: 2px 0 0; color: var(--text); font-size: 22px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.home-section { padding: 28px 0; border-top: 1px solid var(--line-soft); }
.home-section > h2 { margin-bottom: 6px; }
.home-section > .lede { margin-bottom: 18px; font-size: 16px; }
.path-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.path-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.path-item:hover { border-color: var(--accent); }
.path-item__icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-wash); color: var(--accent); }
.path-item__icon .icon { width: 22px; height: 22px; }
.path-item strong { display: block; font-size: 17px; line-height: 1.3; }
.path-item span.path-item__text { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.path-item > .icon { width: 20px; height: 20px; color: var(--muted); }
.path-item.is-external .path-item__icon { background: var(--surface-alt); color: var(--text); }
.path-list + .text-link { margin-top: 8px; }

/* Mode cards: one direct route per real Play mode. */
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 8px; padding: 0; list-style: none; }
.mode-grid > li { display: flex; min-width: 0; }
.mode-card {
  --mode: var(--accent);
  --mode-wash: var(--accent-wash);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--mode);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.mode-card:hover { border-color: var(--mode); }
.mode-card--daily { --mode: var(--accent); --mode-wash: var(--accent-wash); }
.mode-card--weekly { --mode: var(--positive); --mode-wash: var(--positive-wash); }
.mode-card--monthly { --mode: var(--text); --mode-wash: var(--surface-alt); }
.mode-card--survivor { --mode: var(--stop); --mode-wash: var(--stop-wash); }
.mode-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mode-card__icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; background: var(--mode-wash); color: var(--mode); }
.mode-card__icon .icon { width: 20px; height: 20px; }
.mode-card__count { color: var(--muted); font-size: 13px; line-height: 1.15; text-align: right; }
.mode-card__count strong { display: block; color: var(--text); font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.mode-card__name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.mode-card__cadence { color: var(--muted); font-size: 13px; line-height: 1.4; }
.mode-card__line { color: var(--text); font-size: 14px; line-height: 1.4; }
.mode-card--survivor .mode-card__line { color: var(--stop); font-weight: 650; }
.mode-card__status { align-self: flex-start; margin-top: 4px; padding: 2px 9px; border-radius: 999px; background: var(--mode-wash); color: var(--mode); font-size: 13px; font-weight: 650; }
.mode-card__go { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; color: var(--accent); font-size: 15px; font-weight: 650; }
.mode-card__go .icon { width: 16px; height: 16px; }

/* Participation, progression and review. */
.loop-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.loop-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); }
.loop-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-wash); color: var(--accent); }
.loop-card__icon .icon { width: 20px; height: 20px; }
.loop-card strong { display: block; font-size: 16px; line-height: 1.35; }
.loop-card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.loop-card .text-link { font-size: 15px; }

.honest-list { display: grid; gap: 14px; margin: 16px 0 0; padding: 0; list-style: none; }
.honest-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; color: var(--muted); font-size: 15px; }
.honest-list li strong { display: block; color: var(--text); font-size: 16px; }
.honest-list .icon { width: 22px; height: 22px; margin-top: 1px; color: var(--accent); }

/* ---------- Narrow phones ---------- */
@media (max-width: 359px) {
  .brand { font-size: 17px; gap: 7px; }
  .xp-chip__pill { padding: 5px 10px 5px 8px; font-size: 13px; }
  .xp-chip .icon { display: none; }
  .segmented > a, .segmented > button { padding: 8px 9px; font-size: 14px; }
}

/* ---------- Tablet and desktop ---------- */
@media (min-width: 600px) {
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-actions { display: flex; flex-wrap: wrap; }
  .path-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-showcase { max-width: 640px; }
  .demo-label { font-size: 10px; }
  .demo-question { font-size: 24px; }
}

@media (min-width: 768px) {
  .loop-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loop-card { grid-template-columns: 1fr; align-content: start; }
}

@media (min-width: 900px) {
  .ti-app { padding-bottom: 0; }
  html { scroll-padding-bottom: 16px; }
  .app-dock { display: none !important; }
  .site-header__inner { min-height: 72px; gap: 20px; }
  .brand { margin-right: 0; font-size: 21px; }
  .site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
  .site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
  }
  .site-nav a:hover { color: var(--text); }
  .site-nav a[aria-current=page] { background: var(--accent-wash); color: var(--accent); }
  .site-nav .nav-external { margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--line); border-radius: 0; }
  .site-nav .nav-external:hover { color: var(--text); }
  .site-nav .icon { width: 16px; height: 16px; }
  .app-main { padding-top: 32px; padding-bottom: 56px; }
  .page-head { margin: 8px 0 28px; }
  .site-footer { margin-top: 40px; padding-bottom: 40px; }
}

@media (min-width: 960px) {
  .home .home-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "copy demo" "progress demo"; align-items: start; gap: 24px 56px; padding: 32px 0 56px; }
  .home-hero__copy { grid-area: copy; padding-top: 24px; }
  .home .home-returning { grid-area: progress; }
  .play-showcase { grid-area: demo; max-width: none; }
  .mode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .mode-card { padding: 18px; }
  .home-hero__copy h1 { font-size: 58px; }
  .home-hero__copy .lede { font-size: 19px; }
  .home-section { padding: 44px 0; }
  .honest-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
}

.home-returning { display:grid; gap:16px; min-width:0; }
.home-returning:not(:has(.progress-card:not([hidden]), .practice-warning:not([hidden]))) { display:none; }

#home-survivor-progress .mini-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
