/* ==========================================================================
   PomoMed — design system & app layout
   Owner: LAYOUT. Shared tokens/classes used by settings.css, features.css, pages.css
   ========================================================================== */

/* ---------- 0. Fonts: see fonts.css (self-hosted, loaded before this file) ---------- */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Mode palette (light theme) */
  --c-focus: #0f766e;   /* surgical teal */
  --c-short: #0369a1;   /* sky */
  --c-long:  #4338ca;   /* indigo */

  /* Solid accents: always the vivid shade, used on surfaces (buttons, rings) */
  --solid-focus: #0f766e;
  --solid-short: #0369a1;
  --solid-long:  #4338ca;
  --light-focus: #5eead4;
  --light-short: #7dd3fc;
  --light-long:  #a5b4fc;

  --mode-bg: var(--c-focus);
  --mode-solid: var(--solid-focus);
  --mode-light: var(--light-focus);

  /* On-mode-background context */
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, .9);
  --text-soft: rgba(255, 255, 255, .78);
  --card-bg: rgba(255, 255, 255, .09); /* .09 keeps white text on the teal card ≥ 4.5:1 (AA) */
  --card-border: rgba(255, 255, 255, .14);
  --glass: rgba(255, 255, 255, .16);
  --glass-strong: rgba(255, 255, 255, .26);
  --shade: rgba(0, 0, 0, .16);

  /* Surfaces (modals, sheets, white sections) */
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --surface-3: #e8ecef;
  --surface-field: #ffffff;
  --surface-text: #16202c;
  --surface-muted: #4b5866;
  --surface-border: #dde3e8;
  --surface-field-border: #7b8794; /* ≥ 3:1 on white and on --surface-2/-3 (WCAG 1.4.11) */

  /* Shape & depth */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow: 0 12px 32px rgba(4, 20, 30, .18), 0 2px 6px rgba(4, 20, 30, .08);
  --shadow-lg: 0 30px 80px rgba(4, 12, 24, .35), 0 6px 18px rgba(4, 12, 24, .14);

  /* Type */
  --font-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --mode-transition: .6s ease;

  /* Context variables (default = on the colored mode background) */
  --ctx-text: var(--text);
  --ctx-muted: var(--text-muted);
  --ctx-border: rgba(255, 255, 255, .28);
  --ring: #fde047;
  --primary-bg: #ffffff;
  --primary-text: var(--mode-bg);
  --primary-depth: rgba(0, 0, 0, .18);
  --chip-active-bg: #ffffff;
  --chip-active-text: var(--mode-bg);
  --toggle-knob-on: var(--mode-bg);
  /* Fields on the coloured card: a dark tint keeps white text and placeholders
     ≥ 4.5:1, and the border stays ≥ 3:1 against the card (WCAG 1.4.3 / 1.4.11). */
  --field-bg: rgba(0, 0, 0, .16);
  --field-border: rgba(255, 255, 255, .72);
  --field-text: #ffffff;
  --field-placeholder: rgba(255, 255, 255, .86);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* Glass chrome (header buttons, round controls, segmented tabs) */
  --glass-dark: rgba(0, 0, 0, .16);
  --glass-dark-hover: rgba(0, 0, 0, .22);
  --glass-line: rgba(255, 255, 255, .2);
  --glass-line-hover: rgba(255, 255, 255, .55);
  --t-fast: .16s;
  --t-med: .2s;

  --header-h: 64px;
  --gutter: 16px;
  --app-width: 480px;
}

body[data-mode="focus"] { --mode-bg: var(--c-focus); --mode-solid: var(--solid-focus); --mode-light: var(--light-focus); }
body[data-mode="short"] { --mode-bg: var(--c-short); --mode-solid: var(--solid-short); --mode-light: var(--light-short); }
body[data-mode="long"]  { --mode-bg: var(--c-long);  --mode-solid: var(--solid-long);  --mode-light: var(--light-long); }
/* A custom property that references another one is resolved where it is declared:
   on :root, --primary-text, --chip-active-text and --toggle-knob-on would freeze the
   default (light, focus) teal. Re-resolve them on <body>, where the skin (themes.css),
   theme and mode tokens land, so the primary button ink, the active chip ink and the
   switch knob follow Gastro, Pediatria, …, dark and every mode. Surfaces
   (.modal/.surface) still override them with white below. */
body {
  --primary-text: var(--mode-bg);
  --chip-active-text: var(--mode-bg);
  --toggle-knob-on: var(--mode-bg);
}

