@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/fraunces-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/fraunces-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f3eee4;
  --paper-deep: #e4efe6;
  --card: #fffaf3;
  --ink: #17241c;
  --muted: #526158;
  --line: #d5e2d6;
  --stamp: #1f6b45;
  --stamp-ink: #f4fff6;
  --focus: #0b57d0;
  --shadow: 0 12px 32px rgba(23, 48, 32, 0.08);
  --serif: Fraunces, "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --max: 40rem;
  --correct: #e5f6ea;
  --near: #fde8e4;
  --close: #fff1dc;
  --regional: #fff6d4;
  --far: #e7f0fa;
  --very-far: #eef1f4;
  --farthest: #ece7de;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #121814;
    --paper-deep: #243028;
    --card: #1b2420;
    --ink: #f4f1e8;
    --muted: #c5d2c6;
    --line: #314038;
    --stamp: #8ed7ad;
    --stamp-ink: #10261a;
    --focus: #9ec4ff;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    --correct: #143528;
    --near: #3a201c;
    --close: #3a2a14;
    --regional: #332e14;
    --far: #17283d;
    --very-far: #232a34;
    --farthest: #2a303a;
  }
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(31, 107, 69, 0.12), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  z-index: 5;
}

.skip:focus { top: 0.75rem; }

a { color: inherit; }
a:hover { color: var(--stamp); }

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

.site-header,
.site-footer,
main {
  width: min(var(--max), calc(100% - 1.5rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 0 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.stamp {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: rotate(-8deg);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.brand-tag { color: var(--muted); font-size: 0.92rem; }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.site-nav a {
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

main { padding-bottom: 2.5rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.05rem 1.2rem;
}

.kicker { margin: 0; color: var(--muted); font-size: 0.95rem; }

h1 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-size: clamp(2rem, 7vw, 2.8rem);
  margin: 0.2rem 0 0.6rem;
}

.lede, .fact { margin: 0.35rem 0; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.pips {
  display: flex;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pips li {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
}

.pips li.used { background: var(--ink); }

.photo-frame {
  margin-top: 0.85rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: var(--paper-deep);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--zoom, 3.4));
  filter: blur(var(--blur, 12px));
  transform-origin: center;
}

.guess-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0 0.4rem;
  align-items: end;
}

.guess-form[hidden],
.listbox[hidden],
.result[hidden] { display: none; }

.combo { position: relative; flex: 1 1 14rem; }

label.kicker { display: block; margin-bottom: 0.25rem; }

input[type="text"] {
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}

button, .button {
  font: inherit;
  font-weight: 650;
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary { background: var(--stamp); color: var(--stamp-ink); }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.listbox {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 16rem;
  overflow: auto;
}

.listbox button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  font-weight: 500;
}

.listbox button[aria-selected="true"],
.listbox button:hover { background: var(--paper-deep); }

.field-error {
  min-height: 1.4rem;
  margin: 0.15rem 0 0.4rem;
  color: var(--stamp);
}

.guess-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.guess {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: var(--farthest);
}

.guess header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.guess h3 { margin: 0; font-size: 1.15rem; }
.guess p { margin: 0.2rem 0 0; }
.guess .distance { font-weight: 700; }

.tone-correct { background: var(--correct); }
.tone-near { background: var(--near); }
.tone-close { background: var(--close); }
.tone-regional { background: var(--regional); }
.tone-far { background: var(--far); }
.tone-very-far { background: var(--very-far); }
.tone-farthest { background: var(--farthest); }

.hints { margin-top: 0.8rem; }
.hints p { margin: 0.25rem 0 0; }

.empty-help { color: var(--muted); margin: 0.4rem 0 0; }

.banner {
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin: 0 0 0.8rem;
}

.result { margin-top: 1rem; }
.result h2 {
  font-family: var(--serif);
  font-size: 1.8rem;
  margin: 0 0 0.4rem;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0; }

.fine, .footnote, .credit { color: var(--muted); font-size: 0.95rem; }

.site-footer { padding: 0.5rem 0 2rem; }

.draft-banner {
  background: var(--stamp);
  color: var(--stamp-ink);
  font-weight: 700;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.prose h2 { font-family: var(--serif); font-size: 1.45rem; margin: 1.4rem 0 0.3rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }

.archive-month { margin-top: 1.3rem; }
.archive-month h2 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 0.4rem; }
.archive-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }

.archive-list a {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  min-height: 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 0.6rem 0 1rem;
}

.stat { background: var(--paper); border-radius: 12px; padding: 0.7rem; }
.stat b { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1; }

.dist { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.dist li { display: grid; grid-template-columns: 1.2rem 1fr auto; gap: 0.45rem; align-items: center; }
.dist .fill { height: 0.7rem; background: var(--stamp); border-radius: 99px; min-width: 2px; }

dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  width: min(28rem, calc(100% - 1.5rem));
  padding: 1rem 1rem 0.9rem;
}

dialog::backdrop { background: rgba(12, 24, 16, 0.45); }

.noscript {
  background: var(--near);
  border-radius: 12px;
  padding: 0.8rem;
}

.credit-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.credit-table th, .credit-table td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.4rem;
}
.credit-table th { font-size: 0.85rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }

.puzzle-photo {
  width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 0.6rem 0 0.2rem;
}

@media (prefers-reduced-motion: no-preference) {
  .photo-frame img { transition: transform 280ms ease, filter 280ms ease; }
  .guess { animation: rise 220ms ease; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

@media (max-width: 40rem) {
  .archive-list a, .guess header { align-items: flex-start; }
  .archive-list a { flex-direction: column; }
  .credit-table { display: block; overflow-x: auto; }
}
