/* Online countdown timer (kind "timer"). Scoped to [data-timer] or tm- classes. */
[data-timer] .tm-mode, [data-timer] .tm-mode a { min-width: 0; }
[data-timer] .tm-mode { display: flex; width: 100%; max-width: 360px; margin: 0 0 10px; background: var(--soft); }
[data-timer] .tm-mode a { flex: 1; text-align: center; text-decoration: none; font-weight: 600; border-radius: var(--pill); padding: 10px 14px; min-height: 44px; color: var(--ink); }
[data-timer] .tm-mode a:hover { background: var(--pressed); }
[data-timer] .tm-mode a[aria-current] { background: var(--ink); color: var(--on-ink); }
[data-timer] .tm-mode a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
body.embed [data-timer] .tm-mode { display: none; }

[data-timer] .tm-label { font-size: 17px; }
[data-timer] .tm-face { container-type: inline-size; background: var(--canvas); border-radius: 12px; padding: 16px 8px 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; min-height: clamp(220px, 38vh, 400px); min-width: 0; overflow: hidden; position: relative; }
[data-timer] .tm-show { border: 0; background: none; color: inherit; cursor: pointer; padding: 4px 12px; border-radius: 12px; max-width: 100%; }
[data-timer] .tm-show:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[data-timer] .tm-running .tm-show, [data-timer] .tm-isup .tm-show { cursor: default; }
[data-timer] .tm-time { display: block; white-space: nowrap; letter-spacing: -0.045em; line-height: 1; font-size: 26vw; font-size: min(30cqw, 320px); }
[data-timer] .tm-time[data-len="m"] { font-size: 19vw; font-size: min(21cqw, 260px); }
[data-timer] .tm-time[data-len="l"] { font-size: 16vw; font-size: min(18cqw, 230px); }
[data-timer] .tm-time[data-len="xl"] { font-size: 14vw; font-size: min(15cqw, 200px); }
[data-timer] .tm-paused .tm-time { color: var(--body); }
[data-timer] .tm-hint { margin: 10px 0 0; font-size: 15px; color: var(--mute); text-align: center; padding: 0 8px; }
[data-timer] .tm-upmsg { margin: 0 0 6px; font-size: clamp(30px, 8vw, 56px); font-weight: 800; letter-spacing: -0.03em; text-align: center; }
[data-timer] .tm-bar { align-self: stretch; height: 8px; margin: 16px -8px 0; background: var(--soft); overflow: hidden; }
[data-timer] .tm-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left center; }

/* time is up: the face flashes green (the site's one colour, used for "done") */
[data-timer] .tm-isup { background: var(--signal); color: #fff; }
[data-timer] .tm-isup .tm-bar { background: rgba(255,255,255,.3); }
[data-timer] .tm-ring { animation: tm-flash 1s steps(1, end) infinite; }
@keyframes tm-flash { 0% { background: var(--signal); color: #fff; } 50% { background: var(--canvas); color: var(--ink); } }

/* the editor */
[data-timer] .tm-edit { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; padding: 4px 0 8px; }
[data-timer] .tm-fields { display: flex; align-items: flex-start; justify-content: center; gap: 4px; max-width: 100%; }
[data-timer] .tm-f { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--body); min-width: 0; }
[data-timer] .tm-f input { width: 1.55em; min-width: 0; border: 0; border-radius: 12px; background: var(--soft); color: var(--ink); text-align: center; padding: 6px 0;
  font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; line-height: 1; font-size: clamp(48px, 17vw, 120px); caret-color: var(--ink); }
[data-timer] .tm-f input:focus { outline: 3px solid var(--ink); outline-offset: 1px; background: var(--canvas); }
[data-timer] .tm-colon { font-weight: 800; line-height: 1; font-size: clamp(40px, 13vw, 100px); padding-top: 4px; }
[data-timer] .tm-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 340px; }
[data-timer] .tm-pad .pill { min-height: 56px; font-size: 24px; font-weight: 700; }
[data-timer] .tm-editbtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
[data-timer] .tm-editbtns .pill { min-width: 120px; }

[data-timer] .tm-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
[data-timer] .tm-btn { min-height: 76px; font-size: 22px; font-weight: 700; width: 100%; min-width: 0; }
[data-timer] .tm-btn:not(.pill-ink) { background: var(--canvas); }
[data-timer] .tm-btn:not(.pill-ink):hover { background: var(--pressed); }
[data-timer] .tm-btn.tm-pause { box-shadow: inset 0 0 0 3px var(--ink); background: var(--canvas); color: var(--ink); }
[data-timer] .tm-btn.tm-pause:hover { background: var(--pressed); opacity: 1; }
[data-timer] .tm-quick, [data-timer] .tm-presets, [data-timer] .tm-recent { display: flex; flex-wrap: wrap; gap: 8px; }
[data-timer] .tm-quick .pill { background: var(--canvas); font-weight: 600; flex: 1 1 auto; min-width: 72px; }
[data-timer] .tm-presets .pill, [data-timer] .tm-recent .pill { background: var(--canvas); min-height: 44px; padding: 8px 14px; }
[data-timer] .tm-quick .pill:hover, [data-timer] .tm-presets .pill:hover, [data-timer] .tm-recent .pill:hover { background: var(--pressed); }
[data-timer] .tm-recent { align-items: center; }
[data-timer] .tm-recent .pill { max-width: 100%; }
[data-timer] .tm-recent .pill span { color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
[data-timer] .tm-cap { font-size: 13px; font-weight: 600; color: var(--body); width: 100%; }
[data-timer] .settings select.inp { font-size: 16px; }

/* full screen: huge digits, the rest stays reachable underneath */
body.is-focus [data-timer] .tm-stage { gap: 10px; }
body.is-focus [data-timer] .tm-face { flex: 1 0 auto; min-height: 0; }
body.is-focus [data-timer] .tm-time { font-size: min(30cqw, 60vh); }
body.is-focus [data-timer] .tm-time[data-len="m"] { font-size: min(21cqw, 52vh); }
body.is-focus [data-timer] .tm-time[data-len="l"] { font-size: min(18cqw, 46vh); }
body.is-focus [data-timer] .tm-time[data-len="xl"] { font-size: min(15cqw, 40vh); }
body.is-focus [data-timer] .tm-presets, body.is-focus [data-timer] .tm-recent, body.is-focus [data-timer] .stage-head { display: none; }

@media (max-width: 520px) {
  [data-timer] .tm-btn { min-height: 72px; font-size: 20px; }
  [data-timer] .tm-quick .pill { min-width: 64px; padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { [data-timer] .tm-ring { animation: none; } }