/* Dark theme: deeper mode shades + dark surfaces */
body[data-theme="dark"] {
  --c-focus: #0a3f3b;
  --c-short: #0a3150;
  --c-long:  #25226a;
  --card-bg: rgba(255, 255, 255, .07);
  --card-border: rgba(255, 255, 255, .1);
  --glass: rgba(255, 255, 255, .12);
  --glass-strong: rgba(255, 255, 255, .2);
  --shade: rgba(0, 0, 0, .28);
  --surface: #111827;
  --surface-2: #1a2333;
  --surface-3: #243045;
  --surface-field: #0b1220;
  --surface-text: #eef2f6;
  --surface-muted: #a3afbf;
  --surface-border: #2c3a50;
  --surface-field-border: #6b7a90;
  --shadow: 0 12px 32px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .6), 0 6px 18px rgba(0, 0, 0, .3);
  --glass-dark: rgba(255, 255, 255, .06);
  --glass-dark-hover: rgba(255, 255, 255, .1);
  --glass-line: rgba(255, 255, 255, .14);
  --glass-line-hover: rgba(255, 255, 255, .42);
  color-scheme: dark;
}
body[data-theme="light"] { color-scheme: light; }

/* Surface context: white panels/modals (dark panels in dark theme) */
.modal,
.surface {
  --ctx-text: var(--surface-text);
  --ctx-muted: var(--surface-muted);
  --ctx-border: var(--surface-border);
  --ring: var(--mode-solid);
  --primary-bg: var(--mode-solid);
  --primary-text: #ffffff;
  --primary-depth: color-mix(in srgb, var(--mode-solid) 62%, #000);
  --chip-active-bg: var(--mode-solid);
  --chip-active-text: #ffffff;
  --toggle-knob-on: #ffffff;
  --field-bg: var(--surface-field);
  --field-border: var(--surface-field-border);
  --field-text: var(--surface-text);
  --field-placeholder: var(--surface-muted);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%236b7785' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: var(--surface-text);
}
body[data-theme="dark"] .modal,
body[data-theme="dark"] .surface {
  --ring: var(--mode-light);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23a3afbf' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- 2. Reset & base --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  scroll-padding-top: 16px;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--mode-bg);
  transition: background-color var(--mode-transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
body:has(dialog[open]) { overflow: hidden; }

/* subtle top glow so the flat colour has depth */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 70vh;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, .13), transparent 60%);
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; }
::selection { background: rgba(253, 224, 71, .55); color: #111; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ring) 30%, transparent), 0 0 18px 2px color-mix(in srgb, var(--ring) 35%, transparent);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.muted { color: var(--ctx-muted); }

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #111;
  font-weight: 700;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: calc(620px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left));
}

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- 3. Header ---------------------------------------------------- */
.site-header { position: relative; z-index: 5; padding-top: env(safe-area-inset-top); }
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.logo__mark { width: 36px; height: 36px; flex: none; overflow: visible; }
.logo__word {
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.logo__word b { font-weight: 800; }
.logo__pulse { stroke-dasharray: 80; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .logo:hover .logo__pulse { animation: logo-pulse 1.1s var(--ease); }
}
@keyframes logo-pulse {
  0% { stroke-dashoffset: 80; }
  100% { stroke-dashoffset: 0; }
}

/* "Beta" pill right after the wordmark (public beta, v0.x). Not interactive:
   role="img" + aria-label/title carry "Versão beta — …" for AT and hover.
   Dark glass under white text keeps AA on every skin/mode (white on --c-* is
   ≥ 5.5:1 light / ≥ 9:1 dark, and the tint only darkens the light schemes).
   margin-right:auto keeps it next to the logo, not centred by space-between. */
.beta-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 20px;
  margin: 0 auto 0 -4px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-pill);
  background: var(--glass-dark);
  color: var(--text);
  font-size: .625rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
