:root {
  --paper:#fcfaf4;
  --ink:#382a22;
  --muted:#6d6055;
  --line:#d7d0c5;
  --mint:#c4ebd8;
  --green:#20593f;
  --surface:#f0eee6;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--ink);
  background:var(--paper);
  font-size:16px;
  line-height:1.5;
  scrollbar-gutter:stable;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
}

button,input {
  font:inherit;
}

a {
  color:inherit;
  text-underline-offset:4px;
}

a:hover {
  color:var(--green);
}

button,a,input,summary {
  -webkit-tap-highlight-color:transparent;
}

button {
  cursor:pointer;
}

button,a,summary {
  touch-action:manipulation;
}

button {
  min-height:44px;
  border:1px solid var(--ink);
  border-radius:5px;
  padding:8px 16px;
  background:var(--paper);
  color:var(--ink);
  font-weight:700;
}

button:hover {
  background:var(--mint);
}

button:disabled {
  opacity:.5;
  cursor:default;
}

a:focus-visible,button:focus-visible,input:focus-visible,summary:focus-visible {
  outline:3px solid var(--green);
  outline-offset:4px;
}

[hidden] {
  display:none!important;
}

.skip {
  position:absolute;
  top:8px;
  left:16px;
  transform:translateY(-180%);
  z-index:10;
  padding:10px;
  background:var(--mint);
}

.skip:focus {
  transform:none;
}

.wrap {
  width:min(1160px,calc(100% - 48px));
  margin:auto;
}

.site-header {
  border-bottom:1px solid var(--line);
}

.header-inner {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
  min-height:90px;
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  font-size:23px;
  font-weight:800;
  letter-spacing:-1px;
}

.brand-mark {
  width:30px;
  height:36px;
  border:2px solid var(--ink);
  border-radius:8px 2px 8px 2px;
  background:var(--mint);
  position:relative;
}

.brand-mark:after {
  content:'';
  position:absolute;
  inset:8px 5px;
  border-top:2px solid var(--ink);
  border-bottom:2px solid var(--ink);
}

nav {
  display:flex;
  flex-wrap:wrap;
  gap:4px 20px;
}

nav a {
  display:flex;
  align-items:center;
  min-height:44px;
  text-decoration:none;
}

nav a[aria-current=page] {
  font-weight:700;
  text-decoration:underline;
  text-decoration-thickness:3px;
  text-decoration-color:var(--green);
}

main {
  padding-bottom:40px;
}

h1,h2,h3,p {
  margin:0;
}

h1 {
  font-size:clamp(30px,3.4vw,46px);
  letter-spacing:-1.5px;
  line-height:1.12;
}

h2 {
  font-size:24px;
  line-height:1.25;
  letter-spacing:-.5px;
}

h3 {
  font-size:19px;
  line-height:1.3;
}

p+p {
  margin-top:12px;
}

.page-intro {
  padding:28px 0 24px;
}

.page-intro p {
  margin-top:10px;
  color:var(--muted);
}

.content-block {
  margin:0 0 24px;
  padding:22px 0;
  border-top:1px solid var(--line);
}

.topic-heading {
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:16px;
  margin-bottom:18px;
}

.topic-heading p {
  color:var(--muted);
}

.folio-pair {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
}

.folio-card {
  display:grid;
  grid-template-columns:144px 1fr;
  gap:20px;
  align-items:center;
  min-width:0;
}

.card-art {
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--surface);
  border-radius:10px;
  aspect-ratio:4/3;
  min-width:0;
}

.card-art img {
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:10px;
}

.image-fallback {
  padding:12px;
  text-align:center;
  color:var(--muted);
}

.folio-card h3 a {
  text-decoration:none;
}

.category-label {
  display:block;
  font-size:14px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:700;
  margin-bottom:5px;
}

.folio-card .rule-cue {
  display:block;
  margin-top:8px;
}

.card-go {
  display:flex;
  justify-content:space-between;
  align-items:center;
  min-height:44px;
  font-size:16px;
  font-weight:700;
  color:var(--green);
  gap:8px;
}

