:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --text: #2a2620;
  --muted: #6f675b;
  --line: #d9d0bf;
  --accent: #9b3b2a;
  --hit: #4f8a4b;
  --near: #c9a227;
  --miss: #8d877d;
  --on-color: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1b18;
    --surface: #26231f;
    --text: #eee8dc;
    --muted: #a99f8f;
    --line: #48423a;
    --accent: #e08a73;
    --hit: #5b9a56;
    --near: #b8922a;
    --miss: #5f5a52;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.7;
}
a { color: var(--accent); }
.header { text-align: center; padding: 16px 16px 0; }
.logo { margin: 0; font-size: 1.15rem; letter-spacing: 0.08em; }
.no { margin: 0; color: var(--muted); font-size: 0.85rem; }
.game, .page { max-width: 480px; margin: 0 auto; padding: 16px; }
.question { text-align: center; }
.kanji {
  margin: 8px 0 0;
  font-family: "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: keep-all;
}
.suffix { font-size: 1.6rem; color: var(--muted); margin-left: 0.1em; }
.place { margin: 4px 0 0; color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
.board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 46px));
  justify-content: center;
  gap: 6px;
  margin: 20px 0 8px;
}
.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 1.3rem;
  font-weight: 700;
}
.cell.hit, .cell.near, .cell.miss { color: var(--on-color); border-color: transparent; }
.cell.hit { background: var(--hit); }
.cell.near { background: var(--near); }
.cell.miss { background: var(--miss); }
.message { min-height: 1.7em; text-align: center; color: var(--accent); margin: 0; }
.form { display: flex; gap: 8px; }
.guess {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.1rem;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.button {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-color);
  text-decoration: none;
  cursor: pointer;
}
.result { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 8px; }
.result-title { margin: 0; font-size: 1.3rem; font-weight: 700; }
.result-answer { margin: 4px 0 12px; font-size: 1.1rem; }
.note { color: var(--muted); font-size: 0.85rem; }
.howto { margin-top: 24px; color: var(--muted); }
.howto summary { cursor: pointer; }
.howto ul { padding-left: 1.2em; }
.chip { display: inline-block; padding: 0 6px; border-radius: 4px; color: var(--on-color); font-size: 0.8rem; }
.chip.hit { background: var(--hit); }
.chip.near { background: var(--near); }
.chip.miss { background: var(--miss); }
.footer { text-align: center; font-size: 0.8rem; padding: 24px 16px; color: var(--muted); }
.crumb { font-size: 0.85rem; color: var(--muted); }
.answer-kanji { font-family: "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 2.8rem; margin: 8px 0 0; }
.answer-reading { font-size: 1.3rem; margin: 0 0 16px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.page h2 { font-size: 1.05rem; margin-top: 24px; }
.page table { width: 100%; border-collapse: collapse; font-size: 0.85rem; display: block; overflow-x: auto; }
.page th, .page td { border: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
