:root {
  color-scheme: light;
  --text: #282923;
  --paper: #fffaf0;
  --ink: #176352;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: #eee6d5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
nav { display: flex; gap: 1rem; padding: 1rem max(1rem, calc((100% - 860px) / 2)); background: var(--paper); }
a { color: #215747; font-weight: 700; }
nav a { white-space: nowrap; font-size: .88rem; text-decoration: none; }
main { max-width: 860px; margin: auto; padding: 0 12px 32px; }
.ad { margin: 12px auto; overflow: hidden; }
.paper { margin: 0 auto; background: var(--paper); border: 1px solid #d7cbb1; border-radius: 18px; box-shadow: 0 8px 24px #42341b16; }
.cover { max-width: 780px; display: grid; grid-template-columns: 1.12fr 1fr; overflow: hidden; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-copy { align-self: center; padding: clamp(20px, 4vw, 44px); }
h1, h2 { margin: 0; color: #183f34; line-height: 1.16; letter-spacing: -.05em; }
h1 { font-size: clamp(2.05rem, 5vw, 3.2rem); }
h2 { font-size: 1.8rem; }
p { margin: .7rem 0 1rem; font-size: .95rem; line-height: 1.55; }
button { min-height: 44px; padding: .6rem .85rem; border: 1px solid #b8ac93; border-radius: 8px; background: #fffdf7; color: var(--text); font: inherit; font-size: .9rem; font-weight: 750; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #a14328; outline-offset: 3px; }
.primary { background: #164c3e; border-color: #164c3e; color: white; }
#game, #finish { width: min(100%, 510px); padding: clamp(12px, 4vw, 24px); }
.stage-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
#progress { margin: 0 0 .24rem; color: #76562c; font-size: .82rem; font-weight: 750; }
#rules { color: #4d4840; font-size: .86rem; }
.board {
  display: grid;
  grid-template-columns: minmax(44px, 1.05fr) repeat(5, minmax(0, 1fr));
  grid-template-rows: 48px repeat(5, auto);
  gap: 2px;
  max-width: 380px;
  margin: 0 auto;
  padding: 6px;
  border: 1px solid #a99a7b;
  border-radius: 10px;
  background: #d9cdb4;
}
.clue { display: flex; align-items: center; justify-content: center; gap: 4px; background: #f1e9d8; color: #564937; font-size: .83rem; font-weight: 800; line-height: 1; }
.clue.column { flex-direction: column; }
.corner { background: repeating-linear-gradient(135deg, #e9dec7 0 6px, #f6eedf 6px 12px); }
.cell { width: 100%; min-width: 0; min-height: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: 3px; color: #756155; font-size: 1.42rem; }
.cell[data-state="filled"] {
  color: white;
  background: repeating-linear-gradient(126deg, #fff0 0 3px, #fff2 3px 4px), var(--ink);
  box-shadow: inset 0 0 0 2px #0002;
}
.cell[data-state="marked"] { background: #ede6da; }
.modes, .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.modes button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
#message { min-height: 1.55em; margin-bottom: 0; font-size: .86rem; }
#finish { text-align: center; }
#finish .actions { justify-content: center; }
.collection { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 1.2rem 0; }
.stamp { margin: 0; border: 2px dashed var(--ink); border-radius: 9px; padding: 10px 4px 7px; color: var(--ink); }
.stamp-pattern { display: grid; grid-template-columns: repeat(5, 1fr); width: min(100%, 65px); margin: 0 auto 6px; gap: 1px; }
.stamp-pattern i { aspect-ratio: 1; }
.stamp-pattern .printed { background: var(--ink); }
figcaption { font-size: .77rem; font-weight: 800; }
@media (max-width: 560px) {
  .cover { grid-template-columns: 1fr; }
  .cover img { aspect-ratio: 3 / 2; height: auto; }
}
