:root {
  color-scheme: light;
  --background: oklch(0.965 0.01 78);
  --surface: oklch(0.988 0.006 82);
  --surface-strong: oklch(0.94 0.018 78);
  --ink: oklch(0.205 0.025 250);
  --muted: oklch(0.43 0.03 250);
  --subtle: oklch(0.58 0.032 245);
  --rule: oklch(0.84 0.02 78);
  --rule-strong: oklch(0.69 0.032 74);
  --red: oklch(0.56 0.17 29);
  --red-dark: oklch(0.47 0.15 29);
  --blue: oklch(0.51 0.095 225);
  --green: oklch(0.54 0.11 150);
  --shadow: 0 22px 70px oklch(0.205 0.025 250 / 0.16);
  --focus: 0 0 0 4px oklch(0.51 0.095 225 / 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, oklch(0.965 0.01 78), oklch(0.93 0.02 112) 48%, oklch(0.948 0.014 220));
  color: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      oklch(0.84 0.02 78 / 0.35) 32px
    );
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  transform: translateY(-140%);
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
  font-weight: 800;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  display: grid;
  min-height: calc(100vh - 74px);
  place-items: center;
  padding: 48px 20px 24px;
}

.app-frame {
  width: min(1120px, 100%);
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--ink);
  background: var(--surface-strong);
  padding: 16px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.brand span,
.storage-note,
.button,
.state-list dd,
.state-list dt {
  overflow-wrap: anywhere;
}

.storage-note {
  margin: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: oklch(0.988 0.006 82 / 0.78);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 800;
  white-space: nowrap;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.84fr);
  min-height: 620px;
}

.counter-panel,
.control-panel {
  padding: 42px;
}

.counter-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  border-right: 1px solid var(--ink);
  background:
    linear-gradient(180deg, oklch(0.988 0.006 82), oklch(0.965 0.011 83)),
    var(--surface);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: oklch(0.955 0.012 73);
}

.kicker {
  margin: 0 0 10px;
  color: var(--red-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 11ch;
  font-size: 4rem;
  line-height: 0.96;
  font-weight: 950;
}

h2 {
  font-size: 1.375rem;
  line-height: 1.16;
  font-weight: 900;
}

.lede {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

.counter-display {
  display: grid;
  gap: 18px;
  width: min(100%, 560px);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 26px 0;
}

.day-stack {
  display: flex;
  align-items: end;
  gap: 16px;
  min-height: 138px;
}

.days-number {
  font-variant-numeric: tabular-nums;
  font-size: 8rem;
  font-weight: 950;
  line-height: 0.84;
}

.days-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 1.375rem;
  font-weight: 900;
}

.clock-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.clock-row span {
  display: grid;
  gap: 2px;
  min-height: 82px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.clock-row strong {
  font-size: 1.875rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clock-row em {
  color: var(--subtle);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-copy {
  min-height: 2lh;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 750;
}

.section-heading {
  display: grid;
  gap: 2px;
}

.tracker-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 900;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  font-variant-numeric: tabular-nums;
  transition: border-color 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

input:hover {
  border-color: var(--red-dark);
}

input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

.field-hint,
.form-error {
  margin: 0;
  font-size: 0.875rem;
}

.field-hint {
  color: var(--subtle);
}

.form-error {
  color: var(--red-dark);
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row .button-quiet {
  grid-column: 1 / -1;
}

.button {
  min-height: 46px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 900;
  letter-spacing: 0;
  transition:
    transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px oklch(0.205 0.025 250 / 0.13);
}

.button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.button:disabled {
  opacity: 0.45;
}

.button-primary {
  background: var(--ink);
  color: var(--surface);
}

.button-danger {
  background: var(--red);
  color: var(--surface);
}

.button-secondary {
  background: var(--blue);
  color: var(--surface);
}

.button-quiet {
  background: var(--surface);
  color: var(--ink);
}

.state-list {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.state-list div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  min-height: 54px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding: 12px 14px;
}

.state-list div:last-child {
  border-bottom: 0;
}

.state-list dt {
  color: var(--subtle);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.state-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
}

.site-footer {
  padding: 0 20px 26px;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  max-width: 65ch;
  margin: 0 auto;
  font-size: 0.875rem;
}

@media (max-width: 860px) {
  .page-shell {
    place-items: start center;
    padding-top: 20px;
  }

  .masthead {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .counter-panel,
  .control-panel {
    padding: 28px;
  }

  .counter-panel {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  h1 {
    max-width: 12ch;
    font-size: 3rem;
  }

  .days-number {
    font-size: 6.5rem;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 12px 12px 18px;
  }

  .app-frame {
    border-radius: 6px;
  }

  .counter-panel,
  .control-panel {
    padding: 22px;
  }

  h1 {
    font-size: 2.375rem;
  }

  .lede {
    font-size: 1rem;
  }

  .day-stack {
    align-items: start;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
  }

  .days-number {
    font-size: 5rem;
  }

  .days-label {
    margin-bottom: 0;
  }

  .clock-row,
  .button-row {
    grid-template-columns: 1fr;
  }

  .button-row .button-quiet {
    grid-column: auto;
  }

  .state-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