.folio-card .card-go {
  width:fit-content;
  gap:20px;
}

.rule-cue {
  color:var(--muted);
  line-height:1.4;
}

.quiet-link {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  font-weight:700;
  color:var(--green);
}

.intro-link {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
}

.intro-link>div {
  min-width:0;
}

.intro-link .count {
  white-space:nowrap;
  padding:9px 14px;
  background:var(--mint);
  border-radius:24px;
  font-weight:700;
  text-decoration:none;
  min-height:44px;
}

.note-link {
  display:flex;
  justify-content:space-between;
  gap:24px;
  align-items:center;
}

.note-link p {
  margin-top:8px;
  color:var(--muted);
}

.search-region {
  padding:0;
  margin-bottom:4px;
}

.search-line {
  display:flex;
  gap:8px;
}

.search-line form {
  display:flex;
  gap:8px;
  flex:1;
  min-width:0;
}

.search-line input {
  width:100%;
  min-width:0;
  border:1px solid var(--line);
  background:white;
  color:var(--ink);
  border-radius:5px;
  padding:8px 12px;
  min-height:44px;
  font-size:16px;
}

.search-line button {
  white-space:nowrap;
}

.search-status {
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:space-between;
  min-height:30px;
  font-size:14px;
  color:var(--muted);
}

.search-status .text-button {
  font-size:16px;
  font-weight:400;
  min-height:44px;
  padding:0 4px;
  border:0;
  background:transparent;
  text-decoration:underline;
}

.status-left {
  display:flex;
  flex-wrap:wrap;
  gap:0 8px;
}

.batch-caption {
  font-size:14px;
  color:var(--muted);
  margin-bottom:16px;
}

.game-matrix {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px 36px;
}

.matrix-card {
  min-width:0;
}

.matrix-link {
  display:grid;
  grid-template-columns:136px 1fr;
  gap:18px;
  text-decoration:none;
  min-width:0;
  align-items:start;
}

.matrix-copy {
  min-width:0;
}

.matrix-copy h2 {
  font-size:20px;
  line-height:1.25;
  letter-spacing:-.3px;
  overflow-wrap:anywhere;
}

.matrix-copy .rule-cue {
  display:block;
  margin-top:8px;
}

.matrix-link:hover h2 {
  text-decoration:underline;
}

.batch-tail {
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  margin-top:20px;
  color:var(--muted);
  font-size:14px;
}

.batch-finished {
  font-size:14px;
}

.catalogue-batch {
  padding-top:16px;
}

.catalogue-batch+.catalogue-batch {
  border-top:2px solid var(--ink);
}

.empty {
  padding:30px 0;
}

.empty p {
  margin:12px 0 20px;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  clip-path:inset(50%);
  white-space:nowrap;
  overflow:hidden;
}

.filter-dialog {
  color:var(--ink);
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:12px;
  padding:0;
  width:min(480px,calc(100% - 24px));
  max-width:calc(100% - 24px);
  max-height:calc(100dvh - 24px);
}

.filter-dialog::backdrop {
  background:#231b15aa;
}

.dialog-layout {
  display:flex;
  flex-direction:column;
  max-height:calc(100dvh - 26px);
}

.dialog-head,.dialog-actions {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:16px 20px;
  flex-shrink:0;
}

.dialog-head {
  flex-wrap:wrap;
  border-bottom:1px solid var(--line);
}

.dialog-head h2 {
  flex:1 1 160px;
  min-width:0;
  overflow-wrap:anywhere;
  font-size:22px;
}

.dialog-head button {
  flex:0 0 auto;
}

.dialog-body {
  overflow-y:auto;
  padding:16px 20px;
  overscroll-behavior:contain;
}

.dialog-body p {
  color:var(--muted);
  margin-bottom:16px;
}

.dialog-body details {
  border-top:1px solid var(--line);
}

summary {
  min-height:48px;
  padding:10px 0;
  cursor:pointer;
  font-weight:700;
  font-size:16px;
}

