:root {
  color-scheme: dark;
  --bg: #09031f;
  --surface: #10072d;
  --surface-raised: #170b3b;
  --surface-soft: rgb(27 13 61 / 0.78);
  --text: #eddcff;
  --muted: #aaa0ca;
  --muted-strong: #c9bee5;
  --line: rgb(213 191 255 / 0.15);
  --line-strong: rgb(220 200 255 / 0.28);
  --accent: #874bff;
  --accent-vivid: #d75cff;
  --accent-cool: #75dcff;
  --accent-ink: #0c0423;
  --completion: #f3d7ff;
  --range-percent: 66.6667%;
  --range-progress: 0.666667;
  --alarm-cycle-duration: 1.463s;
  --alarm-phase-offset: 0ms;
  --countdown-offset: 100%;
  --stage-wash:
    radial-gradient(circle at 50% 44%, rgb(112 65 201 / 0.09), transparent 48%),
    linear-gradient(rgb(4 0 18 / 0.1), rgb(4 0 18 / 0.28));
  --aperture-tint:
    radial-gradient(circle at 32% 34%, rgb(139 75 255 / 0.64), transparent 44%),
    radial-gradient(circle at 72% 70%, rgb(89 134 255 / 0.48), transparent 42%);
  --aperture-tone: saturate(1.02) contrast(1.02);
  --font-display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --font-body: "Space Grotesk", "Avenir Next", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --focus-ring: 0 0 0 3px rgb(117 220 255 / 0.26), 0 0 0 1px var(--accent-cool);
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f5fb;
  --surface-raised: #ffffff;
  --surface-soft: rgb(255 255 255 / 0.88);
  --text: #281b35;
  --muted: #766b80;
  --muted-strong: #4e425a;
  --line: rgb(57 38 76 / 0.12);
  --line-strong: rgb(57 38 76 / 0.22);
  --accent: #6f35df;
  --accent-vivid: #8f43f2;
  --accent-cool: #5a2bb5;
  --accent-ink: #ffffff;
  --completion: #5c2aaa;
  --stage-wash:
    radial-gradient(circle at 50% 42%, rgb(111 53 223 / 0.055), transparent 48%),
    radial-gradient(circle at 18% 82%, rgb(111 53 223 / 0.035), transparent 36%),
    linear-gradient(#ffffff, #faf8fe);
  --aperture-tint:
    linear-gradient(rgb(111 53 223 / 0.92), rgb(111 53 223 / 0.92));
  --aperture-tone: none;
  --focus-ring: 0 0 0 3px rgb(111 53 223 / 0.16), 0 0 0 1px var(--accent);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

html[data-presentation="on"],
html[data-presentation="on"] body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.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;
}

.material-symbols-rounded {
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 28;
  font-size: 1.45rem;
  line-height: 1;
}

.timer-shell {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 680px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.timer-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.timer-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background: var(--stage-wash);
  pointer-events: none;
  transition: background 600ms var(--ease-out);
}

.aperture {
  position: absolute;
  inset: clamp(8px, 1.5vh, 20px) clamp(20px, 4vw, 80px) 0;
  z-index: -2;
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: var(--aperture-tone);
  transform: translateY(-16px) scale(1.14);
  transform-origin: center;
  transition:
    transform 900ms var(--ease-spring),
    opacity 500ms var(--ease-out),
    filter 500ms var(--ease-out);
}

.aperture::after {
  content: "";
  grid-area: 1 / 1;
  width: min(100%, 1420px);
  height: 100%;
  z-index: 2;
  background: var(--aperture-tint);
  mix-blend-mode: color;
  opacity: 0.56;
  pointer-events: none;
  transition:
    opacity 420ms var(--ease-out),
    filter 520ms var(--ease-out);
}

.aperture-image {
  grid-area: 1 / 1;
  width: min(100%, 1420px);
  height: 100%;
}

.aperture-image {
  display: block;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.aperture-image-base {
  opacity: 0.8;
  filter: saturate(0.9) brightness(0.86);
  transition:
    opacity 600ms var(--ease-out),
    filter 600ms var(--ease-out);
}

.final-countdown-mark {
  position: absolute;
  z-index: 1;
  width: min(80vmin, 820px);
  aspect-ratio: 1;
  overflow: hidden;
  background: color-mix(in srgb, var(--completion) 10%, transparent);
  opacity: 0;
  transform: scale(0.94);
  -webkit-mask: url("assets/ikigai-logo.png") center / 190% 190% no-repeat;
  mask: url("assets/ikigai-logo.png") center / 190% 190% no-repeat;
  pointer-events: none;
  transition:
    opacity 420ms var(--ease-out),
    transform 620ms var(--ease-spring),
    background 420ms var(--ease-out);
}

.final-countdown-mark-fill {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      color-mix(in srgb, var(--accent) 88%, var(--bg)) 0%,
      var(--accent-vivid) 62%,
      var(--completion) 100%
    );
  clip-path: inset(0 0 var(--countdown-offset) 0);
}

.timer-shell.is-final-countdown .aperture {
  opacity: 0;
  transform: translateY(-18px) scale(1.12);
}

.timer-shell.is-final-countdown .final-countdown-mark {
  opacity: 1;
  transform: scale(1);
}

.timer-shell.is-final-countdown .final-countdown-mark-fill {
  will-change: clip-path;
}

.timer-copy {
  position: relative;
  z-index: 2;
  width: min(100%, 1280px);
  display: grid;
  justify-items: center;
  align-content: center;
  padding: clamp(18px, 2.6vh, 36px);
  transform: translateY(4px);
}

.readout-pulse {
  width: 100%;
  display: grid;
  place-items: center;
  transform-origin: center;
}

.timer-shell.is-presentation.is-final-countdown:not(.is-complete) .time-readout {
  font-size: clamp(22rem, 52vmin, 48rem);
  line-height: 0.7;
  letter-spacing: 0;
  text-shadow:
    0 0 34px color-mix(in srgb, var(--completion) 48%, transparent),
    0 0 112px color-mix(in srgb, var(--accent-vivid) 32%, transparent),
    0 36px 100px rgb(2 0 10 / 0.56);
}

.timer-shell.is-final-countdown:not(.is-complete) .readout-pulse.is-second-pulse {
  animation: finalSecondPulse 940ms linear both;
  will-change: transform, opacity;
}

.timer-shell.is-final-countdown.is-countdown-critical:not(.is-complete) .readout-pulse.is-second-pulse {
  animation-name: finalSecondCriticalPulse;
}

.timer-shell.is-final-countdown.is-countdown-beat:not(.is-complete) .final-countdown-mark {
  animation: finalMarkBeat 940ms linear both;
  will-change: transform, opacity;
}

.timer-shell.is-final-countdown.is-countdown-beat.is-countdown-critical:not(.is-complete) .final-countdown-mark {
  animation-name: finalMarkCriticalBeat;
}

.time-readout {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(10.5rem, 20vw, 19rem);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1, "kern" 1;
  letter-spacing: 0.015em;
  line-height: 0.78;
  text-align: center;
  text-wrap: nowrap;
  text-shadow:
    0 0 32px rgb(180 120 255 / 0.12),
    0 18px 60px rgb(2 0 10 / 0.42);
  cursor: text;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center;
  transition:
    color 300ms var(--ease-out),
    font-size 420ms var(--ease-out),
    transform 500ms var(--ease-spring),
    text-shadow 500ms var(--ease-out);
}

.time-readout[data-digits="1"],
.time-readout[data-digits="2"] {
  font-size: clamp(12rem, 25vw, 24rem);
}

.time-readout[data-digits="7"],
.time-readout[data-digits="8"] {
  font-size: clamp(7rem, 15vw, 14rem);
}

.time-readout[data-digits="long"] {
  font-size: clamp(4.8rem, 10vw, 9.5rem);
}

.time-readout.is-editing {
  width: min(92%, 980px);
  padding: 0.05em 0.12em;
  color: var(--completion);
  border-bottom: 1px solid var(--accent-cool);
  text-shadow: none;
  user-select: text;
  -webkit-user-select: text;
}

.time-readout:focus-visible {
  border-radius: 12px;
  box-shadow: var(--focus-ring);
}

.brand-lockup {
  position: absolute;
  left: 50%;
  bottom: clamp(46px, 5.4vh, 58px);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted-strong);
  text-transform: uppercase;
  transition:
    opacity 350ms var(--ease-out),
    transform 500ms var(--ease-spring);
  transform: translateX(-50%);
}

