:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: #1b1f4b;
  background: #eaf0ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: #eaf0ff;
  background-image: radial-gradient(#d2dbff 2px, transparent 2px);
  background-size: 28px 28px;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 48px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(16px, 2.4vw, 28px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.03em;
}

.brand svg {
  width: 34px;
  height: 40px;
}

.site-header p {
  margin: 0;
  color: #3f4470;
  font-size: 15px;
  font-weight: 700;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(16px, 2.4vw, 32px);
}

.timer-card,
.controls-card {
  min-width: 0;
  border: 3px solid #1b1f4b;
  border-radius: 32px;
  box-shadow: 0 6px 0 #1b1f4b;
}

.timer-card {
  --stage-bg: #d9e2ff;
  position: relative;
  display: flex;
  min-height: 570px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 40px) 20px;
  background: var(--stage-bg);
  text-align: center;
  transition: background-color .25s ease;
}

.timer-card[data-state="running"] {
  --stage-bg: #ffe3b3;
}

.timer-card[data-state="paused"] {
  --stage-bg: #e4e2ee;
}

.timer-card[data-state="done"] {
  --stage-bg: #ffc531;
}

.state-badge {
  position: absolute;
  top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 5px 16px;
  border: 3px solid #1b1f4b;
  border-radius: 999px;
  background: #fff;
  font-weight: 900;
}

.timer-card[data-state="done"] .state-badge {
  background: #1b1f4b;
  color: #fff;
}

.egg-art {
  width: min(100%, 300px);
  margin: 16px auto 8px;
}

.egg-art svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.progress-track {
  fill: #fff;
  fill-opacity: .55;
  stroke: #1b1f4b;
  stroke-opacity: .14;
  stroke-width: 16;
}

.progress-ring {
  fill: none;
  stroke: #ff8a1f;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-dasharray: 879.6;
  stroke-dashoffset: 879.6;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset .3s linear, stroke .25s ease;
}

.timer-card[data-state="done"] .progress-ring {
  stroke: #1b1f4b;
}

.egg-shell {
  fill: #fff8ec;
  stroke: #1b1f4b;
  stroke-width: 5;
}

.egg-face,
.egg-sleep,
.egg-happy {
  fill: #1b1f4b;
}

.egg-sleep,
.egg-happy,
.done-rays {
  display: none;
}

.egg-zzz text {
  font-size: 26px;
  font-weight: 900;
  transform-box: fill-box;
  animation: zzz-float 2.4s ease-in-out infinite both;
}

.egg-zzz text:nth-child(2) {
  font-size: 32px;
  animation-delay: .8s;
}

.egg-zzz text:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes zzz-float {
  0% { opacity: 0; transform: translate(-6px, 10px); }
  25%, 70% { opacity: 1; }
  100% { opacity: 0; transform: translate(8px, -16px); }
}

.timer-card[data-state="paused"] .egg-zzz text {
  animation: none;
}

.timer-card[data-state="running"] .egg-face,
.timer-card[data-state="paused"] .egg-face,
.timer-card[data-state="done"] .egg-face {
  display: none;
}

.timer-card[data-state="running"] .egg-sleep,
.timer-card[data-state="paused"] .egg-sleep,
.timer-card[data-state="done"] .egg-happy,
.timer-card[data-state="done"] .done-rays {
  display: initial;
}

.done-rays {
  fill: none;
  stroke: #1b1f4b;
  stroke-width: 7;
  stroke-linecap: round;
}

.timer-label {
  margin: 6px 0 0;
  color: #3f4470;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.timer-time {
  margin: 0;
  font-size: clamp(64px, 10vw, 88px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  line-height: 1;
}

.timer-caption {
  margin: 8px 0 0;
  color: #3f4470;
  font-size: 16px;
  font-weight: 700;
}

.model-note {
  margin: 0;
  color: #3f4470;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.model-note {
  max-width: 62ch;
}

/* Silent mode can't be detected, so show the hint on touch devices (phones, tablets) only. */
@media (pointer: fine) {
  .silent-note {
    display: none;
  }
}

.controls-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: clamp(20px, 3vw, 32px);
  background: #fff;
}

