:root {
  color-scheme: light;
  --ink: #172c29;
  --muted: #5b6d67;
  --paper: #f4f5ef;
  --surface: #fffefa;
  --line: #d8dfd7;
  --green: #176b61;
  --green-dark: #10574f;
  --coral: #c76042;
  --focus: #d28a24;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(#d8dfd7 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(100% - 2rem, 760px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.page-header,
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-header {
  min-height: 76px;
  border-bottom: 1px solid rgb(23 44 41 / 14%);
}

.brand,
.page-footer a {
  color: var(--ink);
  font-weight: 700;
  text-decoration-color: var(--coral);
  text-underline-offset: 4px;
}

.header-note,
.page-footer span {
  color: var(--muted);
  font-size: 0.85rem;
}

.generator {
  width: min(100%, 600px);
  margin: auto;
  padding: 3.5rem 0;
}

.intro {
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--coral);
  font-size: 0.75rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
}

.intro-copy {
  max-width: 38rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
}

.generator-form,
.result {
  border-top: 1px solid var(--line);
}

.length-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 1.25rem 0;
}

.length-control > label,
.result > label,
.character-options legend {
  font-weight: 700;
}

.length-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.length-input-wrap input {
  width: 5.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #aabbb5;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
}

.length-input-wrap span,
.field-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.field-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0;
  padding: 1.25rem 0 1.5rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.character-options legend {
  padding: 1.25rem 0 0.9rem;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.5rem;
  cursor: pointer;
}

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.checkmark {
  display: grid;
  flex: 0 0 1.2rem;
  width: 1.2rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #8b9e97;
  border-radius: 2px;
  background: var(--surface);
}

.option input:checked + .checkmark {
  border-color: var(--green);
  background: var(--green);
}

.option input:checked + .checkmark::after {
  width: 0.35rem;
  height: 0.6rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  content: "";
  transform: translateY(-1px) rotate(45deg);
}

.option input:focus-visible + .checkmark {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.option small {
  margin-left: 0.25rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
}

.generate-button,
.copy-button {
  min-height: 2.8rem;
  border: 1px solid var(--green-dark);
  border-radius: 3px;
  background: var(--green-dark);
  color: #fff;
  cursor: pointer;
}

.generate-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  font-weight: 700;
}

.generate-button span {
  font-size: 1.25rem;
  line-height: 1;
}

.generate-button:hover,
.copy-button:hover:not(:disabled) {
  background: var(--green);
}

.result {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.8rem;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.result-row input {
  min-width: 0;
  min-height: 2.8rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #aabbb5;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.copy-button {
  font-size: 1.2rem;
}

.copy-button:disabled {
  border-color: #aabbb5;
  background: #aabbb5;
  cursor: not-allowed;
}

.status {
  min-height: 1.5em;
  margin: 0.5rem 0 0;
  color: var(--green-dark);
  font-size: 0.88rem;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.privacy-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.privacy-mark {
  color: var(--green);
  font-size: 0.75rem;
  line-height: 1.7;
}

.page-footer {
  min-height: 64px;
  border-top: 1px solid rgb(23 44 41 / 14%);
}

.page-footer a {
  font-size: 0.85rem;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .header-note {
    max-width: 10rem;
    text-align: right;
  }

  .generator {
    padding: 2.5rem 0;
  }

  .character-options {
    grid-template-columns: 1fr;
  }

  .page-footer {
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem 0;
  }
}