:root {
  --bg: #0c0f14;
  --bg2: #131821;
  --card: #171d29;
  --line: rgba(120, 150, 220, 0.16);
  --text: #eef2ff;
  --muted: #9aa7c4;
  --accent: #ff5c33;   /* energetic orange */
  --accent2: #22d3ee;  /* cyan */
  --good: #34d399;
  --bad: #f87171;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { color-scheme: light; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #ffffff 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

.wrap { max-width: 620px; margin: 0 auto; padding: 20px 16px 64px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.brand { font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }
.brand span { color: var(--accent); }
.topnav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-size: 14px; text-decoration: none; }
.topnav a:hover { color: var(--text); }
.topnav a.donate { color: #b45309; }

/* Stats strip */
.stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat-num { display: block; font-size: 24px; font-weight: 800; color: var(--accent2); }
.stat-lbl { font-size: 12px; color: var(--muted); }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.panel-title { font-size: 15px; color: var(--muted); margin-bottom: 12px; font-weight: 600; letter-spacing: 0.4px; }

/* Presets */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.preset {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 12px; text-align: left; cursor: pointer;
  font-size: 13px; transition: border-color .15s, background .15s;
}
.preset:hover { border-color: var(--accent2); }
.preset.active { border-color: var(--accent); background: rgba(255, 92, 51, 0.12); }
.preset .p-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.preset .p-desc { color: var(--muted); font-size: 11px; margin-top: 2px; line-height: 1.4; }

/* Custom editor */
.custom { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.custom summary { cursor: pointer; font-weight: 600; color: var(--accent2); margin-bottom: 8px; }
.fieldgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fieldgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fieldgrid .fld { display: flex; flex-direction: column; gap: 4px; }
.fieldgrid .fld > label { font-size: 12px; color: var(--muted); }
.fieldgrid input[type="number"], .fieldgrid input[type="text"] {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 15px;
}
.fieldgrid .checkline { flex-direction: row; align-items: center; font-size: 13px; color: var(--text); }

/* Steppers: +/− buttons around the value display */
.stepper { display: flex; align-items: stretch; gap: 4px; }
.stepper input[type="number"] {
  flex: 1; min-width: 0; text-align: center; padding: 8px 4px;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper input[type="number"]::-webkit-outer-spin-button,
.stepper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn {
  width: 40px; border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: 8px; font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
.step-btn:hover { border-color: var(--accent2); }
.step-btn:active { background: var(--accent); color: #fff; border-color: var(--accent); transform: scale(0.92); }

/* Summary */
.summary { background: var(--bg2); border-radius: 10px; padding: 12px; font-size: 14px; margin-bottom: 10px; }
.summary b { color: var(--accent2); }

/* Saved routines */
.saved h3 { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
#saved-ul { list-style: none; }
#saved-ul li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
#saved-ul .load { margin-left: auto; }

/* Timer dial */
.timer-panel { text-align: center; }
.phase-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.phase-pill, .round-pill {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.phase-pill { background: rgba(34, 211, 238, 0.14); color: #0e7490; border: 1px solid rgba(34, 211, 238, 0.35); }
.phase-pill.work { background: rgba(255, 92, 51, 0.16); color: var(--accent); border-color: rgba(255, 92, 51, 0.4); }
.phase-pill.rest { background: rgba(52, 211, 153, 0.14); color: var(--good); border-color: rgba(52, 211, 153, 0.35); }
.phase-pill.cooldown { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.4); }
.round-pill { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }

.dial { position: relative; width: 220px; height: 220px; margin: 8px auto 18px; }
.ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) 0%, rgba(120,150,220,0.14) 0%); }
.ring-fill { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) 0deg, rgba(120,150,220,0.12) 0deg); transition: background 0.1s linear; }
.clock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.phase-emoji { position: absolute; top: 50%; transform: translateY(-50%); right: 4px; font-size: 22px; opacity: 0.9; }

/* Controls */
.controls { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.btn {
  border: none; border-radius: 12px; padding: 12px 22px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .1s, filter .15s; color: var(--text);
}
.btn:active { transform: translateY(1px) scale(0.98); filter: brightness(0.88); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: #e8471f; }
.btn-secondary { background: var(--bg2); border: 1px solid var(--line); }
.btn-secondary:active { background: var(--bg2); border-color: var(--accent2); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 10px 16px; font-size: 13px; font-weight: 600; }
.btn-ghost:active { background: rgba(34, 211, 238, 0.12); color: var(--text); }
.btn:hover { filter: brightness(1.12); }

/* Pressed/selected flash — shared pattern across every button */
@keyframes click-flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 51, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(255, 92, 51, 0); }
}
.btn.clicked, .step-btn.clicked, .preset.clicked { animation: click-flash 0.35s ease-out; }

/* Result feedback on primary actions */
@keyframes panel-flash {
  0% { box-shadow: inset 0 0 0 2px var(--accent2); background: rgba(34, 211, 238, 0.14); }
  100% { box-shadow: inset 0 0 0 2px transparent; background: transparent; }
}
.summary.flash { animation: panel-flash 0.65s ease-out; }
@keyframes pill-flash {
  0% { box-shadow: 0 0 0 3px var(--accent); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 3px transparent; transform: scale(1); }
}
.phase-pill.flash { animation: pill-flash 0.65s ease-out; }

.sound-row { justify-content: center; align-items: center; gap: 14px; margin-bottom: 6px; }
.volume { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.volume input { width: 90px; accent-color: var(--accent); }

/* AdSense */
.ad { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 14px; text-align: center; min-height: 90px; }

/* Toast */
.toast {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.4); color: var(--good); font-size: 13px;
}

/* Done card */
#done-card { border-color: rgba(52, 211, 153, 0.4); }
#done-text { color: var(--muted); margin-bottom: 14px; }

/* Hub + footer */
.hub { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-top: 4px; text-align: center; }
.hub p { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hub a { color: var(--accent2); text-decoration: none; margin-right: 14px; font-size: 13px; }
.hub a:hover { text-decoration: underline; }
footer { margin-top: 22px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }
footer span { margin-left: auto; }

.row { display: flex; gap: 8px; margin-top: 10px; }

/* >>> theme-by-name (2026-11-02) >>> */
/* Theme derived from the site's MEANING, not a random variant.
 * Exertion = near-black with hot red and a condensed face. A workout timer should feel loud.
 * Ad layout is deliberately NOT set here — container width and rail geometry are
 * measured and verified separately by check-ad-layout.mjs.
 */
:root {
  /* Light, neutral base (2026-11-13). The previous light block set --bg to
     #121014, i.e. still a dark theme — the owner reported "too dark and the
     font colour is hard to read". Components read --text/--card/--bg2/--line,
     so all four must flip together or the cards stay dark. */
  --bg: #f7f8fa;
  --bg2: #eef1f5;
  --card: #ffffff;
  --text: #1c2430;
  --ink: #1c2430;
  --muted: #5b6675;
  --line: #e2e8f0;
  --brand: #be123c;
  --brand-strong: #9f1239;
  --accent: #e11d48;
  --accent2: #0891b2;
  --radius: 12px;
  --font-sans: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
}
body { font-family: var(--font-sans); background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.015em; }
.card, .panel, section[class*="card"] { border-radius: var(--radius); }
/* <<< theme-by-name <<< */

/* Ad/content geometry contract (2026-11-19, owner-reported overlap defect).
 * adsense.css positions the fixed side rails from --ad-content-w. That variable
 * MUST equal the widest centred in-flow block on the page. The app shell is
 * .wrap (620px); the FAQ section used to be an inline-styled 760px block OUTSIDE
 * .wrap, so at >=1500px the rails were computed from 588px and landed INSIDE both
 * .wrap (6px) and the FAQ band (76px). Two changes make overlap structurally
 * impossible: (1) declare the real width here, (2) never let an in-flow section
 * exceed it. Rails are hidden below 1500px by adsense.css anyway. */
:root { --ad-content-w: 620px; }
.faq, .privacy-section { max-width: 620px; margin-inline: auto; }

/* Privacy architecture section (2026-11-08) — the selling point of every site. */
.privacy-section{margin-top:34px;padding-top:24px;border-top:2px solid #e2e8f0}
.privacy-section h2{font-size:1.35em;margin-bottom:10px}
.privacy-section h3{font-size:1.05em;margin:20px 0 8px}
.privacy-steps{margin:10px 0 14px;padding-left:22px}
.privacy-steps li{margin-bottom:8px;line-height:1.6}
.privacy-section kbd{background:#f1f5f9;border:1px solid #cbd5e1;border-bottom-width:2px;
  border-radius:4px;padding:1px 5px;font-size:.85em;font-family:ui-monospace,Menlo,monospace}

/* sr-only — visually hidden, still announced (a11y utility; 2026-11-09). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
