/* Hoot v2 free timer page (/pomodoro-timer). Owner: timer.
   The extension popup's timer (v2-build/EXTENSION-TIMER-SPEC.md: modes, fields, Hold to finish, the end alert,
   the four timer styles, calm mode) set in a clear night sky with Fable's painted branch (focus) and nest (breaks).
   Painting placement: owl-lab/backdrops/web/README.md. Feet at box centre x and box top + .93 of the box
   (the inline owl's feet sit at y 297-300 of 320); one scene unit = owl box / 134.4; mirrored so the trunk is on the right.
   The owl is never resized between states, never tinted or filtered, and nothing semi-transparent sits over it. */

body.v2 .tm-hero {
  --owl: 180px;                                   /* owl box; the ring stage is owl / .75 (spec: 180 in 240) */
  --ring: calc(var(--owl) / .75);
  --s: calc(var(--owl) / 134.4);                  /* one painting unit */
  --fx: calc(var(--ring) / 2);                    /* the owl's feet inside the stage */
  --fy: calc((var(--ring) - var(--owl)) / 2 + var(--owl) * .93);
  --k: 1;                                         /* clock scale against the popup's 44px */
  --bough-a: 12%;                                 /* where the bough tip has faded out / is solid again (from its tip) */
  --bough-b: 30%;
  --m-top-0: 0%;                                  /* painting top fade (phones keep the tree out of the heading) */
  --m-top-1: 0%;
  --m-top-c: #000;
  --m-bot-0: 84%;                                 /* trunk foot fade (phones end it sooner: the hero is short while running) */
  --m-bot-1: 99%;
  --tm-pad: clamp(20px, 4vw, 56px);               /* hero top padding under the nav */
  --tm-scene-mt: clamp(96px, 10vw, 150px);        /* desktop: the scene's drop below the top of the grid */
  --cut-branch: -400px;                           /* where the nav's bottom edge falls inside each painting (timer.js measures it) */
  --cut-nest: -400px;
  --clock-drop: calc(46 * var(--s));              /* breaks: the clock moves below the nest bowl (nest-front ends feet + 70 units) */
  position: relative;
  isolation: isolate;
  overflow: clip;
  margin-top: calc(-1 * var(--h-nav-h));
  padding: calc(var(--h-nav-h) + var(--tm-pad)) 0 clamp(56px, 7vw, 104px);
  background: var(--h-bg);
}
@media (min-width: 600px) { body.v2 .tm-hero { --owl: 200px; --k: 1.1; } }
@media (min-width: 960px) { body.v2 .tm-hero { --owl: 216px; --k: 1.2; } }

/* ---------- sky, stars, ground (no painted sky, no clouds, no grain over the paintings) ---------- */
body.v2 .tm-hero__sky { position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, #101318 0%, #111827 20%, #121f33 50%, #15283d 76%, #173244 100%); pointer-events: none; }
body.v2 .tm-hero__stars { position: absolute; inset: 0 0 auto 0; width: 100%; height: min(70%, 620px); }
body.v2 .tm-hero { --gh: clamp(110px, 13vw, 190px); }   /* the land's height */
body.v2 .tm-hero__land { position: absolute; left: 0; right: 0; bottom: 0; z-index: -1; pointer-events: none; }
body.v2 .tm-hero__ground { display: block; width: 100%; height: var(--gh); }

/* ---------- layout ---------- */
body.v2 .tm-hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "scene" "panel";
  justify-items: center;
}
body.v2 .tm-head { grid-area: head; position: relative; z-index: 2; text-align: center; max-width: 620px; }
body.v2 .tm-title { margin: 14px auto 0; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); max-width: 17ch; }
body.v2 .tm-lead { margin: 14px auto 0; max-width: 44ch; color: var(--h-ink-soft); }
body.v2 .tm-scene { grid-area: scene; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin-top: clamp(28px, 6vw, 40px); }
body.v2 .tm-panel { grid-area: panel; position: relative; z-index: 2; width: 100%; max-width: 440px; margin-top: 18px; }