body[data-theme="dark"] .beta-badge { border-color: rgba(255, 255, 255, .34); }
@media (max-width: 420px) {
  .site-header__inner { gap: 8px; }
  .beta-badge { height: 18px; margin-left: -2px; padding: 0 5px; font-size: .5625rem; letter-spacing: .07em; }
}
@media (forced-colors: active) {
  .beta-badge { border-color: CanvasText; }
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.btn.btn-nav {
  min-height: 40px;
  padding: 0 13px 0 11px;
  gap: 7px;
  border: 1px solid var(--glass-line);
  border-radius: 11px;
  background: var(--glass-dark);
  color: var(--text);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  backdrop-filter: blur(8px) saturate(140%);
  transition: background-color .18s, border-color .18s, box-shadow .18s, transform .12s var(--ease);
}
.btn.btn-nav:hover {
  border-color: var(--glass-line-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 3px rgba(255, 255, 255, .06);
}
.btn.btn-nav .icon { width: 19px; height: 19px; }

.btn.btn-pro {
  min-height: 40px;
  padding: 0 13px 0 11px;
  gap: 6px;
  border: 1px solid rgba(255, 236, 170, .9);
  border-radius: 11px;
  background: linear-gradient(135deg, #fff4cc 0%, #fcd34d 48%, #f2a516 100%);
  color: #3b1d03;
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 18px -8px rgba(245, 158, 11, .9);
  transition: filter .18s, box-shadow .18s, transform .12s var(--ease);
}
.btn.btn-pro:hover { filter: brightness(1.05) saturate(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 8px 22px -6px rgba(245, 158, 11, 1); }
.btn.btn-pro .icon { width: 16px; height: 16px; fill: rgba(59, 29, 3, .16); }

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-pill);
  background: var(--shade);
}
.lang-switch a {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 28px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-decoration: none;
  color: var(--text-muted);
  transition: background-color .2s, color .2s;
}
.lang-switch a:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.lang-switch a[aria-current="page"] {
  background: #fff;
  color: var(--mode-bg);
  transition: background-color .2s, color var(--mode-transition);
}

/* ---------- 4. ECG progress line ---------------------------------------- */
.ecg-progress {
  position: relative;
  width: 100%;
  margin: 2px 0 0;
  /* viewBox is 1000×40 → keep 25:1 so the waveform is never distorted */
  aspect-ratio: 25 / 1;
  min-height: 14px;
}
.ecg-progress svg { width: 100%; height: 100%; overflow: visible; }
#ecg-track,
#ecg-fill {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#ecg-track { stroke: rgba(255, 255, 255, .15); }
#ecg-fill {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .55));
  transition: stroke-dashoffset .3s linear;
}
/* optional hooks for ecg.js: add .is-running / toggle .is-beat each second */
.ecg-progress.is-beat #ecg-fill { animation: ecg-beat .45s ease-out; }
.ecg-progress.ecg-snap #ecg-fill { transition: none; }
.ecg-progress.is-running #ecg-track { stroke: rgba(255, 255, 255, .2); }
@keyframes ecg-beat {
  0%   { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .55)); }
  30%  { filter: drop-shadow(0 0 9px rgba(255, 255, 255, .95)); }
  100% { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .55)); }
}

/* ---------- 5. App column & timer card ---------------------------------- */
.app {
  max-width: calc(var(--app-width) + 2 * var(--gutter));
  flex: 1 0 auto;
  padding-top: 20px;
  padding-bottom: 56px;
}

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

.timer-card {
  padding: 20px 16px 30px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset;
}
.timer-card:focus-visible { outline-offset: 4px; border-radius: var(--radius-lg); }

/* Segmented control: timer.js adds .mode-tabs__indicator and slides it under
   the selected tab (transform/width via CSSOM). Without JS the selected tab
   paints its own white pill. */
.mode-tabs {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 3px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  background: var(--glass-dark);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .14);
}
.mode-tabs__indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #eef3f6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 4px 14px -4px rgba(0, 0, 0, .3), 0 0 16px -4px color-mix(in srgb, var(--mode-light) 80%, transparent);
  opacity: 0;
  pointer-events: none;
}
.mode-tabs.has-indicator .mode-tabs__indicator {
  opacity: 1;
  transition: transform var(--t-med) var(--ease), width var(--t-med) var(--ease), box-shadow var(--mode-transition);
}
.mode-tab {
  appearance: none;
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  min-height: 36px;
  padding: 4px 13px;
  border-radius: 9px;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--t-fast), color var(--t-med);
}
.mode-tab:hover { background: rgba(255, 255, 255, .08); }
.mode-tab[aria-selected="true"] {
  background: #fff;
  color: var(--mode-bg);
  font-weight: 750;
}
.mode-tabs.has-indicator .mode-tab[aria-selected="true"] { background: transparent; }
body[data-theme="dark"] .mode-tab[aria-selected="true"] { color: var(--mode-bg); }