fieldset {
  border:0;
  margin:0;
  padding:0 0 12px;
}

legend {
  padding:0 0 8px;
  font-size:16px;
}

.radio-row {
  display:flex;
  align-items:center;
  gap:10px;
  min-height:48px;
  border-radius:4px;
  padding:6px 10px;
  font-size:16px;
}

.radio-row:hover,.radio-row:has(input:checked) {
  background:var(--mint);
}

.radio-row input {
  width:20px;
  height:20px;
  flex-shrink:0;
  accent-color:var(--green);
}

.radio-row span:first-of-type {
  min-width:0;
  overflow-wrap:anywhere;
}

.radio-row [data-count] {
  margin-left:auto;
}

.dialog-actions {
  flex-wrap:wrap;
  border-top:1px solid var(--line);
  padding-bottom:max(16px,env(safe-area-inset-bottom));
}

.primary {
  background:var(--ink);
  color:white;
}

.primary:hover {
  color:var(--ink);
}

.prose {
  max-width:760px;
}

.prose h2 {
  margin-bottom:14px;
}

.prose p {
  line-height:1.65;
}

.prose ul {
  padding-left:24px;
  margin:12px 0;
}

.prose li+li {
  margin-top:8px;
}

.prose .quiet-link {
  margin-top:10px;
}

.reading-index {
  display:flex;
  gap:8px 24px;
  flex-wrap:wrap;
  padding-bottom:20px;
}

.reading-index a {
  min-height:44px;
  display:flex;
  align-items:center;
}

.note-example {
  margin-top:18px;
  display:grid;
  grid-template-columns:80px 1fr;
  gap:16px;
  align-items:center;
}

.note-example img {
  width:80px;
  height:60px;
  object-fit:cover;
  border-radius:6px;
}

.note-example a {
  font-weight:700;
}

.note-example p {
  color:var(--muted);
  margin-top:4px;
}

.breadcrumb {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin:20px 0 16px;
  color:var(--muted);
}

.breadcrumb a {
  min-height:44px;
  display:flex;
  align-items:center;
}

.game-heading {
  display:flex;
  align-items:start;
  gap:20px;
  justify-content:space-between;
  margin-bottom:20px;
}

.game-heading h1 {
  font-size:clamp(28px,3vw,40px);
  max-width:850px;
  overflow-wrap:anywhere;
}

.game-heading .category-label {
  margin-top:8px;
}

.game-heading a {
  flex-shrink:0;
}

.rule-panels {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:36px;
}

.rule-panels h2 {
  font-size:22px;
  margin-bottom:12px;
}

.rule-panels p {
  max-width:65ch;
}

.source-note {
  color:var(--muted);
  font-size:14px;
  margin-top:10px;
}

.player-shell {
  background:#251d18;
  color:#fff;
  border-radius:12px;
  margin:0 0 26px;
}

.player-toolbar {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding:12px;
}

.player-toolbar button {
  font-size:16px;
  border-color:#8a7c6f;
  background:transparent;
  color:#fff;
}

.player-toolbar button:hover {
  background:var(--mint);
  color:var(--ink);
}

.player-toolbar .player-label {
  margin-right:auto;
  font-weight:700;
  padding-right:12px;
}

.stage {
  width:100%;
  aspect-ratio:16/9;
  position:relative;
  min-height:240px;
  background:#181411;
  border-radius:0 0 12px 12px;
}

.preview {
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:28px;
  padding:28px;
}

.preview-image {
  width:min(36%,300px);
  aspect-ratio:4/3;
  display:flex;
  align-items:center;
  justify-content:center;
}

.preview img {
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:10px;
}

.preview-copy {
  max-width:300px;
}

.preview-copy h2 {
  font-size:25px;
}

.preview-copy p {
  color:#d3c7b9;
  margin:12px 0 18px;
}

.preview-copy button {
  background:var(--mint);
  border:0;
  color:var(--ink);
  min-width:140px;
}

.stage iframe {
  display:block;
  width:100%;
  height:100%;
  position:absolute;
  inset:0;
  border:0;
}