.brand-title {
  font-size: clamp(0.84rem, 1vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.46em;
}

.brand-subtitle {
  font-size: clamp(0.56rem, 0.72vw, 0.7rem);
  font-weight: 500;
  letter-spacing: 0.38em;
  opacity: 0.74;
}

.control-deck {
  position: relative;
  z-index: 10;
  min-height: 208px;
  display: grid;
  grid-template-columns: minmax(420px, 1.4fr) auto minmax(260px, 0.72fr);
  align-items: center;
  gap: clamp(28px, 3.2vw, 56px);
  padding:
    clamp(28px, 3vh, 38px)
    clamp(32px, 4.2vw, 72px)
    max(clamp(30px, 3.4vh, 46px), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 -30px 90px rgb(2 0 12 / 0.26);
  transition:
    opacity 260ms var(--ease-out),
    transform 360ms var(--ease-spring),
    background 300ms var(--ease-out),
    border-color 300ms var(--ease-out);
}

.duration-control {
  --range-thumb-size: 26px;
  --range-track-height: 8px;
  --range-input-height: 30px;
  --range-top-space: 23px;
  min-width: 0;
  display: grid;
  gap: 13px;
}

.duration-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.range-wrap {
  position: relative;
  min-width: 0;
  padding-top: var(--range-top-space);
}

.range-geometry {
  position: absolute;
  inset: 0 calc(var(--range-thumb-size) / 2);
  pointer-events: none;
}

.duration-value {
  position: absolute;
  left: var(--range-percent);
  top: 0;
  min-width: 62px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-raised);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transform: translate(-50%, -48%);
  will-change: left, transform;
  transition:
    transform 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.duration-track {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--range-top-space) + (var(--range-input-height) - var(--range-track-height)) / 2);
  height: var(--range-track-height);
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.08),
    inset 0 1px 2px rgb(0 0 0 / 0.34),
    0 1px 0 rgb(255 255 255 / 0.08);
}

.duration-track-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(to right, var(--accent), var(--accent-vivid));
  transform: scaleX(var(--range-progress));
  transform-origin: left center;
}

.duration-value::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-raised);
  transform: translateX(-50%) rotate(45deg);
}

.duration-range {
  position: relative;
  z-index: 1;
  width: 100%;
  height: var(--range-input-height);
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  touch-action: pan-y;
}

.duration-range::-webkit-slider-runnable-track {
  height: var(--range-track-height);
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.duration-range::-moz-range-track {
  height: var(--range-track-height);
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.duration-range::-moz-range-progress {
  height: var(--range-track-height);
  border-radius: 999px;
  background: transparent;
}

.duration-range::-webkit-slider-thumb {
  box-sizing: border-box;
  width: var(--range-thumb-size);
  height: var(--range-thumb-size);
  margin-top: calc((var(--range-track-height) - var(--range-thumb-size)) / 2);
  appearance: none;
  -webkit-appearance: none;
  border: 4px solid var(--text);
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 2px var(--accent),
    0 8px 24px rgb(0 0 0 / 0.34);
  transition:
    transform 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
  will-change: transform;
}

.duration-range::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--range-thumb-size);
  height: var(--range-thumb-size);
  border: 4px solid var(--text);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
  transition:
    transform 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.duration-range:hover::-webkit-slider-thumb,
.duration-range:focus-visible::-webkit-slider-thumb {
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 0 7px rgb(117 220 255 / 0.13),
    0 8px 24px rgb(0 0 0 / 0.34);
}

.duration-range:hover::-moz-range-thumb,
.duration-range:focus-visible::-moz-range-thumb {
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 0 7px rgb(117 220 255 / 0.13),
    0 8px 24px rgb(0 0 0 / 0.34);
}

.range-wrap.is-scrubbing .duration-value,
.range-wrap.is-gliding .duration-value {
  border-color: color-mix(in srgb, var(--accent-vivid) 58%, var(--line-strong));
  box-shadow:
    0 8px 24px rgb(0 0 0 / 0.22),
    0 0 22px color-mix(in srgb, var(--accent-vivid) 24%, transparent);
  transform: translate(-50%, -58%) scale(1.035);
}

.range-wrap.is-scrubbing .duration-range::-webkit-slider-thumb {
  transform: scale(0.96);
  box-shadow:
    0 0 0 4px var(--accent),
    0 0 0 10px rgb(117 220 255 / 0.14),
    0 10px 28px rgb(0 0 0 / 0.38);
}

.range-wrap.is-scrubbing .duration-range::-moz-range-thumb {
  transform: scale(0.96);
  box-shadow:
    0 0 0 4px var(--accent),
    0 0 0 10px rgb(117 220 255 / 0.14),
    0 10px 28px rgb(0 0 0 / 0.38);
}

.duration-range:focus-visible {
  border-radius: 999px;
  box-shadow: var(--focus-ring);
}

.duration-anchors {
  position: relative;
  height: 44px;
  margin-inline: calc(var(--range-thumb-size) / 2);
}

.duration-anchors button {
  position: absolute;
  top: 0;
  left: var(--anchor-position);
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transform: translateX(-50%);
  transition:
    color 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.duration-anchors button:nth-child(1) { --anchor-position: 0%; }
.duration-anchors button:nth-child(2) { --anchor-position: 16.6667%; }
.duration-anchors button:nth-child(3) { --anchor-position: 33.3333%; }
.duration-anchors button:nth-child(4) { --anchor-position: 50%; }
.duration-anchors button:nth-child(5) { --anchor-position: 66.6667%; }
.duration-anchors button:nth-child(6) { --anchor-position: 83.3333%; }
.duration-anchors button:nth-child(7) { --anchor-position: 100%; }

.duration-anchors button::before {
  content: "";
  display: block;
  width: 2px;
  height: 7px;
  margin: 0 auto 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
}

.duration-anchors button:hover,
.duration-anchors button:focus-visible,
.duration-anchors button.is-selected {
  color: var(--accent-vivid);
}

.duration-anchors button:active {
  transform: translateX(-50%) translateY(1px);
}

.duration-anchors button:focus-visible {
  border-radius: 8px;
  box-shadow: var(--focus-ring);
}

.primary-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.primary-button,
.reset-button {
  min-height: 86px;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition:
    transform 180ms var(--ease-out),
    color 180ms var(--ease-out),
    background 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
}

.primary-button {
  min-width: 254px;
  padding: 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1px solid rgb(255 255 255 / 0.38);
  color: var(--text);
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.32),
    0 18px 46px color-mix(in srgb, var(--accent) 24%, transparent);
  font-size: 1.08rem;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-vivid);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.38),
    0 20px 54px color-mix(in srgb, var(--accent-vivid) 28%, transparent);
  transform: translateY(-1px);
}

