:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --surface: #fffdf8;
  --ink: #19201d;
  --muted: #5b625f;
  --brand: #e4573d;
  --brand-dark: #9f3423;
  --highlight: #f2d74e;
  --success: #276749;
  --success-soft: #dfece1;
  --warning-soft: #f8edc0;
  --error: #a33228;
  --error-soft: #f5dfda;
  --border: #c9c9bf;
  --focus: #1559a6;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --content: 1080px;
  --reading: 720px;
  --radius-small: 6px;
  --radius-medium: 12px;
  --shadow-art: 7px 7px 0 var(--highlight);
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
main { width: min(var(--content), 100%); margin: 0 auto; padding: 24px 16px 56px; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 7vw, 3.6rem); line-height: 1.02; letter-spacing: -.045em; margin: 0 0 14px; }
h1 em { color: var(--brand); font-family: var(--font-display); font-weight: 400; }
h2 { line-height: 1.2; }
a { color: var(--brand-dark); text-underline-offset: 3px; }
button, input { font: inherit; }
button, .button-link {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  padding: 11px 20px;
  color: var(--surface);
  background: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
button:hover, .button-link:hover { background: #343d38; }
button:disabled { cursor: wait; opacity: .55; }
button.secondary, button.text-link { background: transparent; color: var(--brand-dark); }
button.secondary { border-color: var(--brand-dark); }
button.secondary:hover { background: var(--warning-soft); }
button.text-link { min-height: 44px; padding: 0; border: 0; border-radius: 0; text-decoration: underline; text-underline-offset: 3px; }
button.text-link:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; left: 12px; top: 8px; padding: 8px 12px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); clip-path: none; }
.skip-link:not(:focus) { clip-path: inset(50%); }

.site-header { border-bottom: 2px solid var(--ink); }
.masthead { width: min(var(--content), 100%); margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 1.22rem; font-weight: 900; letter-spacing: -.035em; }
.brand-mark { width: 42px; height: 22px; overflow: visible; }
.brand-mark path, .brand-mark ellipse { fill: var(--brand); stroke: var(--ink); stroke-width: 1.3; }
.brand-mark ellipse { fill: var(--highlight); }
.brand-mark path:last-child { fill: var(--surface); }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.site-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 7px 9px; color: var(--ink); font-size: .9rem; font-weight: 750; text-decoration: none; border-bottom: 3px solid transparent; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--brand); color: var(--brand-dark); }
.help-button { min-width: 44px; min-height: 44px; padding: 5px; border: 1.5px solid var(--ink); border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.1rem; }
.help-button:hover { background: var(--highlight); }
.eyebrow { color: var(--muted); font-size: .76rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 8px; }
.muted { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 24px; }
.state-panel { max-width: var(--reading); margin: 40px auto; }

