/* ==========================================================================
   Shuke / 述刻 — base components for hi-fi screens (393 × 852 pt)
   Depends on tokens.css. Every text style multiplies by var(--dt) so the
   same file renders at Dynamic Type 100 % / 120 % / 135 %.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-family-text);
  color: var(--color-text-primary);
  background: #E6E2D8;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}
:root[data-theme="dark"] body { background: #0A0A09; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, select { font: inherit; }
a { color: inherit; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Viewer shell (single-file view) ---------- */
.viewer { display: flex; gap: 32px; align-items: flex-start; justify-content: center; padding: 32px 24px 64px; min-height: 100vh; }
.spec {
  width: 340px; flex-shrink: 0; font: 13px/1.55 -apple-system, "PingFang SC", sans-serif; color: #3A3833;
  background: #FFFDF8; border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  position: sticky; top: 32px; max-height: calc(100vh - 64px); overflow: auto;
}
:root[data-theme="dark"] .spec { background: #1C1B19; color: #D8D3C8; }
.spec h1 { font-size: 16px; margin: 0 0 4px; }
.spec h2 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8A867D; margin: 18px 0 6px; }
.spec p { margin: 0 0 8px; }
.spec code { font: 11.5px/1.4 ui-monospace, Menlo, monospace; background: rgba(110,75,255,.08); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.spec ul { margin: 0; padding-left: 18px; }
.spec li { margin-bottom: 4px; }
.spec .spec-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.spec .spec-nav a, .spec .spec-nav button { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: #EFEBE1; text-decoration: none; color: #171717; }
.spec .spec-nav button[aria-pressed="true"] { background: #171717; color: #fff; }
.embed body { background: transparent; }
.embed .viewer { padding: 0; display: block; min-height: 0; }
.embed .spec { display: none; }

/* ---------- Device ---------- */
.device {
  position: relative; width: 393px; height: 852px; flex-shrink: 0;
  background: var(--color-bg-canvas); color: var(--color-text-primary);
  border-radius: 55px; overflow: hidden;
  box-shadow: 0 0 0 10px #1B1A18, 0 0 0 11px #3A3833, 0 40px 80px rgba(0,0,0,.25);
  isolation: isolate;
}
.embed .device { border-radius: 0; box-shadow: none; }
.device::after { content: ""; position: absolute; inset: 0 0 auto 0; height: var(--safe-top); background: var(--color-bg-canvas); z-index: 45; pointer-events: none; } /* status-bar backdrop: content never scrolls under the clock */
.statusbar {
  position: absolute; inset: 0 0 auto 0; height: 54px; z-index: 60; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 46px;
  font: 600 17px/1 -apple-system, "SF Pro Text", var(--font-family-text); color: var(--color-text-primary);
}
.statusbar .island { position: absolute; left: 50%; top: 11px; width: 125px; height: 37px; margin-left: -62.5px; background: #000; border-radius: 20px; }
.statusbar .sb-right { display: flex; gap: 6px; align-items: center; }
.statusbar .sb-right i { display: block; width: 18px; height: 11px; border-radius: 3px; background: currentColor; opacity: .9; }
.statusbar .sb-right i:first-child { width: 17px; clip-path: polygon(0 100%, 100% 0, 100% 100%); border-radius: 1px; }
.statusbar .sb-right i:last-child { width: 25px; height: 12px; border-radius: 4px; background: none; box-shadow: inset 0 0 0 1px currentColor; position: relative; }
.statusbar .sb-right i:last-child::after { content: ""; position: absolute; inset: 2px 5px 2px 2px; background: currentColor; border-radius: 2px; }
.statusbar.on-dark { color: #fff; }
.home-indicator { position: absolute; left: 50%; bottom: 8px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--color-text-primary); z-index: 80; pointer-events: none; }
.home-indicator.on-dark { background: #fff; }

.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding-top: var(--safe-top); scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.has-tabbar { padding-bottom: calc(var(--size-tabbar-height) + var(--safe-bottom) + var(--space-6)); }
.screen.has-dock { padding-bottom: calc(var(--size-cta-height) + var(--safe-bottom) + 64px); }
.screen.has-dock.dock-tall { padding-bottom: calc(var(--size-cta-height) * 2 + var(--safe-bottom) + 72px); }
.pad { padding-left: var(--space-gutter); padding-right: var(--space-gutter); }
.stack { display: flex; flex-direction: column; }
.row-flex { display: flex; align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; } .mt-10 { margin-top: 40px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.between { justify-content: space-between; }

/* ---------- Type (iOS text styles × Dynamic Type) ---------- */
.t-display { font: var(--font-weight-heavy) calc(var(--type-display-size) * var(--dt))/calc(var(--type-display-leading) * var(--dt)) var(--font-family-numeric); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.t-large-title { font: var(--font-weight-bold) calc(var(--type-large-title-size) * var(--dt))/calc(var(--type-large-title-leading) * var(--dt)) var(--font-family-text); letter-spacing: var(--type-tracking-tight); }
.t-title1 { font: var(--font-weight-bold) calc(var(--type-title1-size) * var(--dt))/calc(var(--type-title1-leading) * var(--dt)) var(--font-family-text); letter-spacing: var(--type-tracking-tight); }
.t-title2 { font: var(--font-weight-bold) calc(var(--type-title2-size) * var(--dt))/calc(var(--type-title2-leading) * var(--dt)) var(--font-family-text); letter-spacing: -0.01em; }
.t-title3 { font: var(--font-weight-semibold) calc(var(--type-title3-size) * var(--dt))/calc(var(--type-title3-leading) * var(--dt)) var(--font-family-text); }
.t-headline { font: var(--font-weight-semibold) calc(var(--type-headline-size) * var(--dt))/calc(var(--type-headline-leading) * var(--dt)) var(--font-family-text); }
.t-body { font: var(--font-weight-regular) calc(var(--type-body-size) * var(--dt))/calc(var(--type-body-leading) * var(--dt)) var(--font-family-text); }
.t-reading { font: var(--font-weight-regular) calc(var(--type-reading-size) * var(--dt))/calc(var(--type-reading-leading) * var(--dt)) var(--font-family-reading); letter-spacing: 0.01em; }
.t-reading:lang(en), [lang="en"] .t-reading { font-family: var(--font-family-reading-latin); letter-spacing: 0; line-height: calc(var(--type-reading-latin-leading) * var(--dt)); }
:lang(en) .quote, :lang(en) .oa-example { font-family: var(--font-family-text); }
.t-callout { font: var(--font-weight-regular) calc(var(--type-callout-size) * var(--dt))/calc(var(--type-callout-leading) * var(--dt)) var(--font-family-text); }
.t-subhead { font: var(--font-weight-regular) calc(var(--type-subheadline-size) * var(--dt))/calc(var(--type-subheadline-leading) * var(--dt)) var(--font-family-text); }
.t-footnote { font: var(--font-weight-regular) calc(var(--type-footnote-size) * var(--dt))/calc(var(--type-footnote-leading) * var(--dt)) var(--font-family-text); }
.t-caption { font: var(--font-weight-medium) calc(var(--type-caption1-size) * var(--dt))/calc(var(--type-caption1-leading) * var(--dt)) var(--font-family-text); }
.t-caption2 { font: var(--font-weight-semibold) calc(var(--type-caption2-size) * var(--dt))/calc(var(--type-caption2-leading) * var(--dt)) var(--font-family-text); }
.t-timer { font: var(--font-weight-heavy) calc(var(--type-timer-size) * var(--dt))/calc(var(--type-timer-leading) * var(--dt)) var(--font-family-numeric); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.t-num { font-family: var(--font-family-numeric); font-variant-numeric: tabular-nums; font-weight: var(--font-weight-heavy); letter-spacing: -0.02em; }
.t-eyebrow { font: var(--font-weight-bold) calc(11px * var(--dt))/calc(14px * var(--dt)) var(--font-family-text); letter-spacing: var(--type-tracking-caps); text-transform: uppercase; }
.w-semibold { font-weight: var(--font-weight-semibold); } .w-bold { font-weight: var(--font-weight-bold); } .w-medium { font-weight: var(--font-weight-medium); }
.c-secondary { color: var(--color-text-secondary); } .c-tertiary { color: var(--color-text-tertiary); }
.c-success { color: var(--color-status-success); } .c-warning { color: var(--color-status-warning); } .c-danger { color: var(--color-status-danger); }
.c-violet { color: var(--color-topic-violet); }
.c-on-inverse-2 { color: var(--color-text-on-inverse-secondary); }
.tnum { font-variant-numeric: tabular-nums; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: inherit; }

/* ---------- Nav bar ---------- */
.screen > .navbar:not(.large) { position: sticky; top: 0; z-index: 20; background: var(--color-bg-canvas); }
.navbar { height: var(--size-navbar-height); display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: 0 12px; }
.navbar .nav-title { text-align: center; }
.navbar .nav-right { justify-self: end; padding-right: 8px; }
.navbar.large { height: auto; display: flex; justify-content: space-between; padding: 8px var(--space-gutter) 4px; }
.icon-btn {
  width: var(--size-hit-min); height: var(--size-hit-min); border-radius: 50%;
  display: inline-grid; place-items: center; background: var(--color-bg-sunken); color: var(--color-text-primary);
}
.icon-btn.plain { background: none; }
.icon-btn.on-inverse { background: var(--color-bg-inverse-raised); color: var(--color-text-on-inverse); }
.progress-hair { height: 3px; background: var(--color-line-hairline); position: relative; }
.progress-hair > i { position: absolute; inset: 0 auto 0 0; background: var(--color-text-primary); border-radius: 0 2px 2px 0; transition: width var(--motion-duration-slow) var(--motion-ease-emphasized); }
.step-count { font: 600 calc(15px * var(--dt))/1 var(--font-family-numeric); color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--size-tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--color-bg-canvas) 86%, transparent);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 0.5px solid var(--color-line-hairline);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--color-text-tertiary); font: 600 10px/12px var(--font-family-text); }
.tabbar a[aria-current="page"] { color: var(--color-text-primary); }

/* ---------- Buttons ---------- */
.btn {
  min-height: var(--size-cta-height); width: 100%; border-radius: var(--radius-button);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px;
  font: var(--font-weight-bold) calc(17px * var(--dt))/1.25 var(--font-family-text); text-align: center;
  transition: transform var(--motion-duration-instant) var(--motion-ease-standard), background var(--motion-duration-fast);
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--color-accent-primary); color: var(--color-text-on-accent); box-shadow: 0 6px 16px rgba(255,96,48,.22); }
.btn--primary:active { background: var(--color-accent-primary-pressed); }
.btn--ink { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); }
.btn--light { background: var(--color-bg-canvas); color: var(--color-text-primary); }
:root[data-theme="dark"] .btn--light { background: #F5F2E9; color: #171717; }
.btn--secondary { background: var(--color-bg-surface); color: var(--color-text-primary); box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.btn--ghost { background: none; color: var(--color-text-secondary); min-height: var(--size-hit-min); font-weight: var(--font-weight-semibold); }
.btn--danger { background: var(--color-status-danger); color: #fff; }
.btn--danger-ghost { background: none; color: var(--color-status-danger); min-height: var(--size-hit-min); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--color-bg-sunken); color: var(--color-text-disabled); box-shadow: none; cursor: not-allowed; }
.btn--sm { min-height: 36px; width: auto; border-radius: var(--radius-pill); padding: 8px 14px; font-size: calc(14px * var(--dt)); font-weight: var(--font-weight-semibold); }
.btn--sm.btn--secondary { box-shadow: inset 0 0 0 1px var(--color-line-hairline); }
.btn .spinner { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 12px; }
.btn-row > .btn { flex: 1; }
.link { color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--color-line-strong); }

/* bottom CTA dock — never occludes content: screens reserve padding (.has-dock) */
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 28px var(--space-gutter) calc(var(--safe-bottom) + 8px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--color-bg-canvas) 0%, transparent), var(--color-bg-canvas) 28px);
  display: flex; flex-direction: column; gap: 8px;
}
.dock .dock-caption { text-align: center; }

/* ---------- Cards ---------- */
.card { background: var(--color-bg-surface); border-radius: var(--radius-card); box-shadow: var(--elevation-1); padding: var(--space-5); }
.card--flat { box-shadow: inset 0 0 0 1px var(--color-line-hairline); }
.card--sunken { background: var(--color-bg-sunken); box-shadow: none; }
.card--ink { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: var(--elevation-2); }
.card--md { border-radius: var(--radius-md); }
.card--tight { padding: var(--space-4); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: var(--space-section) var(--space-gutter) var(--space-3); }

/* ---------- Chips & tags ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--space-gutter); }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  min-height: 36px; padding: 7px 14px; border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--color-bg-surface); box-shadow: inset 0 0 0 1px var(--color-line-hairline);
  font: var(--font-weight-semibold) calc(14px * var(--dt))/1.3 var(--font-family-text); color: var(--color-text-primary);
  display: inline-flex; align-items: center; gap: 6px; position: relative;
}
.chip::before { content: ""; position: absolute; inset: -4px 0; } /* 44pt hit area */
.chip[aria-pressed="true"], .chip.is-selected { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: none; }
.chip .count { color: var(--color-text-tertiary); font-weight: 500; }
.chip[aria-pressed="true"] .count { color: var(--color-text-on-inverse-secondary); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius-xs); font: 700 calc(12px * var(--dt))/1.3 var(--font-family-text); background: var(--color-bg-sunken); color: var(--color-text-secondary); white-space: nowrap; }
.tag--violet { background: var(--color-topic-violet-soft); color: var(--color-topic-violet); }
.tag--green { background: var(--color-topic-green-soft); color: var(--color-topic-green); }
.tag--amber { background: var(--color-topic-amber-soft); color: var(--color-status-warning); }
.tag--reward { background: var(--color-reward); color: var(--color-text-on-reward); }
.tag--ink { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); }
.tag--line { background: none; box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.tag--danger { background: var(--color-status-danger-soft); color: var(--color-status-danger); }
.xp-badge { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--color-reward); color: var(--color-text-on-reward); font: 800 calc(14px * var(--dt))/1 var(--font-family-numeric); letter-spacing: -0.01em; white-space: nowrap; }