.timer-display {
  margin: 30px 0 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(4.5rem, 24vw, 7.5rem);
  line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 0;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .12), 0 0 42px color-mix(in srgb, var(--mode-light) 22%, transparent);
  user-select: none;
}
/* timer.js renders one span per character */
.timer-display .td { display: inline-block; }
.timer-display .td--colon { margin-inline: -.03em; transform: translateY(-.04em); }
@media (prefers-reduced-motion: no-preference) {
  .timer-display .td.is-flip { animation: td-in .18s var(--ease); }
  .timer-display .td--colon.is-pulse { animation: td-colon 1s ease-in-out; }
}
@keyframes td-in {
  from { opacity: .2; transform: translateY(-.1em); }
  to { opacity: 1; transform: none; }
}
@keyframes td-colon {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.timer-controls {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

/* Main button: white instrument key with an inner glow in the mode colour. */
.start-wrap {
  grid-column: 2;
  position: relative;
  display: grid;
  place-items: center;
}
.btn-start {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 200px;
  max-width: 100%;
  height: 58px;
  padding: 0 26px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f8 100%);
  color: var(--mode-bg);
  font-family: var(--font-ui);
  font-size: 1.375rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--mode-light) 45%, transparent),
    inset 0 -12px 22px -12px color-mix(in srgb, var(--mode-light) 85%, transparent),
    0 2px 0 rgba(0, 0, 0, .14),
    0 14px 30px -14px color-mix(in srgb, var(--mode-light) 80%, rgba(0, 0, 0, .4));
  transition: color var(--mode-transition), transform var(--t-fast) var(--ease), box-shadow var(--t-med) ease, background-color var(--t-med);
}
.btn-start:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--mode-light) 60%, transparent),
    inset 0 -14px 24px -12px var(--mode-light),
    0 3px 0 rgba(0, 0, 0, .12),
    0 18px 36px -14px var(--mode-light);
}
.btn-start:active {
  transform: translateY(2px) scale(.985);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, .14),
    inset 0 -8px 18px -10px color-mix(in srgb, var(--mode-light) 70%, transparent),
    0 0 0 rgba(0, 0, 0, 0),
    0 6px 14px -10px var(--mode-light);
}
/* Running = the key stays pressed in. */
.btn-start.is-running {
  background: linear-gradient(180deg, #eef3f6 0%, #f9fbfc 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, .12),
    inset 0 0 0 1px color-mix(in srgb, var(--mode-light) 55%, transparent),
    inset 0 -10px 20px -12px var(--mode-light),
    0 8px 22px -14px var(--mode-light);
}
.btn-start:focus-visible { outline-offset: 4px; border-radius: 16px; }
body[data-theme="dark"] .btn-start { background: linear-gradient(180deg, #f6f8fa 0%, #e4eaef 100%); }
body[data-theme="dark"] .btn-start.is-running { background: linear-gradient(180deg, #dfe6ec 0%, #eef2f5 100%); }
.btn-start__label { line-height: 1; }
/* Thin progress outline around the main button (timer.js sizes it). */
.start-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med);
}
.start-ring.is-on { opacity: 1; }
.start-ring rect { fill: none; vector-effect: non-scaling-stroke; }
.start-ring__track { stroke: rgba(255, 255, 255, .2); stroke-width: 2; }
.start-ring__fill {
  stroke: color-mix(in srgb, var(--mode-light) 55%, #ffffff);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--mode-light) 90%, transparent));
  transition: stroke-dashoffset .3s linear;
}

/* Secondary round controls: [↺ reset] [main] [⏭ skip] */
.btn-round {
  appearance: none;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--glass-dark);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-med), transform var(--t-fast) var(--ease), color var(--t-fast);
}
.btn-round .pm-icon { width: 22px; height: 22px; }
.btn-round:hover { border-color: var(--glass-line-hover); background: var(--glass-dark-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 16px -4px rgba(255, 255, 255, .35); }
.btn-round:active { transform: scale(.92); }
.btn-round:focus-visible { border-radius: 50%; }
.btn-reset { grid-column: 1; justify-self: end; }
.btn-skip { grid-column: 3; justify-self: start; }
@media (prefers-reduced-motion: no-preference) {
  .btn-round:not([hidden]) { animation: round-in var(--t-med) var(--ease); }
  .btn-reset:hover .pm-icon { transform: rotate(-40deg); }
  .btn-reset .pm-icon { transition: transform var(--t-med) var(--ease); }
}
@keyframes round-in { from { opacity: 0; transform: scale(.85); } }

/* Reset armed (timer running): amber ring + a bubble asking to confirm. */
.btn-reset__confirm {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 10px;
  border-radius: 8px;
  background: #fde68a;
  color: #3b1d03;
  font-size: .8125rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-med) var(--ease), visibility 0s linear var(--t-med);
}
.btn-reset__confirm::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: #fde68a;
}
.btn-reset.is-confirm {
  border-color: #fde68a;
  background: rgba(253, 230, 138, .2);
  color: #fef3c7;
  box-shadow: 0 0 0 3px rgba(253, 230, 138, .25), 0 0 18px -2px rgba(253, 230, 138, .6);
}
.btn-reset.is-confirm .btn-reset__confirm {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity var(--t-fast), transform var(--t-med) var(--ease), visibility 0s;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.preset-chips:empty { display: none; }

/* "#2 · Hora de focar!": a small caption right under the digits. */
.session-label {
  margin: 0 0 26px;
  text-align: center;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--text); /* full white: on the card's glass, .9 alpha drops below 4.5:1 on some skins */
}

/* "Ao iniciar, você concorda com...": one quiet line under the controls until the first start. */
.start-terms {
  margin: 14px auto 0;
  max-width: 46ch;
  text-align: center;
  font-size: .75rem;
  line-height: 1.45;
  color: var(--text);
  opacity: .85;
}
.start-terms a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.start-terms a:hover { opacity: 1; text-decoration-thickness: 2px; }

.panel { margin-top: 24px; }
.panel:empty { display: none; }

.noscript {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, .25);
  text-align: center;
  font-weight: 600;
}

