/* Stopwatch & Timer — mobile-first. Tokens follow the app redesign
   (dark surfaces, orange accent, Work Sans). */

:root {
  --bg: #131314;
  --surface: #1e1e20;
  --card: #2c2c2e;
  --card-2: #3a3a3c;
  --btn: #373737;
  --btn-hover: #444446;
  --line: #3a3a3c;
  --text: #ffffff;
  --muted: #a8a8ad;
  --accent: #ff8f4b;
  --accent-ink: #1b0e06;
  --accent-soft: #3e2b21;
  --green: #4cc20e;
  --best: #5fd27a;
  --worst: #ff7a6e;
  --focus: #e5463e;
  --short: #2e9b3a;
  --long: #2a6fd4;
  --radius: 18px;
  --radius-lg: 24px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

html:not(.is-android) [data-show~="android"]:not([data-show~="desktop"]),
html:not(.is-desktop) [data-show~="desktop"]:not([data-show~="android"]),
html.is-ios [data-show] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 8px; }

/* ---------- Header + tab bar ---------- */

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
}
.has-tool .site-header { padding: 0; }
.has-tool .site-header > .brand,
.has-tool .site-header > .btn-pill { display: none; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { border-radius: 8px; }

.tabs {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 4px 16px calc(4px + var(--safe-b));
  height: calc(var(--tabbar-h) + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid #262628;
}
.tabs__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 16px; color: #d6d6da; text-decoration: none;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
}
.tabs__item svg { width: 24px; height: 24px; color: #c9c9ce; }
.tabs__item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tabs__item[aria-current="page"] svg { color: var(--accent); }
.tabs__item[aria-current="page"]::after {
  content: ''; position: absolute; bottom: 3px; width: 28px; height: 3px; border-radius: 2px; background: var(--accent);
}

.btn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn-pill svg { width: 18px; height: 18px; }
.btn-pill--solid { background: var(--accent); color: var(--accent-ink); }

/* ---------- Tool shell ---------- */

.tool {
  position: relative;
  display: flex; flex-direction: column;
  height: calc(100vh - var(--tabbar-h) - var(--safe-b));
  height: calc(100svh - var(--tabbar-h) - var(--safe-b));
  min-height: 480px;
  padding: 8px 16px 16px;
}
.tool__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.tool__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.tool__actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 14px;
  background: transparent; color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.icon-btn:hover { background: rgba(255,255,255,.06); }
.icon-btn--app { color: var(--accent); background: var(--accent-soft); }
.icon-btn--round { border-radius: 50%; width: 44px; padding: 0; background: rgba(0,0,0,.18); }
.icon-btn--spacer { visibility: hidden; }
.full-exit { display: none; position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; background: rgba(255,255,255,.08); }

.tool__stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Stopwatch/timer markup is split into main + side columns for desktop.
   On phones the wrappers vanish and `order` restores the single column:
   display, then laps or setup, then the buttons. */
.tool__main, .tool__side { display: contents; }
.tool--timer .tool__stage, .tool--stopwatch .tool__stage { flex: 0 0 auto; }
.tool--timer.is-active .tool__stage, .tool--stopwatch:has(.laps:empty) .tool__stage { flex: 1 1 auto; }
.tool--timer .timer-setup, .tool--stopwatch .laps { order: 1; }
.tool--timer .controls, .tool--stopwatch .controls { order: 2; }
.tool--timer .kbd-hint, .tool--stopwatch .kbd-hint { order: 3; }

.display {
  margin: 20px 0 24px;
  text-align: center;
  font-weight: 600;
  font-size: clamp(2.6rem, 14.6vw, 5.5rem);
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
}
.display--huge { font-weight: 900; font-size: clamp(4rem, 27vw, 11rem); letter-spacing: -.02em; margin: 0; }
.display--huge.display--long { font-size: clamp(3rem, 18vw, 8rem); }

.controls { display: flex; gap: 16px; padding-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 20px; border: 0; border-radius: var(--radius);
  background: var(--btn); color: var(--text); font-weight: 600; font-size: 20px; text-decoration: none;
  transition: background-color .15s, transform .08s;
}
.btn:hover:not(:disabled) { background: var(--btn-hover); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 26px; height: 26px; }
.btn--big { flex: 1; }
.btn--wide { width: 100%; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: #ff9d61; }
.btn--ghost { background: transparent; border: 1.5px solid var(--line); font-size: 16px; min-height: 48px; }
.btn--tint { background: rgba(0,0,0,.2); }
.btn--tint:hover:not(:disabled) { background: rgba(0,0,0,.28); }
.btn__meta { margin-left: auto; font-weight: 500; font-size: 17px; opacity: .85; font-variant-numeric: tabular-nums; }
#p-start { padding: 0 22px; }
#p-start span:first-of-type { margin-left: auto; }

.kbd-hint { display: none; margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--line); font: 500 12px/1.5 var(--font); text-align: center;
}

/* ---------- Stopwatch ---------- */

.tool--stopwatch:has(.laps:empty) .display { margin-block: auto; }
.laps {
  list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  overscroll-behavior: contain;
}
.laps:empty { display: none; }
.lap {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  min-height: 46px; padding: 0 16px; border-radius: 16px; background: var(--card);
  font-variant-numeric: tabular-nums; font-size: 15.5px; flex-shrink: 0;
}
.lap__total { min-width: 6.4em; text-align: right; }
.lap--best .lap__split { color: var(--best); }
.lap--worst .lap__split { color: var(--worst); }
@media (max-width: 360px) { .lap { font-size: 13.5px; gap: 8px; padding: 0 12px; } }

/* ---------- Timer ---------- */

.progress { height: 4px; margin: -8px 8px 20px; border-radius: 2px; background: var(--card); overflow: hidden; visibility: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.tool--timer.is-active .progress { visibility: visible; }
.tool--timer.is-active .display { margin-top: auto; }
.tool--timer.is-active .progress { margin-bottom: auto; }
.tool--timer.is-active .timer-setup { display: none; }

.timer-setup { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; overscroll-behavior: contain; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip {
  flex-shrink: 0; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid transparent; background: var(--card); font-weight: 500; font-size: 15px; white-space: nowrap;
}
.chip:hover { background: var(--card-2); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rows:empty { display: none; }
.row {
  display: flex; align-items: center; gap: 16px; width: 100%;
  min-height: 54px; padding: 0 16px; border: 0; border-radius: var(--radius);
  background: var(--card); text-align: left; font-size: 17px; font-variant-numeric: tabular-nums;
}
button.row:hover { background: var(--card-2); }
.row--static { flex-shrink: 0; }
.row--static label { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--muted); font-size: 15px; }
.row--static label svg { width: 20px; height: 20px; flex-shrink: 0; }
.row--static label span { white-space: nowrap; }
.row--static select {
  background: var(--btn); border: 0; border-radius: 10px; padding: 8px 10px; font-size: 15px;
}
.ring { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid #5a5a5e; flex-shrink: 0; }
.ring--on { border-color: var(--accent); }
.ring--new { border-color: #5a5a5e #5a5a5e #5a5a5e transparent; transform: rotate(-30deg); }

/* The idle timer display is three editable fields: HH : MM : SS. */
.display--edit { display: flex; justify-content: center; align-items: center; gap: .04em; margin-bottom: 8px; }
.time-input {
  width: 1.38em; padding: .06em 0; border: 0; border-radius: .16em;
  background: rgba(255,255,255,.05); box-shadow: inset 0 -.05em 0 #4a4a4e;
  color: inherit; font: inherit; font-variant-numeric: tabular-nums; letter-spacing: inherit;
  text-align: center; caret-color: var(--accent); cursor: text;
}
.time-input:hover { background: rgba(255,255,255,.08); }
.time-input:focus { outline: none; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -.05em 0 var(--accent); }
.time-input::selection { background: rgba(255,143,75,.35); }
.time-sep { opacity: .9; }
/* Small unit under each box; positioned so the digits don't move. */
.time-field { position: relative; display: block; }
.time-unit {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px;
  font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: .1em; text-transform: uppercase;
  text-align: center; color: var(--muted); pointer-events: none;
}
.time-field:focus-within .time-unit { color: var(--accent); }
.display--edit { margin-bottom: 30px; }
.edit-hint { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: 14px; }
.tool--timer .display--edit { font-size: clamp(3rem, 17vw, 6rem); }

/* Alarm volume slider */
.row--volume label { flex: 0 0 auto; }
.row--volume output { min-width: 3.2em; text-align: right; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
input[type="range"] {
  flex: 1; min-width: 0; height: 32px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 80%) 100% no-repeat, #4a4a4e;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #4a4a4e; }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

.done-dialog {
  width: min(92vw, 400px); padding: 28px 22px 22px; border: 0; border-radius: 28px;
  background: var(--surface); color: var(--text); text-align: center;
}
.done-dialog::backdrop { background: rgba(229, 70, 62, .55); backdrop-filter: blur(4px); animation: pulse 1.2s ease-in-out infinite alternate; }
.done-dialog h2 { margin: 12px 0 4px; font-size: 30px; font-weight: 800; }
.done-dialog p { margin: 0 0 20px; color: var(--muted); }
.done-dialog__bell { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; animation: ring .6s ease-in-out infinite alternate; }
.done-dialog__bell svg { width: 34px; height: 34px; }
.done-dialog__app { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.done-dialog__app p { margin-bottom: 12px; font-size: 15px; }
@keyframes pulse { from { opacity: .7; } to { opacity: 1; } }
@keyframes ring { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .done-dialog::backdrop, .done-dialog__bell { animation: none; } }

/* ---------- Pomodoro ---------- */

.pomo-setup { flex: 1; min-height: 0; overflow-y: auto; padding-top: 8px; overscroll-behavior: contain; }
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.stepper {
  display: grid; grid-template-columns: 44px 1fr 44px; grid-template-rows: auto auto; align-items: center;
  row-gap: 2px; padding: 12px 16px; border-radius: var(--radius); background: var(--card);
}
.stepper__label { grid-column: 1 / -1; text-align: center; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #dcdce0; }
.stepper__value { display: flex; align-items: baseline; justify-content: center; gap: 6px; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper__input {
  width: 2.4em; padding: 2px 0; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.05); box-shadow: inset 0 -2px 0 #55555a;
  color: inherit; font: inherit; font-variant-numeric: tabular-nums; text-align: center;
  caret-color: var(--accent); cursor: text;
}
.stepper__input:hover { background: rgba(255,255,255,.08); }
.stepper__input:focus { outline: none; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.stepper__unit, .stepper__value:has(.stepper__unit)::before { font-size: 16px; font-weight: 500; color: var(--muted); }
/* Invisible twin of the unit keeps the number centered. */
.stepper__value:has(.stepper__unit)::before { content: 'min'; visibility: hidden; }
.stepper__btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: #fff; color: #131314;
  display: grid; place-items: center; justify-self: center;
}
.stepper__btn svg { width: 20px; height: 20px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--card); cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; background: #58585c; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle-row input:checked + .switch { background: var(--green); }
.toggle-row input:checked + .switch::after { transform: translateX(20px); }
.toggle-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.pomo-today { margin: 14px 4px 0; color: var(--muted); font-size: 14px; text-align: center; }

.tool--pomodoro[data-phase="focus"] { --phase: var(--focus); }
.tool--pomodoro[data-phase="short"] { --phase: var(--short); }
.tool--pomodoro[data-phase="long"] { --phase: var(--long); }
.tool--pomodoro[data-phase]:not([data-phase=""]) {
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,.13) 0 26%, rgba(255,255,255,.09) 26.2% 38%,
      rgba(255,255,255,.06) 38.2% 52%, rgba(255,255,255,.03) 52.2% 68%, transparent 68.2%),
    var(--phase);
  transition: background-color .4s;
}
.tool--pomodoro[data-phase]:not([data-phase=""]) .tool__bar { display: none; }
.pomo-run { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 8px; }
.pomo-run__top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.pomo-run__next { display: flex; flex-direction: column; line-height: 1.25; }
.pomo-run__next span { font-size: 14px; opacity: .85; letter-spacing: .03em; }
.pomo-run__next strong { font-size: 18px; font-weight: 700; }
.pomo-run__phase { margin: auto 0 4px; font-size: 20px; font-weight: 700; }
.pomo-run__app {
  margin-top: auto; margin-bottom: 4px; display: inline-flex; align-items: center; gap: 6px;
  color: #fff; opacity: .9; font-size: 14px; font-weight: 500; text-decoration: none;
  background: rgba(0,0,0,.18); padding: 8px 14px; border-radius: 999px;
}
.pomo-run__app svg { width: 16px; height: 16px; }
.pomo-run__phase + .display { margin-bottom: auto; }
.controls--three .btn { min-height: 54px; }

/* ---------- Home: working stopwatch first, then the other tools ---------- */

.home { max-width: 1240px; margin: 0 auto; padding: 4px 16px 0; display: flex; flex-direction: column; gap: 16px; }
.home__title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.home-label { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.home-sw { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 18px; border-radius: 28px; background: var(--surface); border: 1px solid #2a2a2d; }
.home-sw__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-sw__top h2 { margin: 0; font-size: 19px; font-weight: 700; }
.home-sw__more { font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.home-sw__display {
  padding: 14px 0 0; text-align: center; font-weight: 600; line-height: 1; letter-spacing: -.01em;
  font-size: clamp(2.6rem, 14.6vw, 4rem); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.home-sw__laps { margin: 0; min-height: 1.5em; text-align: center; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: pre; }
.home-sw__btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-sw__btns .btn { font-size: 18px; }
.home-sw__btns svg { width: 22px; height: 22px; }

.home-side { display: flex; flex-direction: column; gap: 16px; }
.home-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-tool {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 16px 16px; border-radius: 24px;
  background: var(--card); border: 1.5px solid var(--card-2); color: var(--text); text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.home-tool:hover { border-color: var(--accent); }
.home-tool__name { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 15px; }
.home-tool__name svg { width: 20px; height: 20px; }
.home-tool__time { font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.home-tool__open { align-self: flex-start; padding: 7px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }

.home-quick { display: flex; flex-direction: column; gap: 10px; }
.home-quick__list { display: flex; flex-wrap: wrap; gap: 8px; }
.home-quick__list .chip { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }

.home-app {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 18px 18px; text-align: center;
  border-radius: 28px; background: #201814; border: 1px solid #3a2a20;
}
.home-app img { border-radius: 18px; }
.home-app strong { font-size: 20px; line-height: 1.25; }
.home-app__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.home-app__chips span { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.07); font-size: 13px; font-weight: 500; }
.home-app .btn { font-size: 17px; font-weight: 700; }
.page-home .content { padding-top: 8px; }

/* ---------- Desktop-only pieces (hidden on phones) ---------- */

.appbar { display: none; }
@media (max-width: 899px) { .side-only { display: none !important; } }

/* ---------- Content ---------- */

.content { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.content h1 { font-size: clamp(30px, 7vw, 44px); line-height: 1.12; letter-spacing: -.02em; margin: 8px 0 12px; font-weight: 800; }
.content h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.01em; margin: 44px 0 14px; font-weight: 700; }
.content p, .content li { color: #dedee2; }
.lead { font-size: 18px; color: #e8e8ec !important; margin: 0 0 8px; }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.breadcrumb li + li::before { content: '›'; margin-right: 6px; }
.breadcrumb a { color: var(--muted); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 56px; border-radius: var(--radius); background: var(--surface); }
.steps li::before {
  content: counter(s); position: absolute; left: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 15px;
}

.features { padding: 0; list-style: none; display: grid; gap: 10px; }
.features li { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.features strong { color: #fff; }

.checks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.checks li { position: relative; padding-left: 28px; }
.checks li::before {
  content: ''; position: absolute; left: 2px; top: .35em; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
}

.kbd-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; font-size: 15px; }
.kbd-table th, .kbd-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #2a2a2c; }
.kbd-table th { color: var(--muted); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.kbd-table tr:last-child td { border-bottom: 0; }

.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border-radius: var(--radius); padding: 0 16px; }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 28px 16px 0; font-weight: 600; position: relative; color: #fff;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 0; top: 12px; font-size: 24px; font-weight: 400; color: var(--accent); }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 0 0 16px; }

.tool-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tool-cards li { display: flex; }
.tool-cards a {
  flex: 1;
  display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); color: var(--muted); text-decoration: none; border: 1.5px solid transparent;
  transition: border-color .15s;
}
.tool-cards a:hover { border-color: var(--accent); }
.tool-cards strong { color: #fff; font-size: 18px; }
.tool-cards--big a { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; padding: 16px; }
.tool-cards--big .tool-cards__icon { grid-row: span 2; margin: 0; }
@media (min-width: 900px) {
  .tool-cards--big a { display: flex; padding: 22px; }
  .tool-cards--big .tool-cards__icon { margin-bottom: 8px; }
}
.tool-cards__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.tool-cards__icon svg { width: 28px; height: 28px; }

.link-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.link-grid a {
  display: block; padding: 12px 14px; border-radius: 14px; background: var(--surface);
  color: #fff; text-decoration: none; font-weight: 500; font-size: 15px;
}
.link-grid a:hover { background: var(--card); }
.link-grid a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.app-promo {
  margin-top: 44px; padding: 22px; border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #2a1d16 0%, var(--surface) 55%);
  border: 1px solid #3a2a20;
}
.app-promo h2 { margin-top: 0; }
.app-promo p { margin: 0; }
.cta { display: flex; align-items: center; gap: 20px; margin-top: 20px; flex-wrap: wrap; }
.play-badge img { width: auto; height: 64px; margin: -8px; } /* badge PNG includes padding */
.play-badge--small img { height: 52px; }
.qr { margin: 0; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; max-width: 260px; }
.qr img { border-radius: 10px; background: #fff; width: 104px; height: 104px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid #222224; background: #0f0f10; }
.site-footer__inner { max-width: 1120px; margin: 0 auto; padding: 28px 16px 32px; display: grid; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-footer nav a:hover { color: #fff; }
.small { font-size: 13px; color: #7c7c82; margin: 0; }

/* ---------- Sticky Android app banner ---------- */

.app-banner {
  position: fixed; z-index: 40; left: 10px; right: 10px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
  display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 10px;
  border-radius: 20px; background: #2a2a2d; border: 1px solid #3c3c40;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: slide-up .35s ease-out;
}
.app-banner img { border-radius: 10px; flex-shrink: 0; }
.app-banner__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; flex: 1; }
.app-banner__text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-banner__text span { font-size: 13px; color: var(--muted); }
.app-banner__close { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.app-banner__close svg { width: 18px; height: 18px; }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
/* Keep the tool's controls clear of the banner. */
.has-banner .tool { padding-bottom: 92px; }

/* ---------- Full screen ---------- */

.is-full { overflow: hidden; padding-bottom: 0; }
.is-full .site-header, .is-full .content, .is-full .site-footer, .is-full .app-banner,
.is-full .tool__bar, .is-full .kbd-hint, .is-full .timer-setup { display: none !important; }
.is-full .tool {
  position: fixed; inset: 0; z-index: 60; height: 100vh; height: 100dvh; min-height: 0; max-height: none;
  border-radius: 0; margin: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, var(--safe-b));
  background-color: var(--bg);
}
.is-full .full-exit { display: inline-flex; z-index: 2; }
.is-full .display:not(.display--huge) { font-size: clamp(3rem, 15vw, 32vh); }
.is-full .tool--stopwatch .display { margin-block: auto 24px; }
.is-full .tool--stopwatch .laps { flex: 0 1 auto; max-height: 30vh; }
.is-full .tool--timer .display { margin-top: auto; }
.is-full .tool--timer .progress { margin-bottom: auto; }
.is-full .display--huge { font-size: clamp(4rem, 30vw, 40vh); }
.is-full .pomo-run__top .icon-btn--spacer { width: 56px; }

/* ---------- Desktop ---------- */

/* Desktop: the tool uses the full width and exactly one screen between the
   header and the always-on app bar. */
@media (min-width: 900px) {
  :root { --header-h: 74px; --bar-h: 96px; }
  body { padding-bottom: 0; }
  html:not(.is-ios) body { padding-bottom: var(--bar-h); }
  .mobile-only { display: none !important; }

  .site-header, .has-tool .site-header {
    position: sticky; top: 0; z-index: 30;
    max-width: 1600px; height: var(--header-h); margin: 0 auto; padding: 0 24px;
    display: grid; grid-template-columns: 1fr auto 1fr;
    background: rgba(19,19,20,.88); backdrop-filter: blur(10px);
  }
  .site-header > .brand { justify-self: start; }
  .has-tool .site-header > .brand { display: inline-flex; }
  /* The app bar replaces the header button on desktop. */
  .site-header > .btn-pill { display: none !important; }

  .tabs {
    position: static; height: auto; padding: 4px; border: 0; gap: 4px;
    display: flex; background: var(--surface); border-radius: 18px;
  }
  .tabs__item { flex-direction: row; gap: 8px; padding: 9px 16px; font-size: 15px; }
  .tabs__item svg { width: 20px; height: 20px; }
  .tabs__item[aria-current="page"]::after { display: none; }
  .tabs__item:hover:not([aria-current]) { background: var(--card); }

  .tool-grid {
    max-width: 1600px; margin: 0 auto; padding: 20px 24px;
    height: calc(100vh - var(--header-h) - var(--bar-h)); min-height: 460px;
  }
  html.is-ios .tool-grid { height: calc(100vh - var(--header-h)); }
  .tool {
    height: 100%; min-height: 0;
    padding: 16px 32px 24px; border-radius: 32px; background: #19191b; border: 1px solid #242427;
    overflow: hidden;
  }
  .tool__title { font-size: 26px; }
  .display--huge { font-size: clamp(6rem, 13vw, 11rem); }
  .display--huge.display--long { font-size: clamp(4.5rem, 9vw, 8rem); }
  .kbd-hint { display: block; }
  html:not(.is-desktop) .kbd-hint { display: none; }
  .controls { max-width: 640px; width: 100%; margin: 0 auto; }
  /* Pomodoro setup: steppers in a 2×2 grid, toggle and alarm rows full width. */
  .pomo-setup { max-width: 820px; width: 100%; margin-inline: auto; }
  .tool--pomodoro .controls { max-width: 820px; }
  .pomo-setup .card { display: grid; grid-template-columns: 1fr 1fr; }
  .pomo-setup .card > :not(.stepper) { grid-column: 1 / -1; }
  .pomo-setup .row--static { min-height: 54px; }

  /* Timer + stopwatch: big main column, options/laps column on the right. */
  .tool--timer, .tool--stopwatch {
    display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 27vw, 420px); gap: 24px;
    padding: 0; border: 0; border-radius: 0; background: none; overflow: visible;
  }
  .tool__main {
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    padding: 16px 32px 24px; border-radius: 32px; background: #19191b; border: 1px solid #242427;
    container-type: inline-size;
  }
  .tool__side {
    display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0;
    padding: 22px; border-radius: 28px; background: var(--surface); overflow-y: auto;
  }
  .tool__side > *, .tool__side .timer-setup, .tool__side .laps { order: 0; }
  .tool__main .tool__stage { flex: 1 1 auto; justify-content: center; align-items: center; gap: 14px; }
  .tool__main .display { margin: 0; font-size: clamp(3.5rem, 14.5cqi, 10.5rem); }
  .tool--timer .display--edit { font-size: clamp(3.5rem, 13cqi, 9.5rem); }
  .tool--timer.is-active .display, .tool--timer.is-active .progress { margin: 0; }
  .tool__main .edit-hint { margin: 0; font-size: 15px; }
  .tool__main .display--edit { margin-bottom: 26px; }
  .tool__main .time-unit { font-size: 13px; margin-top: 10px; }
  .tool__main .progress { width: min(100%, 760px); height: 6px; margin: 4px 0 0; }
  .tool__main .btn--big { min-height: 60px; }
  #t-primary, #sw-primary { background: var(--accent); color: #fff; }
  #t-primary:hover:not(:disabled), #sw-primary:hover:not(:disabled) { background: #ff9d61; }

  .side-label { margin: 12px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .side-label:first-child { margin-top: 0; }
  .side-empty { margin: 0; color: var(--muted); font-size: 14px; }
  .timer-setup, .tool--timer.is-active .timer-setup { display: flex; flex: none; overflow: visible; gap: 10px; padding: 0; }
  .tool__side .chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; overflow: visible; }
  .tool__side .chip { min-height: 44px; padding: 0 8px; border-radius: 14px; }
  .tool__side .rows { gap: 8px; }
  .tool__side .row { min-height: 46px; border-radius: 14px; font-size: 16px; }
  .tool__side .row--sound { padding: 0; gap: 8px; background: none; }
  .tool__side .row--sound label { display: none; }
  .tool__side .row--sound > .chip { min-height: 46px; border-radius: 14px; color: var(--accent); }
  .segmented { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--card); }
  .segmented button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 500; }
  .segmented button:hover { background: var(--card-2); }
  .segmented button[aria-pressed="true"] { background: var(--btn-hover); }

  .tool--stopwatch .tool__side { overflow: hidden; }
  .lap-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; border-radius: 14px; background: var(--card); }
  .stat span { display: block; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
  .stat strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .stat--best strong { color: var(--best); }
  .stat--worst strong { color: var(--worst); }
  .laps-head, .tool__side .lap { display: grid; grid-template-columns: 2.6em 1fr 1fr; gap: 10px; align-items: center; }
  .laps-head { padding: 0 14px; font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
  .laps-head span:not(:first-child), .tool__side .lap span:not(:first-child) { text-align: right; }
  .tool__side .laps { flex: 1 1 auto; min-height: 0; gap: 8px; }
  .tool__side .lap { min-height: 44px; border-radius: 14px; font-size: 15px; }
  .tool__side .lap__total { min-width: 0; }
  .lap__word { display: none; }
  .laps-empty {
    flex: 1; display: grid; place-content: center; gap: 6px; padding: 24px; text-align: center;
    border: 1.5px dashed var(--card-2); border-radius: 18px; color: var(--muted); font-size: 15px;
  }
  .laps-empty strong { color: var(--text); font-size: 17px; }

  /* Full screen on desktop drops the side column. */
  .is-full .tool--timer, .is-full .tool--stopwatch { display: flex; flex-direction: column; padding: 24px; }
  .is-full .tool__side, .is-full .appbar { display: none !important; }
  .is-full .tool__main { flex: 1; padding: 0; border: 0; background: none; }

  /* Always-on app bar */
  .appbar {
    display: block; position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, #201814, #18181a 70%); border-top: 1px solid #3a2a20;
    box-shadow: 0 -12px 30px rgba(0,0,0,.35);
  }
  .appbar__inner { max-width: 1600px; height: var(--bar-h); margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 18px; }
  .appbar__icon { border-radius: 14px; flex-shrink: 0; }
  .appbar__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .appbar__text strong { font-size: 18px; }
  .appbar__text span { color: var(--muted); font-size: 14px; }
  .appbar__feats { margin-left: auto; display: flex; gap: 8px; }
  .appbar__feats span { padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.06); color: #e3e3e7; font-size: 13px; font-weight: 500; white-space: nowrap; }
  .appbar .play-badge img { height: 58px; margin: -6px; }
  .appbar__qr { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.3; white-space: nowrap; }
  .appbar__qr img { width: 72px; height: 72px; border-radius: 8px; background: #fff; }

  .content { padding: 48px 24px 72px; }
  .tool-cards { grid-template-columns: repeat(3, 1fr); }
  .tool-cards--big { grid-template-columns: repeat(3, 1fr); }
  .link-grid { grid-template-columns: repeat(4, 1fr); }
  .app-promo { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 28px; }
  .app-promo .cta { margin-top: 0; flex-direction: column; align-items: center; }

  .site-footer__inner { grid-template-columns: auto 1fr auto; align-items: center; padding: 32px 24px; }
  .site-footer .small { grid-column: 1 / -1; }

  .app-banner { display: none !important; }
  .has-banner .tool { padding-bottom: 24px; }
}

/* Home on desktop: big stopwatch on the left, other tools on the right. */
@media (min-width: 900px) {
  .home {
    display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 32vw, 440px);
    grid-template-areas: "title title" "sw side"; gap: 20px 24px; padding: 20px 24px 0;
  }
  .home__title { grid-area: title; font-size: 26px; }
  .home-sw { grid-area: sw; padding: 24px 32px 28px; container-type: inline-size; justify-content: space-between; min-height: 440px; }
  .home-sw__top h2 { font-size: 22px; }
  .home-sw__display { font-size: clamp(3.5rem, 14.5cqi, 9rem); padding: 0; }
  .home-sw__btns { width: 100%; max-width: 560px; margin: 0 auto; }
  .home-sw__btns .btn { min-height: 60px; }
  .home-side { grid-area: side; }
  .home-tool__time { font-size: 44px; }
  .home-quick__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-quick__list .chip { justify-content: center; min-height: 44px; border-radius: 14px; }
  .page-home .content { padding-top: 40px; }
}

/* Short laptop screens (e.g. 1280×720): tighten so the tool still fits. */
@media (min-width: 900px) and (max-height: 800px) {
  :root { --header-h: 64px; --bar-h: 84px; }
  .tool-grid { padding-block: 12px; }
  .tool__main { padding: 10px 28px 16px; }
  .tool__side { padding: 18px; }
  .kbd-hint { display: none !important; }
  .appbar__qr img { width: 60px; height: 60px; }
  .appbar .play-badge img { height: 52px; }
}

@media (min-width: 900px) and (max-width: 1280px) {
  .appbar__feats { display: none; }
  .appbar__text { margin-right: auto; }
}

@media (min-width: 600px) and (max-width: 899px) {
  .link-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-cards { grid-template-columns: repeat(3, 1fr); }
}
