/* ─── app layout ────────────────────────────────────────────── */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--page-max);
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* sticky header — minimal + translucent chrome */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
@supports not (backdrop-filter: blur(1px)) {
  .header { background: var(--bg); }
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  min-height: var(--header-h);
}

.header__title {
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
}
.header__title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.header__title small {
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  margin-left: var(--space-2);
}

/* tabs */
.tabs {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 49;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--space-3);
  /* indicator positioning vars written by router on active-tab change */
  --tab-x: 0;
  --tab-w: 0;
}
@supports not (backdrop-filter: blur(1px)) {
  .tabs { background: var(--bg); }
}
.tabs::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  background: var(--ink);
  transform: translateX(var(--tab-x)) scaleX(var(--tab-w));
  transform-origin: left center;
  transition: transform var(--dur-mid) var(--ease-ios);
  pointer-events: none;
  will-change: transform;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: 0 0 auto;
  padding: 0 var(--space-3);
  min-height: var(--tabs-h);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}
.tab[aria-selected="true"] { color: var(--ink); }
/* underline is now a single shared indicator on .tabs::before (animated) */

/* main scroll region */
.main {
  padding: var(--space-5) var(--space-4) calc(var(--space-9) * 2);
  padding-left: calc(var(--space-4) + var(--safe-left));
  padding-right: calc(var(--space-4) + var(--safe-right));
  overscroll-behavior-y: contain;
}

/* view head */
.view-head {
  margin: 0 0 var(--space-6);
}
.view-head__eyebrow {
  font-size: var(--fs-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: var(--space-2);
}
.view-head__title {
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}
.view-head__subtitle {
  margin-top: var(--space-3);
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

/* section */
.section {
  margin-top: var(--space-6);
}
.section:first-child { margin-top: 0; }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding: 0;
}
.section__title {
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.section__meta {
  font-size: var(--fs-2xs);
  color: var(--ink-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  font-family: var(--font-mono);
}

/* tones — visually the same, just plumbing for backward compat */
.section.tone-accent,
.section.tone-pull,
.section.tone-core { --section-tone: var(--line-strong); }

/* helpers */
.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.stack--lg { gap: var(--space-5); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

/* login layout */
.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  max-width: 340px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  padding-top: calc(var(--safe-top) + var(--space-6));
  padding-bottom: calc(var(--safe-bot) + var(--space-6));
}

/* fixed bottom timer bar — translucent chrome */
.timer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + var(--safe-bot));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border-top: 1px solid var(--line);
  transform: translateY(120%);
  transition: transform var(--dur-lg) var(--ease-spring);
  will-change: transform;
  overscroll-behavior-y: contain;
}
@supports not (backdrop-filter: blur(1px)) {
  .timer-bar { background: var(--bg); }
}
.timer-bar.is-visible { transform: translateY(0); }

.timer-bar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-2);
  align-items: center;
}
.timer-bar__meta { min-width: 0; }
.timer-bar__adjust {
  display: flex;
  gap: 4px;
}
.timer-bar__controls {
  display: flex;
  gap: 4px;
}
.timer-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: -0.02em;
  height: 36px;
  min-width: 40px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-xs) var(--ease-ios),
              border-color var(--dur-xs) var(--ease-ios),
              transform var(--dur-xs) var(--ease-ios);
}
.timer-chip:hover { border-color: var(--ink); }
.timer-chip:active { background: var(--surface-2); transform: scale(0.94); }

.timer-bar__time {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
}
.timer-bar__label {
  font-size: var(--fs-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
  font-weight: 500;
}

.timer-bar__time { transition: color var(--dur-sm) var(--ease-ios); }
.timer-bar__label { transition: color var(--dur-sm) var(--ease-ios); }
.timer-bar.is-warn .timer-bar__time { color: var(--accent); }
.timer-bar.is-done .timer-bar__time { color: var(--accent); }
.timer-bar.is-done .timer-bar__label { color: var(--accent); }

@keyframes timer-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50%      { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
}
.timer-bar.is-warn { animation: timer-pulse 900ms var(--ease-ios) infinite; }

.install-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.install-banner__text { flex: 1; color: var(--ink-2); }
