:root {
  --paper: #f4f0e6;
  --panel: #fbf9f3;
  --ink: #2f2a24;
  --muted: #746d63;
  --line: #d6cfc0;
  --accent: #883d32;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); font: 15px/1.5 Georgia, "Times New Roman", serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.site-nav { min-height: 75px; padding: 14px clamp(24px, 4vw, 64px); border-bottom: 1px solid var(--line); }
.back-link { display: inline-flex; align-items: center; justify-content: center; width: 187px; min-height: 46px; padding: 3px 5px; border: 1px solid transparent; border-radius: 6px; }
.back-link img { display: block; width: 177px; max-width: 100%; height: auto; }
.back-link:hover { border-color: var(--accent); background: rgba(136, 61, 50, .08); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page-shell { width: min(100% - 48px, 1000px); margin: 0 auto; padding: 64px 0 80px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow, .status, .label, .range-labels, .hint, .model-info code, .results-heading > span, .results-footer, .word-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.eyebrow { margin: 0 0 11px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(36px, 5vw, 54px); font-weight: 400; letter-spacing: -.04em; line-height: 1.1; }
.intro { margin: 15px 0 0; color: var(--muted); }
.status { flex: none; margin-top: 5px; padding: 5px 9px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.status.ready { border-color: #b9cbb8; color: #42644a; }

.generator { display: grid; grid-template-columns: 330px minmax(0, 1fr); border: 1px solid var(--line); background: var(--panel); }
.controls { display: flex; flex-direction: column; min-width: 0; padding: 30px; border-right: 1px solid var(--line); }
.control-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; font-size: 18px; }
.control-heading output { color: var(--accent); font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
input[type="range"] { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.range-labels span:last-child { text-align: right; }
.hint { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
#generate { width: 100%; margin-top: 28px; padding: 12px 16px; border: 1px solid var(--accent); background: var(--accent); color: #fffaf2; font: 700 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
#generate:hover:not(:disabled) { background: #6e3028; }
#generate:disabled { opacity: .55; cursor: wait; }
.model-info { margin-top: auto; padding-top: 38px; }
.label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.model-info p { margin: 0; color: #5d554b; font-size: 13px; line-height: 1.55; }

.results { min-width: 0; padding: 28px 30px 22px; }
.results-heading, .results-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.results-heading { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
h2 { margin: 0; font-size: 20px; font-weight: 400; }
.results-heading > span { color: var(--muted); font-size: 11px; }
.word-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(47px, 1fr)); grid-auto-flow: column; column-gap: 25px; min-height: 306px; margin: 0; padding: 0; list-style: none; }
.word-list li { display: flex; align-items: center; min-width: 0; gap: 12px; border-bottom: 1px solid #e6dfd4; }
.word-list .loading-message { grid-column: 1 / -1; color: var(--muted); font-style: italic; }
.word-number { width: 22px; flex: none; color: #9b9081; font-size: 10px; }
.word-name { overflow: hidden; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.known-word .word-name { color: #aaa49b; }
.known-word .word-number { color: #bbb4aa; }
.results-footer { align-items: center; padding-top: 17px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.results-footer button { flex: none; padding: 5px 0; border: 0; background: transparent; color: var(--accent); font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.results-footer button:hover:not(:disabled) { text-decoration: underline; }
.results-footer button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 720px) {
  .page-shell { padding-top: 36px; }
  .page-header { flex-direction: column; gap: 10px; }
  .generator { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .model-info { padding-top: 28px; }
}
@media (max-width: 460px) {
  .page-shell { width: min(100% - 32px, 1000px); }
  .controls, .results { padding: 22px; }
  .word-list { column-gap: 12px; }
  .word-name { font-size: 18px; }
  .word-number { width: 18px; }
}