/* ---------- Brand mark, level, streak ---------- */
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--color-bg-inverse); color: var(--color-text-on-inverse); display: grid; place-items: center; font: 700 17px/1 var(--font-family-text); }
.level-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--color-bg-inverse); color: var(--color-text-on-inverse); display: flex; align-items: baseline; justify-content: center; padding-top: 12px; gap: 1px; flex-shrink: 0; }
.level-badge small { font: 700 11px/1 var(--font-family-numeric); opacity: .8; }
.level-badge b { font: 800 26px/1 var(--font-family-numeric); }
.level-badge.reward { background: var(--color-reward); color: var(--color-text-on-reward); }
.streak-pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--radius-pill); background: var(--color-topic-amber-soft); color: var(--color-status-warning); font: 800 calc(17px * var(--dt))/1 var(--font-family-numeric); }
.streak-pill.is-done svg { fill: currentColor; }
.streak-pill.is-zero { background: var(--color-bg-sunken); color: var(--color-text-tertiary); }
.streak-pill.at-risk { background: none; box-shadow: inset 0 0 0 1.5px var(--color-status-warning); }

.xpbar { height: 10px; border-radius: var(--radius-pill); background: var(--color-bg-inverse); padding: 2px; position: relative; overflow: hidden; }
.xpbar > i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--color-reward); width: var(--fill, 0%); transition: width var(--motion-duration-celebrate) var(--motion-ease-emphasized); }
.xpbar > i.gain { position: absolute; top: 2px; bottom: 2px; height: auto; background: repeating-linear-gradient(-45deg, var(--color-reward), var(--color-reward) 3px, #c7e34a 3px, #c7e34a 6px); }
.bar { height: 8px; border-radius: var(--radius-pill); background: var(--color-bg-sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--color-text-primary); width: var(--fill, 0%); }
.card--ink .bar { background: var(--color-bg-inverse-raised); }

/* ---------- Topic tile ---------- */
.topic-tile { width: 48px; height: 48px; border-radius: var(--radius-sm); display: grid; place-items: center; color: #fff; font: 700 20px/1 var(--font-family-reading); flex-shrink: 0; }
.topic-tile.sm { width: 40px; height: 40px; font-size: 17px; border-radius: 10px; }
.topic-coral { background: var(--color-topic-coral); }
.topic-violet { background: var(--color-topic-violet); }
.topic-green { background: var(--color-topic-green); }
.topic-ink { background: #171717; box-shadow: inset 0 0 0 1px var(--color-line-inverse); }
.topic-amber { background: var(--color-topic-amber); }

/* ---------- Lists ---------- */
.list { background: var(--color-bg-surface); border-radius: var(--radius-md); box-shadow: var(--elevation-1); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; position: relative; text-decoration: none; color: inherit; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--color-line-hairline); }
.list-row .chev { color: var(--color-text-tertiary); }
.list-plain .list-row { padding-left: 0; padding-right: 0; }
.list-plain .list-row + .list-row::before { left: 60px; }
.group-label { margin: var(--space-6) var(--space-gutter) var(--space-2); }

/* ---------- Toggle / segmented ---------- */
.toggle { width: 51px; height: 31px; border-radius: 16px; background: var(--color-line-strong); position: relative; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform var(--motion-duration-fast) var(--motion-ease-standard); }
.toggle[aria-checked="true"] { background: var(--color-status-success); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--color-bg-sunken); border-radius: 10px; padding: 2px; gap: 2px; }
.segmented button { min-height: 32px; border-radius: 8px; font: 600 calc(14px * var(--dt))/1.2 var(--font-family-text); color: var(--color-text-secondary); }
.segmented button[aria-pressed="true"] { background: var(--color-bg-surface); color: var(--color-text-primary); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- Banners, toasts ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font: 500 calc(14px * var(--dt))/1.45 var(--font-family-text); }
.banner svg { margin-top: 1px; }
.banner--info { background: var(--color-status-info-soft); color: var(--color-text-primary); }
.banner--warning { background: var(--color-status-warning-soft); color: var(--color-text-primary); }
.banner--warning svg { color: var(--color-status-warning); }
.banner--success { background: var(--color-status-success-soft); color: var(--color-text-primary); }
.banner--success svg { color: var(--color-status-success); }
.banner--danger { background: var(--color-status-danger-soft); color: var(--color-text-primary); }
.banner--danger svg { color: var(--color-status-danger); }
.banner--offline { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); border-radius: var(--radius-pill); padding: 8px 14px; align-items: center; }
.toast {
  position: absolute; left: 50%; top: 62px; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-pill);
  background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: var(--elevation-3);
  font: 600 calc(14px * var(--dt))/1.3 var(--font-family-text); white-space: nowrap;
  animation: toast-in var(--motion-duration-base) var(--motion-ease-spring) both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } }

/* ---------- Sheets & alerts ---------- */
.scrim { position: absolute; inset: 0; background: var(--color-bg-scrim); z-index: 50; animation: fade-in var(--motion-duration-base) both; }
@keyframes fade-in { from { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 55;
  background: var(--color-bg-surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 10px var(--space-gutter) calc(var(--safe-bottom) + 12px); box-shadow: var(--elevation-3);
  animation: sheet-in var(--motion-duration-slow) var(--motion-ease-emphasized) both;
  max-height: calc(100% - 64px); overflow-y: auto;
}
@keyframes sheet-in { from { transform: translateY(40%); opacity: 0; } }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--color-line-strong); margin: 0 auto 16px; }
.sheet-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--color-bg-sunken); margin-bottom: 16px; }
.alert {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 55; width: 290px;
  background: color-mix(in srgb, var(--color-bg-surface) 94%, transparent); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-radius: 16px; overflow: hidden; text-align: center; box-shadow: var(--elevation-3);
  animation: alert-in var(--motion-duration-base) var(--motion-ease-spring) both;
}
@keyframes alert-in { from { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
.alert .alert-body { padding: 20px 16px 16px; }
.alert .alert-btn { display: block; width: 100%; min-height: 44px; border-top: 0.5px solid var(--color-line-strong); font: 400 calc(17px * var(--dt))/1.3 -apple-system, var(--font-family-text); color: #007AFF; padding: 11px; }
:root[data-theme="dark"] .alert .alert-btn { color: #0A84FF; }
.alert .alert-btn.bold { font-weight: 600; }
.alert .alert-btn.destructive { color: var(--color-status-danger); }

/* ---------- Skeleton ---------- */
.skel { background: var(--color-bg-sunken); border-radius: 8px; position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
.card--ink .skel { background: var(--color-bg-inverse-raised); }
@keyframes shimmer { to { transform: translateX(100%); } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty / error states ---------- */
.state-block { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 32px; gap: 12px; }
.state-illo { width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; background: var(--color-bg-sunken); color: var(--color-text-secondary); margin-bottom: 4px; }

/* ---------- Home: quest card & 3-step path ---------- */
.quest { border-radius: var(--radius-lg); padding: 20px; background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: var(--elevation-2); }
.quest-title { font: 700 calc(26px * var(--dt))/calc(33px * var(--dt)) var(--font-family-text); letter-spacing: -0.02em; }
.path { display: grid; grid-template-columns: repeat(3, 1fr); position: relative; margin: 20px 0 20px; }
.path::before { content: ""; position: absolute; top: 15px; left: 16.66%; right: 16.66%; height: 2px; background: var(--color-bg-inverse-raised); }
.path .seg-fill { position: absolute; top: 15px; left: 16.66%; height: 2px; background: var(--color-reward); width: var(--fill, 0%); }
.path-step { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; }
.path-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 800 14px/1 var(--font-family-numeric); background: var(--color-bg-inverse); box-shadow: inset 0 0 0 1.5px #4A4743; color: var(--color-text-on-inverse-secondary); }
.path-step.done .path-dot { background: var(--color-reward); color: #171717; box-shadow: none; }
.path-step.current .path-dot { background: var(--color-text-on-inverse); color: #171717; box-shadow: 0 0 0 4px rgba(250,249,245,.14); }
.path-label { font: 600 calc(12px * var(--dt))/1.2 var(--font-family-text); color: var(--color-text-on-inverse-secondary); }
.path-step.current .path-label, .path-step.done .path-label { color: var(--color-text-on-inverse); }
.focus-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 10px; border-radius: var(--radius-pill); background: var(--color-bg-inverse-raised); font: 600 calc(13px * var(--dt))/1.3 var(--font-family-text); color: var(--color-text-on-inverse); }
.focus-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-reward); }
.focus-chip.light { background: var(--color-bg-surface); color: var(--color-text-primary); box-shadow: inset 0 0 0 1px var(--color-line-hairline); }
.focus-chip.light .dot { background: var(--color-topic-violet); }

/* ---------- Record ---------- */
.rec-wrap { display: flex; flex-direction: column; align-items: center; }
.rec { position: relative; width: var(--size-record-ring); height: var(--size-record-ring); display: grid; place-items: center; }
.rec .ring { position: absolute; border-radius: 50%; inset: 0; }
.rec .ring.r1 { box-shadow: inset 0 0 0 3px var(--color-text-primary); }
.rec .ring.r2 { inset: 22px; box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.rec.compact { width: 176px; height: 176px; }
.rec.compact .ring.r2 { inset: 18px; }
.rec.compact .ring.r3 { inset: 32px; }
.rec .ring.r3 { inset: 40px; box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.rec-btn { width: var(--size-record-button); height: var(--size-record-button); border-radius: 50%; background: var(--color-bg-inverse); color: var(--color-text-on-inverse); display: grid; place-items: center; position: relative; z-index: 2; box-shadow: 0 12px 28px rgba(23,23,23,.28); transition: background var(--motion-duration-fast), transform var(--motion-duration-fast) var(--motion-ease-spring); }
.rec.is-recording .rec-btn { background: var(--color-accent-primary); color: #fff; box-shadow: var(--elevation-record); }
.rec.is-recording .ring.r1 { box-shadow: inset 0 0 0 3px var(--color-accent-primary); }
.rec.is-recording .ring.r2, .rec.is-recording .ring.r3 { background: var(--color-accent-primary-soft); box-shadow: none; animation: breathe var(--motion-breath) var(--motion-ease-standard) infinite; }
.rec.is-recording .ring.r2 { opacity: .55; }
.rec.is-recording .ring.r3 { animation-delay: 200ms; }
@keyframes breathe { 0%, 100% { transform: scale(0.94); } 50% { transform: scale(1.03); } }
.rec.is-paused .rec-btn { background: var(--color-bg-surface); color: var(--color-text-primary); box-shadow: inset 0 0 0 2px var(--color-text-primary), 0 10px 24px rgba(23,23,23,.12); }
.rec.is-disabled .rec-btn { background: var(--color-bg-sunken); color: var(--color-text-disabled); box-shadow: none; }
.rec.is-disabled .ring.r1 { box-shadow: inset 0 0 0 3px var(--color-line-strong); }
.timer-row { display: flex; align-items: baseline; gap: 6px; margin-top: 24px; }
.timer-max { font: 600 calc(15px * var(--dt))/1 var(--font-family-numeric); color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 40px; margin-top: 16px; }
.wave i { width: 3px; border-radius: 2px; background: var(--color-line-strong); height: 4px; }
.wave.live i { background: var(--color-accent-primary); animation: wave 900ms ease-in-out infinite alternate; }
.wave.frozen i { background: var(--color-text-tertiary); }
@keyframes wave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
.rec-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--color-status-danger-soft); color: var(--color-status-danger); font: 700 calc(12px * var(--dt))/1 var(--font-family-text); }
.rec-indicator::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-recording); animation: blink 1.2s steps(2) infinite; }
.rec-indicator.paused { background: var(--color-bg-sunken); color: var(--color-text-secondary); }
.rec-indicator.paused::before { background: var(--color-text-tertiary); animation: none; }
@keyframes blink { 50% { opacity: .2; } }
.rec-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
.round-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); font: 700 calc(13px * var(--dt))/1 var(--font-family-text); }

/* ---------- Score ring & feedback ---------- */
.score-ring { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .val small { font: 600 11px/1 var(--font-family-text); color: var(--color-text-tertiary); margin-bottom: 2px; }
.score-ring .val b { font: 800 calc(40px * var(--dt))/1 var(--font-family-numeric); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-ring .arc { transition: stroke-dashoffset var(--motion-duration-countup) var(--motion-ease-emphasized); }
.dim-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; align-items: center; position: relative; }
.dim-row + .dim-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--color-line-hairline); }
.dim-row .dim-score { font: 800 calc(24px * var(--dt))/1 var(--font-family-numeric); font-variant-numeric: tabular-nums; grid-row: span 2; align-self: center; }
.dim-row .dim-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--color-bg-sunken); overflow: hidden; margin-top: 6px; }
.dim-row .dim-bar i { display: block; height: 100%; width: var(--fill); background: var(--dimc, var(--color-text-primary)); border-radius: inherit; }
.dim-name { display: flex; align-items: center; gap: 8px; }
.dim-name::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--dimc, var(--color-text-primary)); flex-shrink: 0; }
.ts-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 6px; background: var(--color-bg-sunken); font: 700 calc(12px * var(--dt))/1.3 var(--font-family-numeric); font-variant-numeric: tabular-nums; color: var(--color-text-primary); white-space: nowrap; min-height: 22px; }
.card--ink .ts-chip { background: var(--color-bg-inverse-raised); color: var(--color-text-on-inverse); }
.one-action { border-radius: var(--radius-lg); background: var(--color-bg-inverse); color: var(--color-text-on-inverse); padding: 20px; box-shadow: var(--elevation-2); }
.one-action .oa-head { display: flex; align-items: center; gap: 8px; color: var(--color-reward); font: 700 calc(15px * var(--dt))/1.2 var(--font-family-text); }
.one-action .oa-instruction { font: 700 calc(20px * var(--dt))/calc(28px * var(--dt)) var(--font-family-text); margin-top: 10px; }
.one-action .oa-example { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--color-bg-inverse-raised); font: 400 calc(15px * var(--dt))/1.6 var(--font-family-reading); color: var(--color-text-on-inverse); }
.evidence { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; padding: 14px 16px; position: relative; align-items: start; }
.evidence + .evidence::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--color-line-hairline); }
.evidence .quote { font: 400 calc(15px * var(--dt))/1.55 var(--font-family-reading); }
.evidence.is-playing { background: var(--color-topic-violet-soft); }
.evidence.is-playing .ts-chip { background: var(--color-topic-violet); color: #fff; }
.player { display: flex; align-items: center; gap: 12px; }
.player .pbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--color-bg-inverse); color: var(--color-text-on-inverse); flex-shrink: 0; }
.player .track { flex: 1; height: 4px; border-radius: 2px; background: var(--color-line-strong); position: relative; }
.player .track i { position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%); background: var(--color-text-primary); border-radius: inherit; }
.player .track i::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-text-primary); }
.mark { background: linear-gradient(transparent 55%, color-mix(in srgb, var(--color-topic-violet) 28%, transparent) 55%); padding: 0 1px; }
.mark-miss { text-decoration: underline wavy var(--color-status-warning); text-underline-offset: 4px; }

