/* Shared small-screen layout, loaded last to keep responsive rules consistent. */
.mobile-menu-toggle {
  display: none
}

.section-nav .section-nav-track {
  width: 100%;
  margin: 0;
  min-width: 0
}

.section-nav-scroll {
  display: none
}

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

  .header-inner {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px 16px;
    height: auto;
    min-height: 0;
    padding: 12px 0 0
  }

  .header-inner .brand {
    min-width: 0
  }

  .header-inner .brand img {
    width: 110px;
    height: 46px
  }

  .header-search {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0
  }

  .search-field input {
    font-size: 16px;
    padding: 11px 10px 11px 0
  }

  .search-submit {
    min-height: 44px;
    min-width: 40px;
    padding: 10px
  }

  .search-results {
    width: min(350px, calc(100vw - 32px));
    max-height: 60vh
  }

  #main-nav {
    grid-column: 1/-1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    height: auto;
    gap: 0 10px;
    overflow: visible;
    order: initial;
    align-items: stretch;
    justify-content: initial
  }

  #main-nav a {
    justify-content: center;
    text-align: center;
    font-size: 14px;
    min-height: 44px;
    height: auto;
    white-space: normal;
    padding: 8px 0;
    line-height: 1.5
  }

  #main-nav a.active:after {
    bottom: 0;
    left: 15%;
    width: 70%
  }

  .hero .breadcrumbs {
    font-size: 14px;
    padding: 14px 0
  }

  .hero .hero-grid {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    padding: 2px 0 20px
  }

  .hero-game-icon {
    width: 86px;
    height: 86px;
    border-radius: 20px
  }

  .hero .hero-copy {
    display: contents
  }

  .hero .hero-copy h1 {
    grid-column: 2;
    align-self: center;
    font-size: clamp(25px, 4.3vw, 32px);
    line-height: 1.3;
    letter-spacing: -.6px;
    margin: 0;
    overflow-wrap: break-word
  }

  .hero .hero-copy h1 span {
    font-size: inherit;
    line-height: inherit
  }

  .hero .intro,
  .hero .tags,
  .hero .hero-actions {
    grid-column: 1/-1
  }

  .hero .intro {
    font-size: 16px;
    line-height: 1.75;
    margin: 0
  }

  .hero .tags {
    gap: 8px
  }

  .hero .tags>span {
    font-size: 14px;
    padding: 7px 11px
  }

  .hero .hero-actions {
    width: 100%;
    gap: 12px;
    margin: 0;
    min-width: 0
  }

  .platform-button {
    min-width: 0;
    min-height: 48px;
    height: auto;
    font-size: 15px;
    line-height: 1.5;
    padding: 12px 10px;
    gap: 8px
  }

  .hero .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 17px 4px;
    gap: 20px 0
  }

  .hero .stats>div {
    min-width: 0;
    gap: 10px;
    padding: 0 10px;
    border-right: 0
  }

  .hero .stats>div:nth-child(odd) {
    border-right: 1px solid var(--line)
  }

  .hero .stats p {
    font-size: 13px;
    min-width: 0;
    line-height: 1.6
  }

  .hero .stats strong {
    font-size: 15px;
    white-space: normal;
    overflow-wrap: break-word
  }

  .hero .stat-icon {
    width: 34px;
    height: 36px;
    flex-shrink: 0
  }

  .hero .stat-icon .icon {
    width: 21px;
    height: 21px
  }

  .section-nav nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0 22px;
    overflow: visible;
    padding: 5px 0
  }

  .section-nav a {
    font-size: 14px;
    min-height: 44px;
    padding: 10px 0;
    line-height: 1.6
  }

  .content-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
    padding-bottom: 32px
  }

  .main-column {
    display: contents
  }

  .content-layout .card {
    min-width: 0;
    width: 100%;
    padding: 22px;
    margin: 0
  }

  #about {
    order: 0
  }

  #screenshots {
    order: 1
  }

  #collection {
    order: 2
  }

  #features {
    order: 3
  }

  .content-layout>aside {
    order: 4;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: static;
    top: auto;
    align-self: stretch;
    max-height: none;
    overflow: visible;
    padding: 0;
    width: 100%;
    min-width: 0
  }

  #faq {
    order: 5
  }

  #reviews {
    order: 6
  }

  .section-heading {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px
  }

  .section-heading h2 {
    font-size: 22px;
    line-height: 1.45;
    min-width: 0;
    overflow-wrap: break-word
  }

  aside #app-information .section-heading h2 {
    font-size: 22px
  }

  .section-icon {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 9px
  }

  .card p {
    font-size: 16px;
    line-height: 1.8
  }

  .screenshots-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px
  }

  .screenshot {
    min-width: 0
  }

  .screenshot-placeholder {
    aspect-ratio: 3/4.2;
    min-height: 0;
    padding: 10px;
    gap: 8px
  }

  .screenshot-placeholder strong,
  .screenshot-placeholder small {
    display: none
  }

  .screenshot-placeholder .screen-outline {
    width: 34px;
    height: 54px;
    border-radius: 7px;
    flex-shrink: 0
  }

  .screen-outline:after {
    width: 10px;
    left: 10px;
    bottom: 5px
  }

  .screenshot figcaption {
    font-size: 14px;
    line-height: 1.5;
    margin-top: 9px
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px
  }

  .game-category {
    min-height: 130px;
    padding: 16px 10px
  }

  .game-category strong {
    font-size: 16px
  }

  .game-symbol {
    height: 65px
  }

  #features .section-heading {
    flex-wrap: nowrap
  }

  #features .section-heading h2 {
    font-size: 22px;
    min-width: 0;
    flex: 1
  }

  #features .feature-carousel {
    padding: 0 22px;
    min-width: 0
  }

  #features #feature-list {
    gap: 16px;
    max-width: 100%;
    min-width: 0
  }

  #features .feature-row {
    flex: 0 0 min(280px, 100%);
    padding: 24px 18px
  }

  #features .feature-row h3 {
    font-size: 17px;
    line-height: 1.6
  }

  #features .feature-row p {
    font-size: 14px;
    line-height: 1.8
  }

  #features .feature-scroll-controls button {
    width: 44px;
    height: 44px
  }

  #features #features-previous {
    left: -16px
  }

  #features #features-next {
    right: -16px
  }

  .app-information-table {
    font-size: 15px;
    line-height: 1.7
  }

  .app-information-table th:first-child {
    width: 45%;
    padding-right: 14px
  }

  .app-information-table code {
    font-size: 14px
  }

  aside .resource {
    min-width: 0;
    gap: 12px;
    padding: 18px 0
  }

  aside .resource>div {
    min-width: 0
  }

  aside .resource h3 {
    font-size: 16px;
    line-height: 1.5
  }

  aside .resource p {
    font-size: 15px;
    line-height: 1.75
  }

  .resource-explore {
    min-width: 20px
  }

  summary {
    font-size: 16px;
    line-height: 1.7;
    padding: 17px 26px 17px 0
  }

  #reviews .rating-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 22px
  }

  .average-rating-block {
    padding: 0 0 20px;
    border-right: 0;
    border-bottom: 1px solid #e1d7f0
  }

  .distribution-block {
    min-width: 0
  }

  .distribution-row {
    grid-template-columns: 30px minmax(0, 1fr) 22px 36px;
    gap: 8px;
    font-size: 14px
  }

  #reviews .review-source-label {
    margin-top: 8px
  }

  .review-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px
  }

  .review-controls label {
    min-width: 0;
    font-size: 14px
  }

  .review-controls select {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    min-height: 46px;
    padding: 10px
  }

  .review-header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 13px
  }

  .review-user {
    font-size: 15px;
    overflow-wrap: anywhere
  }

  .review-date {
    font-size: 13px
  }

  .review-header .stars {
    font-size: 15px;
    letter-spacing: 0;
    white-space: nowrap;
    margin: 0
  }

  .review h3 {
    font-size: 17px;
    line-height: 1.6
  }

  .review p {
    font-size: 16px;
    overflow-wrap: break-word
  }

  .review-tag {
    display: inline-block;
    font-size: 13px;
    line-height: 1.6;
    max-width: 100%;
    overflow-wrap: anywhere
  }

  .outline-button {
    min-height: 46px;
    font-size: 16px
  }

  .experience-heading {
    align-items: flex-start
  }

  .experience-heading h3 {
    font-size: 20px;
    line-height: 1.5
  }

  .experience-fields {
    grid-template-columns: 1fr;
    gap: 18px
  }

  .experience-form {
    gap: 20px;
    min-width: 0
  }

  .experience-form label {
    min-width: 0;
    font-size: 15px
  }

  .experience-form label>select,
  .experience-form label>textarea {
    font-size: 16px;
    min-height: 46px;
    max-width: 100%
  }

  .experience-rating {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px
  }

  .experience-rating label {
    justify-content: center;
    gap: 5px;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 14px
  }

  .experience-rating input {
    width: 16px;
    height: 16px;
    flex-shrink: 0
  }

  .experience-form .button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    justify-content: center
  }

  .simple-footer {
    padding: 20px 0
  }

  .simple-footer nav {
    font-size: 13px;
    gap: 10px 0;
    line-height: 1.8
  }

  .simple-footer a {
    min-height: 30px
  }

  .simple-footer a+a:before {
    padding: 0 10px
  }
}

