body {
  font-family: Arial, Helvetica, sans-serif;
  background: #fffcf6;
  color: #302e2a;
}
.site-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 30px;
  align-items: center;
  border-bottom: 2px solid #786c59;
}
.wordmark {
  font-weight: bold;
  text-decoration: none;
}
.primary-nav {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.quote-entry {
  display: grid;
  grid-template-columns: 40fr 60fr;
  gap: 30px;
  padding: 18px 0;
  border-top: 2px solid #81745f;
  margin-bottom: 18px;
}
.quote-game h2 {
  margin: 10px 0;
}
.quote-game img {
  max-height: 190px;
}
.source-quote {
  padding: 10px 0;
  border-bottom: 1px solid #c6baa7;
}
.source-quote blockquote {
  font:
    1.08rem/1.5 Georgia,
    serif;
  margin: 6px 0 12px;
}
.source-quote p {
  margin: 4px 0;
}
.source-field {
  font-size: 0.9rem;
  color: #655a4b;
}
.quote-caveat {
  padding: 12px 0;
  border-top: 2px solid #786c59;
  max-width: 70ch;
}
.result-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.clip-game-card {
  border-top: 1px solid #948571;
  padding: 10px 0;
}
.clip-game-card img {
  max-height: 125px;
}
.clip-game-card h3 {
  margin: 8px 0;
}
.clip-game-card p {
  margin: 4px 0;
}
.clip-group {
  border-top: 2px solid #81745f;
  padding: 12px 0;
}
.saved-quote {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid #c6baa7;
  padding: 12px 0;
}
.saved-quote h2 {
  margin: 0;
}
.saved-quote blockquote {
  margin: 8px 0;
  font-family: Georgia, serif;
}
.source-clip-options {
  padding: 12px 0;
  border-bottom: 1px solid #bfb39e;
}
[data-source-clips] {
  margin-top: 14px;
}
.game-heading {
  border-left: 4px solid #8b6f46;
  padding-left: 14px;
  margin-bottom: 16px;
}
@media (max-width: 999px) {
  .result-cards {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 649px) {
  .site-header {
    display: block;
  }
  .primary-nav {
    justify-content: flex-start;
    gap: 0 18px;
  }
  .quote-entry {
    display: block;
    padding: 12px 0;
  }
  .quote-game {
    display: grid;
    grid-template-columns: 35% minmax(0, 1fr);
    gap: 14px;
  }
  .quote-game h2 {
    margin: 0;
    font-size: 1.15rem;
  }
  .quote-game img {
    max-height: 130px;
  }
  .source-quote blockquote {
    font-size: 1rem;
  }
  .clip-game-card img {
    max-height: 100px;
  }
  .clip-game-card p {
    font-size: 0.95rem;
  }
  .saved-quote {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }
}

.quote-entry {
  display: block;
}
.quote-summary {
  display: grid;
  grid-template-columns: 40fr 60fr;
  gap: 30px;
}
.quote-summary blockquote {
  margin: 8px 0;
  font-family: Georgia, serif;
}
.quote-wording {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
}
@media (max-width: 649px) {
  .quote-summary {
    display: block;
  }
  .quote-summary > img {
    max-height: 140px;
  }
  .quote-summary h2 {
    font-size: 1.1rem;
  }
}

.result-row {
  padding: 6px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid #bac3c3;
}
.game-block .image-cell {
  display: block;
  position: relative;
  min-width: 0;
  min-height: 72px;
  aspect-ratio: 16/9;
  overflow: hidden;
  align-self: stretch;
}
.game-block .image-cell > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center;
  padding: 0 !important;
  margin: 0 !important;
  align-self: stretch;
}
.notice-item > .image-cell,
.notice-reading > .image-cell,
.index-frame > .image-cell,
.register-record > .image-cell,
.answer-example > .image-cell,
.switch-entry > .image-cell,
.picture-entry > .image-cell,
.saved-picture-head > .image-cell,
.question-game > .image-cell,
.saved-quote > .image-cell,
.quote-summary > .image-cell {
  aspect-ratio: auto;
  max-height: none;
  min-height: 90px;
}
.fact-frame > .image-cell {
  height: 170px;
}
.picture-choice > .game-block {
  display: block;
}
.picture-card-main > .image-cell,
.browser-card-main > .image-cell,
.picture-choice-main > .image-cell,
.answer-card > .image-cell,
.stage-choice > .image-cell,
.catalogue-notice > .image-cell,
.word-game > .image-cell,
.clip-game-card > .image-cell {
  height: 116px;
  aspect-ratio: auto;
}
.game-block {
  padding: 10px;
}
.picture-actions {
  padding: 0 10px 8px;
}
.compact-notices .notice-item > .image-cell {
  min-height: 88px;
}
.quote-summary > .image-cell {
  min-height: 130px;
}
@media (max-width: 999px) {
  .index-frame > .image-cell {
    height: 104px;
    aspect-ratio: 16/9;
  }
  .register-record > .image-cell {
    height: 90px;
    aspect-ratio: 16/9;
  }
}
@media (max-width: 649px) {
  .register-record > .image-cell {
    height: auto;
    aspect-ratio: auto;
  }
  .picture-entry > .image-cell,
  .quote-summary > .image-cell {
    height: 140px;
    aspect-ratio: 16/9;
  }
  .picture-card-main > .image-cell,
  .browser-card-main > .image-cell,
  .picture-choice-main > .image-cell,
  .answer-card > .image-cell,
  .stage-choice > .image-cell,
  .catalogue-notice > .image-cell,
  .word-game > .image-cell,
  .clip-game-card > .image-cell {
    height: 92px;
  }
  .compact-notices .notice-item {
    display: block;
  }
  .compact-notices .notice-item > .image-cell {
    height: 106px;
    aspect-ratio: 16/9;
  }
  .switch-entry.game-block {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .fact-frame > .image-cell {
    height: auto;
    min-height: 110px;
  }
  .quote-summary.game-block {
    display: block;
  }
}

.result-cards {
  align-items: start;
}
.register-leaves {
  align-items: start;
}
.register-leaves > .register-leaf:only-child,
.switch-listing > .game-block:only-child,
[data-notice-extra] > .game-block:only-child {
  grid-column: 1/-1;
}
.site-header {
  position: relative;
}
@media (max-height: 450px) {
  .site-header {
    padding-block: 6px;
  }
  .primary-nav {
    margin-top: 0;
  }
  .site-header a {
    min-height: 44px;
  }
  h1 {
    margin-block: 6px 10px;
  }
}

.game-block .image-cell {
  width: 100%;
  max-width: 100%;
}

/* Content first: identity and tools stay shallow; only navigation scrolls. */
.site-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 12px;
  padding-block: 6px;
  position: relative;
}
.site-header .wordmark {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 112px);
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}
.site-header .catalogue-trigger {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.catalogue-trigger svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.site-header .primary-nav {
  display: flex;
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0 18px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin: 0;
  border-top: 0;
  scrollbar-width: thin;
}
.site-header .primary-nav a {
  flex: 0 0 auto;
  min-width: 44px;
  white-space: nowrap;
  padding-inline: 2px;
}
.site-header .primary-nav a:focus-visible {
  outline-offset: -3px;
}
[data-results] {
  min-width: 0;
}
[data-catalogue-list] {
  display: grid;
  gap: 12px;
  align-items: start;
  padding-top: 8px;
}
[data-catalogue-item] {
  min-width: 0;
  margin: 0;
}
[data-catalogue-item][data-batch-start] {
  scroll-margin-block-start: 8px;
}
[data-catalogue-more] {
  margin-block: 12px 8px;
}
[data-search-form] {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-block: 12px;
}
[data-search-form] input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
}
[data-filter-dialog] .modal-body {
  padding-bottom: 8px;
}
.game-block h2,
.game-block h3 {
  line-height: 1.3;
}
@media (min-width: 1000px) {
  .site-header {
    flex-wrap: nowrap;
  }
  .site-header .wordmark {
    flex: 0 1 auto;
    max-width: none;
  }
  .site-header .primary-nav {
    flex: 1 1 auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  .catalogue-trigger {
    order: 3;
  }
}
@media (max-height: 600px) and (max-width: 999px) {
  .site-header .primary-nav {
    font-size: 0.9rem;
  }
  .game-block {
    padding: 8px;
  }
  [data-catalogue-list] {
    gap: 10px;
  }
}

@media (max-width: 999px) {
  .site-header {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .site-header .primary-nav {
    display: none;
  }
  .site-header .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    padding: 8px;
    background: transparent;
  }
  .site-header .wordmark {
    max-width: calc(100% - 104px);
  }
}
@media (min-width: 1000px) {
  .site-header .menu-toggle {
    display: none;
  }
}
.quote-summary {
  align-items: stretch;
}
.quote-summary h2 {
  margin: 0;
  font-size: 1.1rem;
}
.quote-wording {
  display: block;
  padding: 0 10px;
}
.quote-wording summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.quote-wording blockquote {
  font-family: Georgia, serif;
  margin: 8px 0;
}
.quote-entry {
  padding: 8px 0;
  margin-bottom: 12px;
}
.clip-group {
  border: 0;
  padding: 0;
}
.saved-quote-wrap {
  border-top: 1px solid #c6baa7;
}
.quote-summary > .image-cell {
  min-height: 96px;
}
@media (max-width: 649px) {
  .quote-summary.game-block {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
  }
  .quote-summary > .image-cell {
    height: 96px;
    min-height: 96px;
    aspect-ratio: auto;
  }
}

/* The site owns one condition form; panel placement follows its reading workflow. */
[data-filter-dialog] .condition-field {
  display: grid;
  gap: 6px;
  margin-block: 12px;
}
[data-filter-dialog] select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  font: inherit;
  color: inherit;
  background: transparent;
}
[data-filter-dialog] .radio-label {
  cursor: pointer;
}
[data-filter-dialog] .modal-layout {
  max-height: calc(100dvh - 26px);
}
[data-filter-dialog] .modal-head {
  border-bottom: 1px solid currentColor;
}
[data-filter-dialog] [data-category-options]:not(select) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
@media (max-width: 419px) {
  [data-filter-dialog] [data-category-options]:not(select) {
    grid-template-columns: 1fr;
  }
}
[data-filter-dialog] {
  width: min(500px, calc(100% - 24px));
  margin: auto;
  border-radius: 4px;
}
[data-filter-dialog] .modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
[data-filter-dialog] [data-search-form],
[data-filter-dialog] .modal-body > p {
  grid-column: 1/-1;
}
@media (max-width: 419px) {
  [data-filter-dialog] .modal-body {
    display: block;
  }
}