/* ---------- Completion ---------- */
.trophy { width: 104px; height: 104px; border-radius: 30px; background: var(--color-reward); color: #171717; display: grid; place-items: center; transform: rotate(-6deg); box-shadow: 0 16px 36px rgba(184,214,47,.35); animation: pop var(--motion-duration-celebrate) var(--motion-ease-spring) both; }
.trophy.neutral { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: var(--elevation-2); transform: none; }
@keyframes pop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 100% { transform: scale(1) rotate(-6deg); opacity: 1; } }
.rays { position: absolute; inset: -30px; pointer-events: none; }
.rays i { position: absolute; left: 50%; top: 50%; width: 4px; height: 18px; margin: -9px -2px; border-radius: 2px; background: var(--color-reward-deep); transform: rotate(var(--r)) translateY(-86px); animation: ray var(--motion-duration-celebrate) var(--motion-ease-emphasized) both; }
@keyframes ray { from { opacity: 0; transform: rotate(var(--r)) translateY(-50px); } }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--color-bg-sunken); border-radius: var(--radius-md); padding: 14px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.stat b { font: 800 calc(24px * var(--dt))/1 var(--font-family-numeric); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font: 600 calc(11px * var(--dt))/1.25 var(--font-family-text); color: var(--color-text-secondary); }
.ba { border-radius: var(--radius-lg); background: var(--color-bg-inverse); color: var(--color-text-on-inverse); padding: 18px 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; box-shadow: var(--elevation-2); }
.ba .side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ba .side small { font: 600 calc(12px * var(--dt))/1.2 var(--font-family-text); color: var(--color-text-on-inverse-secondary); }
.ba .side b { font: 800 calc(44px * var(--dt))/1 var(--font-family-numeric); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ba .side.after b { color: var(--color-reward); }
.ba .side.after.flat b { color: var(--color-text-on-inverse); }
.ba .side .sub { font: 600 calc(12px * var(--dt))/1.2 var(--font-family-numeric); color: var(--color-text-on-inverse-secondary); font-variant-numeric: tabular-nums; }
.ba-foot { grid-column: 1 / -1; display: flex; justify-content: center; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-line-inverse); font: 600 calc(13px * var(--dt))/1.3 var(--font-family-text); color: var(--color-text-on-inverse-secondary); flex-wrap: wrap; }
.ba-foot b { color: var(--color-text-on-inverse); font-family: var(--font-family-numeric); }
.delta-up { color: var(--color-status-success); } .delta-down { color: var(--color-status-warning); }
.card--ink .delta-up, .ba .delta-up { color: var(--color-reward); }
.xp-lines { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font: 500 calc(14px * var(--dt))/1.35 var(--font-family-text); }
.xp-lines b { font: 800 calc(14px * var(--dt))/1.35 var(--font-family-numeric); text-align: right; }
.xp-lines .muted { color: var(--color-text-tertiary); text-decoration: line-through; }