.reset-button {
  min-width: 118px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
}

.reset-button:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgb(255 255 255 / 0.035);
}

.primary-button:active,
.reset-button:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.reset-button:focus-visible {
  box-shadow: var(--focus-ring);
}

.mood-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mood-control legend {
  width: 100%;
  margin-bottom: 16px;
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mood-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: var(--space-md);
}

.mood-option {
  position: relative;
  min-width: 0;
  min-height: 92px;
  padding: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  outline: none;
  transition:
    color 180ms var(--ease-out),
    background 180ms var(--ease-out),
    transform 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
}

.mood-option:hover {
  color: var(--text);
  background: rgb(255 255 255 / 0.025);
}

.mood-option:focus-visible {
  box-shadow: var(--focus-ring);
}

.mood-option:active {
  transform: translateY(1px);
}

.mood-swatch {
  position: relative;
  width: 56px;
  height: 56px;
  border: 1px solid rgb(255 255 255 / 0.32);
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    inset 0 0 16px rgb(255 255 255 / 0.16),
    0 8px 26px rgb(0 0 0 / 0.28);
  transition:
    transform 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
}

.dark-swatch {
  background:
    radial-gradient(circle at 31% 24%, rgb(238 224 255 / 0.88), transparent 18%),
    linear-gradient(145deg, #b88bff 0%, #6f35d8 52%, #27104f 100%);
}

.light-swatch {
  background:
    radial-gradient(circle at 31% 24%, #ffffff, transparent 20%),
    linear-gradient(145deg, #ffffff 0%, #f1ebfb 56%, #d5c5ee 100%);
}

.mood-option[aria-checked="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.mood-option[aria-checked="true"] .mood-swatch {
  transform: scale(1.08);
  box-shadow:
    inset 0 0 18px rgb(255 255 255 / 0.22),
    0 0 0 2px var(--surface),
    0 0 0 4px var(--accent-vivid),
    0 10px 30px color-mix(in srgb, var(--accent) 28%, transparent);
}

.timer-shell.is-running .aperture,
.timer-shell.is-paused .aperture {
  transform: translateY(-18px) scale(1.18);
}

.timer-shell.is-running .aperture-image-base,
.timer-shell.is-paused .aperture-image-base {
  opacity: 0.62;
  filter: saturate(0.9) brightness(0.72);
}

.timer-shell.is-running .brand-lockup,
.timer-shell.is-paused .brand-lockup {
  opacity: 0.52;
  transform: translateX(-50%) translateY(5px);
}

.timer-shell.is-running .time-readout,
.timer-shell.is-paused .time-readout {
  font-size: clamp(12rem, 25vw, 24rem);
  text-shadow:
    0 0 40px color-mix(in srgb, var(--accent-vivid) 16%, transparent),
    0 24px 72px rgb(2 0 10 / 0.5);
}

.timer-shell.is-presentation {
  min-height: 100svh;
  grid-template-rows: 1fr;
}

.timer-shell.is-presentation .timer-stage {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 72% 34% at 20% 76%,
      color-mix(in srgb, var(--accent) 24%, transparent),
      transparent 72%
    ),
    radial-gradient(
      ellipse 72% 34% at 82% 78%,
      color-mix(in srgb, var(--accent-cool) 16%, transparent),
      transparent 74%
    ),
    radial-gradient(
      ellipse 92% 52% at 50% 42%,
      color-mix(in srgb, var(--accent-vivid) 10%, transparent),
      transparent 72%
    ),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface) 58%, var(--bg)) 0%,
      var(--bg) 48%,
      color-mix(in srgb, var(--surface) 32%, var(--bg)) 100%
    );
}

.timer-shell.is-presentation .aperture {
  inset: 0;
  transform: scale(1.38);
}

@media (min-width: 901px) {
  .timer-shell.is-presentation .timer-stage {
    background:
      radial-gradient(
        ellipse 72% 34% at 20% 76%,
        color-mix(in srgb, var(--accent) 24%, transparent),
        transparent 72%
      ),
      radial-gradient(
        ellipse 72% 34% at 82% 78%,
        color-mix(in srgb, var(--accent-cool) 16%, transparent),
        transparent 74%
      ),
      linear-gradient(
        180deg,
        var(--bg) 0%,
        var(--bg) 52%,
        color-mix(in srgb, var(--surface) 32%, var(--bg)) 100%
      );
  }

  .timer-shell.is-presentation .aperture-image {
    height: auto;
    max-height: 100%;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      #000 11%,
      #000 89%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      #000 11%,
      #000 89%,
      transparent 100%
    );
  }
}

.timer-shell.is-presentation .control-deck {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(92vw, 380px);
  min-height: 0;
  padding: 7px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  box-shadow:
    0 18px 60px rgb(0 0 0 / 0.42),
    inset 0 1px 0 rgb(255 255 255 / 0.08);
  transform: translateX(-50%);
  backdrop-filter: blur(18px) saturate(1.2);
}

.timer-shell.is-presentation .duration-control,
.timer-shell.is-presentation .mood-control {
  display: none;
}

