*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --accent: #2f6f5e;
  --accent-dark: #1f4d41;
  --text: #1d2327;
  --muted: #56616a;
  --border: #c5ccd1;
  --error: #b3261e;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --focus: #1a5fb4;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.2rem;
}

.lead {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.timer {
  padding: 1.25rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.modes legend {
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

button {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font: inherit;
  color: var(--accent-dark);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 0.5rem;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #e7f0ed;
}

button[aria-pressed="true"],
button[type="submit"] {
  color: #fff;
  background: var(--accent);
}

button[aria-pressed="true"]:hover:not(:disabled),
button[type="submit"]:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.mode {
  flex: 1 1 8rem;
}

.durations {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 30rem) {
  .durations {
    grid-template-columns: 1fr 1fr;
  }
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
}

.field input:disabled {
  background: #eef1f2;
}

.error {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--error);
}

.time {
  margin: 1.25rem 0 0.25rem;
  font-size: clamp(3rem, 18vw, 6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.state {
  margin: 0 0 1rem;
  text-align: center;
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.controls button {
  flex: 1 1 7rem;
}

.hint,
.note {
  margin: 0.75rem 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.sound {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.sound input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  flex: none;
}

.notice {
  margin: 1rem 0;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-dark);
  border-radius: 0.75rem;
}

.about ul {
  padding-left: 1.25rem;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
