:root {
  color-scheme: light;
  --page: #f5f8fc;
  --surface: #ffffff;
  --soft-blue: #e8f1fb;
  --ink: #20354b;
  --muted: #52677d;
  --blue: #2366a2;
  --blue-hover: #164f82;
  --focus: #176fc4;
  --radius: 10px;
  --shell: 1100px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; min-width: 280px; line-height: 1.6; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button, input, select, dialog { color: inherit; }
button { border: 0; }
img, svg { display: block; }
img { max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
::selection { color: #163958; background: #cfe6ff; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .4; }
.shell { width: min(var(--shell), calc(100% - 64px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 200; top: 12px; left: 16px; padding: 12px 18px; color: white; background: var(--blue); transform: translateY(-160%); border-radius: 6px; }
.skip-link:focus { transform: translateY(0); }

.site-header { background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 82px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; min-height: 44px; font-size: 1.35rem; font-weight: 750; letter-spacing: .03em; }
.brand-mark { width: 36px; height: 32px; color: var(--blue); }
.header-inner nav { display: flex; align-items: center; gap: 24px; }
.header-inner nav > a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9375rem; }
.plain-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 12px; background: transparent; border-radius: 6px; color: var(--blue); font-weight: 600; }
.share-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.header-inner .share-button { font-size: .9375rem; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 10px; background: transparent; border-radius: 6px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 20px; color: white; background: var(--blue); border-radius: 7px; font-size: .9375rem; font-weight: 600; text-align: center; transition: background-color .16s ease, transform .16s ease; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); font-weight: 600; text-underline-offset: 5px; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: center; gap: 40px; min-height: 230px; padding: 28px 40px 26px 0; }
.intro h1 { font-size: 2rem; line-height: 1.25; font-weight: 750; letter-spacing: -.045em; }
.intro-copy > p { margin-top: 17px; font-size: 1.0625rem; color: var(--muted); }
.intro-copy .text-link { margin-top: 9px; font-size: .9375rem; }
.welcome-mascot { width: 205px; max-height: 218px; object-fit: contain; justify-self: center; transform: rotate(2deg); }
.catalog { padding-bottom: 64px; }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.catalog-heading > div { display: flex; align-items: baseline; gap: 16px; }
.catalog h2 { font-size: 1.625rem; line-height: 1.3; letter-spacing: -.02em; }
.catalog-count { font-size: .875rem; color: var(--muted); white-space: nowrap; }
.search-form { display: flex; align-items: center; gap: 10px; width: 278px; min-height: 48px; padding: 0 13px; background: var(--surface); border: 1px solid #c6d3e1; border-radius: 7px; }
.search-form > svg { color: var(--muted); }
.search-form input { width: 100%; min-width: 0; height: 46px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.search-form input::placeholder { color: #66798c; opacity: 1; }
.search-form:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-form .clear-search { width: 34px; height: 44px; margin-right: -8px; padding: 8px; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-button { min-height: 44px; padding: 9px 18px; border-radius: 7px; background: transparent; color: var(--muted); font-size: .9375rem; white-space: nowrap; transition: background-color .16s ease, color .16s ease; }
.filter-button[aria-pressed="true"] { background: var(--blue); color: white; font-weight: 600; }
.play-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 22px; }
.play-card { min-width: 0; }
.card-link { display: block; border-radius: var(--radius); }
.cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--radius); background: #e4edf6; isolation: isolate; }
.cover > img { width: 100%; height: 100%; max-width: none; object-fit: cover; transition: transform .28s ease; }
.cover-note { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 24px); padding: 5px 10px; background: white; color: #20354b; border-radius: 5px; font-size: .8125rem; font-weight: 600; }
.cover-action { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px; color: var(--blue); background: white; border-radius: 6px; text-align: center; font-size: .875rem; font-weight: 600; opacity: 0; transform: translateY(7px); transition: transform .2s ease, opacity .2s ease; }
.card-info { padding: 13px 1px 0; }
.card-info h3 { min-height: 1.4em; font-size: 1.0625rem; line-height: 1.4; font-weight: 700; letter-spacing: -.02em; transition: color .16s ease; }
.card-info p { margin-top: 3px; font-size: .875rem; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.card-link:focus-visible .cover-action { opacity: 1; transform: translateY(0); }
.empty-state { padding: 70px 16px 90px; text-align: center; }
.empty-state h3 { font-size: 1.4rem; }
.empty-state p { margin: 10px 0 24px; color: var(--muted); }

.site-footer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; min-height: 136px; padding-block: 28px; }
.footer-brand { font-size: 1.125rem; }
.footer-brand .brand-mark { width: 30px; }
.site-footer p { font-size: .875rem; color: var(--muted); }
.site-footer > a:last-child { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); font-size: .875rem; }

.detail-main { padding-top: 25px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-left: -7px; padding: 8px 7px; color: var(--blue); font-size: .9375rem; font-weight: 600; }
.detail-title-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 14px; }
.detail-title-row > div { min-width: 0; }
.detail-title-row h1 { font-size: 2rem; line-height: 1.3; letter-spacing: -.03em; }
.detail-title-row p { max-width: 740px; margin-top: 13px; color: var(--muted); font-size: 1rem; }
.detail-title-row > .button { flex-shrink: 0; }
.section-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.section-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 15px; color: var(--blue); background: var(--soft-blue); border-radius: 6px; font-size: .9375rem; font-weight: 600; }
.section-nav span { margin-left: 8px; color: var(--muted); font-size: .875rem; }
.poster-column { width: min(850px, 100%); margin: 31px auto 0; }
.poster-section { scroll-margin-top: 24px; margin-bottom: 48px; }
.poster-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.poster-heading h2 { font-size: 1.25rem; line-height: 1.4; }
.poster-heading .text-link { flex-shrink: 0; font-size: .9375rem; }
.poster-button { display: block; width: 100%; margin: 0; padding: 0; background: transparent; cursor: zoom-in; }
.poster-button img { display: block; width: 100%; height: auto; }
.poster-caption { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 13px; color: var(--muted); font-size: .875rem; }
.poster-caption svg { width: 17px; height: 17px; }
.poster-error { padding: 48px 16px; text-align: center; background: var(--soft-blue); border-radius: var(--radius); }
.poster-error p { margin-bottom: 12px; }
.poster-error > a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; color: var(--blue); }
.detail-end { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 2px 0 44px; }
.detail-end p { color: var(--muted); }
.missing-page { min-height: 55vh; padding-block: 80px; }
.missing-page h1 { max-width: 700px; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.3; }
.missing-page p { margin: 16px 0 26px; color: var(--muted); }