.timer-shell.is-presentation .primary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.timer-shell.is-presentation .primary-button,
.timer-shell.is-presentation .reset-button {
  width: 100%;
  min-width: 0;
  min-height: 52px;
}

.timer-shell.is-presentation .primary-button {
  padding-inline: 20px;
}

.timer-shell.is-presentation .reset-button {
  padding-inline: 16px;
  border-color: var(--line);
  background: rgb(255 255 255 / 0.035);
}

.timer-shell.is-complete .aperture {
  transform: scale(1.08);
  filter: brightness(1.14) saturate(1.16);
}

.timer-shell.is-complete .timer-copy {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 0;
  align-content: center;
  transform: none;
}

.timer-shell.is-complete .aperture-image-base {
  opacity: 1;
  filter: saturate(1.25) brightness(1.12);
  animation: completionApertureBloom 900ms var(--ease-out) both;
}

.timer-shell.is-complete.is-zero-strike .final-countdown-mark {
  opacity: 1;
  transform: scale(1.04);
}

.timer-shell.is-complete.is-complete-message .final-countdown-mark {
  opacity: 0.22;
  transform: scale(1.08);
}

.timer-shell.is-complete.is-complete-message .aperture {
  opacity: 0;
}

.timer-shell.is-complete .brand-lockup {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
}

.timer-shell.is-complete .time-readout {
  width: min(98vw, 1580px);
  color: var(--completion);
  font-size: clamp(9rem, 21vw, 20rem);
  letter-spacing: 0.025em;
  line-height: 0.86;
  text-transform: uppercase;
  text-shadow:
    0 0 18px color-mix(in srgb, var(--completion) 34%, transparent),
    0 0 72px color-mix(in srgb, var(--accent-vivid) 22%, transparent),
    0 30px 90px rgb(2 0 10 / 0.54);
}

.timer-shell.is-complete.is-zero-strike .time-readout {
  font-size: clamp(14rem, 30vw, 32rem);
  animation: completionZeroStrike 260ms cubic-bezier(0.7, 0, 0.84, 0) both;
}

.timer-shell.is-complete.is-complete-message .time-readout {
  animation: completionArrival 220ms var(--ease-out) both;
}

