:root {
  --sky: #e8f3f8;
  --paper: #fff9ee;
  --brown: #3b2c24;
  --wood: #85644b;
  --blue: #215d78;
  --line: #c7b69d;
  --muted: #63574d;
  font-family: "Trebuchet MS", Arial, sans-serif;
  color: var(--brown);
  background: var(--sky);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
body.modal-open { position: fixed; width: 100%; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: 4px; }
a, button, input, summary { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; font-size: 16px; }
button, .button { min-height: 44px; border: 1px solid var(--brown); border-radius: 4px; padding: 8px 15px; background: var(--paper); color: var(--brown); font-weight: bold; cursor: pointer; }
button:hover, .button:hover { background: #e2edf0; }
button:disabled { cursor: default; color: var(--muted); border-color: var(--line); }
.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.primary:hover { background: #17465b; }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
:focus-visible { outline: 3px solid #bc560d; outline-offset: 4px; }
.skip { position: absolute; top: -100px; left: 12px; z-index: 10; background: white; padding: 12px; }
.skip:focus { top: 10px; }
.site-header { border-bottom: 2px solid var(--brown); background: var(--paper); }
.header-inner { max-width: 1200px; margin: auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 25px; font-weight: bold; color: var(--brown); text-decoration: none; white-space: nowrap; }
.book-mark { display: inline-flex; align-items: end; gap: 3px; height: 28px; border-bottom: 3px solid var(--brown); padding: 0 3px 3px; }
.book-mark i { width: 6px; height: 21px; display: block; background: var(--blue); }
.book-mark i:nth-child(2) { height: 25px; background: #aa5936; }
.book-mark i:nth-child(3) { height: 17px; background: var(--wood); }
nav a { display: inline-flex; min-height: 44px; padding: 9px 12px; align-items: center; }
.main-nav { display: flex; flex-wrap: wrap; }
.main-nav a { color: var(--brown); text-decoration: none; }
.main-nav a[aria-current="page"] { text-decoration: underline; font-weight: bold; }
main { max-width: 1200px; padding: 20px 24px 36px; margin: auto; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(28px, 3.4vw, 39px); margin: 0 0 8px; }
h2 { font-size: 24px; margin: 0; }
h3 { font-size: 18px; margin: 0 0 6px; }
p { margin: 8px 0; }
.page-intro { margin-bottom: 20px; }
.page-intro p { margin-bottom: 0; }
.meta { color: var(--muted); font-size: 14px; }
.shelf-block { margin: 0 0 28px; background: var(--paper); border: 1px solid var(--line); border-bottom: 9px solid var(--wood); border-radius: 4px 4px 0 0; box-shadow: 0 4px 0 #dbc7aa; padding: 16px; }
.shelf-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.shelf-heading h2 { font-size: 22px; }
.shelf-label { font-size: 14px; color: var(--muted); }
.game-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-spine { min-width: 0; display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 12px; padding: 12px; background: #fffdf7; border: 1px solid #dfd1ba; border-left: 5px solid var(--blue); border-radius: 3px; text-decoration: none; color: var(--brown); align-content: start; }
.game-spine:nth-child(3n+2) { border-left-color: #a95f3c; }
.game-spine:nth-child(3n) { border-left-color: #70844e; }
.game-spine:hover { background: #eef5f7; border-top-color: var(--blue); }
.game-spine img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: #e6e0d5; border-radius: 2px; }
.game-copy { min-width: 0; }
.game-copy h3 { font-size: 17px; }
.game-copy .controls { font-size: 14px; color: var(--muted); display: block; }
.game-copy p { font-size: 16px; margin: 6px 0; }
.card-action { color: var(--blue); font-size: 14px; display: block; margin-top: 7px; font-weight: bold; }
.image-fallback { display: block; font-size: 14px; }
.shelf-footer { min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.shelf-footer p { font-size: 14px; }
.label-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.category-label { display: block; min-width: 0; padding: 16px; border-left: 6px solid var(--blue); background: #fffdf7; color: var(--brown); }
.category-label strong { font-size: 21px; }
.category-label p { margin: 4px 0 0; }
.prose { max-width: 760px; }
.prose p { margin: 12px 0 0; }
.prose h2 { font-size: 23px; }
.small-note { background: transparent; border: 1px solid var(--line); box-shadow: none; }
.search-tools { padding: 6px 0; margin: 0 0 12px; min-width: 0; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; min-width: 0; }
.search-form input { width: 100%; min-width: 0; flex: 1; min-height: 44px; padding: 9px 12px; border: 1px solid var(--wood); border-radius: 4px; background: #fffdf7; }
.search-form button { padding: 7px 12px; }
.search-state { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; min-height: 24px; margin-top: 4px; font-size: 14px; }
.search-state p { min-width: 0; margin: 0; }
.clear-link { border: 0; padding: 0 8px; min-height: 44px; background: transparent; text-decoration: underline; font-size: 14px; }
.search-state .clear-link { min-height: 44px; }
/* Clip only intentionally hidden accessible labels, including their scroll overflow. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.spine-arrow { color: var(--blue); font-weight: bold; }
.filter-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 2px solid var(--brown); border-radius: 8px; background: var(--paper); color: var(--brown); }
.filter-dialog::backdrop { background: #241d17b8; }
.dialog-layout { display: flex; flex-direction: column; max-height: calc(100dvh - 30px); }
.dialog-header, .dialog-footer { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; flex-shrink: 0; background: var(--paper); }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 22px; }
.dialog-body { padding: 4px 16px 14px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.dialog-body p { font-size: 16px; }
.dialog-footer { border-top: 1px solid var(--line); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.filter-group { border-bottom: 1px solid var(--line); }
.filter-group summary { cursor: pointer; padding: 13px 0; min-height: 48px; font-size: 17px; font-weight: bold; }
fieldset { padding: 0; margin: 0 0 12px; border: 0; min-width: 0; }
.radio-row { display: flex; align-items: center; gap: 12px; padding: 10px; min-height: 46px; font-size: 16px; border: 1px solid var(--line); margin: 6px 0; border-radius: 3px; cursor: pointer; }
.radio-row:has(input:checked) { background: #dcecf4; border-color: var(--blue); }
.radio-row input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--blue); }
.radio-row span { min-width: 0; flex: 1; }
.radio-row em { font-style: normal; }
.game-head { margin-bottom: 18px; }
.game-head .back { display: inline-flex; min-height: 44px; align-items: center; }
.player-block { padding: 14px; }
.player-stage { position: relative; aspect-ratio: 16 / 9; background: #211e1b; display: grid; place-items: center; min-width: 0; }
.player-stage img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.player-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #171717; }
.preview-label { z-index: 1; align-self: end; background: #fff9eef2; padding: 7px 12px; margin: 10px; text-align: center; }
.player-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.player-status { margin: 8px 0; }
.player-block:fullscreen { background: var(--paper); overflow-y: auto; padding: 12px; width: 100%; }
.player-block:fullscreen .player-stage { aspect-ratio: auto; height: calc(100dvh - 155px); min-height: 100px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.detail-grid > * { min-width: 0; }
.site-footer { max-width: 1200px; margin: auto; padding: 20px 24px; border-top: 2px solid var(--brown); }
.site-footer nav { display: flex; flex-wrap: wrap; margin-left: -12px; }
.site-footer p { font-size: 14px; }
@media (max-width: 1000px) {
  .game-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .header-inner { padding: 10px 16px 2px; flex-wrap: wrap; gap: 2px; }
  .brand { font-size: 24px; }
  .main-nav { width: 100%; justify-content: space-between; }
  .main-nav a { padding: 9px 4px; font-size: 14px; }
  main { padding: 18px 14px 28px; }
  .page-intro { margin-bottom: 16px; }
  .page-intro p { font-size: 16px; }
  .shelf-block { padding: 12px; margin-bottom: 24px; }
  .shelf-heading { align-items: start; gap: 8px; }
  .shelf-heading h2 { font-size: 21px; }
  .shelf-label { font-size: 13px; }
  .game-row, .home-row, .label-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .game-spine { grid-template-columns: 80px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .game-copy h3 { font-size: 17px; }
  .game-copy p { font-size: 16px; }
  .home-row .game-spine { grid-template-columns: 92px minmax(0, 1fr); }
  .category-label { padding: 12px; }
  .search-form { gap: 5px; }
  .search-form button { padding: 7px 9px; }
  .search-state { gap: 4px; }
  .shelf-footer { align-items: center; }
  .shelf-footer p { max-width: 58%; }
  .site-footer { padding: 18px 14px; }
  .player-block { padding: 10px; }
  .player-controls button { flex-grow: 1; padding: 8px 10px; }
  .detail-grid { gap: 0; }
}
@media (max-height: 450px) {
  .dialog-header, .dialog-footer { padding: 6px 12px; }
  .dialog-header h2 { font-size: 19px; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: background-color .12s ease; }
}

@media (min-width: 651px) {
  .search-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
  .search-state { margin-top: 0; min-height: 44px; }
}
