/* ===== Self-hosted fonts (zero external requests) ===== */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('../fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/plex-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/plex-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/plex-mono-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/plex-mono-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ===== Theme tokens ===== */
:root {
  color-scheme: light;
  --bg: #f4efe5;
  --surface: #fbf7ef;
  --surface-2: #efe8db;
  --text: #191612;
  --muted: #6e6457;
  --rule: #d8cfc0;
  --rule-strong: #b9ac9a;
  --accent: #b93d2b;
  --accent-strong: #9f3122;
  --on-accent: #fff8f1;
  --positive: #246b4e;
  --danger: #c0392b;
  --danger-ring: rgba(192, 57, 43, .16);
  --bar: #e8e0d3;
  --shadow: 0 1px 0 rgba(25, 22, 18, .035);
  --focus-ring: rgba(185, 61, 43, .18);
  --radius: 10px;
  --max: 1120px;
  --font-display: 'Fraunces', 'Noto Serif SC', 'Songti SC', Georgia, serif;
  --font-sans: 'IBM Plex Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Native CJK fallbacks keep Japanese and Korean glyph shapes correct. */
html:lang(ja) {
  --font-display: 'Fraunces', 'Noto Serif JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
  --font-sans: 'IBM Plex Sans', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', 'Noto Sans JP', sans-serif;
}
html:lang(ko) {
  --font-display: 'Fraunces', 'Noto Serif KR', 'Batang', 'Nanum Myeongjo', serif;
  --font-sans: 'IBM Plex Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}
/* Traditional Chinese needs TC glyph shapes (not the simplified fallbacks). */
html:lang(zh-TW),
html:lang(zh-Hant) {
  --font-display: 'Fraunces', 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif;
  --font-sans: 'IBM Plex Sans', 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
}

html.dark {
  color-scheme: dark;
  --bg: #14120f;
  --surface: #1c1915;
  --surface-2: #24201a;
  --text: #f1eadf;
  --muted: #a79b8a;
  --rule: #342f28;
  --rule-strong: #4d4539;
  --accent: #e06a50;
  --accent-strong: #ef7d62;
  --on-accent: #1b100c;
  --positive: #63b08d;
  --danger: #ff8a73;
  --danger-ring: rgba(255, 138, 115, .22);
  --bar: #2a251f;
  --shadow: none;
  --focus-ring: rgba(224, 106, 80, .24);
}

/* ===== Base ===== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(25, 22, 18, .075) 1px, transparent 0);
  background-size: 24px 24px;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html.dark body {
  background-image: radial-gradient(circle at 1px 1px, rgba(241, 234, 223, .055) 1px, transparent 0);
}

::selection { background: var(--accent); color: var(--on-accent); }

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.015em;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px; letter-spacing: -.02em;
}
.brand::before {
  content: '';
  width: 8px; height: 8px; flex: none;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.controls { display: flex; gap: 8px; align-items: center; }
.controls select {
  width: auto; min-width: 72px;
  padding: 8px 10px; font-size: 13px;
}

/* ===== Form controls ===== */
input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

button { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 600; line-height: 1.2;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .1s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { display: block; width: 16px; height: 16px; flex: none; }
.btn-primary {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  background: transparent; color: var(--text);
  border: 1px solid var(--rule-strong); border-radius: 50%;
  transition: color .18s ease, border-color .18s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { display: block; width: 18px; height: 18px; }
.icon-btn .icon-sun { display: none; }
html.dark .icon-btn .icon-sun { display: block; }
html.dark .icon-btn .icon-moon { display: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Layout ===== */
main {
  max-width: var(--max); margin: 0 auto;
  padding: 30px 24px 52px;
  display: grid; gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.content { display: grid; gap: 20px; }

/* ===== Hero ===== */
.hero {
  padding: 10px 0 30px;
  border-bottom: 1px solid var(--rule-strong);
}
.sample-banner {
  width: 100%;
  min-height: 44px;
  margin: 0 0 18px;
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 14px; flex-wrap: wrap;
  font: inherit; text-align: left; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.sample-banner[hidden] { display: none; }
.sample-banner:hover { border-color: var(--accent); }
.sample-copy {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px; line-height: 1.5; letter-spacing: .02em;
  color: var(--muted);
}
.sample-copy b {
  flex: none;
  color: var(--accent);
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
.sample-cta {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.hero-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 26px;
}
.tagline {
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
  text-wrap: balance;
}
.tagline::before {
  content: ''; width: 22px; height: 1px; flex: none;
  background: var(--accent);
}
.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
.hero-primary {
  min-width: 0; padding-right: 34px;
  display: flex; flex-direction: column;
}
.hero-secondary {
  min-width: 0;
  padding-left: 34px;
  border-left: 1px solid var(--rule-strong);
  display: flex; flex-direction: column;
}
/* fitTickers() briefly restores the base font while measuring. Clip that
   transient nowrap overflow so mobile browsers don't resize the page and
   clamp the vertical scroll position. */
.hero-primary, .hero-secondary {
  overflow: hidden;
  overflow: clip;
}
.hero-label {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.ticker, .ticker-month {
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: clamp(38px, 6vw, 70px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color .18s ease, opacity .2s ease;
}
.ticker-month { font-weight: 500; }
.hero-cap {
  margin-top: auto;
  padding-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .03em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hero-cap b { color: var(--text); font-weight: 600; }
.hero-cap .hero-note {
  display: block;
  margin-top: 3px;
  font-size: .9em;
  letter-spacing: .01em;
}
.hero-live { display: flex; align-items: center; gap: 7px; }
.live-dot {
  width: 5px; height: 5px; flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* ===== Settings ===== */
.settings { padding: 0; overflow: hidden; scroll-margin-top: 84px; }
.settings-summary { display: none; }
.settings-body { padding: 20px; display: grid; gap: 22px; }
.settings-group { display: grid; gap: 12px; }
.group-title {
  margin: 0; padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; }
.currency-wrap { min-width: 0; }
.currency-wrap select { padding-left: 8px; padding-right: 6px; font-size: 12px; }
.time-wrap { position: relative; min-width: 0; }
.time-input {
  position: relative;
  /* iOS/WebView time controls paint their own chevron that the webkit
     pseudo-element below cannot always reach; drop the native skin entirely. */
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  padding-right: 46px;
}
/* Some Chrome/Edge builds render their own clock/chevron on top of our button. */
.time-wrap input[type="time"]::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
}
/* Safari paints temporal steppers through the spin-button pseudo-elements. */
.time-input::-webkit-inner-spin-button,
.time-input::-webkit-outer-spin-button {
  display: none;
  -webkit-appearance: none;
  margin: 0;
}
/* appearance:none centres the shadow value on iOS; keep it next to the label. */
.time-input::-webkit-date-and-time-value { text-align: left; }
.time-picker {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  width: 44px;
  display: grid; place-items: center;
  padding: 0;
  /* Opaque: mobile WebViews that ignore the pseudo-element would otherwise
     show a native chevron underneath the clock. */
  background: var(--surface);
  border: 0;
  border-radius: 0 5px 5px 0;
  color: var(--muted);
  transition: color .15s ease;
  z-index: 1;
}
.time-picker svg { display: block; width: 16px; height: 16px; pointer-events: none; }
.time-picker:hover,
.time-wrap:focus-within .time-picker { color: var(--accent); }
.field.has-error > label { color: var(--danger); }
.field.has-error input,
.time-input[aria-invalid="true"] {
  border-color: var(--danger);
}
.field.has-error input:focus,
.time-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-ring);
}
.field-error {
  display: flex; align-items: flex-start; gap: 7px;
  margin: 0;
  font-size: 12px; line-height: 1.45;
  color: var(--danger);
}
.field-error[hidden] { display: none; }
.field-error::before {
  content: '';
  width: 6px; height: 6px; margin-top: 6px;
  flex: none;
  background: currentColor;
}
.help { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.settings-foot {
  margin: 0; padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10px; line-height: 1.5;
  color: var(--muted);
}

/* ===== Section heads ===== */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.section-head h2::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 10px;
  vertical-align: 2px;
  background: var(--accent);
}

/* ===== Breakdown ===== */
.breakdown { padding: 22px; }
.breakdown-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat { min-width: 0; }
.stat-feature { padding: 18px 18px 18px 0; }
.stat-feature + .stat-feature { padding-left: 18px; border-left: 1px solid var(--rule); }
.stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.stat-feature .stat-val { font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; letter-spacing: -.03em; }
.stat-label {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
/* Cadence ladder: sec · min · week · month · year in one aligned strip.
   Five equal columns on wide screens, 3-up / 2-up as the column narrows. */
.ladder-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-top: 16px;
}
.stat-ladder { min-width: 0; padding: 0 12px; border-left: 1px solid var(--rule); }
.stat-ladder:first-child { padding-left: 0; border-left: 0; }
.stat-ladder .stat-val { font-size: 14px; font-weight: 600; }
.stat-ladder .stat-label { margin-top: 4px; }
@media (max-width: 1099px) {
  .ladder-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .stat-ladder:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
}
@media (max-width: 899px) {
  .ladder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-ladder:nth-child(3n + 1) { padding-left: 12px; border-left: 1px solid var(--rule); }
  .stat-ladder:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
}
@media (max-width: 339px) {
  .stat-ladder { padding: 0 8px; }
  .stat-ladder:nth-child(3n + 1) { padding-left: 8px; border-left: 1px solid var(--rule); }
  .stat-ladder:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
  .stat-ladder .stat-val { font-size: 13px; }
}

/* ===== Progress ===== */
.progress { padding: 22px; }
.progress-head { align-items: flex-end; margin-bottom: 18px; }
.time-ledger { display: flex; gap: 22px; margin-left: auto; }
.time-cell { display: grid; gap: 3px; text-align: right; }
.time-cell + .time-cell {
  padding-left: 22px;
  border-left: 1px dotted var(--rule-strong);
}
.time-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.time-value {
  font-family: var(--font-mono);
  font-size: 17px; font-weight: 600; line-height: 1.1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.bar {
  position: relative;
  height: 30px;
  background: var(--bar);
  border-radius: 999px;
}
.bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}
.bar-knob {
  position: absolute; top: 50%;
  /* right edge rides the fill edge, never half outside it */
  left: clamp(58px, var(--p, 0%), 100%);
  transform: translate(-100%, -50%);
  display: flex; align-items: center; justify-content: center;
  min-width: 58px; height: 24px;
  padding: 0 9px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  box-shadow: 0 1px 2px rgba(25, 22, 18, .08);
  transition: left .3s ease, background .18s ease, color .18s ease;
  pointer-events: none;
  z-index: 2;
}
html.dark .bar-knob { box-shadow: none; }
.timeline-scale {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .05em;
  color: var(--muted);
}
.progress-foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 16px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Quote ===== */
.quote {
  padding: 26px 22px;
  border-left: 3px solid var(--accent);
}
.quote-eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.quote-text {
  position: relative;
  margin: 0; padding-left: 30px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.8vw, 28px);
  font-style: italic; font-weight: 600;
  line-height: 1.35;
}
.quote-text::before {
  content: '\201C';
  position: absolute; left: 0; top: -8px;
  font-family: var(--font-display);
  font-style: normal; font-weight: 700;
  font-size: 52px; line-height: 1;
  color: var(--accent);
  opacity: .5;
}
@keyframes quote-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.quote-text.quote-in { animation: quote-in .35s ease both; }

.calc-note {
  margin: 0; padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 11px; line-height: 1.65;
  color: var(--muted);
  white-space: pre-line;
}
.breakdown .calc-note {
  margin-top: 16px; padding: 14px 2px 0;
  border-top: 1px solid var(--rule);
}

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 12px; flex-wrap: wrap;
}
.privacy {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500;
  color: var(--muted);
}
.privacy svg { display: block; width: 14px; height: 14px; flex: none; color: var(--positive); }
.local-clock {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px; line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.local-clock > svg { display: block; width: 14px; height: 14px; flex: none; }
.local-label {
  font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
}
.local-clock time {
  color: var(--text);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .02em;
}
.local-zone {
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 9.5px; letter-spacing: .04em;
}

/* ===== Motion ===== */
@media (prefers-reduced-motion: no-preference) {
  .hero-primary, .hero-secondary {
    animation: hero-in .55s cubic-bezier(.2, .7, .2, 1) both;
  }
  .hero-secondary { animation-delay: .08s; }
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live-pulse 2.4s ease-in-out infinite; }
}
@keyframes live-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

/* ===== Responsive ===== */
@media (min-width: 760px) {
  main { grid-template-columns: 310px minmax(0, 1fr); align-items: start; }
  .hero { grid-column: 1 / -1; }
  .settings { grid-column: 1; grid-row: 2; position: sticky; top: 86px; }
  .content { grid-column: 2; grid-row: 2; }
}

@media (min-width: 760px) and (max-width: 900px) {
  /* the narrower content column cannot fit two feature values at the 1M cap */
  .breakdown-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-feature { padding: 16px 0; }
  .stat-feature + .stat-feature {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
  }
  .time-ledger { gap: 16px; }
  .time-cell + .time-cell { padding-left: 16px; }
  .time-value { font-size: 15px; }
}

@media (max-width: 759px) {
  .topbar-inner { padding: 12px 18px; }
  main { padding: 24px 18px 40px; gap: 20px; }
  .settings-summary {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 13px 54px 13px 18px;
    text-align: left;
    cursor: pointer;
    list-style: none;
    transition: background .15s ease;
  }
  .settings-summary:hover { background: var(--surface-2); }
  .settings-summary::-webkit-details-marker { display: none; }
  .settings-summary .settings-title {
    display: block;
    text-align: left;
    font-family: var(--font-display);
    font-size: 17px; font-weight: 600;
    line-height: 22px;
  }
  .settings-summary svg {
    position: absolute;
    top: 50%; right: 18px;
    display: block; width: 18px; height: 18px;
    margin-top: -9px;
    color: var(--muted);
    transition: transform .2s ease;
  }
  .settings[open] .settings-summary { border-bottom: 1px solid var(--rule); }
  .settings[open] .settings-summary svg { transform: rotate(180deg); }
  .settings-body { padding: 18px; }
  /* keep today / month side by side; fitTickers() scales them to the half width */
  .hero-primary { padding-right: 16px; }
  .hero-secondary { padding-left: 16px; }
  .hero-label { margin-bottom: 9px; font-size: 9px; letter-spacing: .1em; }
  .hero-cap { padding-top: 10px; font-size: 10px; }
}

@media (max-width: 540px) {
  .tagline { gap: 8px; font-size: 10px; letter-spacing: .1em; }
  .tagline::before { width: 16px; }
  /* Reserve two label lines on narrow phones: the longer English month label
     wraps while "Today" does not, otherwise the two tickers sit 13px apart. */
  .hero-label { line-height: 1.5; min-height: 27px; }
  .breakdown { padding: 18px; }
  .breakdown-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-feature { padding: 16px 0; }
  .stat-feature + .stat-feature {
    padding-left: 0; border-left: 0; border-top: 1px solid var(--rule);
  }
  .progress-head { align-items: flex-start; gap: 14px; }
  .time-ledger {
    width: 100%; margin-left: 0;
    justify-content: space-between; gap: 0;
    padding-top: 12px;
    border-top: 1px dotted var(--rule-strong);
  }
  .time-cell { text-align: left; }
  .time-cell + .time-cell {
    padding-left: 0; border-left: 0;
    text-align: right;
  }
  .progress-foot { align-items: stretch; }
  .actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .actions .btn { width: 100%; }
  .footer-inner {
    flex-direction: column; align-items: flex-start;
    padding: 18px;
  }
  .local-clock { margin-left: 0; }
}

@media (max-width: 380px) {
  .topbar-inner { padding: 12px 14px; gap: 10px; }
  .brand { font-size: clamp(16px, 5vw, 20px); gap: 8px; min-width: 0; }
  .controls { gap: 6px; flex: none; }
  .field-pair { grid-template-columns: minmax(0, 1fr); }
  .input-row { grid-template-columns: minmax(0, 1fr) 92px; }
  .controls select { min-width: 62px; }
  /* The localized label pushes the English footer clock past 320px; keep it
     for screen readers but let the icon + date/time + offset carry the row. */
  .local-label {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-primary, .hero-secondary { animation: none; }
  .btn, .bar-fill, .bar-knob, .ticker, .ticker-month, .settings-summary svg {
    transition: none;
  }
  .live-dot { animation: none; }
  .quote-text.quote-in { animation: none; }
}