.timer-shell.is-complete.is-complete-message.is-alarm-sounding .readout-pulse {
  animation-name: completionSignal;
  animation-duration: var(--alarm-cycle-duration);
  animation-timing-function: linear;
  animation-delay: var(--alarm-phase-offset);
  animation-iteration-count: infinite;
  animation-fill-mode: both;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.timer-shell.is-invalid .time-readout {
  animation: invalidNudge 340ms var(--ease-out);
}

@keyframes completionApertureBloom {
  0% {
    transform: scale(0.985);
  }

  20% {
    transform: scale(0.94);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes completionArrival {
  0% {
    opacity: 0.72;
    transform: translateY(6px) scale(0.96);
  }

  42% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes completionZeroStrike {
  0% {
    opacity: 1;
    transform: scale(1.08);
  }

  62% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0.88);
  }
}

@keyframes completionSignal {
  0%,
  6.5%,
  100% {
    opacity: 0.78;
    transform: scale(1);
  }

  7.9% {
    opacity: 1;
    transform: scale(1.022);
  }

  12% {
    opacity: 1;
    transform: scale(1.008);
  }

  60% {
    opacity: 0.98;
    transform: scale(1.006);
  }

  64% {
    opacity: 0.92;
    transform: scale(1.002);
  }

  72% {
    opacity: 0.78;
    transform: scale(1);
  }
}

@keyframes finalSecondPulse {
  0% {
    opacity: 0.04;
    transform: scale(0.42);
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  16% {
    opacity: 1;
    transform: scale(1.18);
    animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  }

  38% {
    opacity: 0.98;
    transform: scale(0.98);
  }

  70% {
    opacity: 0.86;
    transform: scale(0.96);
    animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0);
  }

  100% {
    opacity: 0.12;
    transform: scale(1.14);
  }
}

@keyframes finalSecondCriticalPulse {
  0% {
    opacity: 0;
    transform: scale(0.26);
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  14% {
    opacity: 1;
    transform: scale(1.28);
    animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  }

  36% {
    opacity: 1;
    transform: scale(0.98);
  }

  68% {
    opacity: 0.84;
    transform: scale(0.94);
    animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0);
  }

  100% {
    opacity: 0.08;
    transform: scale(1.22);
  }
}

@keyframes finalMarkBeat {
  0% {
    opacity: 0.18;
    transform: scale(0.86);
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  18% {
    opacity: 1;
    transform: scale(1.06);
    animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  }

  46% {
    opacity: 0.78;
    transform: scale(1);
  }

  100% {
    opacity: 0.38;
    transform: scale(1.04);
  }
}

@keyframes finalMarkCriticalBeat {
  0% {
    opacity: 0.08;
    transform: scale(0.74);
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  16% {
    opacity: 1;
    transform: scale(1.12);
    animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  }

  42% {
    opacity: 0.82;
    transform: scale(0.98);
  }

  100% {
    opacity: 0.3;
    transform: scale(1.08);
  }
}

@keyframes invalidNudge {
  0%,
  100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-8px);
  }

  70% {
    transform: translateX(8px);
  }
}

@media (max-width: 1100px) {
  .control-deck {
    grid-template-columns: minmax(360px, 1fr) auto;
    gap: 24px 34px;
    min-height: 240px;
    padding-inline: 34px;
  }

  .mood-control {
    grid-column: 1 / -1;
  }

  .mood-control legend {
    margin-bottom: 8px;
    text-align: left;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(64px, 1fr));
  }

  .mood-option {
    min-height: 62px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
    padding-inline: 0;
  }

  .mood-swatch {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 900px) {
  .timer-shell.is-presentation.is-final-countdown:not(.is-complete) .time-readout {
    font-size: clamp(15rem, 72vmin, 27rem);
  }

  .timer-shell {
    min-height: 100svh;
    height: 100svh;
    grid-template-rows: minmax(300px, 46svh) minmax(0, 1fr);
  }

  .aperture {
    inset: 2px -18vw -4px;
  }

  .aperture-image {
    width: 100%;
  }

  .timer-copy {
    padding: 16px;
    transform: translateY(14px);
  }

  .time-readout,
  .timer-shell.is-running .time-readout,
  .timer-shell.is-paused .time-readout {
    font-size: clamp(7.2rem, 31vw, 10rem);
    line-height: 0.84;
  }

  .time-readout[data-digits="7"],
  .time-readout[data-digits="8"] {
    font-size: clamp(4.1rem, 18vw, 6rem);
  }

  .time-readout[data-digits="long"] {
    font-size: clamp(3rem, 13vw, 4.3rem);
  }

  .brand-lockup {
    gap: 6px;
    margin-top: 20px;
  }

  .brand-title {
    font-size: 0.66rem;
    letter-spacing: 0.32em;
  }

  .brand-subtitle {
    font-size: 0.48rem;
    letter-spacing: 0.24em;
  }

  .control-deck {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: var(--space-xl);
    padding:
      var(--space-2xl)
      max(var(--space-xl), env(safe-area-inset-right))
      max(var(--space-xl), env(safe-area-inset-bottom));
    padding-left: max(var(--space-xl), env(safe-area-inset-left));
  }

  .duration-control {
    gap: var(--space-sm);
  }

  .duration-heading {
    font-size: 0.66rem;
  }

  .duration-control {
    --range-input-height: 44px;
    --range-top-space: 19px;
  }

  .duration-value {
    min-width: 58px;
    padding-block: 4px;
    font-size: 0.7rem;
  }

  .duration-range {
    height: 44px;
  }

  .duration-anchors button {
    min-height: 44px;
    font-size: 0.7rem;
  }

  .duration-anchors button::before {
    height: 5px;
    margin-bottom: 3px;
  }

  .primary-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-md);
  }

  .primary-button,
  .reset-button {
    min-height: 52px;
  }

  .primary-button {
    min-width: 0;
    width: 100%;
    padding-inline: 18px;
  }

  .reset-button {
    min-width: 94px;
    border-color: var(--line);
    background: rgb(255 255 255 / 0.025);
  }

  .mood-control legend {
    margin-bottom: 4px;
    font-size: 0.62rem;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
  }

  .mood-option {
    min-height: 56px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
    padding-inline: 0;
    font-size: 0.52rem;
  }

  .mood-swatch {
    width: 36px;
    height: 36px;
  }

  .timer-shell.is-presentation .aperture {
    inset: 0 -24vw;
    transform: translateY(-10px) scale(1.7);
  }

  .timer-shell.is-presentation .time-readout {
    font-size: clamp(7.8rem, 34vw, 11rem);
  }

  .timer-shell.is-complete .time-readout {
    width: min(98vw, 760px);
    font-size: clamp(4rem, 21vw, 9.5rem);
  }

  .timer-shell.is-presentation .control-deck {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(94vw, 390px);
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .timer-shell {
    min-height: 560px;
  }

  .control-deck {
    min-height: 176px;
    padding-block: 22px;
  }

  .time-readout,
  .timer-shell.is-running .time-readout,
  .timer-shell.is-paused .time-readout {
    font-size: clamp(8rem, 20vw, 15rem);
  }

  .brand-lockup {
    margin-top: 18px;
  }
}

@media (max-width: 420px) and (max-height: 760px) {
  .timer-shell {
    grid-template-rows: minmax(244px, 40svh) minmax(0, 1fr);
  }

  .control-deck {
    gap: var(--space-md);
    padding-top: var(--space-lg);
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
  }

  .mood-control legend,
  .brand-subtitle {
    display: none;
  }

  .brand-lockup {
    margin-top: 14px;
  }

  .mood-option {
    min-height: 44px;
  }

  .mood-swatch {
    width: 30px;
    height: 30px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .timer-shell:not(.is-presentation) {
    height: 100svh;
    min-height: 100svh;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 46vw);
    grid-template-rows: 1fr;
  }

  .control-deck {
    height: 100svh;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 18px;
    overflow-y: auto;
    padding:
      max(22px, env(safe-area-inset-top))
      max(22px, env(safe-area-inset-right))
      max(22px, env(safe-area-inset-bottom))
      max(22px, env(safe-area-inset-left));
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .mood-control {
    grid-column: auto;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-readout,
  .timer-shell.is-running .time-readout,
  .timer-shell.is-paused .time-readout {
    font-size: clamp(6rem, 16vw, 10rem);
  }
}

@media (min-width: 1024px) and (min-height: 621px) {
  .timer-shell:not(.is-presentation) {
    min-height: 620px;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 29vw, 420px);
    grid-template-rows: 1fr;
  }

  .timer-stage {
    min-height: 100%;
  }

  .timer-copy {
    width: min(100%, 1080px);
    padding: var(--space-2xl);
  }

  .time-readout,
  .timer-shell.is-running .time-readout,
  .timer-shell.is-paused .time-readout {
    font-size: clamp(8.5rem, 14vw, 15rem);
  }

  .time-readout[data-digits="1"],
  .time-readout[data-digits="2"] {
    font-size: clamp(10rem, 18vw, 18rem);
  }

  .time-readout[data-digits="7"],
  .time-readout[data-digits="8"] {
    font-size: clamp(6rem, 10.5vw, 11rem);
  }

  .time-readout[data-digits="long"] {
    font-size: clamp(4.2rem, 7.4vw, 7.5rem);
  }

  .control-deck {
    height: 100svh;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: clamp(var(--space-xl), 4vh, 40px);
    overflow-y: auto;
    padding:
      max(var(--space-2xl), env(safe-area-inset-top))
      clamp(var(--space-xl), 3vw, var(--space-2xl))
      max(var(--space-2xl), env(safe-area-inset-bottom));
    border-top: 0;
    border-left: 1px solid var(--line);
    background: var(--surface);
    box-shadow: -32px 0 80px rgb(2 0 12 / 0.2);
  }

  .duration-control {
    gap: var(--space-md);
  }

  .primary-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-sm);
  }

  .primary-button,
  .reset-button {
    min-height: 68px;
  }

  .primary-button {
    width: 100%;
    min-width: 0;
    padding-inline: var(--space-xl);
  }

  .reset-button {
    min-width: 96px;
    border-color: var(--line);
    background: color-mix(in srgb, var(--surface-raised) 42%, transparent);
  }

  .mood-control {
    grid-column: auto;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--line);
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .mood-option {
    min-height: 76px;
    padding: var(--space-sm);
  }

  .mood-swatch {
    width: 48px;
    height: 48px;
  }
}

/* Liquid Glass control layer
   The aperture remains the content layer; controls float above it as one
   restrained, interactive material surface. */

:root {
  --glass-fill: rgb(20 10 48 / 0.54);
  --glass-fill-strong: rgb(30 14 68 / 0.72);
  --glass-line: rgb(226 214 255 / 0.24);
  --glass-line-hot: rgb(255 255 255 / 0.48);
  --glass-shine: rgb(205 180 255 / 0.19);
  --glass-shadow: rgb(2 0 15 / 0.48);
  --glass-reflection-a: rgb(143 87 255 / 0.2);
  --glass-reflection-b: rgb(102 210 255 / 0.14);
}