.player-status {
  padding:10px 16px 14px;
  color:#e3d7ca;
  font-size:14px;
  line-height:1.45;
}

.player-shell:fullscreen {
  width:100%;
  height:100%;
  margin:0;
  border:0;
  border-radius:0;
  padding:0;
  display:flex;
  flex-direction:column;
  max-width:none;
  max-height:none;
  min-height:0;
  aspect-ratio:auto;
}

.player-shell:fullscreen .stage {
  flex:1;
  aspect-ratio:auto;
  min-height:0;
  max-height:none;
  border:0;
  border-radius:0;
}

.player-shell:fullscreen .player-toolbar {
  padding:6px 10px;
  flex-shrink:0;
}

.player-shell:fullscreen .player-status {
  padding:4px 10px 6px;
  flex-shrink:0;
}

.player-shell:fullscreen iframe {
  max-height:none;
  min-height:0;
  aspect-ratio:auto;
}

.player-shell:fullscreen .preview {
  padding:12px;
}

:root:has(.player-shell:fullscreen) {
  scrollbar-gutter:auto;
}

.related .folio-card {
  grid-template-columns:100px 1fr;
}

.description-block details {
  margin-top:14px;
}

.description-block summary {
  width:fit-content;
}

.description-block .provided {
  margin-top:12px;
  max-width:70ch;
  color:var(--muted);
  overflow-wrap:anywhere;
}

.site-footer {
  border-top:1px solid var(--line);
  padding:24px 0 30px;
  background:var(--surface);
}

.footer-inner {
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:start;
}

.footer-inner p {
  font-size:14px;
  color:var(--muted);
}

.site-footer nav {
  gap:0 18px;
  font-size:14px;
}

.footer-note {
  font-size:14px;
  color:var(--muted);
  margin-top:12px;
}

.site-footer .brand-name {
  font-size:18px;
  font-weight:700;
  color:var(--ink);
}

@media(min-width:1250px) {
  .folio-card {
    grid-template-columns:170px 1fr;
  }

  .matrix-link {
    grid-template-columns:160px 1fr;
  }

}

@media(max-width:800px) {
  .wrap {
    width:calc(100% - 32px);
  }

  .header-inner {
    gap:12px;
    min-height:0;
    padding:16px 0;
    flex-wrap:wrap;
  }

  .site-header nav {
    width:100%;
    justify-content:space-between;
    gap:4px 12px;
  }

  .site-header nav a {
    min-height:44px;
  }

  .brand {
    font-size:22px;
  }

  .page-intro {
    padding:22px 0;
  }

  .page-intro h1 {
    font-size:34px;
  }

  .topic-heading {
    display:block;
    margin-bottom:16px;
  }

  .topic-heading p {
    margin-top:6px;
  }

  .folio-pair {
    gap:20px;
  }

  .folio-card {
    grid-template-columns:100px 1fr;
    gap:14px;
    align-items:start;
  }

  .folio-card h3 {
    font-size:18px;
  }

  .folio-card .category-label {
    font-size:13px;
  }

  .folio-pair {
    grid-template-columns:1fr;
  }

  .content-block {
    padding:20px 0;
    margin-bottom:18px;
  }

  .matrix-link {
    display:block;
  }

  .matrix-link .card-art {
    aspect-ratio:2/1;
  }

  .matrix-copy {
    display:block;
    padding-top:8px;
  }

  .matrix-copy h2 {
    font-size:17px;
    line-height:1.25;
  }

  .matrix-copy .category-label {
    display:none;
  }

  .matrix-copy .rule-cue {
    font-size:16px;
    line-height:1.35;
    margin-top:6px;
  }

  .game-matrix {
    gap:20px 16px;
  }

  .batch-caption {
    margin-bottom:12px;
  }

  .batch-tail {
    margin-top:16px;
  }

  .matrix-copy .card-go {
    display:none;
  }

  .search-line button {
    padding:8px 12px;
  }

  .search-status {
    font-size:13px;
    gap:4px;
  }

  .status-left {
    gap:0 5px;
  }

  .rule-panels {
    grid-template-columns:1fr;
    gap:0;
  }

  .rule-panels .content-block {
    margin-bottom:18px;
  }

  .footer-inner {
    display:block;
  }

  .site-footer nav {
    margin-top:12px;
  }

  .note-link {
    display:block;
  }

  .note-link .quiet-link {
    display:flex;
    width:fit-content;
    margin-top:12px;
  }

  .game-heading {
    display:block;
  }

  .game-heading>a {
    margin-top:8px;
  }

  .player-toolbar .player-label {
    display:none;
  }

  .stage {
    aspect-ratio:4/3;
    min-height:260px;
  }

  .preview {
    gap:14px;
    padding:20px;
  }

  .preview-image {
    flex:0 0 96px;
    width:96px;
  }

  .preview-copy {
    flex:1;
    min-width:0;
    max-width:260px;
  }

  .preview-copy h2 {
    font-size:21px;
  }

  .preview-copy p {
    font-size:16px;
  }

  .player-toolbar {
    gap:6px;
    padding:10px;
  }

  .player-toolbar button {
    padding:8px 10px;
  }

  .related .folio-card {
    grid-template-columns:90px 1fr;
  }

  .intro-link {
    gap:12px;
  }

  .intro-link .count {
    font-size:14px;
    padding:8px 12px;
  }

}