/* ---------- 6. Buttons --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: var(--ctx-text);
  font-family: var(--font-ui);
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
/* Inside dialogs, long labels wrap instead of being clipped at large text sizes. */
.modal .btn,
dialog .btn { white-space: normal; text-align: center; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-text);
  font-weight: 750;
  box-shadow: 0 3px 0 var(--primary-depth);
}
.btn-primary:hover { background: var(--primary-bg); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 0 0 var(--primary-depth); }

.btn-ghost {
  background: transparent;
  border-color: var(--ctx-border);
  color: var(--ctx-text);
}
.btn-ghost:hover { background: color-mix(in srgb, currentColor 8%, transparent); }

.btn-danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 3px 0 #991b1b;
}
.btn-danger:hover { background: #dc2626; filter: brightness(1.07); }
.btn-danger:active { transform: translateY(3px); box-shadow: none; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: .8125rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  transition: background-color .15s, transform .08s;
}
.btn-icon:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.btn-icon:active { transform: scale(.94); }
.btn-icon svg { width: 20px; height: 20px; }

/* ---------- 7. Chips ----------------------------------------------------- */
.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, currentColor 8%, transparent);
  color: var(--ctx-text);
  font-family: var(--font-ui);
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s;
}
.chip:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"],
.chip[aria-checked="true"],
.chip[aria-selected="true"],
.chip.is-active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-bg);
  color: var(--chip-active-text);
}
.chip small, .chip .chip__meta { font-weight: 500; opacity: .8; font-family: var(--font-mono); font-size: .75rem; }
.chip .dot, .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- 8. Form controls -------------------------------------------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > label,
.field__label {
  font-size: .875rem;
  font-weight: 650;
  color: var(--ctx-text);
}
.field__hint {
  margin: 0;
  font-size: .8125rem;
  color: var(--ctx-muted);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
}
.field-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--field-text);
  font-family: var(--font-ui);
  font-size: 1rem; /* ≥16px avoids iOS zoom */
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input::placeholder,
.textarea::placeholder { color: var(--field-placeholder); opacity: 1; }
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--field-border) 60%, var(--ctx-text)); }
.input:focus, .textarea:focus, .select:focus { outline: none; }
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible,
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent);
  outline: none;
  border-radius: 10px;
}
.input[aria-invalid="true"] { border-color: #ef4444; }
.textarea { min-height: 88px; resize: vertical; }
.input[type="number"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  cursor: pointer;
}
.select option { color: #16202c; background: #fff; }

/* Toggle switch — works as <input type="checkbox" class="toggle">
   or <label class="toggle"><input type="checkbox"> Text</label> */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
input.toggle,
.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ctx-text) 22%, transparent);
  border: 0;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
input.toggle::before,
.toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .22s var(--ease-spring);
}
input.toggle:checked,
.toggle input[type="checkbox"]:checked { background: var(--primary-bg); }
input.toggle:checked::before,
.toggle input[type="checkbox"]:checked::before {
  transform: translateX(18px);
  background: var(--toggle-knob-on);
}
input.toggle:focus-visible,
.toggle input[type="checkbox"]:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
input.toggle:disabled,
.toggle input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }

input[type="range"] {
  width: 100%;
  accent-color: var(--mode-solid);
  cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--mode-solid); }

