:root {
  color-scheme: light;
  --paper: #faf7ef;
  --ink: #212620;
  --muted: #505a4b;
  --line: #dcdacc;
  --accent: #214c35;
  --wash: #edeee1;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2 {
  font-family: Georgia, "Songti SC", serif;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.45rem, 5vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -.035em;
}

h2 {
  margin: 0 0 .6em;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
}

p { margin: 0 0 1em; }
.frame { width: min(calc(100% - 32px), 1440px); margin-inline: auto; }

.skip {
  position: fixed;
  z-index: 3;
  top: .5rem;
  left: 1rem;
  padding: .65rem 1rem;
  transform: translateY(-180%);
  background: var(--paper);
}

.skip:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); }

.header-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem clamp(.9rem, 2vw, 2.5rem);
  padding-block: .55rem;
}

.brand {
  font: bold 1.375rem Georgia, serif;
  color: var(--ink);
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  font-size: .94rem;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}
nav a:hover, nav a[aria-current="page"] { text-decoration: underline; }

.languages { margin-inline-start: auto; position: relative; }
.languages summary {
  cursor: pointer;
  padding: .45rem .65rem;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .875rem;
  color: var(--accent);
}
.languages ul {
  z-index: 2;
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  min-width: 9.5rem;
  margin: 0;
  border: 1px solid var(--line);
  padding: .25rem;
  list-style: none;
  background: var(--paper);
  box-shadow: 0 8px 20px #2126201c;
}
.languages a {
  display: block;
  padding: .45rem .65rem;
  text-decoration: none;
}
.languages a:hover, .languages a[aria-current="page"] { background: var(--wash); }

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-block: clamp(1.5rem, 5vw, 3.25rem) 3.5rem;
}
.play-columns { padding-block-start: clamp(1.35rem, 3vw, 2.25rem); }

main { min-width: 0; }

.ad-slot {
  display: none;
  width: 300px;
  height: 250px;
  overflow: hidden;
}

.intro {
  padding-block: .3rem 1.9rem;
  border-bottom: 1px solid var(--line);
}

.lede {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 62ch;
}

.game-board {
  --board-padding: clamp(.875rem, 3vw, 1.35rem);
  padding: var(--board-padding);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf7;
  box-shadow: 0 10px 26px #24341a0c;
}

.game-header {
  margin: calc(-1 * var(--board-padding)) calc(-1 * var(--board-padding)) .8rem;
  padding: .7rem var(--board-padding) .85rem;
  color: #fffdf7;
  background: #244836;
  border-radius: 13px 13px 0 0;
}

.game-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .15rem .75rem;
  min-height: 36px;
  font-size: .85rem;
}

.game-meta time, #practice-label { margin-inline-end: auto; color: #f1e4bc; }
.game-meta .text-button { color: white; }
.game-meta :focus-visible { outline-color: #f1e4bc; }
.game-header h1 {
  margin: .25rem 0 .7rem;
  font-size: clamp(1.5rem, 2.7vw, 2.1rem);
  letter-spacing: -.015em;
}

.game-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  color: #edf1e7;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  padding: 0;
  margin: 0 0 .85rem;
  list-style: none;
}

