.clock-page {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  position: relative;
  isolation: isolate;
  background: var(--paper);
}
.clock-page .site-header {
  width: 100%;
}
.clock-landscape {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--paper);
}
.clock-landscape .landscape-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.clock-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--paper) 52%, transparent),
    color-mix(in srgb, var(--paper) 64%, transparent) 50%,
    color-mix(in srgb, var(--paper) 82%, transparent)
  );
}
.clock-mist {
  position: absolute;
  inset: -15%;
  background: radial-gradient(
    ellipse at 65% 55%,
    color-mix(in srgb, var(--surface) 60%, transparent),
    transparent 50%
  );
  animation: clock-mist 16s ease-in-out infinite alternate;
}
@keyframes clock-mist {
  from {
    transform: translate(-2%, 1%);
    opacity: 0.4;
  }
  to {
    transform: translate(2%, -1%);
    opacity: 0.8;
  }
}
html[data-effects='false'] .clock-mist {
  animation: none;
}
.clock-page.is-hidden .clock-mist {
  animation-play-state: paused;
}
.clock-shell {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  min-height: 0;
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.clock-a11y-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.clock-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}
.clock-modes {
  position: relative;
  z-index: 1;
}
.clock-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}
.clock-page[data-clock-mode='clock'] .clock-alert {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  width: max-content;
  max-width: calc(100% - 24px);
}
.clock-shell button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  border-radius: 3px;
}
.clock-shell button:hover {
  border-color: var(--accent);
}
.clock-shell button:focus-visible,
.clock-shell input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.clock-shell button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--panel);
}
.clock-shell button:disabled,
.clock-shell input:disabled {
  opacity: 0.55;
  cursor: default;
}
.clock-modes,
.clock-presets,
.clock-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.time-display {
  font:
    600 clamp(56px, min(18vw, 32svh), 288px)/1.08 'Bahnschrift',
    'DIN Alternate',
    Inter,
    'Microsoft YaHei',
    sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--ink);
}