#setup-controls,
.timer-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-block {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

h1,
legend {
  margin: 0;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.number-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 2px solid #c3caea;
  border-radius: 20px;
  background: #f3f5ff;
}

.number-field label {
  color: #3f4470;
  font-size: 14px;
  font-weight: 900;
}

.field-help {
  color: #3f4470;
  font-size: 12px;
  font-weight: 700;
}

.location-field {
  gap: 6px;
  padding: 10px;
}

.location-title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.adjustment-toggle {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.adjustment-toggle input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: #1b1f4b;
}

.adjustment-toggle strong {
  font-size: 12px;
  line-height: 1.15;
}

.adjustment-toggle span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.adjustment-toggle small {
  color: #3f4470;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.adjustment-label {
  display: block;
  margin-bottom: 4px;
  color: #3f4470;
  font-size: 11px;
  font-weight: 900;
}

.location-field .number-entry input {
  height: 36px;
  font-size: 20px;
}

.location-field .field-help {
  font-size: 10px;
}

.number-entry {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.number-entry input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 4px 8px;
  border: 2px solid #1b1f4b;
  border-radius: 12px;
  background: #fff;
  color: #1b1f4b;
  font-size: 28px;
  font-weight: 900;
}

.number-entry input:focus-visible,
button:focus-visible,
.brand:focus-visible {
  outline: 3px solid #5946c8;
  outline-offset: 3px;
}

.number-entry input[aria-invalid="true"] {
  border-color: #a32135;
}

.number-entry span {
  flex: none;
  font-size: 18px;
  font-weight: 900;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.step-button {
  height: 42px;
  border: 2px solid #1b1f4b;
  border-radius: 12px;
  background: #fff;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
}

.doneness-block {
  margin: 0;
  padding: 0;
  border: 0;
}

.doneness-block legend {
  margin-bottom: 12px;
}

.doneness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.doneness-option {
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 3px solid #c3caea;
  border-radius: 18px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.doneness-option.is-selected {
  border-color: #1b1f4b;
  background: #ffc531;
  box-shadow: 0 4px 0 #1b1f4b;
}

.yolk-art {
  display: grid;
  width: 42px;
  height: 48px;
  flex: none;
  place-items: center;
  border: 2px solid #1b1f4b;
  border-radius: 50%;
  background: #fff;
}

.yolk-art svg {
  display: block;
  width: 72%;
  overflow: visible;
}

.doneness-option > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.doneness-option strong {
  font-size: 17px;
  line-height: 1.1;
}

.doneness-option small {
  color: #3f4470;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.input-error {
  margin: -8px 0 0;
  color: #a32135;
  font-size: 14px;
  font-weight: 800;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 3px solid #1b1f4b;
  border-radius: 20px;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.button-primary {
  min-height: 66px;
  background: #ff8a1f;
  box-shadow: 0 5px 0 #1b1f4b;
}

.start-button {
  margin: 4px 0 5px;
  font-size: 23px;
}

.button-secondary {
  background: #fff;
  box-shadow: 0 4px 0 #1b1f4b;
}

.settings-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.settings-summary li {
  padding: 7px 12px;
  border: 2px solid #c3caea;
  border-radius: 999px;
  background: #f3f5ff;
  font-size: 14px;
  font-weight: 900;
}

.settings-summary li:last-child {
  border-color: #1b1f4b;
  background: #ffe3b3;
}

.done-controls h1 {
  font-size: 30px;
}

.done-copy {
  margin: 8px 0 0;
  color: #3f4470;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.polite-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .page {
    padding: 16px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .timer-card {
    min-height: 0;
    padding: 30px 16px 24px;
  }

  .egg-art {
    width: min(66vw, 250px);
  }

  .timer-time {
    font-size: clamp(64px, 18vw, 88px);
  }
}

@media (max-width: 380px) {
  .page {
    padding: 12px;
  }

  .site-header p {
    font-size: 13px;
    text-align: right;
  }

  .brand {
    font-size: 23px;
  }

  .controls-card {
    padding: 18px;
  }

  .number-field {
    padding: 9px;
  }

  .doneness-option {
    gap: 7px;
    padding: 8px;
  }

  .yolk-art {
    width: 34px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }

  .egg-zzz text {
    animation: none;
  }
}