.answer-grid li {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 49px;
  padding: .32rem .5rem;
  border: 1px solid #e5e2d0;
  border-radius: 8px;
  color: var(--muted);
  background: #f7f5eb;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-size: .96rem;
}
.answer-grid [data-state="found"] { color: #1b432c; background: #e4efdf; border-color: #bcceba; font-weight: 700; }
.answer-grid [data-state="hint"] { color: #4a381e; background: #fff2d1; border-color: #e5cc91; font-weight: 700; }
.answer-grid [data-state="revealed"] { color: #503b2a; background: #f5e9df; border-color: #dac7b6; }

.rank-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: #e7dec3;
  color: #3e3523;
  font-size: .82rem;
  font-weight: 750;
}
.answer-grid [data-state="found"] .rank-number { background: #c6ddbf; color: #244836; }

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }

.guess-form label, #archive-form label {
  display: block;
  margin: 0 0 .2rem;
  font-size: .85rem;
  font-weight: 650;
}

.guess-controls { display: flex; gap: .5rem; }

.guess-controls input, #archive-date {
  min-width: 0;
  min-height: 44px;
  border: 1px solid #a9b5a3;
  border-radius: 7px;
  padding: .45rem .7rem;
  color: var(--ink);
  background: #fff;
}
.guess-controls input { flex: 1; }
.guess-controls input::placeholder { color: #606a5a; opacity: 1; }

.primary-button, .outline-button, .text-button {
  min-height: 42px;
  padding: .4rem .75rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 650;
  font-size: .92rem;
  line-height: 1.2;
}
.primary-button {
  background: var(--accent);
  color: var(--paper);
}
.primary-button:hover:enabled { background: #193a29; }
.outline-button { background: #fffdf7; color: var(--accent); border-color: #a9b5a3; }
.outline-button:hover:enabled { background: var(--wash); }
.text-button { background: transparent; color: var(--accent); }
.text-button:enabled { text-decoration: underline; text-underline-offset: .18em; }
.text-button:hover:enabled { text-decoration-thickness: 2px; }

.game-actions, .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .6rem;
}

.game-feedback {
  min-height: 1.5em;
  margin: .3rem 0 .25rem;
  color: var(--muted);
  font-size: .87rem;
}
.game-feedback[data-kind="success"] { color: var(--accent); }
.game-feedback[data-kind="error"] { color: #88432f; }

.game-result {
  padding: .6rem .75rem;
  border: 1px solid #abc1a6;
  border-radius: 8px;
  background: #eef2e7;
}
.game-result h3, .near-misses h3 {
  margin: 0;
  font-size: .96rem;
}
.game-result p { margin: .2rem 0 .45rem; font-size: .87rem; }
#next-puzzle-clock { font-variant-numeric: tabular-nums; }
#share-text {
  width: 100%;
  margin-top: .5rem;
  padding: .45rem .6rem;
  border: 1px solid #a9b5a3;
  border-radius: 7px;
  font: inherit;
  font-size: .875rem;
  resize: vertical;
}

.near-misses { margin: .55rem 0; }
.near-misses ul {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  list-style: none;
  padding: 0;
  margin: .35rem 0;
}
.near-misses li {
  padding: .14rem .6rem;
  border-radius: 20px;
  background: #f4e7c3;
  color: #4d391c;
  font-size: .84rem;
}

dialog {
  max-width: min(28rem, calc(100% - 28px));
  border: 1px solid #a9b5a3;
  padding: 1.2rem;
  border-radius: 12px;
  background: #fffdf7;
  color: var(--ink);
}
dialog::backdrop { background: #172c20a8; }
.dialog-actions { margin-top: 1rem; justify-content: flex-end; }
#archive-date { width: 100%; }
.home-note { margin-top: .9rem; color: var(--muted); font-size: .875rem; }

.related-guides {
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.related-guides ul {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-guides a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
}

.guide-section {
  padding-block: 1.65rem;
  border-bottom: 1px solid var(--line);
}

article .related-guides { border-top: 0; }

.guide-section > :last-child { margin-bottom: 0; }
.guide-section ol { padding-inline-start: 1.5em; }
.guide-section li { padding-inline-start: .35em; margin-bottom: .65em; }

.question + .question { border-top: 1px solid var(--line); }
.question summary {
  font-weight: 650;
  padding-block: .75rem;
  cursor: pointer;
}
.question p { color: var(--muted); margin: 0 0 .85rem; }
.site-footer {
  padding-block: 1.4rem;
  font-size: .875rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }

@media (max-width: 480px) {
  .header-inner { justify-content: space-between; }
  nav { order: 1; flex-basis: 100%; }
  .game-meta { gap: .15rem .2rem; }
  .game-meta button { padding-inline: .45rem; }
}

@media (min-width: 1024px) {
  .frame { width: min(calc(100% - 48px), 1440px); }
  .columns { grid-template-columns: minmax(540px, 1fr) 300px; }
  .ad-right { display: block; }
}

@media (min-width: 1280px) {
  .columns { grid-template-columns: 300px minmax(540px, 1fr) 300px; }
  .ad-left { display: block; }
}