/* Short landscape keeps the existing native image and title side by side. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 999px) {
  .site-header {
    padding-block: 2px;
  }
  [data-catalogue-list] {
    padding-top: 4px;
  }
  .clip-game-card.game-block {
    display: grid;
    grid-template-columns: 38% minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 6px;
  }
  .clip-game-card.game-block > .image-cell {
    height: 68px;
    min-height: 68px;
  }
  .clip-game-card.game-block h3 {
    margin: 0;
  }
}

/* Rules 8–12: source-owned columns, compact continuous cards, full local preview. */
[data-discovery-grid] {
  display: grid;
  gap: 16px;
  align-items: start;
}
[data-discovery-grid] > * {
  min-width: 0;
  margin-block: 0;
}
[data-discovery-grid] .game-block {
  min-width: 0;
}
[data-discovery-grid] .game-block h2,
[data-discovery-grid] .game-block h3 {
  margin-block: 8px 0;
  font-size: 1rem;
  line-height: 1.3;
  min-height: 2.6em;
  max-height: 2.6em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
button,
[data-filter-dialog],
[data-discovery-grid] > * {
  border-radius: 4px;
}
.site-header .primary-nav {
  scrollbar-width: thin;
  gap: 0 16px;
}
.site-header .primary-nav::-webkit-scrollbar {
  height: 3px;
}
.site-header {
  border-bottom-width: 1px;
}
[data-filter-dialog] .modal-head {
  border-bottom: 1px solid rgb(100 110 115 / 0.25);
}
[data-filter-dialog] .radio-label {
  border-radius: 4px;
}
[data-filter-dialog] .radio-label:has(input:checked) {
  background: rgb(100 110 115 / 0.08);
}
.stage-screen {
  position: relative;
}
.stage-screen > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center;
  padding: 0;
  margin: 0;
}
@media (max-width: 649px) {
  [data-discovery-grid] {
    gap: 12px;
  }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 999px) {
  [data-discovery-grid] {
    gap: 12px;
  }
}
[data-quote-home] .quote-entry {
  margin: 0;
  padding: 0;
  border-top-width: 1px;
}
[data-quote-home] .quote-summary.game-block {
  display: block;
}
[data-quote-home] .quote-summary > .image-cell {
  height: 116px;
  min-height: 0;
  aspect-ratio: auto;
}
.quote-wording {
  padding: 0 10px 8px;
}
@media (max-width: 649px) {
  [data-quote-home] .quote-summary > .image-cell {
    height: 92px;
  }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 999px) {
  [data-discovery-grid] .quote-summary.game-block {
    display: grid;
    grid-template-columns: 40% minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }
  [data-discovery-grid] .quote-summary.game-block > .image-cell {
    height: 64px;
    min-height: 64px;
  }
}
