:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171717;
  background: #f5f5f3;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100svh;
  background: #f5f5f3;
}

main {
  width: min(100% - 2rem, 35rem);
  margin-inline: auto;
  padding: max(3rem, env(safe-area-inset-top)) 0 max(2rem, env(safe-area-inset-bottom));
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.65rem, 8vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

input,
button {
  min-height: 3rem;
  border: 1px solid #c9c9c5;
  border-radius: 0.7rem;
  font: inherit;
  font-size: 1rem;
}

input {
  width: 100%;
  min-width: 0;
  padding: 0 0.9rem;
  color: #171717;
  background: #fff;
  outline: none;
}

input:focus {
  border-color: #171717;
  box-shadow: 0 0 0 3px rgb(23 23 23 / 10%);
}

button {
  padding: 0 1rem;
  border-color: #171717;
  color: #fff;
  background: #171717;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

button:hover { background: #303030; }
button:disabled { cursor: wait; opacity: 0.55; }
button.secondary { color: #171717; background: transparent; }
button.secondary:hover { background: #e9e9e6; }

#status {
  min-height: 1.5rem;
  margin: 0.8rem 0 0;
  color: #a12c25;
  font-size: 0.9rem;
}

#results { margin-top: 0.8rem; }

#answer-list {
  overflow: hidden;
  border-block: 1px solid #d8d8d4;
}

.answer-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  min-height: 2.6rem;
  padding: 0.62rem 0;
  border-bottom: 1px solid #e2e2de;
}

.answer-row:last-child { border-bottom: 0; }
.number { color: #777772; font-variant-numeric: tabular-nums; }
.answer { overflow-wrap: anywhere; font-weight: 600; }
.missing { color: #9a3b34; font-weight: 450; }

.task-link {
  color: #777772;
  font-size: 0.8rem;
  text-decoration: none;
}

.task-link:hover { color: #171717; text-decoration: underline; }
#copy-button { width: 100%; margin-top: 0.75rem; }
.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; }
[hidden] { display: none !important; }

@media (max-width: 22rem) {
  main {
    width: calc(100% - 1rem);
    padding-top: max(1.25rem, env(safe-area-inset-top));
  }

  h1 { margin-bottom: 1rem; }
  form { grid-template-columns: 1fr; }
  input, button { min-height: 2.75rem; }
  .answer-row { grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.35rem; }
  .task-link { grid-column: 2; }
}

@media (max-width: 13rem) {
  main { width: calc(100% - 0.7rem); padding-top: 0.75rem; }
  h1 { font-size: 1.4rem; }
  input, button { font-size: 0.92rem; padding-inline: 0.55rem; }
  .answer-row { font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