@media(max-width:420px) {
  .container {
    width: calc(100% - 24px)
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding-top: 10px
  }

  .header-inner .brand {
    grid-row: 1;
    grid-column: 1;
    justify-self: center
  }

  .header-search {
    grid-row: 2;
    grid-column: 1;
    width: 100%
  }

  #main-nav {
    grid-row: 3;
    grid-column: 1;
    gap: 0 8px
  }

  #main-nav a {
    font-size: 14px
  }

  .search-results {
    width: 100%;
    max-width: 100%
  }

  .hero .hero-grid {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 14px
  }

  .hero-game-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px
  }

  .hero .hero-copy h1 {
    font-size: 25px
  }

  .hero .hero-actions {
    grid-template-columns: minmax(0, 1fr)
  }

  .platform-button {
    font-size: 16px
  }

  .hero .tags {
    gap: 6px
  }

  .hero .tags>span {
    font-size: 13px;
    padding: 7px 9px
  }

  .hero .stats>div {
    gap: 8px;
    padding: 0 8px
  }

  .hero .stats strong {
    font-size: 14px
  }

  .hero .stats p {
    font-size: 13px
  }

  .hero .stat-icon {
    width: 30px;
    height: 34px
  }

  .content-layout .card {
    padding: 18px
  }

  .section-heading h2,
  aside #app-information .section-heading h2,
  #features .section-heading h2 {
    font-size: 21px
  }

  .screenshots-grid {
    gap: 9px
  }

  .screenshot figcaption {
    font-size: 13px
  }

  .review-controls {
    grid-template-columns: minmax(0, 1fr)
  }

  .review-header {
    grid-template-columns: 36px minmax(0, 1fr)
  }

  .review-header .stars {
    grid-column: 2;
    justify-self: start;
    margin-top: -4px
  }

  .avatar {
    width: 36px;
    height: 36px
  }

  #reviews .rating-summary {
    padding: 18px
  }

  .distribution-row {
    gap: 7px
  }

  .experience-rating {
    gap: 5px
  }

  .experience-rating label {
    gap: 4px;
    font-size: 13px
  }

  .experience-rating input {
    width: 14px;
    height: 14px
  }
}