kbd, .kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: .8em;
  line-height: 1.4;
  text-align: center;
}

/* ---------- 9. Surfaces & dialogs --------------------------------------- */
.surface {
  background: var(--surface);
}
.panel-surface {
  background: var(--surface);
  color: var(--surface-text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.modal {
  width: min(560px, calc(100% - 32px));
  max-width: 100%;
  max-height: min(88vh, 780px);
  max-height: min(88dvh, 780px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--surface-text);
  box-shadow: var(--shadow-lg);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal[open] { animation: modal-in .26s var(--ease); }
.modal::backdrop {
  background: rgba(6, 12, 22, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal[open]::backdrop { animation: fade-in .26s ease; }

.modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
}
.modal__header h2,
.modal__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.modal__header .btn-icon { margin-right: -8px; color: var(--surface-muted); }
.modal__header .btn-icon:hover { color: var(--surface-text); }
.modal__body {
  padding: 18px 20px 22px;
  display: grid;
  gap: 18px;
}
.modal__section { display: grid; gap: 12px; }
.modal__section + .modal__section { padding-top: 18px; border-top: 1px solid var(--surface-border); }
.modal__section-title {
  margin: 0;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--surface-muted);
}
.modal__footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface-2);
  border-top: 1px solid var(--surface-border);
}
.modal a:not(.btn) { color: var(--mode-solid); font-weight: 600; }
body[data-theme="dark"] .modal a:not(.btn) { color: var(--mode-light); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
@keyframes fade-in { from { opacity: 0; } }

/* Bottom-sheet dialogs on phones */
@media (max-width: 560px) {
  .modal {
    width: 100%;
    margin: auto 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }
  .modal[open] { animation: sheet-in .3s var(--ease); }
  .modal__header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background: var(--surface-border);
  }
}

/* ---------- 10. Toasts --------------------------------------------------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 14px;
  background: #101826;
  color: #f4f7fa;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .06) inset;
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.4;
  --ring: #fde047;
  animation: toast-in .3s var(--ease-spring);
}
.toast__text, .toast > span:first-child { flex: 1; min-width: 0; }
.toast a { color: #fde68a; font-weight: 700; }
.toast .btn,
.toast__action {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .8125rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
}
.toast .btn:hover, .toast__action:hover { background: rgba(255, 255, 255, .2); filter: none; }
.toast .btn-primary, .toast__action--primary { background: #fff; color: #101826; }
.toast .btn-primary:hover, .toast__action--primary:hover { background: #fff; filter: brightness(.95); }
.toast__close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, .7);
}
.toast__close:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast--success { box-shadow: 0 14px 34px rgba(0, 0, 0, .3), inset 4px 0 0 #34d399; }
.toast--error   { box-shadow: 0 14px 34px rgba(0, 0, 0, .3), inset 4px 0 0 #f87171; }
.toast--pro     { box-shadow: 0 14px 34px rgba(0, 0, 0, .3), inset 4px 0 0 #fbbf24; }
.toast.is-leaving { animation: toast-out .22s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* Inline banner (e.g. language suggestion) */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 10px var(--gutter);
  background: var(--shade);
  color: var(--text);
  font-size: .875rem;
  text-align: center;
}
.banner .btn { min-height: 32px; padding: 0 12px; font-size: .8125rem; }

/* ---------- 11. About (SEO) section ------------------------------------- */
.about {
  position: relative;
  padding: 56px 0 40px;
  line-height: 1.65;
}
.about::before {
  /* little ECG flourish bridging the coloured app and the white article */
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 120px; height: 4px;
  margin-left: -60px;
  border-radius: 0 0 4px 4px;
  background: var(--mode-solid);
  transition: background-color var(--mode-transition);
}
.about__inner {
  max-width: calc(640px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.about__title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .6em;
}
.about__lead { font-size: 1.0625rem; color: var(--surface-text); }
.about h3 {
  margin-top: 1.9em;
  font-size: 1.1875rem;
  font-weight: 750;
}
.about p, .about li { color: var(--surface-muted); }
.about__steps {
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 10px;
}
.about__steps li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  min-height: 30px;
}
.about__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -1px;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--mode-solid) 14%, transparent);
  color: var(--mode-solid);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: .875rem;
}
body[data-theme="dark"] .about__steps li::before { color: var(--mode-light); }
.about__presets {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.about__presets li {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
}
.about__presets strong {
  color: var(--surface-text);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.about__pro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(251, 191, 36, .18), transparent 55%),
    var(--surface-2);
  border: 1px solid var(--surface-border);
}
.about__pro > div { flex: 1 1 260px; }
.about__pro h3 { margin-top: 0; }
.about__pro p { margin: 0; }