.toast { position: fixed; z-index: 100; bottom: max(26px, env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100% - 32px); padding: 13px 20px; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 8px; font-size: .9375rem; text-align: center; }
dialog { border: 0; }
dialog::backdrop { background: rgb(10 23 37 / 65%); }
.share-dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 24px; border-radius: 14px; background: var(--surface); }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-title h2 { font-size: 1.5rem; line-height: 1.3; }
.dialog-title .icon-button { margin-right: -8px; }
.share-dialog p { margin: 14px 0 18px; color: var(--muted); }
.share-dialog input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #bacbdc; border-radius: 6px; background: var(--page); font-size: 1rem; }
.share-dialog .button { margin-top: 20px; width: 100%; }
.image-viewer { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; color: var(--ink); background: #e8edf3; }
.image-viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 16px; min-height: 60px; padding: max(8px, env(safe-area-inset-top)) 20px 8px; background: var(--surface); }
#viewer-title { min-width: 0; font-size: 1rem; font-weight: 650; line-height: 1.4; }
.viewer-controls { display: flex; flex-shrink: 0; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 60px; padding: 7px 16px; background: var(--surface); }
.viewer-controls button { min-height: 44px; padding: 8px 16px; color: var(--blue); background: var(--soft-blue); border-radius: 6px; font-size: .9375rem; font-weight: 600; }
.zoom-label { min-width: 52px; margin-left: 8px; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.viewer-scroll { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; padding: 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.viewer-image { display: block; max-width: none; min-width: 0; height: auto; margin-inline: auto; user-select: none; -webkit-user-select: none; }

@media (hover: hover) {
  .header-inner nav > a:hover, .site-footer > a:last-child:hover, .back-link:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 5px; }
  .plain-button:hover, .icon-button:hover { background: var(--soft-blue); }
  .button:hover { background: var(--blue-hover); transform: translateY(-1px); }
  .text-link:hover { color: var(--blue-hover); text-decoration: underline; }
  .filter-button:hover:not([aria-pressed="true"]) { color: var(--blue); background: var(--soft-blue); }
  .card-link:hover .cover > img { transform: scale(1.025); }
  .card-link:hover .cover-action { opacity: 1; transform: translateY(0); }
  .card-link:hover h3 { color: var(--blue); }
  .section-nav a:hover, .viewer-controls button:hover:not(:disabled) { background: #d7e7f8; }
}
.button:active, .filter-button:active { transform: translateY(1px); }

@media (min-width: 650px) and (max-width: 999px) {
  .shell { width: calc(100% - 48px); }
  .play-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 18px; }
  .intro { grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; padding-right: 10px; min-height: 234px; }
  .welcome-mascot { width: 175px; max-height: 195px; }
  .catalog-heading > div { display: block; }
  .catalog-count { margin-top: 5px; }
  .site-footer { grid-template-columns: 1fr auto; gap: 6px 20px; }
  .site-footer p { grid-column: 1; }
  .site-footer > a:last-child { grid-column: 2; grid-row: 1 / 3; }
}

@media (max-width: 649px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { gap: 10px; min-height: 66px; }
  .brand { gap: 7px; font-size: 1.125rem; letter-spacing: 0; }
  .brand-mark { width: 29px; height: 27px; }
  .header-inner nav { gap: 7px; }
  .header-inner nav > a { font-size: .875rem; }
  .header-inner .share-button { gap: 5px; padding: 8px 4px; font-size: .875rem; }
  .header-inner .share-button svg { width: 17px; height: 17px; }
  .intro { grid-template-columns: minmax(0, 1fr) 111px; min-height: 174px; gap: 11px; padding: 24px 0 22px; }
  .intro h1 { font-size: clamp(1.6rem, 7.1vw, 2rem); line-height: 1.35; letter-spacing: -.045em; }
  .intro-copy > p { margin-top: 10px; max-width: 230px; font-size: .9375rem; line-height: 1.6; }
  .intro-copy .text-link { margin-top: 4px; font-size: .875rem; }
  .welcome-mascot { width: 111px; max-height: 155px; }
  .catalog { padding-bottom: 38px; }
  .catalog-heading { display: block; margin-bottom: 14px; }
  .catalog-heading > div { justify-content: space-between; gap: 12px; margin-bottom: 15px; }
  .catalog h2 { font-size: 1.375rem; }
  .catalog-count { font-size: .875rem; }
  .search-form { width: 100%; }
  .filter-row { flex-wrap: nowrap; gap: 3px; margin-bottom: 20px; }
  .filter-button { flex: 1 1 auto; padding: 9px 7px; font-size: .875rem; }
  .play-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .cover { border-radius: 8px; }
  .cover-note { top: 8px; left: 8px; max-width: calc(100% - 16px); padding: 4px 7px; font-size: .75rem; }
  .cover-action { left: 8px; right: 8px; bottom: 8px; padding: 8px 4px; font-size: .8125rem; }
  .card-info { padding-top: 10px; }
  .card-info h3 { font-size: 1rem; min-height: 1.4em; line-height: 1.4; letter-spacing: -.025em; }
  .card-info p { margin-top: 4px; font-size: .875rem; line-height: 1.5; }
  .site-footer { grid-template-columns: 1fr auto; gap: 7px 14px; min-height: 144px; padding-block: 25px; }
  .footer-brand { font-size: 1.0625rem; }
  .site-footer p { grid-column: 1 / -1; grid-row: 2; font-size: .8125rem; }
  .site-footer > a:last-child { grid-column: 2; grid-row: 1; }
  .detail-main { width: calc(100% - 24px); padding-top: 15px; }
  .detail-overview { padding-inline: 4px; }
  .detail-title-row { display: block; padding-top: 10px; }
  .detail-title-row h1 { font-size: 1.75rem; }
  .detail-title-row p { margin-top: 11px; font-size: .9375rem; }
  .detail-title-row > .button { margin-top: 17px; }
  .section-nav { margin-top: 17px; gap: 7px; }
  .section-nav a { padding-inline: 12px; font-size: .875rem; }
  .section-nav span { margin-left: 2px; font-size: .8125rem; }
  .poster-column { margin-top: 22px; }
  .poster-section { margin-bottom: 30px; }
  .poster-heading { margin-bottom: 9px; padding-inline: 4px; }
  .poster-heading h2 { font-size: 1.125rem; }
  .poster-heading .text-link { font-size: .875rem; }
  .poster-caption { margin-top: 11px; font-size: .8125rem; }
  .detail-end { padding: 4px 0 28px; gap: 13px; }
  .detail-end p { font-size: .9375rem; }
  .viewer-bar { gap: 10px; min-height: 60px; padding-inline: 12px; }
  #viewer-title { font-size: .9375rem; }
  .viewer-controls { flex-wrap: nowrap; gap: 6px; min-height: 60px; padding-inline: 12px; }
  .viewer-controls button { padding-inline: 12px; font-size: .875rem; }
  .zoom-label { min-width: 44px; margin-left: 2px; font-size: .8125rem; }
  .share-dialog { padding: 20px; }
  .share-dialog p { font-size: .9375rem; }
  .missing-page { padding-block: 60px; }
}

@media (max-width: 359px) {
  .shell { width: calc(100% - 24px); }
  .brand { font-size: 1rem; gap: 5px; }
  .brand-mark { width: 25px; }
  .header-inner nav { gap: 4px; }
  .header-inner .share-button svg { display: none; }
  .intro { grid-template-columns: minmax(0, 1fr) 90px; }
  .welcome-mascot { width: 90px; }
  .play-grid { gap: 22px 12px; }
  .filter-button { padding-inline: 4px; font-size: .8125rem; }
  .viewer-controls button { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Combinable difficulty, map and gameplay filters. */
.filter-panel { margin-bottom: 26px; }
.filter-panel .filter-row { margin-bottom: 12px; }
.filter-tools { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.filter-select { display: flex; flex-direction: column; gap: 5px; width: 190px; min-width: 0; }
.filter-select > span { font-size: .875rem; color: var(--muted); }
.filter-select select { width: 100%; min-width: 0; min-height: 46px; padding: 9px 32px 9px 12px; border: 1px solid #c6d3e1; border-radius: 7px; background-color: var(--surface); cursor: pointer; }
.reset-filters { margin-left: auto; min-height: 46px; font-size: .875rem; }
.filter-note { margin-top: 12px; color: var(--muted); font-size: .8125rem; line-height: 1.6; }
.card-info .card-types { margin-top: 6px; color: var(--blue); font-size: .8125rem; }
.detail-title-row .detail-filter-meta { font-size: .875rem; line-height: 1.8; color: var(--blue); }
@media (max-width: 649px) {
  .filter-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
  .filter-select { width: auto; }
  .filter-select select { font-size: 1rem; }
  .reset-filters { grid-column: 1 / -1; justify-self: end; margin-top: -4px; padding-block: 4px; min-height: 44px; }
  .filter-note { margin-top: 1px; }
}