.overlay-ink { position: absolute; inset: 0; z-index: 58; background: rgba(12,12,11,.94); color: #FAF9F5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 32px; animation: fade-in var(--motion-duration-base) both; }

/* ---------- Growth ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .line { fill: none; stroke: var(--color-text-primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#areaGrad); }
.chart .grid { stroke: var(--color-line-hairline); stroke-width: 1; }
.chart .axis { font: 600 10px var(--font-family-numeric); fill: var(--color-text-tertiary); }
.chart .pt { fill: var(--color-bg-surface); stroke: var(--color-text-primary); stroke-width: 2; }
.chart .pt.last { fill: var(--color-reward); stroke: #171717; }
.chart .gap { stroke: var(--color-line-strong); stroke-dasharray: 2 4; stroke-width: 1.5; }
.chart .gap-mark { fill: var(--color-bg-canvas); stroke: var(--color-line-strong); stroke-width: 1.5; stroke-dasharray: 2 2; }
.chart .next { fill: none; stroke: var(--color-text-tertiary); stroke-dasharray: 3 3; stroke-width: 1.5; }
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skill { background: var(--color-bg-surface); border-radius: var(--radius-md); padding: 14px; box-shadow: var(--elevation-1); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skill.is-focus { box-shadow: inset 0 0 0 2px var(--color-text-primary); }
.skill.is-empty { background: var(--color-bg-sunken); box-shadow: none; }
.pips { display: flex; gap: 3px; }
.pips i { flex: 1; height: 6px; border-radius: 2px; background: var(--color-bg-sunken); }
.pips i.on { background: var(--color-status-success); }
.pips i.miss { background: var(--color-line-strong); }
.ach-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 var(--space-gutter); scrollbar-width: none; }
.ach { width: 104px; flex-shrink: 0; background: var(--color-bg-surface); border-radius: var(--radius-md); padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: var(--elevation-1); }
.ach .ach-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--color-reward); color: #171717; }
.ach.locked .ach-icon { background: var(--color-bg-sunken); color: var(--color-text-tertiary); }
.ach.locked { box-shadow: inset 0 0 0 1px var(--color-line-hairline); background: none; }

/* ---------- Onboarding ---------- */
.ob-progress { display: grid; grid-auto-flow: column; gap: 6px; padding: 12px var(--space-gutter) 0; }
.ob-progress i { height: 4px; border-radius: 2px; background: var(--color-line-hairline); }
.ob-progress i.on { background: var(--color-text-primary); }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px; border-radius: var(--radius-md); background: var(--color-bg-surface);
  box-shadow: inset 0 0 0 1px var(--color-line-hairline); min-height: 72px;
  transition: box-shadow var(--motion-duration-fast), transform var(--motion-duration-fast) var(--motion-ease-spring);
}
.option .opt-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--color-bg-sunken); flex-shrink: 0; }
.option .radio { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--color-line-strong); display: grid; place-items: center; flex-shrink: 0; color: transparent; }
.option[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--color-text-primary); }
.option[aria-checked="true"] .radio { background: var(--color-text-primary); box-shadow: none; color: var(--color-bg-canvas); }
.option[aria-checked="true"] .opt-icon { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); }
.day-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.day-opt { border-radius: var(--radius-md); background: var(--color-bg-surface); box-shadow: inset 0 0 0 1px var(--color-line-hairline); padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; justify-content: center; }
.day-opt b { font: 800 calc(30px * var(--dt))/1 var(--font-family-numeric); }
.day-opt[aria-checked="true"] { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: none; }
.day-opt[aria-checked="true"] span { color: var(--color-text-on-inverse-secondary); }
.wheel { position: relative; height: 170px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: var(--radius-md); background: var(--color-bg-surface); box-shadow: inset 0 0 0 1px var(--color-line-hairline); }
.wheel::before { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 36px; margin-top: -18px; border-radius: 8px; background: var(--color-bg-sunken); }
.wheel .col { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: 500 calc(20px * var(--dt))/30px var(--font-family-numeric); color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
.wheel .col .sel { color: var(--color-text-primary); font-weight: 700; font-size: calc(22px * var(--dt)); }
.wheel .col .far { opacity: .4; font-size: 17px; }

/* ---------- Paywall ---------- */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--color-text-primary) var(--pct, 50%), var(--color-line-strong) var(--pct, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--color-line-strong); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--color-text-primary); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: var(--color-bg-surface); box-shadow: 0 0 0 2px var(--color-text-primary), 0 3px 8px rgba(0,0,0,.18); margin-top: -12px; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--color-bg-surface); border: 2px solid var(--color-text-primary); }
.range:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 4px; border-radius: 8px; }
.range-ticks { display: flex; justify-content: space-between; padding: 0 4px; }
.range-ticks button { min-width: 44px; min-height: 32px; font: 700 calc(13px * var(--dt))/1 var(--font-family-text); color: var(--color-text-tertiary); }
.range-ticks button[aria-pressed="true"] { color: var(--color-text-primary); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font: 600 10px/1 var(--font-family-text); color: var(--color-text-tertiary); text-align: center; padding-bottom: 4px; }
.cal-day { position: relative; border-radius: 10px; padding: 6px 2px 6px; min-height: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--color-bg-sunken); text-align: center; transition: background var(--motion-duration-fast), color var(--motion-duration-fast); }
.cal-day .dn { font: 700 13px/1 var(--font-family-numeric); }
.cal-day .th { font: 600 9.5px/1.2 var(--font-family-text); color: var(--color-text-secondary); word-break: break-all; }
.cal-day.practice { background: var(--color-bg-surface); box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.cal-day.today { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); box-shadow: none; }
.cal-day.today .th { color: var(--color-text-on-inverse-secondary); }
.cal-day.rest .th { color: var(--color-text-disabled); }
.cal-day .mk { position: absolute; top: -5px; right: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; }
.cal-day .mk.streak { background: var(--color-status-warning); color: #fff; }
.cal-day .mk.bill { background: var(--color-text-primary); color: var(--color-bg-canvas); }
.cal-day .mk.goal { background: var(--color-reward); color: #171717; }
.cal-day.billing { box-shadow: inset 0 0 0 1.5px var(--color-text-primary); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 500 calc(12px * var(--dt))/1.3 var(--font-family-text); color: var(--color-text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.product {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; width: 100%; text-align: left;
  padding: 16px; border-radius: var(--radius-md); background: var(--color-bg-surface); box-shadow: inset 0 0 0 1px var(--color-line-strong); position: relative;
}
.product[aria-checked="true"] { box-shadow: inset 0 0 0 2.5px var(--color-text-primary); }
.product .radio { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--color-line-strong); grid-row: span 2; display: grid; place-items: center; color: transparent; }
.product[aria-checked="true"] .radio { background: var(--color-text-primary); color: var(--color-bg-canvas); box-shadow: none; }
.product .price { font: 800 calc(18px * var(--dt))/1.1 var(--font-family-numeric); text-align: right; white-space: nowrap; }
.product .badge { position: absolute; top: -10px; right: 14px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--color-line-hairline); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--color-bg-sunken); }
.tl-dot.ink { background: var(--color-bg-inverse); color: var(--color-text-on-inverse); }
.tl-dot.reward { background: var(--color-reward); color: #171717; }

/* ---------- Accessibility Dynamic Type layout switches (≥ AX1) ---------- */
.dt-ax .stat-grid { grid-template-columns: 1fr; }
.dt-ax .stat { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 16px; text-align: left; }
.dt-ax .stat span { margin-left: auto; }
.dt-ax .ba .side .sub { display: none; }
.dt-ax #cal, .dt-ax .legend { display: none; }
.dt-ax .day-picker { grid-template-columns: 1fr; }
.dt-ax .skill-grid { grid-template-columns: 1fr; }

/* ---------- Bindings overlay (press "b" or the spec toggle) ---------- */
.show-binds [data-bind] { outline: 1.5px dashed rgba(110,75,255,.85); outline-offset: 1px; position: relative; }
.show-binds [data-bind]::after {
  content: attr(data-bind); position: absolute; left: 0; top: 100%; z-index: 90; white-space: nowrap;
  font: 600 9px/1.3 ui-monospace, Menlo, monospace; color: #fff; background: rgba(110,75,255,.92);
  padding: 1px 4px; border-radius: 3px; pointer-events: none; letter-spacing: 0; text-transform: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