/* ---------- 12. Footer --------------------------------------------------- */
.site-footer {
  padding: 26px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--surface-border);
  font-size: .875rem;
  text-align: center;
  color: var(--surface-muted);
}
.site-footer__inner { display: grid; gap: 8px; justify-items: center; }
.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
}
.site-footer__nav a {
  color: var(--surface-text);
  font-weight: 600;
  text-decoration: none;
  padding: 4px 2px;
}
.site-footer__nav a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }
.site-footer__love { color: var(--surface-text); font-weight: 600; }
.site-footer__legal { font-size: .8125rem; }

/* ---------- 13. Responsive ---------------------------------------------- */
@media (max-width: 600px) {
  :root { --header-h: 58px; }
  .btn.btn-nav .btn-label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .btn.btn-nav { width: 38px; padding: 0; }
  .btn.btn-nav .icon { width: 20px; height: 20px; }
  .site-header__nav { gap: 6px; }
  .mode-tab { padding: 4px 10px; font-size: .875rem; }
}
@media (max-width: 380px) {
  .logo__mark { width: 30px; height: 30px; }
  .logo__word { font-size: 1.125rem; }
  .logo { gap: 6px; }
  .btn.btn-pro .icon { display: none; }
  .btn.btn-pro { padding: 0 10px; }
  .site-header__inner { gap: 8px; }
  .lang-switch a { min-width: 28px; padding: 0 5px; }
  .mode-tab { padding: 4px 8px; font-size: .8125rem; }
  .btn-start { min-width: 168px; padding: 0 18px; }
  .timer-controls { gap: 10px; }
  .btn-round { width: 44px; height: 44px; }
}
@media (min-width: 720px) {
  .timer-card { padding: 24px 24px 34px; }
}

/* ---------- 14. Motion & print ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  #ecg-fill { filter: none; }
}

@media (forced-colors: active) {
  .btn-start, .btn, .chip, .mode-tab[aria-selected="true"] { border: 1px solid ButtonText; }
  #ecg-fill { stroke: Highlight; }
}

@media print {
  .site-header, #toast-region, .timer-card, .about__pro { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- 15. Touch targets (≥ 40px) ----------------------------------- */
.logo { min-height: 40px; }
.btn.btn-nav,
.btn.btn-pro { min-height: 40px; }
.lang-switch a { min-height: 34px; position: relative; }
/* Extend the hit area of the small pill links to 40px without changing the look. */
.lang-switch a::before { content: ""; position: absolute; inset: -3px 0; }
.mode-tab { min-height: 40px; }
button.chip,
a.chip { min-height: 40px; }
.banner .btn { min-height: 40px; }
.site-footer__nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }
@media (max-width: 600px) {
  .btn.btn-nav { width: 40px; }
  .site-header__nav { gap: 4px; }
}
@media (max-width: 420px) {
  /* Tight headers: show only the language you can switch to, as a full 40px target. */
  .lang-switch { padding: 0; background: transparent; }
  .lang-switch a[aria-current="page"] { display: none; }
  .lang-switch a { min-width: 40px; min-height: 40px; background: var(--shade); }
  .lang-switch a::before { display: none; }
}

/* ---------- 16. Contrast (WCAG AA on the light mode colours) -------------- */
:root { --text-soft: rgba(255, 255, 255, .9); }
.btn.btn-nav { background: var(--shade); }
.btn.btn-nav:hover { background: rgba(0, 0, 0, .26); }

/* ---------- 17. v4 layout: timer on top, "Seu dia" strip below ----------
   Markup: main.app > div#timer-col.app-col (timer card, session label, hint)
                    + aside#day-panel.day-panel (head, #day-goal, #questions-panel, #tasks-panel).
   <700px: one column, stacked.  700–1099px: Meta | Questões, Tarefas full width.
   ≥1100px: Meta | Questões | Tarefas, three columns side by side.
   The timer card is always alone on top, centred. */
:root {
  --day-bg: rgba(0, 0, 0, .1);
  --day-border: var(--card-border);
  --desk-max: 1180px;
  --timer-max: 560px;
}
body[data-theme="dark"] { --day-bg: rgba(255, 255, 255, .045); }

.app-col { min-width: 0; }
#timer-col { width: 100%; max-width: var(--timer-max); margin-inline: auto; }
.day-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}
.day-panel > .panel { margin-top: 0; }
.day-goal { min-width: 0; }
.day-goal:empty { display: none; }