/* Each card has a stationary upper/lower face and two moving half-flaps. */
.flip-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.025em;
  perspective: 1200px;
}
.flip-card {
  position: relative;
  display: block;
  flex: 0 0 0.68em;
  width: 0.68em;
  height: 1.02em;
  perspective: 4em;
  border-radius: 0.035em;
  box-shadow: 0 0.008em 0.015em color-mix(in srgb, var(--ink) 15%, transparent);
}
.flip-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  background-image:
    url('digit-grain.svg'),
    linear-gradient(
      color-mix(in srgb, var(--surface) 92%, var(--ink)),
      color-mix(in srgb, var(--surface) 86%, var(--ink))
    );
  border: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 16%, transparent);
}
.flip-upper,
.flip-old {
  top: 0;
  border-radius: 0.035em 0.035em 0 0;
  border-bottom: 0;
  transform-origin: bottom center;
}
.flip-lower,
.flip-new {
  bottom: 0;
  border-radius: 0 0 0.035em 0.035em;
  border-top: 0;
  transform-origin: top center;
  background-image:
    url('digit-grain.svg'),
    linear-gradient(
      color-mix(in srgb, var(--surface) 96%, var(--ink)),
      color-mix(in srgb, var(--surface) 91%, var(--ink))
    );
}
.flip-number {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  line-height: 1.02;
  font-size: 1em;
  text-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 75%, transparent);
}
.flip-number:before {
  content: attr(data-value);
  transform: translate(var(--glyph-x, 0em), var(--glyph-shift, 0em));
}
.flip-lower .flip-number,
.flip-new .flip-number {
  top: auto;
  bottom: 0;
}
.flip-old,
.flip-new {
  display: none;
  z-index: 3;
}
.flip-card:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  z-index: 5;
  background: color-mix(in srgb, var(--ink) 24%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent);
  pointer-events: none;
}
.flip-separator {
  flex: 0 0 0.18em;
  width: 0.18em;
  align-self: center;
  line-height: 1;
  color: var(--ink);
}
.is-flipping .flip-old {
  display: block;
  animation: clock-flip-fold 0.25s ease-in forwards;
}
.is-flipping .flip-new {
  display: block;
  transform: rotateX(90deg);
  animation: clock-flip-reveal 0.25s 0.25s ease-out forwards;
}
@keyframes clock-flip-fold {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(-90deg);
  }
}
@keyframes clock-flip-reveal {
  from {
    transform: rotateX(90deg);
  }
  to {
    transform: rotateX(0deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .flip-old,
  .flip-new {
    display: none !important;
    animation: none !important;
  }
}
@media (forced-colors: active) {
  .time-display {
    color: CanvasText;
  }
  .flip-half {
    background: Canvas;
    border-color: CanvasText;
  }
  .flip-number {
    color: CanvasText;
    text-shadow: none;
  }
  .flip-card {
    box-shadow: none;
  }
  .flip-card:after {
    background: CanvasText;
    box-shadow: none;
  }
}
.timer-status {
  margin: 8px 0 0;
  color: var(--ink);
}
#duration-options {
  margin-top: 8px;
}
#duration-options summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#duration-options summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.clock-duration {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 0;
}
.clock-duration label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink);
}
.clock-duration input {
  width: 80px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: center;
}
.clock-error {
  margin: 4px 0 8px;
  color: var(--ink);
}
.clock-error:empty {
  display: none;
}
.clock-shell .clock-primary {
  background: var(--accent);
  color: var(--on-accent, #fff);
  border-color: var(--accent);
  min-width: 104px;
}
.clock-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
}
.clock-sound label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.clock-sound input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.clock-alert {
  margin-top: 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--accent);
  background: var(--surface);
}
.clock-hint {
  font-size: 13px;
  color: var(--ink);
  margin: 12px 0 0;
}
.clock-shell [hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  .clock-shell {
    padding: 20px 12px;
    gap: 20px;
  }
  .clock-presets button {
    padding: 8px 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .clock-mist {
    animation: none;
  }
}

/* The display slot never moves when settings or modes change. */
.clock-page .clock-shell {
  justify-content: flex-start;
  position: relative;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 110px;
  max-width: none;
}
.clock-page .clock-stage {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  padding: 0;
  pointer-events: auto;
  margin-top: clamp(28px, 9svh, 110px);
}
.clock-face {
  position: relative;
}
.clock-shell > * {
  flex-shrink: 0;
}
.flip-number[data-value='0'] {
  --glyph-x: var(--glyph-x-0);
}
.flip-number[data-value='1'] {
  --glyph-x: var(--glyph-x-1);
}
.flip-number[data-value='2'] {
  --glyph-x: var(--glyph-x-2);
}
.flip-number[data-value='3'] {
  --glyph-x: var(--glyph-x-3);
}
.flip-number[data-value='4'] {
  --glyph-x: var(--glyph-x-4);
}
.flip-number[data-value='5'] {
  --glyph-x: var(--glyph-x-5);
}
.flip-number[data-value='6'] {
  --glyph-x: var(--glyph-x-6);
}
.flip-number[data-value='7'] {
  --glyph-x: var(--glyph-x-7);
}
.flip-number[data-value='8'] {
  --glyph-x: var(--glyph-x-8);
}
.flip-number[data-value='9'] {
  --glyph-x: var(--glyph-x-9);
}
.flip-separator {
  transform: translateY(var(--glyph-shift, 0em));
}
.clock-page[data-clock-mode='clock'] .time-display {
  font-size: clamp(56px, min(18vw, 29svh), 288px);
}
.clock-date {
  font: 14px/1.6 var(--sans);
  letter-spacing: 0.06em;
  margin: 18px 0 0;
  color: var(--ink);
  white-space: nowrap;
}
.clock-stage .timer-status {
  position: absolute;
  bottom: -28px;
  font-size: 12px;
  color: var(--muted);
}
.clock-dock {
  margin-top: 26px;
  gap: 10px;
}
.clock-page .time-display {
  font-size: clamp(56px, min(18vw, 29svh), 288px);
}
.clock-meta,
.clock-audio-corner {
  position: fixed;
  bottom: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: 11px/1.5 var(--sans);
  text-align: left;
  color: var(--muted);
  max-width: calc(50% - 28px);
}
.clock-meta {
  left: 24px;
  pointer-events: none;
}
.clock-audio-corner {
  right: 24px;
  text-align: right;
  align-items: flex-end;
}
.clock-audio-corner button {
  font-size: 12px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 20px;
}
.clock-audio-corner small {
  font-size: 11px;
}
#computer-audio-status {
  margin: 0;
  max-width: 290px;
}
#computer-audio-status:empty {
  display: none;
}
.clock-page .clock-alert {
  position: relative !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin-top: 24px;
  max-width: 100%;
}
@media (max-width: 600px) {
  .clock-page .clock-stage {
    margin-top: clamp(36px, 14svh, 140px);
  }
  .clock-page .clock-shell {
    padding-top: 16px;
    padding-bottom: 130px;
  }
  .clock-meta {
    left: 12px;
    bottom: 14px;
    max-width: 46%;
  }
  .clock-audio-corner {
    right: 12px;
    bottom: 14px;
    max-width: 46%;
  }
  .clock-date {
    font-size: 12px;
    margin-top: 16px;
  }
  .clock-meta > span:last-child {
    max-width: 140px;
  }
  .clock-audio-corner small {
    max-width: 150px;
  }
}
@media (max-height: 600px) {
  .clock-page .clock-stage {
    margin-top: 18px;
  }
  .clock-page .time-display {
    font-size: clamp(44px, min(18vw, 24svh), 288px);
  }
  .clock-meta,
  .clock-audio-corner {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: 100%;
    text-align: center;
    align-items: center;
  }
  .clock-page .clock-shell {
    padding-bottom: 24px;
  }
  .clock-page .clock-dock {
    margin-top: 24px;
  }
}
@media (max-height: 600px) {
  .clock-page[data-clock-mode='clock'] .time-display {
    font-size: clamp(44px, min(18vw, 24svh), 288px);
  }
}
@media (max-width: 600px) {
  .clock-page .clock-meta,
  .clock-page .clock-audio-corner {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: 100%;
    text-align: center;
    align-items: center;
  }
  .clock-page .clock-meta {
    margin-top: 30px;
  }
  .clock-page .clock-shell {
    padding-bottom: 24px;
  }
  .clock-meta > span:last-child {
    max-width: none;
  }
  .clock-audio-corner small {
    max-width: none;
  }
}
.clock-footer {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: end;
  pointer-events: none;
}
.clock-page .clock-footer .clock-meta,
.clock-page .clock-footer .clock-audio-corner {
  position: static;
  margin: 0;
  max-width: 100%;
  text-align: left;
  align-items: flex-start;
}
.clock-page .clock-footer .clock-audio-corner {
  text-align: right;
  align-items: flex-end;
  pointer-events: auto;
  justify-self: end;
}
.clock-page:not([data-clock-mode='clock']) .clock-footer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  margin-top: 24px;
}
@media (max-width: 600px), (max-height: 600px) {
  .clock-footer {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    margin-top: auto;
    padding-top: 24px;
    gap: 16px;
  }
  .clock-meta span {
    max-width: 100% !important;
  }
  .clock-audio-corner small {
    max-width: 100% !important;
  }
}