html[data-theme="light"] {
  --glass-fill: rgb(255 255 255 / 0.7);
  --glass-fill-strong: rgb(255 255 255 / 0.9);
  --glass-line: rgb(68 46 88 / 0.14);
  --glass-line-hot: rgb(255 255 255 / 0.96);
  --glass-shine: rgb(255 255 255 / 0.74);
  --glass-shadow: rgb(58 39 75 / 0.15);
  --glass-reflection-a: rgb(111 53 223 / 0.09);
  --glass-reflection-b: rgb(66 45 82 / 0.045);
}

.control-deck {
  isolation: isolate;
  border-color: var(--glass-line);
  background:
    linear-gradient(132deg, var(--glass-shine), transparent 28%),
    linear-gradient(110deg, var(--glass-fill-strong), var(--glass-fill));
  box-shadow:
    0 26px 80px var(--glass-shadow),
    inset 0 1px 0 var(--glass-line-hot),
    inset 0 -1px 0 rgb(255 255 255 / 0.05);
  -webkit-backdrop-filter: blur(30px) saturate(1.38) contrast(1.04);
  backdrop-filter: blur(30px) saturate(1.38) contrast(1.04);
}

.control-deck::before,
.control-deck::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.control-deck::before {
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 13% -25%, var(--glass-reflection-a), transparent 38%),
    radial-gradient(circle at 88% 130%, var(--glass-reflection-b), transparent 40%);
}

.control-deck::after {
  left: 8%;
  right: 8%;
  top: 1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-line-hot), transparent);
  opacity: 0.78;
}

.control-deck > * {
  position: relative;
  z-index: 1;
}

.timer-shell.is-presentation .control-deck {
  height: auto;
  border-color: var(--glass-line);
  border-radius: 22px;
  background:
    linear-gradient(132deg, var(--glass-shine), transparent 34%),
    linear-gradient(110deg, var(--glass-fill-strong), var(--glass-fill));
}

.duration-heading {
  display: none;
}

.duration-value {
  border-color: var(--glass-line);
  color: var(--text);
  background:
    linear-gradient(145deg, var(--glass-shine), transparent 48%),
    var(--glass-fill-strong);
  box-shadow:
    0 8px 22px rgb(0 0 0 / 0.2),
    inset 0 1px 0 var(--glass-line-hot);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
}

.duration-value::after {
  border-color: var(--glass-line);
  background: var(--glass-fill-strong);
}

.duration-range::-webkit-slider-runnable-track {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.duration-range::-webkit-slider-thumb {
  border-color: color-mix(in srgb, var(--text) 86%, transparent);
  background:
    radial-gradient(circle at 36% 28%, rgb(255 255 255 / 0.8), transparent 25%),
    var(--accent);
  box-shadow:
    0 0 0 1px var(--glass-line-hot),
    0 0 0 4px color-mix(in srgb, var(--accent) 58%, transparent),
    0 10px 28px rgb(0 0 0 / 0.38);
}

.primary-button,
.reset-button,
.mood-option {
  border: 1px solid var(--glass-line);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.09), transparent 46%),
    rgb(255 255 255 / 0.045);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.15),
    0 8px 24px rgb(0 0 0 / 0.14);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.primary-button {
  border-color: color-mix(in srgb, var(--glass-line-hot) 76%, var(--accent));
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.3), transparent 44%),
    linear-gradient(120deg, color-mix(in srgb, var(--accent-vivid) 78%, var(--accent)), var(--accent));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.42),
    0 14px 34px color-mix(in srgb, var(--accent) 24%, transparent);
}

.primary-button:hover {
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.36), transparent 42%),
    linear-gradient(120deg, var(--accent-vivid), color-mix(in srgb, var(--accent) 86%, var(--accent-vivid)));
}

.reset-button:hover,
.mood-option:hover {
  border-color: var(--glass-line-hot);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.14), transparent 46%),
    rgb(255 255 255 / 0.075);
}

.mood-option[aria-checked="true"] {
  border-color: color-mix(in srgb, var(--accent-cool) 72%, var(--glass-line-hot));
  background:
    linear-gradient(145deg, rgb(255 255 255 / 0.16), transparent 44%),
    color-mix(in srgb, var(--accent) 19%, transparent);
}

.timer-shell:not(.is-presentation) .reset-button {
  display: grid;
  place-items: center;
  gap: 0;
  line-height: 1;
}

.timer-shell:not(.is-presentation) .reset-button span:last-child {
  display: none;
}

.timer-shell:not(.is-presentation) .reset-button .material-symbols-rounded {
  display: block;
  width: 1em;
  height: 1em;
  margin: 0;
  line-height: 1;
  text-align: center;
}

