:root {
  --paper: #f9f2ef;
  --surface: #fffaf6;
  --rose: #8e3655;
  --rose-dark: #61273f;
  --ink: #30212b;
  --muted: #6a4d5b;
  --line: #d9b8c5;
  --wash: #f2dde4;
  --gutter: clamp(1rem, 5vw, 4rem);
  --display: Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.6 "Trebuchet MS", system-ui, sans-serif; }
body.player-open { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; }
h1, h2 { font-family: var(--display); }
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .22em; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }
.skip { position: fixed; z-index: 2; top: .75rem; left: .75rem; transform: translateY(-200%); background: var(--surface); padding: .75rem; }
.skip:focus { transform: none; }
.wrap, .site-header, .legal-main { width: min(75rem, 100% - 2 * var(--gutter)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .35rem 1.5rem; padding-block: 1rem; border-bottom: 3px double var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 700 clamp(1.3rem, 3vw, 1.75rem)/1 var(--display); text-decoration: none; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 0 clamp(.75rem, 3vw, 1.5rem); }
.site-header nav a, .site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; }
.catalog { padding-block: clamp(2rem, 5vw, 4.5rem); }
.catalog-heading { max-width: 48rem; margin-bottom: clamp(1.5rem, 4vw, 2.75rem); }
.label { color: var(--rose-dark); font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.catalog-heading h1 { font-size: clamp(2.55rem, 6.5vw, 5.5rem); letter-spacing: -.045em; margin-block: .35rem .75rem; }
.catalog-heading > p:last-child { color: var(--muted); max-width: 54ch; }
.game-lane { display: grid; grid-template-columns: minmax(8rem, .65fr) repeat(2, minmax(0, 1.5fr)); gap: .75rem; border-top: 1px solid var(--line); padding-block: .85rem; }
.game-lane:last-child { border-bottom: 1px solid var(--line); }
.game-lane > h2 { align-self: center; font-size: clamp(1.15rem, 2vw, 1.65rem); color: var(--rose-dark); }
.game-entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6rem, 42%); min-width: 0; background: var(--surface); border: 1px solid var(--line); }
.game-entry img { width: 100%; height: 100%; min-height: 6rem; aspect-ratio: 4 / 3; object-fit: cover; }
.game-copy { display: flex; flex-direction: column; align-items: start; justify-content: space-between; gap: .5rem; padding: .65rem clamp(.65rem, 1.4vw, 1rem); }
.game-copy h3 { font-size: clamp(1rem, 1.7vw, 1.3rem); overflow-wrap: anywhere; }
.play, .memory button, #close-player { min-height: 44px; padding: .4rem .7rem; border: 1px solid var(--rose); background: var(--surface); color: var(--rose-dark); font-weight: 700; font-size: .9rem; }
.play:hover, .memory button[aria-pressed="true"], #close-player { color: white; background: var(--rose-dark); }
.info-section { padding-block: clamp(1.5rem, 4vw, 3rem); }
.info-section h2 { font-size: clamp(1.75rem, 3.5vw, 3rem); letter-spacing: -.025em; }
.player-info, .external { display: grid; grid-template-columns: 1fr 1.5fr; gap: .75rem 2rem; border-top: 1px solid var(--line); }
.info-section p { max-width: 62ch; }
.info-section p + p { margin-top: .65rem; }
.info-section a { display: inline-flex; align-items: center; min-height: 44px; }
.memory { background: var(--wash); padding-inline: clamp(1rem, 4vw, 3rem); }
.memory > p { margin-top: .65rem; }
.memory fieldset { border: 0; margin: 1rem 0 0; padding: 0; min-width: 0; }
.memory legend { color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.memory-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
#memory-status { color: var(--muted); font-size: .9rem; }
#recent { margin-top: 1rem; }
#recent-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .5rem; }
#recent-list li { display: flex; align-items: center; gap: .5rem; }
#recent-list img { width: 3rem; height: auto; }
#recent-list button { flex: 1; text-align: left; }
#recent-list strong { display: block; }
.external { margin-top: clamp(1.5rem, 4vw, 3rem); }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem 2rem; padding: 1.75rem var(--gutter); background: var(--rose-dark); color: white; }
.site-footer :focus-visible { outline-color: white; }
.site-footer p, .site-footer small { font-size: .85rem; }
.site-footer p { margin-top: .5rem; }
dialog { width: min(70rem, 100% - 1.25rem); max-width: none; max-height: calc(100dvh - 1.25rem); padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(48 33 43 / 85%); }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem 1rem; }
.player-bar span, #player-note { font-size: .85rem; color: var(--muted); }
.player-bar h2 { font-size: clamp(1rem, 3vw, 1.5rem); }
#close-player { flex-shrink: 0; }
#game-frame { display: block; width: 100%; height: min(60dvh, 42rem); border: 0; background: white; }
#player-note { padding: .75rem 1rem; }
.legal-main { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 3fr); gap: 2rem; padding-block: clamp(1.5rem, 5vw, 4rem); }
.legal-main aside { display: flex; flex-direction: column; }
.legal-main aside a { padding-block: .65rem; }
.legal-article { max-width: 70ch; }
.legal-article h1 { font-size: clamp(2rem, 5vw, 4rem); margin-bottom: 1rem; }
.legal-article h2 { margin-block: 1.5rem .5rem; }
.legal-article p + p { margin-top: .75rem; }
.legal-article code { overflow-wrap: anywhere; }
@media (max-width: 55rem) {
  .game-lane { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-lane > h2 { grid-column: 1 / -1; }
}
@media (max-width: 39rem) {
  .site-header { flex-direction: column; align-items: start; padding-bottom: .25rem; }
  .site-header nav { justify-content: space-between; width: 100%; gap: 0 .4rem; }
  .site-header nav a { font-size: .85rem; }
  .game-lane, .player-info, .external, .legal-main { grid-template-columns: 1fr; }
  .game-entry { grid-template-columns: minmax(0, 1fr) 38%; }
  .game-entry img { min-height: 5.5rem; }
  .legal-main aside { flex-direction: row; flex-wrap: wrap; gap: 0 1rem; }
}