/* Section tabs occupy one row; arrows and touch scroll reveal remaining links. */
@media(max-width:800px) {
  .section-nav-shell {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 4px;
    align-items: center
  }

  .section-nav .section-nav-track {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding: 4px;
    padding: 0;
    overscroll-behavior-x: contain
  }

  .section-nav-track::-webkit-scrollbar {
    display: none
  }

  .section-nav-track a {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 50px;
    padding: 13px 0;
    font-size: 14px
  }

  .section-nav-scroll {
    display: grid;
    place-items: center;
    width: 32px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6035ce;
    cursor: pointer
  }

  .section-nav-scroll .icon {
    width: 18px;
    height: 18px;
    stroke-width: 2
  }

  .section-nav-scroll:hover:enabled {
    background: #f1eafa
  }

  .section-nav-scroll:disabled {
    opacity: .25;
    cursor: default
  }

  .section-nav-scroll[hidden] {
    display: none
  }

  .section-nav-shell:not(.has-overflow) {
    display: block
  }
}

/* Keep the menu rules after the narrow-screen header overrides. */
@media(max-width:800px) {
  .header-inner.mobile-nav-ready {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
    padding: 10px 0 12px
  }

  .mobile-nav-ready .brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start
  }

  .mobile-menu-toggle {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #e3d9ff;
    border-radius: 8px;
    background: #f3efff;
    color: #5030ac;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle[aria-expanded="true"] {
    background: #eae1ff
  }

  .mobile-menu-toggle:focus-visible {
    outline: 2px solid #5933c7;
    outline-offset: 3px
  }

  .mobile-menu-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 18px
  }

  .mobile-menu-icon span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor
  }

  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon span:first-child {
    transform: translateY(6px) rotate(45deg)
  }

  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon span:nth-child(2) {
    opacity: 0
  }

  .mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon span:last-child {
    transform: translateY(-6px) rotate(-45deg)
  }

  .mobile-nav-ready .header-search {
    grid-column: 1/-1;
    grid-row: 2
  }

  .mobile-nav-ready #main-nav {
    display: none;
    grid-column: 1/-1;
    grid-row: 3;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff
  }

  .mobile-nav-open #main-nav {
    display: grid
  }

  .mobile-nav-ready #main-nav a {
    justify-content: flex-start;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 6px;
    text-align: left
  }

  .mobile-nav-ready #main-nav a:hover,
  .mobile-nav-ready #main-nav a.active {
    background: #f3efff;
    color: #5933c7
  }

  .mobile-nav-ready #main-nav a.active:after {
    display: none
  }
}
