body {
  font-family: Arial, Helvetica, sans-serif;
  background: #fff;
  color: #303136;
}
.site-header {
  display: flex;
  gap: 28px;
  align-items: center;
  border-top: 5px solid #373b41;
  border-bottom: 1px solid #999;
}
.wordmark {
  font-weight: 700;
  text-decoration: none;
}
.primary-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
  flex-wrap: wrap;
}
.register-leaves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.register-leaf {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #9ba0a8;
  border-top: 3px solid #454c59;
  padding: 12px;
}
.leaf-initial {
  font:
    700 2.2rem/1.1 Georgia,
    serif;
  margin: 0;
  overflow-wrap: anywhere;
}
.leaf-entries {
  min-width: 0;
}
.register-record {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #c6c9ce;
  min-width: 0;
}
.register-record:first-child {
  padding-top: 0;
}
.register-record:last-child {
  border-bottom: 0;
}
.register-record h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}
.register-record p {
  font-size: 0.95rem;
  margin: 0;
  color: #4d5360;
}
.result-batch {
  border-bottom: 0;
  padding: 6px 0 18px;
}
.game-heading {
  border-bottom: 3px solid #596679;
  margin-bottom: 16px;
}
.prose h1 {
  font-family: Georgia, serif;
}
@media (max-width: 999px) {
  .register-leaves {
    gap: 18px;
  }
  .register-leaf {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 10px;
    gap: 10px;
  }
  .leaf-initial {
    font-size: 1.6rem;
  }
  .register-record {
    display: block;
  }
  .register-record img {
    max-height: 94px;
    width: 100%;
    margin-bottom: 8px;
  }
}
@media (max-width: 649px) {
  .site-header {
    display: block;
  }
  .primary-nav {
    gap: 0 18px;
  }
  .register-leaves {
    display: block;
  }
  .register-leaf {
    display: block;
    margin-bottom: 16px;
  }
  .leaf-initial {
    font-size: 1.4rem;
    margin: 0 0 8px;
    border-bottom: 1px solid #b7bdc6;
    padding-bottom: 6px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .register-record {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }
  .register-record img {
    margin: 0;
  }
  .register-record p {
    font-size: 0.95rem;
  }
}

.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;
  }
}
.register-leaves {
  gap: 12px;
}
.register-record {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  border: 0;
  border-top: 1px solid #9ba0a8;
  padding: 10px;
}
.register-record h3 {
  margin: 0;
}
.register-initial {
  display: block;
  font:
    700 1rem Georgia,
    serif;
  color: #4d5360;
  margin-bottom: 4px;
}
.register-record > .image-cell {
  height: 90px;
  min-height: 90px;
}
.register-record[data-register-pair] {
  border-bottom: 1px solid #c6c9ce;
}
@media (max-width: 649px) {
  .register-record {
  }
  .register-leaves {
    display: grid;
  }
}

/* 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(420px, calc(100% - 16px));
  margin: 8px auto 8px 8px;
  height: fit-content;
}
[data-filter-dialog] .modal-layout {
  height: auto;
}
[data-filter-dialog] .modal-body {
  flex: 0 1 auto;
}

/* 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;
  }
  .register-record.game-block {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 6px;
  }
  .register-record.game-block > .image-cell {
    height: 64px;
    min-height: 64px;
  }
  .register-record.game-block h3 {
    margin: 0;
  }
  .register-initial {
    margin-bottom: 2px;
  }
}

/* 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: 3px;
}
.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: 3px;
}
[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-catalogue-list] .register-record.game-block {
  display: block;
  border: 1px solid #c6c9ce;
  border-top: 2px solid #596679;
  padding: 10px;
}
[data-catalogue-list] .register-record > .image-cell {
  height: 116px;
  min-height: 0;
  aspect-ratio: auto;
}
[data-catalogue-list] .register-initial {
  display: none;
}
@media (max-width: 649px) {
  [data-catalogue-list] .register-record > .image-cell {
    height: 92px;
  }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 999px) {
  [data-discovery-grid] .register-record.game-block {
    display: grid;
    grid-template-columns: 40% minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }
  [data-discovery-grid] .register-record.game-block > .image-cell {
    height: 64px;
    min-height: 64px;
  }
}
