:root {
  --bg: #f7f4ef;
  --paper: #fffdf9;
  --ink: #1c1a17;
  --muted: #6b645c;
  --line: #e4ddd4;
  --accent: #8b3d3d;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; }
body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.bare { background: var(--paper); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header, .site-footer, main { width: min(1080px, calc(100% - 40px)); margin-left: auto; margin-right: auto; }
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 700;
}
.site-header nav { display: flex; gap: 18px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.85rem; }
.site-header nav a { color: var(--muted); }
.site-header nav a.is-active { color: var(--ink); }
main { flex: 1; padding: 36px 0 64px; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: normal;
  letter-spacing: -0.02em;
  max-width: 16ch;
  line-height: 1.15;
}
.lede { margin-top: 16px; max-width: 62ch; color: var(--ink); }
.muted { color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-block;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn:hover { text-decoration: none; background: var(--ink); color: var(--paper); }
.btn.ghost { border-color: var(--line); }
button.btn { background: transparent; cursor: pointer; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 48px; }
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 24px;
}
.panel h2 { font-size: 1.3rem; font-weight: normal; margin-bottom: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-top: 28px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.card[hidden] { display: none !important; }
.card img { width: 100%; height: 160px; object-fit: cover; background: #ddd6cc; }
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .actions { margin-top: auto; padding-top: 8px; }
.card h2 { font-size: 1.1rem; font-weight: normal; }
.meta { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 36px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .fine { margin-top: 8px; font-size: 0.8rem; }
.prose { max-width: 66ch; }
.prose.story { max-width: 72ch; }
.prose.legal { max-width: 72ch; }
.prose p, .prose li { margin-top: 12px; }
.prose h1 { font-size: 2rem; font-weight: normal; margin-bottom: 12px; }
.prose h2 { font-size: 1.25rem; font-weight: normal; margin-top: 28px; }
.prose h3 {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 20px;
}
.prose ul { margin: 8px 0 0 1.2em; }
.prose .updated { margin-top: 0; font-size: 0.9rem; }
.story-body img { max-width: 100%; height: auto; margin: 16px 0; border: 1px solid var(--line); }
.story-embed iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; margin: 16px 0; background: #111; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.filter-row button {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.filter-row button.is-on { border-color: var(--ink); }
#play-wrap { max-width: 920px; margin: 0 auto; }
#play-wrap.is-klotski { max-width: min(1080px, 100%); }
#play-wrap header { text-align: left; margin-bottom: 16px; }
#game-shell {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 20px;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}
#controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: 0.95rem; }
.pickers { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.control-actions { display: flex; gap: 12px; align-items: center; }
.levels { display: flex; gap: 6px; align-items: center; }
.levels-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.levels button {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  min-width: 2em;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.levels button.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.pit-watch {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  width: auto;
  height: auto;
  background: none;
  border: 0;
  box-shadow: none;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  flex: 0 0 auto;
  position: absolute;
  top: 52px;
  left: 8px;
  z-index: 1;
  pointer-events: none;
}
.pit-gate-gap {
  flex: 0 0 var(--pit-sq, 64px);
  width: var(--pit-sq, 64px);
  height: var(--pit-sq, 64px);
}
.pit-sq {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--pit-sq, 64px);
  width: var(--pit-sq, 64px);
  height: var(--pit-sq, 64px);
  border-radius: 2px;
  background: linear-gradient(160deg, #3a2a16 0%, #140e08 70%);
  border: 3px solid #c9a227;
  box-shadow: inset 0 0 0 2px #7a5a18, 0 1px 0 #e6d08a;
}
.pit-watch.is-low .pit-sq { border-color: #8b3d3d; }
.pit-time {
  color: #e23b2c;
  font-variant-numeric: tabular-nums;
  font-size: calc(var(--pit-sq, 64px) * 0.26);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.pit-colon { display: inline-block; width: 0.35em; text-align: center; }
.pit-watch.is-live .pit-colon { animation: pit-blink 1s step-end infinite; }
@keyframes pit-blink { 50% { opacity: 0; } }
.pit-watch.is-low .pit-time { color: #ff6b5b; }
.pit-moves {
  color: #f4e7d1;
  font-variant-numeric: tabular-nums;
  font-size: calc(var(--pit-sq, 64px) * 0.32);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.pit-moves-label {
  margin-top: 4px;
  color: #cbb79a;
  font-size: calc(var(--pit-sq, 64px) * 0.14);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.win-note.is-lose { color: var(--accent); }
.difficulty { display: flex; gap: 6px; }
.difficulty button {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.difficulty button.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
#play-row {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 24px;
  justify-content: start;
  align-items: start;
}
#gameCanvas, #ideaCanvas { display: block; touch-action: none; background: #f7f4ef; border: 0; }
.original { display: contents; }
.original img { display: block; width: 400px; height: 400px; object-fit: cover; border: 1px solid var(--line); grid-column: 1; }
.original img.klotski-ref {
  width: 400px;
  height: auto;
  object-fit: contain;
  background: #3a2416;
}
#ideaArt { grid-column: 1; }
#gameCanvas.klotski, #ideaCanvas.klotski {
  background: #f7f4ef;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(40, 18, 6, 0.38), 0 1px 0 rgba(230, 200, 140, 0.35);
}
.win-note { margin: 0 0 12px; color: var(--accent); font-size: 0.95rem; }
.original p { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; text-align: center; grid-column: 1; }
.original p.credit { margin: 8px 0 0; font-size: 0.75rem; line-height: 1.45; }
.original p.credit a { color: inherit; text-decoration: underline; }
.board { grid-column: 2; grid-row: 2; position: relative; }
.bite-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #1c120c;
}
.bite-overlay[hidden] { display: none !important; }
.bite-overlay img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.hint { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
button.ink {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 6px 12px;
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  border: 0;
}
.form { display: grid; gap: 10px; max-width: 480px; }
.form input, .form textarea {
  font: inherit;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
}
@media (max-width: 880px) {
  .cards { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  #play-row { grid-template-columns: min(400px, 100%); }
  .original p, .original img, #ideaArt, .board { grid-column: 1; grid-row: auto; }
  .original img, #gameCanvas, #ideaArt { width: min(400px, 100%); height: auto; }
  .site-header { flex-direction: column; align-items: flex-start; }
}