.reset-button,
.timer-shell.is-presentation .reset-button,
.mood-option,
.reset-button:hover,
.mood-option:hover,
.mood-option[aria-checked="true"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.reset-button .material-symbols-rounded {
  transition:
    color 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.reset-button:hover .material-symbols-rounded {
  transform: rotate(-18deg) scale(1.06);
}

.reset-button:focus-visible,
.mood-option:focus-visible {
  box-shadow: none;
}

.reset-button:focus-visible .material-symbols-rounded {
  border-radius: 50%;
  color: var(--text);
  outline: 2px solid var(--accent-cool);
  outline-offset: 6px;
  text-shadow: 0 0 16px color-mix(in srgb, var(--accent-cool) 44%, transparent);
}

.mood-option:focus-visible .mood-swatch {
  outline: 2px solid var(--accent-cool);
  outline-offset: 4px;
}

.mood-option:not([aria-checked="true"]):hover .mood-swatch {
  transform: scale(1.05);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .control-deck {
    background: var(--surface-raised);
  }
}

@media (min-width: 901px) {
  .timer-shell:not(.is-presentation) {
    width: 100%;
    height: 100svh;
    min-height: 620px;
    display: block;
    overflow: hidden;
  }

  .timer-shell:not(.is-presentation) .timer-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .timer-shell:not(.is-presentation) .aperture {
    inset: -2.5vh -1.5vw;
    transform: scale(1.035);
  }

  .timer-shell:not(.is-presentation) .aperture-image {
    width: 100%;
    max-width: none;
    height: 100%;
  }

  .timer-shell:not(.is-presentation) .aperture-image {
    object-fit: cover;
  }

  .timer-shell:not(.is-presentation) .timer-copy {
    width: 100%;
    max-width: none;
    height: 100%;
    padding: clamp(24px, 4vw, 64px) clamp(24px, 5vw, 80px) clamp(150px, 19vh, 190px);
    transform: none;
  }

  .timer-shell:not(.is-complete) .time-readout {
    font-size: clamp(14rem, 28vw, 34rem);
    line-height: 0.78;
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="1"],
  .timer-shell:not(.is-complete) .time-readout[data-digits="2"] {
    font-size: clamp(16rem, 32vw, 40rem);
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="7"],
  .timer-shell:not(.is-complete) .time-readout[data-digits="8"] {
    font-size: clamp(8.5rem, 18vw, 20rem);
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="long"] {
    font-size: clamp(5.5rem, 11vw, 11rem);
  }

  .timer-shell:not(.is-presentation) .control-deck {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(22px, env(safe-area-inset-bottom));
    width: min(calc(100vw - 44px), 1080px);
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(380px, 1fr) auto auto;
    grid-template-rows: auto;
    align-content: center;
    align-items: center;
    gap: clamp(14px, 2vw, 24px);
    padding: 14px 16px;
    overflow: visible;
    border: 1px solid var(--glass-line);
    border-radius: 28px;
    transform: translateX(-50%);
  }

  .timer-shell:not(.is-presentation) .duration-control {
    gap: 0;
  }

  .timer-shell:not(.is-presentation) .duration-control {
    --range-top-space: 20px;
  }

  .timer-shell:not(.is-presentation) .duration-range {
    height: 30px;
  }

  .timer-shell:not(.is-presentation) .duration-anchors button {
    min-height: 34px;
    font-size: 0.72rem;
  }

  .timer-shell:not(.is-presentation) .duration-anchors {
    height: 34px;
  }

  .timer-shell:not(.is-presentation) .duration-anchors button::before {
    height: 5px;
    margin-bottom: 3px;
  }

  .timer-shell:not(.is-presentation) .primary-actions {
    display: grid;
    grid-template-columns: auto 54px;
    gap: 8px;
  }

  .timer-shell:not(.is-presentation) .primary-button,
  .timer-shell:not(.is-presentation) .reset-button {
    min-height: 58px;
    border-radius: 18px;
  }

  .timer-shell:not(.is-presentation) .primary-button {
    min-width: 166px;
    padding-inline: 24px;
    font-size: 0.94rem;
  }

  .timer-shell:not(.is-presentation) .reset-button {
    min-width: 54px;
    width: 54px;
    padding: 0;
    font-size: 0;
  }

  .timer-shell:not(.is-presentation) .reset-button .material-symbols-rounded {
    font-size: 1.35rem;
  }

  .timer-shell:not(.is-presentation) .mood-control {
    grid-column: auto;
    padding: 0;
    border: 0;
  }

  .timer-shell:not(.is-presentation) .mood-options {
    grid-template-columns: repeat(2, 58px);
    gap: 7px;
  }

  .timer-shell:not(.is-presentation) .mood-option {
    width: 58px;
    min-height: 58px;
    padding: 0;
    border-radius: 18px;
  }

  .timer-shell:not(.is-presentation) .mood-swatch {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 900px) {
  .timer-shell:not(.is-presentation) {
    width: 100%;
    height: 100svh;
    min-height: 500px;
    display: block;
    overflow: hidden;
  }

  .timer-shell:not(.is-presentation) .timer-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .timer-shell:not(.is-presentation) .aperture {
    inset: -6vh -42vw -4vh;
    transform: scale(1.08);
  }

  .timer-shell:not(.is-presentation) .aperture-image {
    width: 100%;
    max-width: none;
    height: 100%;
  }

  .timer-shell:not(.is-presentation) .aperture-image {
    object-fit: cover;
  }

  .timer-shell.is-presentation .aperture-image {
    object-fit: cover;
  }

  .timer-shell:not(.is-presentation) .timer-copy {
    width: 100%;
    height: 100%;
    padding: 16px 10px clamp(150px, 21svh, 180px);
    transform: none;
  }

  .timer-shell:not(.is-complete) .time-readout {
    font-size: clamp(8rem, 42vw, 12rem);
    line-height: 0.82;
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="7"],
  .timer-shell:not(.is-complete) .time-readout[data-digits="8"] {
    font-size: clamp(4.5rem, 22vw, 7.5rem);
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="long"] {
    font-size: clamp(3.1rem, 14vw, 5rem);
  }

  .timer-shell:not(.is-presentation) .control-deck {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-areas:
      "duration duration"
      "actions mood";
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    gap: 4px 6px;
    padding:
      4px
      max(10px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    transform: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .timer-shell:not(.is-presentation) .control-deck::before {
    inset: -44px 0 0;
    border-radius: 0;
    background: linear-gradient(
      to bottom,
      transparent 0%,
      color-mix(in srgb, var(--glass-fill) 30%, transparent) 28%,
      color-mix(in srgb, var(--glass-fill-strong) 74%, transparent) 58%,
      color-mix(in srgb, var(--glass-fill-strong) 94%, transparent) 100%
    );
    -webkit-backdrop-filter: blur(24px) saturate(1.32);
    backdrop-filter: blur(24px) saturate(1.32);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 0.46) 30%, black 58%);
    mask-image: linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 0.46) 30%, black 58%);
  }

  .timer-shell:not(.is-presentation) .control-deck::after {
    display: none;
  }

  .timer-shell:not(.is-presentation) .duration-control {
    grid-area: duration;
    gap: 0;
  }

  .timer-shell:not(.is-presentation) .duration-control {
    --range-thumb-size: 22px;
    --range-track-height: 6px;
    --range-input-height: 44px;
    --range-top-space: 12px;
  }

  .timer-shell:not(.is-presentation) .duration-value {
    min-width: 50px;
    padding: 3px 7px;
    border-radius: 8px;
    font-size: 0.66rem;
  }

  .timer-shell:not(.is-presentation) .duration-range {
    height: 44px;
  }

  .timer-shell:not(.is-presentation) .duration-range::-webkit-slider-runnable-track,
  .timer-shell:not(.is-presentation) .duration-range::-moz-range-track,
  .timer-shell:not(.is-presentation) .duration-range::-moz-range-progress {
    height: 6px;
  }

  .timer-shell:not(.is-presentation) .duration-range::-webkit-slider-thumb {
    border-width: 3px;
  }

  .timer-shell:not(.is-presentation) .duration-range::-moz-range-thumb {
    border-width: 3px;
  }

  .timer-shell:not(.is-presentation) .duration-anchors button {
    min-height: 44px;
    font-size: 0.66rem;
  }

  .timer-shell:not(.is-presentation) .duration-anchors button::before {
    height: 4px;
    margin-bottom: 2px;
  }

  .timer-shell:not(.is-presentation) .primary-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: minmax(84px, 1fr) 48px;
    gap: 6px;
  }

  .timer-shell:not(.is-presentation) .primary-button,
  .timer-shell:not(.is-presentation) .reset-button {
    min-height: 48px;
    border-radius: 16px;
  }

  .timer-shell:not(.is-presentation) .primary-button {
    min-width: 0;
    width: 100%;
    padding-inline: 12px;
    gap: 7px;
    font-size: 0.84rem;
    letter-spacing: 0.08em;
  }

  .timer-shell:not(.is-presentation) .primary-button .material-symbols-rounded {
    font-size: 1.16rem;
  }

  .timer-shell:not(.is-presentation) .reset-button {
    min-width: 48px;
    width: 48px;
    padding: 0;
  }

  .timer-shell:not(.is-presentation) .reset-button span:last-child {
    display: none;
  }

  .timer-shell:not(.is-presentation) .reset-button .material-symbols-rounded {
    font-size: 1.2rem;
  }

  .timer-shell:not(.is-presentation) .mood-control {
    grid-area: mood;
    grid-column: auto;
    padding: 0;
    border: 0;
  }

  .timer-shell:not(.is-presentation) .mood-options {
    grid-template-columns: repeat(2, 44px);
    gap: 3px;
  }

  .timer-shell:not(.is-presentation) .mood-option {
    width: 44px;
    min-height: 48px;
    padding: 0;
    border-radius: 15px;
  }

  .timer-shell:not(.is-presentation) .mood-swatch {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 350px) {
  .timer-shell:not(.is-presentation) .control-deck {
    width: 100%;
    padding-right: max(6px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
  }

  .timer-shell:not(.is-presentation) .duration-anchors {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
  }

  .timer-shell:not(.is-presentation) .primary-actions {
    grid-template-columns: minmax(78px, 1fr) 46px;
    gap: 4px;
  }

  .timer-shell:not(.is-presentation) .primary-button {
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  .timer-shell:not(.is-presentation) .reset-button {
    min-width: 46px;
    width: 46px;
  }

  .timer-shell:not(.is-presentation) .mood-options {
    grid-template-columns: repeat(2, 44px);
    gap: 2px;
  }

  .timer-shell:not(.is-presentation) .mood-option {
    width: 44px;
  }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 900px) {
  .timer-shell:not(.is-presentation) {
    height: 100svh;
    min-height: 100svh;
  }

  .timer-shell:not(.is-presentation) .aperture {
    inset: -8vh -12vw;
  }

  .timer-shell:not(.is-presentation) .timer-copy {
    padding: 14px 16px clamp(78px, 24vh, 96px);
  }

  .timer-shell:not(.is-complete) .time-readout {
    font-size: clamp(6.5rem, 20vw, 10rem);
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="7"],
  .timer-shell:not(.is-complete) .time-readout[data-digits="8"] {
    font-size: clamp(4rem, 13vw, 7rem);
  }

  .timer-shell:not(.is-complete) .time-readout[data-digits="long"] {
    font-size: clamp(3rem, 9vw, 5rem);
  }

  .timer-shell:not(.is-presentation) .control-deck {
    bottom: 0;
    width: 100%;
    grid-template-areas: "duration actions mood";
    grid-template-columns: minmax(210px, 1fr) auto auto;
    grid-template-rows: auto;
    gap: 5px;
    padding:
      6px
      max(8px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    border-radius: 0;
  }

  .timer-shell:not(.is-presentation) .control-deck::before {
    inset: -28px 0 0;
  }

  .timer-shell:not(.is-presentation) .range-wrap {
    padding-top: 12px;
  }

  .timer-shell:not(.is-presentation) .duration-anchors {
    display: none;
  }
}

@media (pointer: coarse) {
  .timer-shell:not(.is-presentation) .duration-anchors button {
    min-height: 44px;
  }

  .timer-shell:not(.is-presentation) .mood-option,
  .timer-shell:not(.is-presentation) .primary-button,
  .timer-shell:not(.is-presentation) .reset-button {
    min-height: 48px;
  }
}

/* Daylight appearance: the same cinematic object, lit as a gallery piece. */
html[data-theme="light"] .timer-shell.is-presentation .timer-stage {
  background:
    radial-gradient(ellipse 76% 42% at 50% 46%, rgb(111 53 223 / 0.055), transparent 72%),
    linear-gradient(180deg, #ffffff 0%, #ffffff 54%, #f8f5fc 100%);
}

html[data-theme="light"] .aperture {
  filter: none;
}

html[data-theme="light"] .aperture-image-base,
html[data-theme="light"] .timer-shell.is-running .aperture-image-base,
html[data-theme="light"] .timer-shell.is-paused .aperture-image-base,
html[data-theme="light"] .timer-shell.is-complete .aperture-image-base {
  opacity: 0.92;
  filter: invert(1) hue-rotate(180deg) saturate(0.92) brightness(1.04) contrast(0.92);
  mix-blend-mode: normal;
}

html[data-theme="light"] .aperture::after {
  opacity: 0;
}

html[data-theme="light"] .time-readout,
html[data-theme="light"] .timer-shell.is-running .time-readout,
html[data-theme="light"] .timer-shell.is-paused .time-readout {
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.96),
    0 18px 46px rgb(73 45 96 / 0.15);
}

html[data-theme="light"] .timer-shell.is-presentation.is-final-countdown:not(.is-complete) .time-readout {
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.9),
    0 16px 52px rgb(92 42 170 / 0.2);
}

html[data-theme="light"] .timer-shell.is-complete .time-readout {
  text-shadow:
    0 1px 0 rgb(255 255 255 / 0.9),
    0 20px 58px rgb(92 42 170 / 0.2);
}

html[data-theme="light"] .control-deck {
  box-shadow:
    0 26px 72px var(--glass-shadow),
    inset 0 1px 0 var(--glass-line-hot),
    inset 0 -1px 0 rgb(57 38 76 / 0.06);
}

html[data-theme="light"] .duration-value {
  box-shadow:
    0 8px 22px rgb(58 39 75 / 0.1),
    inset 0 1px 0 var(--glass-line-hot);
}

html[data-theme="light"] .duration-track {
  background: rgb(57 38 76 / 0.1);
  box-shadow:
    inset 0 0 0 1px rgb(57 38 76 / 0.08),
    inset 0 1px 2px rgb(57 38 76 / 0.12),
    0 1px 0 rgb(255 255 255 / 0.8);
}

html[data-theme="light"] .primary-button {
  color: #ffffff;
}

html[data-theme="light"] .mood-swatch {
  border-color: rgb(57 38 76 / 0.2);
  box-shadow:
    inset 0 0 14px rgb(111 53 223 / 0.06),
    0 8px 24px rgb(58 39 75 / 0.12);
}

html[data-theme="light"] .mood-option[aria-checked="true"] .mood-swatch {
  box-shadow:
    inset 0 0 14px rgb(111 53 223 / 0.08),
    0 0 0 2px #ffffff,
    0 0 0 4px var(--accent),
    0 10px 26px rgb(58 39 75 / 0.16);
}

@media (prefers-reduced-transparency: reduce) {
  .control-deck,
  .duration-value,
  .primary-button,
  .reset-button,
  .mood-option {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .control-deck {
    background: var(--surface-raised);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer-shell.is-alarm-sounding .readout-pulse {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