.puzzle-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.puzzle-heading h1 { max-width: 560px; }
.shape-badge { flex: 0 0 auto; margin: 2px 0 0; padding: 5px 0 5px 9px; border-left: 4px solid var(--brand); color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.artwork-frame { margin: 14px 0 22px; min-width: 0; }
.art-mat { padding: 8px; background: var(--surface); border: 1.5px solid var(--ink); box-shadow: var(--shadow-art); }
.artwork-frame img { display: block; width: 100%; height: auto; max-height: 65vh; object-fit: contain; background: #e4e3dc; }
.artwork-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 2px 1px; font-size: .82rem; font-weight: 800; }
#score-preview { color: var(--brand-dark); text-align: right; }
.guess-panel { min-width: 0; }
.checkpoint-rail { list-style: none; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; padding: 0; margin: 0 0 22px; }
.checkpoint-step { min-width: 0; padding-top: 6px; border-top: 4px solid var(--border); color: var(--muted); text-align: center; font-size: .65rem; }
.checkpoint-step[data-state="past"] { border-top-color: var(--success); color: var(--ink); }
.checkpoint-step[data-marker="wrong"] { border-top-color: var(--error); }
.checkpoint-step[data-marker="artist"] { border-top-color: #a98300; }
.checkpoint-step[data-marker="reveal"] { border-top-color: #8a8d87; }
.checkpoint-step[data-state="current"] { border-top-color: var(--brand); color: var(--brand-dark); font-weight: 900; }
#guess-form label { display: block; font-size: .82rem; font-weight: 850; margin-bottom: 7px; }
.guess-row { display: flex; flex-direction: column; gap: 10px; }
.guess-row input { width: 100%; min-width: 0; min-height: 50px; padding: 11px 13px; border: 2px solid var(--ink); border-radius: var(--radius-small); background: var(--surface); color: var(--ink); }
.guess-row input::placeholder { color: #6a706c; }
.guess-row input:focus { border-color: var(--focus); }
#guess-button { width: 100%; }
.reveal-button { width: 100%; margin-top: 10px; }
#game-message { min-height: 1.5em; margin: 12px 0 0; font-weight: 700; }
.artist-confirmation { color: var(--success); font-weight: 800; }
.error { color: var(--error); font-weight: 800; }
.attempt-history { margin-top: 22px; border-top: 1px solid var(--border); }
.attempt-history h2 { margin: 14px 0 6px; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; }
.attempt-list { list-style: none; padding: 0; margin: 0; }
.attempt-row { display: grid; grid-template-columns: 26px 86px 1fr; align-items: center; gap: 6px; min-height: 36px; border-bottom: 1px solid var(--border); font-size: .82rem; }
.attempt-row[data-current="true"] { color: var(--brand-dark); font-weight: 850; }
.attempt-marker { font-size: 1rem; }
.action-square { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--ink); background: var(--surface); }
.action-square[data-marker="wrong"] { background: var(--error); }
.action-square[data-marker="artist"] { background: var(--highlight); }
.action-square[data-marker="artwork"] { background: var(--success); }
.action-square[data-marker="reveal"] { background: #d4d5cf; }
.attempt-shapes { font-weight: 800; }
.attempt-label { color: var(--muted); }

.archive-intro { max-width: var(--reading); color: var(--muted); }
.archive-summary { display: inline-block; margin: 10px 0 22px; padding: 5px 10px; background: var(--highlight); font-size: .85rem; font-weight: 850; }
.archive-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 9px; }
.archive-tile { position: relative; min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; padding: 9px; border: 1.5px solid var(--ink); border-radius: var(--radius-small); background: var(--surface); color: var(--ink); text-decoration: none; }
.archive-tile:hover { box-shadow: 3px 3px 0 var(--ink); }
.archive-tile[data-status="complete"] { background: var(--success-soft); }
.archive-tile[data-status="in-progress"] { background: var(--warning-soft); }
.archive-tile[data-current="true"] { outline: 3px solid var(--brand); outline-offset: 2px; }
.tile-number { font-size: 1.05rem; font-weight: 900; }
.tile-date { color: var(--muted); font-size: .68rem; }
.tile-status { position: absolute; right: 8px; top: 7px; font-size: .9rem; }

#completion { max-width: 860px; margin: 0 auto; }
.result-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 22px 0 8px; padding: 10px 12px; border-left: 4px solid var(--ink); background: var(--surface); }
.result-banner[data-outcome="artwork"] { border-left-color: var(--success); background: var(--success-soft); }
.result-banner[data-outcome="artist-only"] { border-left-color: #9b7a00; background: var(--warning-soft); }
.completion-status-heading { margin: 0 0 3px; color: var(--muted); font-size: .7rem; line-height: 1.3; letter-spacing: .09em; text-transform: uppercase; }
.completion-status-heading:focus { outline: none; }
.result-summary { margin: 0; font-size: .92rem; font-weight: 750; }
.result-banner .artist-confirmation { font-size: .78rem; }
#points { flex: 0 0 auto; font-size: 1.1rem; }
.comparison { background: var(--warning-soft); border-left: 5px solid var(--highlight); padding: 12px; }
.completion-artwork { max-width: var(--reading); margin: 14px auto 20px; }
.completion-caption { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 16px; padding-top: 8px; color: var(--muted); font-size: .82rem; }
.reconstruction-explorer { margin-top: 8px; padding: 10px 2px 0; border-top: 1px solid var(--border); }
.reconstruction-explorer label { display: block; color: var(--ink); font-size: .76rem; font-weight: 850; letter-spacing: .04em; }
#reconstruction-slider { width: 100%; min-height: 44px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.explorer-extents { display: flex; justify-content: space-between; margin-top: -5px; color: var(--muted); font-size: .68rem; }
.about-page { margin-top: 0; }
.about-page > p { max-width: 65ch; }
.about-page.museum-placard h2 { margin: 28px 0 8px; font-family: var(--font-body); font-size: 1.2rem; }
.support-panel { margin-top: 30px; padding: 18px; border-left: 5px solid var(--brand); background: var(--warning-soft); }
.support-panel h2 { margin-top: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-nav a { color: var(--brand-dark); }
.museum-placard { max-width: var(--reading); margin: 32px auto 0; padding-top: 20px; border-top: 2px solid var(--ink); }
.museum-placard h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 2rem; }
.artwork-artist { font-size: 1.08rem; font-weight: 800; margin: 0; }
.attribution { color: var(--muted); font-size: .88rem; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 20px; }
.reference-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 20px; }
.share { max-width: var(--reading); margin: 26px auto 0; padding-top: 20px; border-top: 1px solid var(--border); }
.clipboard-helper { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.completion-links { max-width: var(--reading); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.archive-return { display: inline-block; margin-top: 26px; }
footer { max-width: var(--content); margin: 0 auto; padding: 22px 16px; border-top: 1px solid var(--border); color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; font-size: .76rem; }

dialog { width: min(500px, calc(100% - 28px)); max-height: 88vh; padding: 24px; border: 2px solid var(--ink); border-radius: var(--radius-medium); background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--brand); }
dialog::backdrop { background: rgb(25 32 29 / 65%); }
.dialog-heading h2 { margin: 0 0 16px; font-size: 2rem; }
.help-steps { list-style: none; padding: 0; margin: 0 0 22px; counter-reset: help; }
.help-steps li { position: relative; padding: 12px 0 12px 45px; border-top: 1px solid var(--border); counter-increment: help; }
.help-steps li::before { content: "0" counter(help); position: absolute; left: 0; color: var(--brand-dark); font-weight: 900; }
.help-steps strong, .help-steps span { display: block; }
.help-steps span { color: var(--muted); font-size: .9rem; }
#help-close { width: 100%; }

@media (min-width: 700px) {
  main { padding-inline: 28px; }
  .masthead { padding-inline: 28px; }
  .brand { font-size: 1.4rem; }
  .site-nav a { padding-inline: 14px; font-size: 1rem; }
  .guess-row { flex-direction: row; }
  #guess-button { width: auto; flex: 0 0 auto; }
  .archive-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
}
@media (min-width: 900px) {
  .play-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr); gap: 34px; align-items: start; }
  .puzzle-heading { grid-column: 1; }
  .guess-panel { padding-top: 54px; }
  .artwork-frame img { max-height: 70vh; }
}
@media (max-width: 390px) {
  .brand-mark { width: 34px; }
  .brand { font-size: 1.08rem; gap: 6px; }
  .site-nav a { padding-inline: 6px; font-size: .82rem; }
  .shape-badge { max-width: 92px; }
  .attempt-row { grid-template-columns: 24px 78px 1fr; }
}
@media (max-width: 360px) {
  .brand-mark { display: none; }
  .masthead { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