body.v2 .tm-scene { scroll-margin-top: calc(var(--h-nav-h) + 12px); }
@media (max-width: 959px) {
  body.v2 .tm-hero { --m-top-0: 44%; --m-top-1: 56%; --m-top-c: transparent; --m-bot-0: 76%; --m-bot-1: 93%; }
}
/* phones: once the timer runs, the intro steps aside so the owl, the clock and Pause / Hold fit on one screen */
@media (max-width: 599px) {
  body.v2 .tm-hero:not([data-view="ready"]) .tm-head { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
}
@media (min-width: 960px) {
  body.v2 .tm-hero {
    --bough-a: 15%; --bough-b: 31%; padding-bottom: clamp(72px, 7vw, 112px);
    /* the stage's top sits at nav + pad + scene drop, so the nav edge is known before timer.js measures it */
    --cut-branch: calc(590 * var(--s) - var(--fy) - var(--tm-pad) - var(--tm-scene-mt));
    --cut-nest: calc(330 * var(--s) - var(--fy) - var(--tm-pad) - var(--tm-scene-mt));
    /* the land sits a fixed distance under the owl's feet (not on the hero's bottom edge), so the trunk always
       stands in it: the trunk is solid down past the hills and its foot fades out behind the opaque land */
    --land-top: calc(var(--h-nav-h) + var(--tm-pad) + var(--tm-scene-mt) + var(--fy) + 183 * var(--s));
    --m-bot-0: 93%; --m-bot-1: 99%;
    min-height: calc(var(--land-top) + var(--gh));
  }
  /* in front of the paintings (the scene drops to z 0), behind the copy and the panel; dark #101318 below the hills */
  body.v2 .tm-hero__land {
    top: var(--land-top); z-index: 1;
    background: linear-gradient(to bottom, transparent calc(var(--gh) - 1px), #101318 calc(var(--gh) - 1px));
  }
  body.v2 .tm-hero__grid { z-index: auto; }        /* no stacking context: the land sits between the scene and the copy */
  body.v2 .tm-scene { z-index: 0; }
  body.v2 .tm-hero__grid {
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "head scene" "panel scene";
    column-gap: clamp(40px, 5vw, 80px);
    justify-items: stretch;
    align-items: start;
  }
  body.v2 .tm-head { text-align: left; max-width: none; }
  body.v2 .tm-title, body.v2 .tm-lead { margin-left: 0; }
  /* pinned to the top so the owl never moves when the panel grows (settings) or shrinks (running) */
  body.v2 .tm-scene { align-self: start; justify-self: center; margin-top: var(--tm-scene-mt); padding-top: 0; }
  body.v2 .tm-panel { margin-top: 26px; max-width: none; }
}

/* ---------- the stage: paintings, ring, owl, nest front ---------- */
body.v2 .tm-stage { position: relative; width: var(--ring); height: var(--ring); flex: none; }
body.v2 .tm-paint { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
body.v2 .tm-paint__img {
  position: absolute;
  max-width: none;
  transform: scaleX(-1);                          /* the trunk on the right, lit from the upper left */
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity .9s var(--h-ease-in-out);
}
body.v2 .tm-paint--branch {
  left: calc(var(--fx) - 324 * var(--s)); top: calc(var(--fy) - 590 * var(--s));
  width: calc(660 * var(--s)); height: calc(906 * var(--s));
  /* local (unmirrored) coordinates: the bough tip is at the right edge, the trunk foot at the bottom */
  -webkit-mask-image: linear-gradient(to left, transparent var(--bough-a), #000 var(--bough-b)), linear-gradient(to bottom, var(--m-top-c) var(--m-top-0), #000 var(--m-top-1), #000 var(--m-bot-0), transparent var(--m-bot-1)), linear-gradient(to bottom, transparent var(--cut-branch), #000 calc(var(--cut-branch) + 72px));
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to left, transparent var(--bough-a), #000 var(--bough-b)), linear-gradient(to bottom, var(--m-top-c) var(--m-top-0), #000 var(--m-top-1), #000 var(--m-bot-0), transparent var(--m-bot-1)), linear-gradient(to bottom, transparent var(--cut-branch), #000 calc(var(--cut-branch) + 72px));
  mask-composite: intersect;
}
body.v2 .tm-paint--nest {
  left: calc(var(--fx) - 260 * var(--s)); top: calc(var(--fy) - 330 * var(--s));
  width: calc(740 * var(--s)); height: calc(690 * var(--s));
  opacity: 0;
  /* the limb's cut end is the local bottom-left corner */
  -webkit-mask-image: linear-gradient(to right, transparent 2%, #000 24%), linear-gradient(to bottom, var(--m-top-c) calc(var(--m-top-0) - 22%), #000 calc(var(--m-top-1) - 25%), #000 72%, transparent 97%), linear-gradient(to bottom, transparent var(--cut-nest), #000 calc(var(--cut-nest) + 72px));
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 2%, #000 24%), linear-gradient(to bottom, var(--m-top-c) calc(var(--m-top-0) - 22%), #000 calc(var(--m-top-1) - 25%), #000 72%, transparent 97%), linear-gradient(to bottom, transparent var(--cut-nest), #000 calc(var(--cut-nest) + 72px));
  mask-composite: intersect;
}
body.v2 .tm-hero[data-scene="nest"] .tm-paint--branch { opacity: 0; }
body.v2 .tm-hero[data-scene="nest"] .tm-paint--nest { opacity: 1; }

/* the nest bowl in front of the owl: always fully opaque where it is drawn, wiped in with a clip (never faded) */
body.v2 .tm-nest-front {
  position: absolute; z-index: 4;
  left: calc(var(--fx) - 118 * var(--s)); top: calc(var(--fy) - 56 * var(--s));
  width: calc(236 * var(--s)); height: calc(126 * var(--s));
  max-width: none;
  transform: scaleX(-1);
  clip-path: inset(0 0 0 100%);
  visibility: hidden;
  pointer-events: none;
  user-select: none;
  transition: clip-path .7s var(--h-ease-out), visibility 0s linear .7s;
}
body.v2 .tm-hero[data-scene="nest"] .tm-nest-front { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .7s var(--h-ease-out) .25s, visibility 0s; }

body.v2 .tm-stage .tm-owl {                      /* beats owl-web's [data-hoot-owl]{position:relative} */
  position: absolute; z-index: 3;
  left: calc((var(--ring) - var(--owl)) / 2); top: calc((var(--ring) - var(--owl)) / 2);
  width: var(--owl); height: var(--owl);
}
body.v2 .tm-owl > .tm-owl__svg { display: block; width: 100%; height: 100%; }
/* SVG fallback only (Rive hides it once drawn): eyes shut while it sleeps in the nest or while paused */
body.v2 .tm-hero[data-owl-sleep] .tm-owl__svg .h-owl__lid { transform: translateY(64px); }
body.v2 .tm-hero[data-owl-sleep] .tm-owl__svg .hm-rig-eye { animation: none; }

/* Spiral ring (behind the owl). Track + fill, r 92 of 200, starts at 12 o'clock, fills clockwise. */
body.v2 .tm-ring { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity .5s var(--h-ease-out); }
body.v2 .tm-hero[data-view="running"][data-style="spiral"] .tm-ring { opacity: 1; }
body.v2 .hoot-ring-track { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 6; }
body.v2 .hoot-ring-fill {
  fill: none; stroke: #c4b8ff; stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 4px rgba(196, 184, 255, .75)) drop-shadow(0 0 10px rgba(130, 221, 209, .35));
}
body.v2 .tm-hero.is-snap .hoot-ring-fill { transition: none; }
body.v2 .tm-hero[data-view="running"] .hoot-ring-fill { animation: hoot-ring-breathe 3.2s ease-in-out infinite; }
@keyframes hoot-ring-breathe { 0%, 100% { stroke: #c4b8ff; } 50% { stroke: #82ddd1; } }

/* one-shot pulse on Start, behind the owl */
body.v2 .tm-burst { position: absolute; z-index: 2; inset: calc((var(--ring) - var(--owl)) / 2 + var(--owl) * .1); border: 2px solid #b8a6ff; border-radius: 50%; opacity: 0; pointer-events: none; }
body.v2 .tm-hero.is-starting .tm-burst { animation: tm-start-ring .75s ease-out; }
@keyframes tm-start-ring { 0% { opacity: 0; transform: scale(.85); } 25% { opacity: .45; } 100% { opacity: 0; transform: scale(1.18); } }

/* ---------- the clock (44px in the popup; scaled with the owl here) ---------- */
body.v2 .tm-readout { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; margin-top: 2px; min-height: calc(44px * var(--k) * 1.15 + 30px); }
body.v2 .popup-clock {
  display: inline-flex; align-items: baseline; justify-content: center;
  padding: 0 10px;
  border-radius: 12px;
  font-size: calc(44px * var(--k)); font-weight: 700; line-height: 1.15; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: #f3f4f6;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(220, 214, 255, .2), 0 0 16px rgba(160, 140, 255, .12);
  transform-origin: 50% 0;
  transition: transform .14s ease-out, text-shadow .14s ease-out, background-color .16s;
}
body.v2 .tm-hero[data-view="running"] .popup-clock { text-shadow: 0 0 6px rgba(225, 218, 255, .3), 0 0 16px rgba(170, 150, 255, .18); }
@media (hover: hover) { body.v2 .tm-hero[data-view="running"] .popup-clock:hover { background: rgba(23, 25, 32, .7); } }
body.v2 .tm-hero:is([data-view="finished"], [data-view="saved"]) .tm-readout { visibility: hidden; }
/* breaks: the clock drops clear of the nest bowl and its limb (phones in the flow, desktop without moving anything) */
body.v2 .tm-hero[data-wt] .tm-readout { transition: opacity .2s ease-out, transform .6s var(--h-ease-out), margin-top .6s var(--h-ease-out); }
body.v2 .tm-hero[data-scene="nest"] .tm-readout { margin-top: calc(2px + var(--clock-drop)); }
@media (min-width: 960px) {
  body.v2 .tm-hero[data-scene="nest"] .tm-readout { margin-top: 2px; transform: translateY(var(--clock-drop)); }
}
body.v2 .hoot-digit, body.v2 .hoot-digit-sep { display: inline-block; }
body.v2 .hoot-digit-face { display: inline-block; }
body.v2 .tm-round { margin: 4px 0 0; min-height: 20px; color: var(--h-muted); font-size: .875rem; font-weight: 500; letter-spacing: .01em; text-shadow: 0 1px 2px rgba(8, 10, 14, .9); }

/* 1. Circular Spiral (default) */
body.v2 .hoot-spiral-clock .hoot-digit { transform-origin: 50% 40%; animation: hoot-digit-spiral 720ms cubic-bezier(.2, .8, .2, 1) both; }
body.v2 .hoot-spiral-clock .hoot-digit:nth-child(2) { animation-delay: 50ms; }
body.v2 .hoot-spiral-clock .hoot-digit:nth-child(4) { animation-delay: 100ms; }
body.v2 .hoot-spiral-clock .hoot-digit:nth-child(5) { animation-delay: 150ms; }
body.v2 .hoot-spiral-clock .hoot-digit:nth-child(7) { animation-delay: 200ms; }
body.v2 .hoot-spiral-clock .hoot-digit--ones { animation: hoot-digit-trickle 420ms cubic-bezier(.2, .8, .2, 1) both; animation-delay: 0ms !important; }
@keyframes hoot-digit-spiral {
  0% { opacity: 0; transform: translateY(-60%) rotate(-220deg) scale(.3); filter: blur(3px); }
  55% { opacity: 1; transform: translateY(8%) rotate(14deg) scale(1.05); filter: blur(0); }
  80% { transform: translateY(-2%) rotate(-4deg) scale(.99); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes hoot-digit-trickle {
  0% { opacity: 0; transform: translateY(-45%) rotate(-80deg) scale(.6); filter: blur(2px); }
  70% { opacity: 1; transform: translateY(4%) rotate(6deg) scale(1.02); filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
/* 2. Classic Digital */
body.v2 .hoot-clock--classic { gap: 4px; letter-spacing: 0; text-shadow: none !important; align-items: center; }
body.v2 .hoot-clock--classic .hoot-digit {
  min-width: .68em; padding: .02em .06em; border-radius: 7px; text-align: center; overflow: hidden;
  background: linear-gradient(#1f2531, #161b25);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .05);
}
body.v2 .hoot-clock--classic .hoot-digit-face { animation: hoot-digit-slide 360ms cubic-bezier(.2, .8, .2, 1) both; }
body.v2 .hoot-clock--classic .hoot-digit-sep { opacity: .55; margin: 0 -1px; }
@keyframes hoot-digit-slide { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }
/* 3. Cyber Glitch */
body.v2 .hoot-clock--cyber {
  position: relative;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; letter-spacing: .02em;
  color: #d9fff8;
  text-shadow: -1.5px 0 rgba(255, 64, 176, .8), 1.5px 0 rgba(0, 229, 255, .8), 0 0 14px rgba(0, 229, 255, .35) !important;
  animation: hoot-cyber-jitter 5s steps(1) infinite;
}
body.v2 .hoot-clock--cyber::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .28) 2px 3px); }
body.v2 .hoot-clock--cyber .hoot-digit-face { animation: hoot-cyber-glitch 320ms steps(3) both; }
@keyframes hoot-cyber-glitch {
  0% { transform: translate(3px, -1px) skewX(-12deg); clip-path: inset(0 0 55% 0); opacity: .55; }
  40% { transform: translate(-3px, 1px); clip-path: inset(45% 0 0 0); }
  70% { transform: translate(1px, 0) skewX(6deg); clip-path: inset(10% 0 20% 0); }
  100% { transform: none; clip-path: inset(0); opacity: 1; }
}
@keyframes hoot-cyber-jitter { 0%, 95%, 100% { transform: none; } 96% { transform: translateX(2px) skewX(5deg); } 97% { transform: translateX(-2px); } 98% { transform: translateX(1px) skewX(-3deg); } }
/* 4. Minimalist */
body.v2 .hoot-clock--minimal { font-weight: 300; color: #e9ebf0; text-shadow: none !important; animation: none; }
body.v2 .hoot-clock--minimal * { animation: none !important; }

/* ---------- calm mode: everything but the owl, its ring and the clock fades; the clock grows 1.2x ---------- */
body.v2 .tm-head, body.v2 .tm-panel, body.v2 .tm-round { transition: opacity .14s ease-out, transform .14s ease-out; }
body.v2 .tm-hero.is-calm :is(.tm-head, .tm-panel, .tm-round) { opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .42s ease, transform .42s ease; }
body.v2 .tm-hero.is-calm .popup-clock {
  transform: scale(1.2);
  text-shadow: 0 1px 2px rgba(8, 10, 14, .9), 0 0 14px rgba(8, 10, 14, .7), 0 0 6px rgba(225, 218, 255, .3), 0 0 16px rgba(170, 150, 255, .18);
  transition: transform .6s cubic-bezier(.34, 1.3, .64, 1) .25s, text-shadow .6s ease .25s;
}
body.v2 .tm-hero.is-calm .hoot-clock--classic, body.v2 .tm-hero.is-calm .hoot-clock--minimal { text-shadow: 0 1px 2px rgba(8, 10, 14, .9), 0 0 14px rgba(8, 10, 14, .7) !important; }

/* ---------- the panel ---------- */
body.v2 .tm-panel {
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--h-r-lg);
  background: rgba(20, 25, 32, .74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8);
}
body.v2 .tm-view[hidden] { display: none !important; }
body.v2 .tm-view { animation: tm-rise .36s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes tm-rise { from { opacity: 0; transform: translateY(6px); } }

/* mode words with the extension's always-on glow */
body.v2 .tm-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
body.v2 .tm-modes button {
  min-height: 44px; padding: 4px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  font: 600 .9375rem/1.2 var(--h-font);
  color: #b9b3d6;
  text-shadow: 0 0 4px rgba(196, 184, 255, .35), 0 0 10px rgba(160, 140, 255, .2);
  transition: color 160ms ease, text-shadow 160ms ease, background 160ms ease;
}
body.v2 .tm-modes button:focus-visible { outline: 2px solid var(--h-focus); outline-offset: 2px; }
@media (hover: hover) { body.v2 .tm-modes button:hover { color: #ece8ff; } }
body.v2 .tm-modes [aria-pressed="true"] { color: #ece8ff; background: rgba(255, 255, 255, .05); text-shadow: 0 0 5px rgba(196, 184, 255, .55), 0 0 13px rgba(160, 140, 255, .35); }

/* the values: one fixed-height block so switching modes never moves anything */
body.v2 .tm-values { height: 96px; padding-top: 12px; }
body.v2 .tm-set { display: flex; justify-content: center; }
body.v2 .tm-set--pomodoro { display: grid; grid-template-columns: 1.3fr 1.3fr .7fr; gap: 6px; }
body.v2 .tm-set[hidden] { display: none; }
body.v2 .tm-field { display: flex; flex-direction: column; align-items: center; min-width: 0; }
body.v2 .hoot-value-row { display: flex; align-items: center; justify-content: center; gap: 0; border-radius: 12px; background: transparent; transition: background-color .16s, box-shadow .16s; max-width: 100%; }
body.v2 .hoot-value-row:focus-within { background: #171920; }
@media (hover: hover) { body.v2 .hoot-value-row:hover { background: #171920; } }
body.v2 .hoot-value-row:focus-within { box-shadow: 0 0 0 1px #7775ec; }
body.v2 .clock-edit {
  width: 7ch; min-width: 0; height: 52px; padding: 0 2px; border: 0; border-radius: 10px;
  background: transparent; color: #f3f4f6; text-align: center;
  font: 600 36px/1 var(--h-font); letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(220, 214, 255, .2), 0 0 16px rgba(160, 140, 255, .12);
}
body.v2 .clock-edit:focus { outline: none; }
body.v2 .clock-edit:focus-visible { outline: none; }
body.v2 .tm-set--countdown .clock-edit { width: 180px; }
body.v2 .tm-set--pomodoro .clock-edit { width: 100%; height: 44px; font-size: 24px; letter-spacing: 0; }
body.v2 .tm-field--rounds .clock-edit { font-size: 25px; }
body.v2 .tm-set--pomodoro .hoot-value-row { width: 100%; }
body.v2 .tm-stopwatch-readout { height: 52px; display: flex; align-items: center; font: 600 36px/1 var(--h-font); letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #f3f4f6; text-shadow: 0 0 6px rgba(220, 214, 255, .2), 0 0 16px rgba(160, 140, 255, .12); }
body.v2 .hoot-value-label { margin-top: 4px; color: #a5a6b9; font-size: .8125rem; font-weight: 500; }
body.v2 .hoot-step {
  flex: none; width: 26px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: #a5a6b9; font: 500 26px/1 var(--h-font);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: opacity .16s, background-color .14s, color .14s, transform .14s;
}
body.v2 .tm-set--pomodoro .hoot-step { width: 18px; font-size: 22px; }
@media (hover: hover) { body.v2 .hoot-step:hover:not(:disabled) { background: #302c46; color: #ddd3ff; } }
body.v2 .hoot-step:active:not(:disabled) { transform: scale(.86); }
body.v2 .hoot-step:disabled { opacity: .25; cursor: default; }
body.v2 .hoot-step:focus-visible { outline: 2px solid var(--h-focus); outline-offset: 0; }
@media (pointer: fine) {
  body.v2 .hoot-value-row .hoot-step { opacity: 0; }
  body.v2 .hoot-value-row:is(:hover, :focus-within) .hoot-step:not(:disabled) { opacity: 1; }
  body.v2 .hoot-value-row:is(:hover, :focus-within) .hoot-step:disabled { opacity: .25; }
}
@media (pointer: coarse) {
  body.v2 .tm-values { height: 136px; }
  body.v2 .tm-set--countdown .hoot-step { width: 44px; }
  body.v2 .tm-set--pomodoro { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.v2 .tm-set--pomodoro .hoot-value-row { flex-wrap: wrap; }
  body.v2 .tm-set--pomodoro .clock-edit { order: -1; flex: 0 0 100%; height: 44px; }
  body.v2 .tm-set--pomodoro .hoot-step { width: 44px; height: 40px; font-size: 26px; }
}
/* the ready fields follow the chosen style */
body.v2 .tm-hero[data-style="cyber"] :is(.clock-edit, .tm-stopwatch-readout) { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; color: #d9fff8; letter-spacing: 0; text-shadow: -1px 0 rgba(255, 64, 176, .8), 1px 0 rgba(0, 229, 255, .8); }
body.v2 .tm-hero[data-style="cyber"] .tm-set--countdown .clock-edit { font-size: 32px; }
body.v2 .tm-hero[data-style="minimal"] :is(.clock-edit, .tm-stopwatch-readout) { font-weight: 300; text-shadow: none; }

body.v2 .tm-error { margin: 6px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .35); color: #fecdd3; font-size: .875rem; line-height: 1.4; }
body.v2 .tm-start { margin-top: 14px; }

/* settings (style, sounds, calm) */
body.v2 .tm-settings { margin-top: 10px; }
body.v2 .tm-settings__toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin: 0 auto; width: max-content; padding: 0 12px;
  border-radius: var(--h-r-pill); color: var(--h-muted); font-size: .9375rem; font-weight: 500; cursor: pointer; list-style: none;
}
body.v2 .tm-settings__toggle::-webkit-details-marker { display: none; }
body.v2 .tm-settings__toggle svg { width: 18px; height: 18px; flex: none; }
@media (hover: hover) { body.v2 .tm-settings__toggle:hover { color: var(--h-ink); } }
body.v2 .tm-settings__toggle:focus-visible { outline: 2px solid var(--h-focus); outline-offset: 2px; }
body.v2 .tm-settings__chev { transition: transform .2s var(--h-ease-out); }
body.v2 .tm-settings[open] .tm-settings__chev { transform: rotate(180deg); }
body.v2 .tm-settings:not([open]) .tm-settings__panel { display: none; }   /* closed: no hidden radios for the peek to trip over */
body.v2 .tm-settings__panel { margin-top: 8px; padding-top: 14px; border-top: 1px solid #232838; display: grid; gap: 14px; }
body.v2 .tm-styles { margin: 0; padding: 0; border: 0; min-width: 0; }
body.v2 .tm-styles legend { padding: 0; margin-bottom: 8px; color: #c3cad6; font-size: .8125rem; font-weight: 700; }
body.v2 .tm-styles__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 399px) { body.v2 .tm-styles__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body.v2 .tm-style { position: relative; display: block; }
body.v2 .tm-style input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
body.v2 .tm-style span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 4px; border: 1px solid #2a3042; border-radius: 10px; color: var(--h-ink-soft); font-size: .8125rem; font-weight: 600; transition: border-color .14s, background-color .14s, color .14s; }
body.v2 .tm-style input:checked + span { border-color: #526ce5; background: rgba(82, 108, 229, .18); color: var(--h-ink); }
body.v2 .tm-style input:focus-visible + span { outline: 2px solid var(--h-focus); outline-offset: 2px; }
@media (hover: hover) { body.v2 .tm-style:hover span { color: var(--h-ink); } }
body.v2 .tm-hint { margin: 8px 0 0; color: var(--h-muted); font-size: .8125rem; line-height: 1.45; }
body.v2 .tm-switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
body.v2 .tm-switch__text { display: grid; gap: 2px; }
body.v2 .tm-switch__text b { color: #c3cad6; font-size: .875rem; font-weight: 700; }
body.v2 .tm-switch__text small { color: var(--h-muted); font-size: .8125rem; line-height: 1.4; }
body.v2 .tm-switch input { position: absolute; opacity: 0; width: 36px; height: 20px; right: 0; margin: 0; cursor: pointer; }
body.v2 .tm-switch__track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: #2a3042; transition: background-color .16s; }
body.v2 .tm-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #c3cad6; transition: transform .16s var(--h-ease-out), background-color .16s; }
body.v2 .tm-switch input:checked + .tm-switch__track { background: #6dd6b3; }
body.v2 .tm-switch input:checked + .tm-switch__track::after { transform: translateX(16px); background: #12161d; }
body.v2 .tm-switch input:focus-visible + .tm-switch__track { outline: 2px solid var(--h-focus); outline-offset: 2px; }

/* running */
body.v2 .tm-running { text-align: center; }
body.v2 .tm-active-title { margin: 0; color: var(--h-ink); font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
body.v2 .tm-status { margin: 4px 0 0; color: #6dd6b3; font-size: .875rem; font-weight: 600; }
body.v2 .tm-hero.is-paused .tm-status { color: #facc15; }
body.v2 .tm-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
body.v2 .tm-btn { --h-btn-h: 48px; width: 100%; padding: 0 14px; font-size: .9375rem; color: var(--h-ink); border-color: rgba(255, 255, 255, .06); }
body.v2 .tm-btn svg { width: 17px; height: 17px; flex: none; }
body.v2 .tm-btn--secondary { background: #222934; }
@media (hover: hover) { body.v2 .tm-btn--secondary:hover { background: #303a49; transform: translateY(-2px); } }
body.v2 .tm-btn--stop { color: #fda4af; background: #3c2430; }
@media (hover: hover) { body.v2 .tm-btn--stop:hover { background: #4a2a38; } }
body.v2 .tm-btn--quiet { background: transparent; border-color: transparent; color: var(--h-muted); }
@media (hover: hover) { body.v2 .tm-btn--quiet:hover { color: var(--h-ink); background: rgba(255, 255, 255, .04); } }
body.v2 .tm-btn[hidden] { display: none; }
body.v2 .hold-finish { overflow: hidden; isolation: isolate; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.v2 .hold-finish__progress { position: absolute; inset: 0; z-index: -1; background: #fb718540; transform-origin: 0 50%; transform: scaleX(0); transition: transform .16s var(--h-ease-out); }
body.v2 .hold-finish[data-holding="true"] .hold-finish__progress { transform: scaleX(1); transition: transform 1.2s linear; }
body.v2 .hold-finish__label { display: inline-flex; align-items: center; gap: 8px; }
@media (prefers-reduced-motion: reduce) { body.v2 .hold-finish[data-holding="true"] .hold-finish__progress { opacity: .5; } }
html.motion-off body.v2 .hold-finish[data-holding="true"] .hold-finish__progress { opacity: .5; }
body.v2 .tm-confirm-inline { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; color: var(--h-ink-soft); font-size: .875rem; }
body.v2 .tm-confirm-inline[hidden] { display: none; }
body.v2 .tm-confirm-inline .tm-btn { width: auto; --h-btn-h: 40px; }

/* finished / saved */
body.v2 .tm-done { text-align: center; }
body.v2 .tm-done__title { margin: 0; color: var(--h-ink); font-size: 1.375rem; font-weight: 700; line-height: 1.25; text-shadow: 0 0 8px rgba(183, 161, 255, .35); }
body.v2 .tm-done__sub { margin: 4px 0 0; color: var(--h-muted); font-size: .875rem; }
body.v2 .completion-duration { display: block; margin-top: 6px; color: #6dd6b3; font-size: 1.625rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
body.v2 .tm-done__actions { display: grid; gap: 7px; margin-top: 18px; }

body.v2 .tm-note { max-width: 60ch; margin: 14px auto 0; color: var(--h-muted); font-size: .875rem; line-height: 1.5; text-align: center; }

/* ---------- end-session alert (iOS style, from the extension) ---------- */
/* No dimming layer over the page: the owl is never covered by anything see-through. The words around it dim instead. */
body.v2 .hoot-end-confirm {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 16px;
  background: transparent;
  animation: hoot-ios-fade .2s ease-out both;
}
body.v2 .tm-hero :is(.tm-head, .tm-panel, .tm-readout) { transition: opacity .2s ease-out, transform .14s ease-out; }
body.v2 .tm-hero.is-alert :is(.tm-head, .tm-panel, .tm-readout) { opacity: .22; }
body.v2 .hoot-end-confirm[hidden] { display: none; }
body.v2 .hoot-end-card {
  width: min(300px, 100%); overflow: hidden;
  border-radius: 16px; background: #1c202b;
  border: 1px solid #2c3140;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .25);
  text-align: center;
  animation: hoot-ios-pop .3s cubic-bezier(.2, 1.25, .4, 1) both;
}
body.v2 .hoot-end-body { padding: 18px 16px 14px; }
body.v2 .hoot-end-card h2 { margin: 0; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; color: #f4f1ff; text-shadow: 0 0 8px rgba(183, 161, 255, .45); }
body.v2 .hoot-end-sub { margin: 4px 0 0; font-size: .8125rem; color: #a6b0bf; }
body.v2 .hoot-end-quote { margin: 10px 0 0; color: #c3cad6; font-size: .8125rem; line-height: 1.45; }
body.v2 .hoot-end-quote p { margin: 0; font-style: italic; }
body.v2 .hoot-end-quote cite { display: block; margin-top: 4px; font-size: .75rem; font-style: normal; color: #8b93a7; }
body.v2 .hoot-end-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid rgba(255, 255, 255, .1); }
body.v2 .hoot-end-actions button { height: 46px; border: 0; background: transparent; font: 500 .9375rem/1 var(--h-font); cursor: pointer; transition: background-color .14s; }
body.v2 .hoot-end-actions button + button { border-left: 1px solid rgba(255, 255, 255, .1); }
@media (hover: hover) { body.v2 .hoot-end-actions button:hover { background: rgba(255, 255, 255, .05); } }
body.v2 .hoot-end-actions button:focus-visible { outline: 2px solid var(--h-focus); outline-offset: -3px; }
body.v2 .hoot-end-stop { color: #ff8a9e; }
body.v2 .hoot-end-keep { color: #9db0ff; font-weight: 700 !important; }
body.v2 .hoot-end-confirm.is-leaving { animation: hoot-ios-fade-out .16s ease-in both; }
body.v2 .hoot-end-confirm.is-leaving .hoot-end-card { animation: hoot-ios-out .16s ease-in both; }
@keyframes hoot-ios-fade { from { opacity: 0; } }
@keyframes hoot-ios-fade-out { to { opacity: 0; } }
@keyframes hoot-ios-pop { from { opacity: 0; transform: scale(1.12); } }
@keyframes hoot-ios-out { to { opacity: 0; transform: scale(.96); } }

/* completion sparkles beside the owl (never over it) */
body.v2 .tm-stage::before, body.v2 .tm-stage::after {
  content: "\2726"; position: absolute; z-index: 5; pointer-events: none; opacity: 0;
  color: #c9b0ff; font-size: 15px; line-height: 1;
}
body.v2 .tm-stage::before { left: calc((var(--ring) - var(--owl)) / 2 - 14px); top: 34%; text-shadow: 6px 40px #6dd6b3, 18px -26px #f4d78b; }
body.v2 .tm-stage::after { right: calc((var(--ring) - var(--owl)) / 2 - 14px); top: 40%; text-shadow: -10px -38px #6dd6b3, -4px 32px #f4d78b; }
body.v2 .tm-hero[data-view="finished"] .tm-stage::before { animation: tm-sparkle 1.6s ease-out .1s 2 both; }
body.v2 .tm-hero[data-view="finished"] .tm-stage::after { animation: tm-sparkle 1.6s ease-out .25s 2 both; }
@keyframes tm-sparkle { 0% { opacity: 0; transform: translateY(5px) scale(.6); } 25% { opacity: .9; } 100% { opacity: 0; transform: translateY(-8px) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { body.v2 .tm-hero[data-view="finished"] .tm-stage::before, body.v2 .tm-hero[data-view="finished"] .tm-stage::after { animation: none; opacity: .9; } }
html.motion-off body.v2 .tm-hero[data-view="finished"] .tm-stage::before, html.motion-off body.v2 .tm-hero[data-view="finished"] .tm-stage::after { animation: none; opacity: .9; }

/* ---------- below the timer ---------- */
body.v2 .tm-after { padding-top: clamp(8px, 2vw, 24px); }

/* ---------- motion off: everything static and visible ---------- */
html.motion-off body.v2 .tm-hero.is-calm :is(.tm-head, .tm-panel, .tm-round) { opacity: 1; transform: none; pointer-events: auto; }
html.motion-off body.v2 .tm-hero.is-calm .popup-clock { transform: none; }
html.motion-off body.v2 .tm-hero :is(.hoot-digit, .hoot-digit-face, .popup-clock, .tm-burst, .tm-view, .hoot-ring-fill) { animation: none !important; }
html.motion-off body.v2 .tm-hero .hoot-ring-fill { transition: none; }
html.motion-off body.v2 .tm-hero :is(.tm-paint__img, .tm-nest-front, .tm-ring, .tm-readout) { transition: none; }
@media (prefers-reduced-motion: reduce) {
  body.v2 .tm-hero :is(.hoot-digit, .hoot-digit-face, .popup-clock, .tm-burst, .tm-view, .hoot-ring-fill) { animation: none !important; }
  body.v2 .tm-hero .hoot-ring-fill { transition: none; }
  body.v2 .tm-hero :is(.tm-paint__img, .tm-nest-front, .tm-ring) { transition: none; }
  body.v2 .tm-hero[data-wt] .tm-readout { transition: opacity .2s ease-out; }
  body.v2 .tm-hero.is-calm .popup-clock { transition: none; }
  body.v2 .hoot-end-confirm, body.v2 .hoot-end-card { animation: none !important; }
}
html.motion-off body.v2 .hoot-end-confirm, html.motion-off body.v2 .hoot-end-card { animation: none !important; }