/* The strip heading is for screen readers on phones, visible from 700px. */
.day-panel__head {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.day-panel__icon { width: 18px; height: 18px; flex: none; }
.day-panel__title {
  margin: 0;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
}

/* Zen mode hides every direct child of .app except the timer. */
body.zen #main > #timer-col { display: block !important; align-self: stretch; max-width: none; }
body.zen #timer-col > :not(#timer-card) { display: none !important; }
body.zen #main > #day-panel { display: none !important; }

@media (min-width: 700px) {
  :root { --timer-max: 620px; }
  body:not(.pg) .site-header .container,
  .app {
    max-width: calc(var(--desk-max) + 2 * var(--gutter));
    padding-inline: max(24px, env(safe-area-inset-left));
  }
  body:not(.pg) .ecg-progress { max-width: 900px; margin-inline: auto; }
  .app { padding-top: 28px; padding-bottom: 72px; }
  .app > noscript,
  .app > .noscript { grid-column: 1 / -1; }

  .day-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
    margin-top: 32px;
  }
  .day-panel__head {
    grid-column: 1 / -1;
    position: static;
    width: auto; height: auto;
    margin: 0 0 -4px;
    padding: 0 4px;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
  }
  .day-panel__head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, .35), transparent);
  }
  .day-panel > #tasks-panel { grid-column: 1 / -1; }

  /* Every column is the same glass instrument panel. */
  .day-panel > .day-goal,
  .day-panel > .panel {
    min-width: 0;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--day-border);
    border-radius: 20px;
    background: var(--day-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 18px 40px -30px rgba(0, 0, 0, .5);
    transition: border-color var(--t-med);
  }
  .day-panel > .day-goal:hover,
  .day-panel > .panel:hover { border-color: rgba(255, 255, 255, .26); }
  .day-panel > .panel:empty,
  .day-panel > .day-goal:empty { display: none; }
}

@media (min-width: 1100px) {
  :root { --timer-max: 780px; }
  .app { padding-top: 32px; }
  .day-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .day-panel > #tasks-panel { grid-column: auto; }

  .timer-card {
    padding: 28px 40px 40px;
    border-radius: 26px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 30px 70px -34px rgba(0, 0, 0, .45);
  }
  .timer-display {
    margin: 40px 0 10px;
    font-size: clamp(8rem, 11vw, 11rem);
  }
  .btn-start {
    min-width: 270px;
    height: 66px;
    font-size: 1.5rem;
    border-radius: 16px;
  }
  .btn-round { width: 52px; height: 52px; }
  .session-label { margin-bottom: 34px; font-size: .875rem; }
}

@media (min-width: 1400px) {
  :root { --timer-max: 820px; }
}

@media print {
  .day-panel > .day-goal, .day-panel > .panel { border: 0; background: none; padding: 0; }
}

/* Header labels need ~640px next to the wordmark: icon-only below 720px. */
@media (max-width: 719.98px) {
  .btn.btn-nav .btn-label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .btn.btn-nav { width: 40px; padding: 0; }
}

/* ---------- 18. Crowded header (themes.js adds a 🎨 button to the nav) ----
   Five nav controls don't fit next to the wordmark on phones: keep the
   tomato mark (the link keeps its aria-label) and drop the word. */
.logo { overflow: hidden; } /* fallback without :has(): clip, never overlap */
@media (max-width: 520px) {
  .site-header__inner:has(.site-header__nav > :nth-child(5)) .logo__word { display: none; }
  .site-header__inner:has(.site-header__nav > :nth-child(5)) .logo__mark { width: 36px; height: 36px; }
  .site-header__inner:has(.site-header__nav > :nth-child(5)) .logo { min-width: 40px; justify-content: center; }
}
@media (max-width: 340px) {
  .site-header__nav:has(> :nth-child(5)) { gap: 2px; }
  .site-header__nav:has(> :nth-child(5)) .btn.btn-pro { padding: 0 8px; }
}

/* ---------- 19. App header: icon-only round buttons (all widths) ----------
   Relatório / Tema / Ajustes keep their text as the accessible name (sr-only
   label or aria-label) plus a tooltip; Pro keeps its visible label. */
body:not(.pg) .site-header .btn.btn-nav {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}
body:not(.pg) .site-header .btn.btn-nav .btn-label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
body:not(.pg) .site-header .btn.btn-nav .icon { width: 19px; height: 19px; }
@media (min-width: 601px) {
  body:not(.pg) .site-header__nav { gap: 6px; }
}