@media(max-width:360px) {
  .wrap {
    width:calc(100% - 24px);
  }

  .site-header nav {
    font-size:15px;
  }

  .game-matrix {
    gap:18px 12px;
  }

  .matrix-copy h2 {
    font-size:16px;
  }

  .matrix-copy .card-go {
    display:none;
  }

  .folio-card {
    grid-template-columns:86px 1fr;
    gap:12px;
  }

  .page-intro h1 {
    font-size:30px;
  }

  .search-line {
    gap:6px;
  }

  .search-line form {
    gap:6px;
  }

  .search-line button {
    padding:8px;
  }

  .search-line input {
    padding:8px;
  }

  .search-status {
    display:block;
    min-height:32px;
  }

  .status-left {
    display:inline-flex;
  }

  .search-status .text-button {
    margin-left:6px;
  }

  .search-region {
    padding-bottom:8px;
  }

  .preview {
    padding:18px;
    display:block;
    text-align:center;
  }

  .preview-image {
    width:96px;
    height:72px;
    margin:0 auto 12px;
  }

  .preview-copy {
    margin:auto;
  }

  .preview-copy h2 {
    font-size:19px;
  }

  .preview-copy p {
    margin:6px 0 10px;
  }

  .stage {
    min-height:330px;
  }

  .intro-link .count {
    max-width:90px;
    text-align:center;
    white-space:normal;
  }

  .player-toolbar {
    gap:4px;
  }

  .player-toolbar button {
    padding:8px;
    font-size:16px;
  }

}

@media(max-height:450px) {
  .filter-dialog {
    max-height:calc(100dvh - 12px);
  }

  .dialog-layout {
    max-height:calc(100dvh - 14px);
  }

  .dialog-head,.dialog-actions {
    padding:8px 14px;
  }

  .dialog-body {
    padding:8px 14px;
  }

  .player-shell:fullscreen .player-toolbar button {
    min-height:44px;
    padding:6px 12px;
  }

  .player-shell:fullscreen .player-status {
    font-size:12px;
  }

  .player-shell:fullscreen .preview {
    display:flex;
    text-align:left;
  }

  .player-shell:fullscreen .preview-image {
    width:110px;
    height:80px;
    margin:0;
  }

  .player-shell:fullscreen .preview-copy {
    margin:0;
  }

}

@media(prefers-reduced-motion:no-preference) {
  a,button {
    transition:background-color .15s,color .15s;
  }

}


/* Filled preview cells and native links for complete game cards. */
.folio-card, .note-example { color: inherit; text-decoration: none; }
.folio-card:hover h3, .note-example:hover strong { color: var(--green); text-decoration: underline; }

.matrix-link { height: 100%; }
