@layer reset, theme, layout, components, responsive;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    min-width: 20rem;
    color-scheme: dark;
    font-family: "Segoe UI", sans-serif;
    line-height: 1.5;
  }

  body {
    min-height: 100dvh;
    margin: 0;
  }

  button,
  input,
  select {
    color: inherit;
    font: inherit;
  }

  button,
  a {
    -webkit-tap-highlight-color: transparent;
  }

  button {
    border: 0;
  }

  img,
  video {
    display: block;
    max-width: 100%;
  }

  h1,
  h2,
  h3,
  p {
    margin-block-start: 0;
  }

  a {
    color: inherit;
  }

  [hidden] {
    display: none !important;
  }
}

@layer theme {
  :root {
    --color-background: #050708;
    --color-surface: rgb(0 0 0 / 70%);
    --color-surface-strong: rgb(25 29 36);
    --color-surface-soft: rgb(25 34 41 / 82%);
    --color-border: rgb(255 255 255);
    --color-border-strong: rgb(255 255 255);
    --color-text: #fff;
    --color-text-muted: #b8c3ca;
    --color-accent: #006dbf;
    --color-accent-strong: #005caa;
    --color-focus: #8bd0ff;
    --color-success: #7ce4b3;
    --header-height: 70px;
    --header-offset: var(--header-height);
    --sidebar-width: 350px;
    --radius-small: 5px;
    --radius-medium: 5px;
    --radius-large: 20px;
    --shadow-large: none;
    --transition-fast: 160ms ease;
  }

  body {
    overflow-x: hidden;
    background:
      var(--color-background);
    color: var(--color-text);
  }

  body::after {
    position: fixed;
    z-index: -1;
    inset: 0;
    background: transparent;
    content: "";
    pointer-events: none;
  }

  :focus-visible {
    outline: 0.2rem solid var(--color-focus);
    outline-offset: 0.18rem;
  }

  ::selection {
    background: var(--color-accent);
    color: white;
  }

  .surface {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
  }
}

@layer layout {
  .app-background {
    position: fixed;
    z-index: -2;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    object-fit: cover;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .app-header {
    position: fixed;
    z-index: 50;
    inset: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--header-height);
    padding-inline: 13px;
    border-bottom: 1px solid white;
    background: rgb(0 0 0 / 70%);
    backdrop-filter: blur(8px);
  }

  .brand {
    display: inline-flex;
    gap: 0;
    align-items: center;
    min-width: 0;
    min-height: var(--header-height);
    color: var(--color-text);
    font-family: "Segoe UI", sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: normal;
    text-decoration: none;
  }

  .brand img {
    display: none;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    inset-block: var(--header-offset) 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    border-inline-end: 0;
    background: rgb(0 0 0 / 70%);
    scrollbar-color: rgb(255 255 255 / 25%) transparent;
    backdrop-filter: blur(8px);
  }

  .navigation {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 25px 5px 6px;
  }

  .game-navigation {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .nav-settings {
    margin-top: auto;
  }

  .main-content {
    height: 100dvh;
    margin-inline-start: var(--sidebar-width);
    overflow-x: hidden;
    overflow-y: auto;
    padding: calc(var(--header-offset) + 21px) 20px 19px;
    scroll-margin-top: var(--header-offset);
  }

  .route-view {
    min-height: 100%;
  }

  .drawer-backdrop {
    display: none;
  }
}

@layer components {
  .skip-link {
    position: fixed;
    z-index: 100;
    inset: 0.75rem auto auto 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-small);
    background: var(--color-accent);
    color: white;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-200%);
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  .icon-button,
  .nav-item,
  .button,
  .text-button {
    cursor: pointer;
  }

  .menu-button {
    display: none;
    gap: 0.25rem;
    place-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-inline-end: 0.65rem;
    border-radius: var(--radius-small);
    background: transparent;
  }

  .menu-button img {
    width: 24px;
    height: 24px;
    object-fit: fill;
  }

  .nav-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 0 3px;
    border-radius: var(--radius-small);
    background: transparent;
    color: var(--color-text);
    font-family: "Segoe UI", sans-serif;
    font-size: 21.3333px;
    font-weight: 400;
    line-height: normal;
    text-align: start;
    text-decoration: none;
    transition:
      background-color var(--transition-fast),
      color var(--transition-fast),
      transform var(--transition-fast);
  }

  .nav-item:hover {
    background: rgb(255 255 255 / 10%);
  }

  .nav-item.is-active {
    background: var(--color-accent);
    color: white;
  }

  .nav-item img {
    width: 40px;
    height: 40px;
    object-fit: none;
  }

  .nav-section-toggle {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    margin-bottom: 5px;
  }

  .nav-section-toggle .nav-chevron {
    width: 40px;
    height: 40px;
  }

  .nav-section-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
  }

  .nav-game {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 5px;
    min-height: 40px;
    margin-top: 5px;
    padding-block: 0;
    padding-inline-start: 35px;
  }

  .game-navigation li {
    min-height: 50px;
  }

  .nav-game span {
    align-self: start;
    margin-top: 4px;
  }

  .nav-game img {
    object-fit: fill;
    transform: translateX(-1px);
  }

  /* Steam's desktop icons contain the original artwork inside opaque squares. */
  img[src="assets/halospartanstrike.png"] {
    clip-path: polygon(
      50% 10.5%, 61% 12%, 70.5% 18%, 77.5% 26.5%, 79% 44.5%,
      74% 48%, 80.5% 54%, 77% 68%, 72% 75.5%, 66% 80%, 59.5% 86%,
      53.5% 89%, 46% 89%, 40% 85%, 32% 79%, 26.5% 71%, 22% 63%,
      19% 54%, 25% 48%, 21% 44%, 22% 26.5%, 29% 18%, 39% 12%
    );
  }

  img[src="assets/halospartanassault.png"] {
    clip-path: polygon(
      36% 3%, 50% 6%, 64% 3%, 74% 7%, 82% 16%, 86% 27%,
      85% 34%, 92% 46%, 94% 56%, 91% 66%, 84% 75%, 72% 84%,
      54% 96%, 50% 92%, 46% 96%, 30% 86%, 17% 76%, 10% 66%,
      8.5% 56%, 10% 48%, 17% 37%, 15% 28%, 18% 18%, 26% 9%
    );
  }

  img[src="assets/halocampaignevolved.png"] {
    clip-path: polygon(
      0 93%, 10% 82%, 22% 74%, 32% 67%, 28% 60%, 27% 54%,
      24% 45%, 22% 31%, 24% 22%, 29% 15%, 36% 9%, 43% 7%,
      61% 7%, 68% 8%, 73% 19%, 70% 26%, 73% 35%, 72% 40%,
      75% 45%, 74% 53%, 84% 48%, 94% 45%, 100% 46%, 100% 100%, 0 100%
    );
  }

  .navigation > .nav-item:first-child {
    margin-bottom: 10px;
  }

  .navigation > .nav-item:first-child span,
  .nav-section-toggle > span,
  .nav-settings > span {
    align-self: start;
    margin-top: 4px;
  }

  .home-page {
    height: auto;
  }

  .home-hero {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    height: auto;
    overflow: hidden;
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-small);
    background: rgb(0 0 0 / 70%);
    box-shadow: none;
    backdrop-filter: blur(8px);
  }

  .home-hero-image {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    object-fit: fill;
    object-position: center;
  }

  .home-hero-content {
    width: 100%;
    margin-top: -0.375px;
    padding: 20px 40px 36px;
    text-align: center;
  }

  .home-title {
    margin-bottom: 20px;
    font-family: "Segoe UI", sans-serif;
    font-size: 42.6667px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 57px;
  }

  .home-description {
    max-width: none;
    margin: 0 auto;
    color: white;
    font-family: "Segoe UI", sans-serif;
    font-size: 21.3333px;
    line-height: 28px;
  }

  .achievements-page,
  .settings-page {
    display: grid;
    gap: 10px;
  }

  .achievements-page {
    display: block;
  }

  .achievements-page,
  .guide-page,
  .leaderboard-page {
    --achievement-inline-inset: 11px;
  }

  .guide-page > .achievement-card {
    margin-inline: var(--achievement-inline-inset);
  }

  .achievements-page,
  .guide-page,
  .leaderboard-page {
    --game-header-inset: 6px;
  }

  .achievements-page,
  .guide-page,
  .leaderboard-page,
  .profile-page {
    min-height: calc(100dvh - 111px);
    padding: 10px;
    border: 1px solid white;
    border-radius: var(--radius-small);
    background: rgb(0 0 0 / 70%);
    backdrop-filter: blur(8px);
  }

  .game-hero {
    min-height: 78px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .game-hero-overlay {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 78px;
    margin: 0;
    padding-inline: var(--game-header-inset);
  }

  .achievements-page .game-hero-overlay,
  .leaderboard-page .game-hero-overlay {
    padding-inline-end: var(--achievement-inline-inset);
  }

  .game-hero-icon {
    width: 66px;
    height: 66px;
    flex: none;
    object-fit: contain;
  }

  .game-hero h1,
  .guide-game-link {
    display: table-cell;
    margin: 0;
    font-size: 22.6667px;
    font-weight: 400;
    line-height: normal;
    vertical-align: middle;
  }

  .game-hero-text {
    display: table;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .achievement-search {
    flex: 0 1 clamp(12rem, 30%, 20rem);
    min-width: 0;
    margin-inline-start: 0.75rem;
  }

  :is(.achievement-search, .player-lookup) input {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-small);
    background: #10161d url("assets/search.svg") left 0.75rem center / 0.875rem no-repeat;
    color: var(--color-text);
  }

  :is(.achievement-search, .player-lookup) input:dir(rtl) {
    padding-inline: 2.25rem 0.75rem;
    background-position: right 0.75rem center;
  }

  :is(.achievement-search, .player-lookup) input::placeholder {
    color: var(--color-text-muted);
  }

  .eyebrow {
    margin-bottom: 0.5rem;
    color: var(--color-success);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .achievement-count {
    display: flex;
    align-items: center;
    margin: 0;
    color: white;
    font-size: 18.6667px;
    transform: translateY(-1px);
  }

  .player-lookup {
    width: min(100%, 17.5rem);
    min-width: 0;
    margin-inline-start: auto;
  }

  .player-search-field {
    position: relative;
    min-width: 0;
  }

  .player-suggestions {
    position: absolute;
    z-index: 1;
    inset: calc(100% + 0.375rem) 0 auto;
    max-block-size: min(22rem, 50dvh);
    margin: 0;
    padding: 0.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-small);
    background: #10161d;
    box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 45%);
  }

  .player-suggestions li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-small);
    cursor: pointer;
    overflow-wrap: anywhere;
  }

  .player-suggestions li:hover,
  .player-suggestions li[aria-selected="true"] {
    background: #263746;
    outline: 1px solid var(--color-text-muted);
    outline-offset: -1px;
  }

  .profile-portrait.player-suggestion-avatar {
    inline-size: 2.25rem;
    font-size: 1rem;
  }

  .player-suggestion-identity {
    display: grid;
    gap: 0.125rem;
  }

  .player-suggestion-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.25rem;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
  }

  .player-suggestion-detail .menu-item-icon {
    inline-size: 0.875rem;
    block-size: 0.875rem;
  }

  .player-profile {
    flex: none;
    max-width: min(15rem, 36vw);
  }

  .player-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    min-height: 44px;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-small);
    background: #10161d;
    cursor: pointer;
  }

  .player-profile-trigger:hover,
  .player-profile:has(:popover-open) .player-profile-trigger {
    border-color: var(--color-focus);
  }

  .player-profile-initial {
    display: grid;
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--color-accent);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    place-items: center;
  }

  .player-profile-picture {
    position: relative;
    display: grid;
    flex: none;
    inline-size: 1.75rem;
    block-size: 1.75rem;
  }

  .player-profile-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-medium);
    object-fit: cover;
  }

  .menu-item-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex: none;
  }

  .player-profile-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-profile-trigger img {
    flex: none;
  }

  .player-profile-menu {
    inset: auto;
    inset-block-start: var(--header-offset);
    inset-inline-end: 13px;
    width: min(12rem, calc(100% - 26px));
    margin: 0;
    padding: 0.25rem;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-small);
    background: #10161d;
    color: var(--color-text);
  }

  .player-profile-menu :is(a, button) {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-small);
    background: transparent;
    color: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
  }

  .player-profile-menu :is(a, button):hover {
    background: var(--color-surface-strong);
  }

  .achievement-summary,
  .leaderboard-page > .leaderboard-results {
    margin: 10px var(--achievement-inline-inset) 0;
  }

  .leaderboard-page > p {
    margin-inline: var(--achievement-inline-inset);
    margin-block: 0.5rem 1rem;
    color: var(--color-text-muted);
  }

  .leaderboard-results {
    overflow: auto;
    background: var(--color-surface-strong);
  }

  .leaderboard-results table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
  }

  .leaderboard-results :is(th, td) {
    padding: 0.75rem;
    border-block-end: 1px solid rgb(255 255 255 / 18%);
    text-align: start;
  }

  .leaderboard-results th:has(> button) {
    padding: 0;
  }

  .leaderboard-results th button {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    inline-size: 100%;
    min-block-size: 44px;
    padding: 0.75rem;
    background: transparent;
    color: inherit;
    font-weight: inherit;
    text-align: start;
    cursor: pointer;
  }

  .leaderboard-sort-indicator {
    visibility: hidden;
    inline-size: 0.75rem;
    block-size: 0.75rem;
  }

  .leaderboard-results th[aria-sort] .leaderboard-sort-indicator,
  .leaderboard-results th button:hover .leaderboard-sort-indicator {
    visibility: visible;
  }

  .leaderboard-results th[aria-sort="descending"] .leaderboard-sort-indicator {
    transform: rotate(180deg);
  }

  .leaderboard-identity {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .profile-portrait.leaderboard-avatar {
    inline-size: 2rem;
    font-size: 0.875rem;
  }

  .leaderboard-results tbody tr:last-child > * {
    border-block-end: 0;
  }

  .leaderboard-results :is(td:first-child, td:nth-last-child(-n + 2)) {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .leaderboard-status:empty {
    display: none;
  }

  .profile-page {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: start;
    gap: 1.25rem;
    padding: clamp(11px, 2vw, 21px);
  }

  .profile-hero {
    display: flex;
    align-items: center;
    gap: clamp(0.875rem, 3vw, 1.5rem);
    padding: clamp(0.875rem, 1.5vw, 1.125rem);
    border-radius: var(--radius-medium);
    background: linear-gradient(120deg, rgb(0 109 191 / 24%), transparent 65%), var(--color-surface);
    backdrop-filter: blur(8px);
    overflow-wrap: anywhere;
  }

  .profile-page.has-steam-background {
    background-image: linear-gradient(rgb(0 0 0 / 68%), rgb(0 0 0 / 82%)), var(--steam-profile-background);
    background-position: center top;
    background-size: cover;
  }

  .profile-background-video {
    position: absolute;
    inset: 0;
    z-index: -1;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    object-position: center top;
    opacity: 0.3;
    border-radius: inherit;
    pointer-events: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .profile-background-video {
      display: none;
    }
  }

  .profile-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
  }

  .profile-hero h1 {
    margin-block-end: 0;
    font-size: clamp(1.5rem, 4vw, 2.375rem);
    line-height: 1.15;
  }

  .profile-status {
    margin: 0;
    color: var(--color-text-muted);
  }

  .profile-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }

  .profile-platforms a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-underline-offset: 0.2em;
  }

  .profile-steam-link,
  .profile-icon-link {
    min-inline-size: 1.75rem;
    min-block-size: 1.75rem;
    justify-content: center;
  }

  .profile-location {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.375rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
  }

  .profile-portrait {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    inline-size: clamp(3.75rem, 9vw, 5.5rem);
    aspect-ratio: 1;
    border: 1px solid var(--color-focus);
    border-radius: var(--radius-medium);
    background: var(--color-accent-strong);
    font-size: 2rem;
    font-weight: 700;
  }

  .profile-hero > .profile-portrait {
    inline-size: min(var(--profile-identity-height, 7rem), 30vw);
    block-size: min(var(--profile-identity-height, 7rem), 30vw);
  }

  .profile-portrait > img {
    inline-size: 100%;
    block-size: 100%;
    border-radius: inherit;
    object-fit: cover;
  }

  .profile-portrait:has(.profile-avatar-frame) {
    border-color: transparent;
  }

  .profile-avatar-frame {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }

  .profile-avatar-frame img {
    inline-size: 100%;
    block-size: 100%;
    transform: scale(1.22);
    object-fit: contain;
  }

  .profile-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    border-block-end: 1px solid var(--color-border);
  }

  .profile-tabs button {
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-small) var(--radius-small) 0 0;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
  }

  .profile-tabs button[aria-selected="true"] {
    background: var(--color-surface-strong);
    box-shadow: inset 0 -2px var(--color-focus);
  }

  .profile-tabs button:hover {
    background: var(--color-surface-strong);
  }

  .profile-tab-panel > .profile-progress + .profile-progress {
    margin-block-start: 1.25rem;
  }

  .profile-presence,
  .profile-joined {
    margin: 0.25rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
  }

  .profile-job-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .profile-job-icon {
    flex: none;
    inline-size: 1rem;
    block-size: 1rem;
  }

  .profile-presence {
    display: flex;
    align-items: center;
    gap: 0.375rem;
  }

  .profile-presence::before {
    content: '';
    flex: none;
    inline-size: 0.55rem;
    block-size: 0.55rem;
    border-radius: 50%;
    background: var(--presence-color);
  }

  .profile-presence.is-online { --presence-color: #70d8a2; }
  .profile-presence.is-offline { --presence-color: #ff777d; }
  .profile-presence.is-away { --presence-color: #ffac60; }

  .profile-review {
    padding: 1rem;
    background: var(--color-surface-strong);
    border-radius: var(--radius-small);
    overflow-wrap: anywhere;
  }

  .profile-review + .profile-review {
    margin-block-start: 0.75rem;
  }

  .profile-review h2,
  .profile-review-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .profile-review h2 {
    margin: 0;
    font-size: 1.125rem;
  }

  .profile-review h2 img {
    flex: none;
    object-fit: contain;
  }

  .profile-review-rating,
  .profile-review-meta {
    margin: 0.5rem 0 0;
  }

  .profile-review-meta {
    color: var(--color-text-muted);
  }

  .profile-review-text {
    margin-block-end: 0;
    white-space: pre-wrap;
  }

  .profile-location img {
    flex: none;
  }

  .profile-friends-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-block: 0.75rem;
  }

  .profile-friends-page-buttons:not([hidden]) {
    display: flex;
    gap: 0.5rem;
  }

  .profile-friends-pagination .achievement-search {
    margin-inline-start: auto;
  }

  .profile-game-activity {
    display: grid;
    gap: 0.375rem;
    margin: 0.125rem 0 0;
    padding-block-start: 0.625rem;
    border-block-start: 1px solid rgb(255 255 255 / 18%);
    font-size: 0.875rem;
  }

  .profile-game-activity > div {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.125rem 0.75rem;
  }

  .profile-game-activity dt {
    color: var(--color-text-muted);
  }

  .profile-game-activity dd {
    margin: 0;
  }

  .profile-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
    gap: 0.625rem;
  }

  .profile-gallery {
    min-inline-size: 0;
    padding: 0.75rem;
    background: var(--color-surface-strong);
  }

  .profile-gallery h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.625rem;
    font-size: 1rem;
  }

  .profile-screenshots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
    gap: 0.5rem;
  }

  .profile-gallery-status {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--color-text-muted);
  }

  .profile-gallery-status:empty {
    display: none;
  }

  .profile-screenshots button {
    padding: 0;
    border: 0;
    border-radius: var(--radius-small);
    background: transparent;
    cursor: zoom-in;
  }

  .profile-screenshot-viewer {
    inline-size: min(92vw, 88rem);
    max-block-size: 94dvh;
    padding: 1rem;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-medium);
    background: var(--color-surface-strong);
    color: var(--color-text);
    overscroll-behavior: contain;
  }

  .profile-screenshot-viewer::backdrop {
    background: rgb(0 0 0 / 82%);
  }

  .profile-screenshot-viewer > img {
    display: block;
    inline-size: 100%;
    block-size: min(70dvh, 52vw);
    margin-inline: auto;
    object-fit: contain;
  }

  .profile-screenshot-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-block-start: 0.75rem;
  }

  .profile-screenshots img {
    inline-size: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-small);
  }

  .profile-progress h2 {
    margin-block-end: 0.625rem;
    font-size: 1.25rem;
    overflow-wrap: anywhere;
  }

  .profile-overall-progress {
    display: grid;
    gap: 0.5rem;
    margin-block-end: 0.875rem;
    padding: 0.875rem;
    border-radius: var(--radius-medium);
    background: var(--color-surface-strong);
  }

  .profile-overall-progress p {
    margin: 0;
    font-weight: 600;
  }

  .profile-games {
    display: grid;
    border-radius: var(--radius-medium);
  }

  .profile-game-count {
    color: var(--color-text-muted);
    font-size: 0.875rem;
  }

  .profile-games {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 0.625rem;
    margin: 0;
    padding: 0;
    list-style: '';
  }

  .profile-game {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border-color: var(--color-text-muted);
    border-radius: var(--radius-medium);
    background: var(--color-surface-strong);
  }

  .profile-game-heading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .profile-game-heading a {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration-color: var(--color-text-muted);
    text-underline-offset: 0.2em;
  }

  .profile-game-heading a:hover {
    color: var(--color-focus);
  }

  .profile-game-icon {
    flex: none;
    object-fit: contain;
  }

  :is(.profile-game-progress, .player-achievement-progress) {
    inline-size: 100%;
    block-size: 0.5rem;
  }

  @media (forced-colors: none) {
    :is(.profile-game-progress, .player-achievement-progress) {
      appearance: none;
      overflow: clip;
      border: 0;
      border-radius: 1rem;
      background: #35414c;
    }

    :is(.profile-game-progress, .player-achievement-progress)::-webkit-progress-bar {
      background: transparent;
    }

    :is(.profile-game-progress, .player-achievement-progress)::-webkit-progress-value {
      border-radius: 1rem;
      background: var(--color-focus);
    }

    :is(.profile-game-progress, .player-achievement-progress)::-moz-progress-bar {
      border-radius: 1rem;
      background: var(--color-focus);
    }
  }

  .profile-game-count {
    margin: 0;
  }

  .player-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem 1rem;
  }

  .player-progress-info {
    flex: 1 1 20rem;
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }

  .player-progress-result + .player-progress-result {
    margin-block-start: 0.75rem;
  }

  .player-achievement-progress {
    display: block;
    margin-block-start: 0.375rem;
  }

  .player-progress-status {
    margin: 0.125rem 0 0;
    color: var(--color-text-muted);
  }

  .player-progress-status p {
    margin: 0;
  }

  .player-progress-actions {
    --select-width: 100%;
    width: min(14rem, 100%);
  }

  .achievement-summary:has(.player-progress) {
    display: grid;
    gap: 0.625rem;
  }

  .achievement-pack {
    margin-inline-start: 0.5rem;
    padding-inline-start: 0.5rem;
    border-inline-start: 1px solid rgb(255 255 255 / 30%);
  }

  .achievement-unlock {
    margin-inline-start: 0.5rem;
    padding-inline-start: 0.5rem;
    border-inline-start: 1px solid rgb(255 255 255 / 30%);
    font-weight: 600;
  }

  .achievement-unlock[data-unlocked="true"] {
    color: var(--color-success);
  }

  .achievement-summary {
    display: flex;
    align-items: center;
    min-height: 80px;
    padding: 14px 15px 12px 14px;
    border-radius: 5px;
    background: rgb(25 29 36);
  }

  .achievement-browser {
    --achievement-heading-gap: 10px;

    display: grid;
    grid-template-columns: minmax(12rem, 28%) minmax(0, 1fr);
    gap: 20px;
    margin-top: 10px;
    padding: 11px var(--achievement-inline-inset) 10px;
  }

  .filter-panel {
    padding: 0;
  }

  .filter-panel fieldset {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .filter-panel legend,
  .achievement-sort > label {
    font-size: 18.6667px;
    font-weight: 400;
    line-height: 25px;
  }

  .filter-panel legend {
    margin-bottom: var(--achievement-heading-gap);
    padding: 0;
  }

  .filter-options {
    display: grid;
    gap: 4px;
    margin-inline-start: 24px;
  }

  .filter-option {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: white;
    cursor: pointer;
    min-height: 1.75rem;
    font-size: 14.6667px;
    line-height: 22px;
  }

  .filter-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--color-accent);
  }

  .achievement-sort {
    --select-width: 100%;

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.375rem;
    margin-block-start: 1rem;
    font-size: 14.6667px;
  }

  .achievement-search-label,
  .achievement-sort-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .achievement-results > h2 {
    margin: 0 0 var(--achievement-heading-gap);
    font-size: 18.6667px;
    font-weight: 400;
    line-height: 25px;
  }

  .achievement-name,
  .achievement-description {
    text-align: match-parent;
  }

  .achievement-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .achievement-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid white;
    border-radius: 5px;
    background: rgb(25 29 36);
    color: var(--color-text);
    text-align: start;
    box-shadow: none;
    content-visibility: auto;
    contain-intrinsic-size: auto 100px;
    transition:
      border-color var(--transition-fast),
      background-color var(--transition-fast),
      transform var(--transition-fast);
  }

  .achievement-card.has-guide:hover {
    border-color: var(--color-accent);
    background: rgb(25 29 36);
  }

  .achievement-image {
    width: clamp(3rem, 10vw, 4.75rem);
    height: auto;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 0;
    background: rgb(25 29 36);
    object-fit: cover;
  }

  .achievement-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .achievement-name {
    margin: 0;
    font-size: 18.6667px;
    font-weight: 700;
    line-height: normal;
  }

  .achievement-description {
    margin: 0;
    color: white;
    font-size: 14.6667px;
    line-height: normal;
  }

  .achievement-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: center;
    color: white;
    font-size: 14.6667px;
    line-height: normal;
  }

  .achievement-guide-link {
    text-decoration: none;
  }

  .achievement-guide-link::after {
    position: absolute;
    inset: 0;
    content: "";
  }

  .achievement-card:has(.achievement-guide-link:focus-visible) {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
  }

  .empty-state {
    margin: 0;
    padding: 3rem 1.5rem;
    border-radius: var(--radius-medium);
    color: var(--color-text-muted);
    text-align: center;
  }

  .settings-page,
  .release-notes-page {
    padding: 10px;
  }

  .settings-page {
    display: block;
    min-height: calc(100dvh - var(--header-offset) - 41px);
    border: 1px solid white;
    border-radius: 5px;
    background: rgb(0 0 0 / 70%);
    backdrop-filter: blur(8px);
  }

  .page-heading {
    position: relative;
    display: block;
    width: 100%;
    height: 55px;
    min-height: 55px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .page-heading-icon {
    position: absolute;
    top: 6px;
    inset-inline-start: 6px;
    width: 43px;
    height: 43px;
  }

  .page-heading h1 {
    position: absolute;
    top: 0;
    inset-inline-start: 55px;
    display: flex;
    align-items: center;
    width: calc(100% - 55px);
    height: 55px;
    margin: 0;
    font-size: 22.6667px;
    font-weight: 400;
    line-height: normal;
  }

  .release-notes-page {
    display: grid;
    gap: 0.75rem;
    border-radius: var(--radius-medium);
    backdrop-filter: blur(8px);
  }

  .release-entry {
    border-radius: var(--radius-medium);
    background: var(--color-surface-strong);
  }

  .release-entry > summary {
    padding: 0.75rem 0.875rem;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
  }

  .release-screenshot-icon {
    display: inline-block;
    margin-inline-start: 0.75rem;
    vertical-align: middle;
  }

  .release-entry-body {
    padding: 0 0.875rem 0.875rem;
  }

  .release-entry ul {
    margin: 0;
    padding-inline-start: 1.25rem;
  }

  .release-entry li + li {
    margin-block-start: 0.25rem;
  }

  .release-entry-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-small);
  }

  .settings-grid {
    display: grid;
    gap: 10px;
    margin: 20px 10px 0;
  }

  .settings-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    min-height: 76px;
    padding: 0.75rem;
    border-radius: 5px;
    background: rgb(25 29 36);
  }

  .settings-icon {
    width: 40px;
    height: 38px;
    object-fit: fill;
  }

  .settings-card h2 {
    margin: 0;
    font-size: 18.6667px;
    font-weight: 400;
    line-height: normal;
    overflow-wrap: anywhere;
  }

  .settings-card p {
    margin: 0;
    color: white;
    font-size: 14.6667px;
    line-height: normal;
    overflow-wrap: anywhere;
  }

  #display-language {
    --select-width: 220px;
  }

  :is(.settings-card, .achievement-sort, .player-progress-actions) select {
    appearance: none;
    width: var(--select-width, 175px);
    min-height: 48px;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-small);
    background: #10161d url("assets/chevron-down.svg") right 0.75rem center / 1rem no-repeat;
    color: var(--color-text);
    color-scheme: dark;
    font-size: 1rem;
    cursor: pointer;
  }

  :is(.achievement-sort, .player-progress-actions) select:dir(rtl) {
    padding-inline: 0.75rem 2.5rem;
    background-position: left 0.75rem center;
  }

  :is(.settings-card, .achievement-sort, .player-progress-actions) select:hover {
    border-color: var(--color-focus);
  }

  @supports (appearance: base-select) and selector(::picker(select)) {
    @media (forced-colors: none) {
      :is(.settings-card, .achievement-sort, .player-progress-actions) select,
      :is(.settings-card, .achievement-sort, .player-progress-actions) select::picker(select) {
        appearance: base-select;
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select,
      :is(.achievement-sort, .player-progress-actions) select:dir(rtl) {
        align-items: center;
        padding-inline: 0.75rem;
        background-image: none;
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select::picker-icon {
        width: 1rem;
        height: 1rem;
        background: url("assets/chevron-down.svg") center / contain no-repeat;
        content: "";
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select:open {
        border-color: var(--color-focus);
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select::picker(select) {
        margin-block-start: 0.375rem;
        padding: 0.25rem;
        border: 1px solid var(--color-text-muted);
        border-radius: var(--radius-small);
        background: #10161d;
        color: var(--color-text);
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select option {
        min-height: 2.75rem;
        align-items: center;
        padding: 0.5rem 0.625rem;
        border-radius: var(--radius-small);
        cursor: pointer;
      }

      #achievement-unlock-filter option {
        gap: 0.5rem;
      }

      @supports (position-area: block-end) {
        :is(.achievement-sort, .player-progress-actions) select::picker(select) {
          position-area: block-end span-inline-end;
          position-try-order: normal;
          position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
        }
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select option:checked {
        background: var(--color-surface-strong);
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select option:is(:hover, :focus-visible) {
        background: var(--color-accent-strong);
      }

      :is(.settings-card, .achievement-sort, .player-progress-actions) select option::checkmark {
        order: 1;
        margin-inline-start: auto;
        color: var(--color-focus);
      }
    }
  }

  @media (forced-colors: active) {
    :is(.settings-card, .achievement-sort, .player-progress-actions) select {
      appearance: auto;
      padding-inline-end: 0.75rem;
      background-image: none;
    }
  }

  .settings-actions {
    display: flex;
    gap: 9px;
  }

  .settings-icon-button {
    display: grid;
    width: 50px;
    height: 48px;
    padding: 8px;
    border: 0;
    border-radius: 5px;
    background: var(--color-accent);
    cursor: pointer;
    place-items: center;
  }

  .settings-icon-button:hover {
    background: var(--color-accent-strong);
  }

  .settings-action-icon {
    width: 30px;
    height: 30px;
  }

  .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 2.6rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-small);
    font-weight: 750;
    text-decoration: none;
    transition:
      background-color var(--transition-fast),
      transform var(--transition-fast);
  }

  .button:hover {
    transform: translateY(-0.08rem);
  }

  .primary-button {
    background: var(--color-accent);
    color: white;
  }

  .primary-button:hover {
    background: var(--color-accent-strong);
  }

  .secondary-button {
    border: 1px solid var(--color-border);
    background: rgb(255 255 255 / 8%);
  }

  .secondary-button:hover {
    background: rgb(255 255 255 / 14%);
  }

  .useful-links {
    min-height: 176px;
    margin: 10px 10px 0;
    padding: 0;
    border-radius: 5px;
    background: rgb(25 29 36);
  }

  .useful-links-heading {
    position: relative;
    display: block;
    height: 76px;
    min-height: 76px;
    padding: 0;
  }

  .useful-links-icon {
    position: absolute;
    top: 18px;
    inset-inline-start: 13px;
    width: 40px;
    height: 40px;
  }

  .useful-links h2 {
    position: absolute;
    top: 13px;
    inset-inline-start: 66px;
    width: calc(100% - 66px);
    height: 50px;
    margin: 0;
    padding: 4px 0 6px;
    display: flex;
    align-items: center;
    font-size: 18.6667px;
    font-weight: 400;
    line-height: normal;
  }

  .links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: 0.25rem;
    padding: 0 0.75rem 0.75rem;
  }

  .link-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    min-height: 44px;
    padding: 5px 0 5px 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: white;
    font-size: 14.6667px;
    line-height: normal;
    text-align: start;
    text-decoration: none;
    transition:
      border-color var(--transition-fast),
      transform var(--transition-fast);
  }

  .link-card:hover {
    background: rgb(255 255 255 / 10%);
    transform: none;
  }

  .link-icon {
    width: 32px;
    height: 32px;
    object-fit: fill;
  }

  .link-card > span {
    text-box: trim-both cap alphabetic;
  }

  .not-found {
    max-width: 42rem;
    margin: 15vh auto 0;
    padding: clamp(1.5rem, 5vw, 3rem);
    border-radius: var(--radius-large);
    text-align: center;
  }

  .not-found h1 {
    margin-bottom: 0.6rem;
    font-size: clamp(2rem, 6vw, 4rem);
  }

  .not-found .button {
    margin-top: 1rem;
  }

  .guide-content {
    padding: clamp(0.625rem, 2vw, 1.75rem);
    overflow-wrap: anywhere;
  }

  .guide-game-link {
    display: flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
    overflow-wrap: anywhere;
    text-decoration: none;
    text-underline-offset: 0.2em;
  }

  .guide-game-link:hover,
  .guide-game-link:focus-visible {
    text-decoration: underline;
  }

  .guide-section {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
  }

  .guide-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .guide-description {
    margin: 0;
    color: #dce3e7;
    white-space: pre-line;
  }

  .video-grid {
    display: grid;
    gap: 1rem;
  }

  .video-frame {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: black;
    aspect-ratio: 16 / 9;
  }

  .video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
  }

  .toast {
    position: fixed;
    z-index: 110;
    inset: auto 1rem 1rem auto;
    max-width: min(24rem, calc(100% - 2rem));
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: #152029;
    box-shadow: var(--shadow-large);
    opacity: 0;
    pointer-events: none;
    transform: translateY(1rem);
    transition:
      opacity var(--transition-fast),
      transform var(--transition-fast);
  }

  .toast.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .loading-message,
  .noscript-message {
    padding: 2rem;
    color: var(--color-text-muted);
    text-align: center;
  }
}

@layer responsive {
  @media (width < 760px) {
    .app-header {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 0.25rem 0.625rem;
      padding-block: 0.375rem 0.5rem;
    }

    .app-header .brand {
      grid-column: 2 / -1;
      min-height: 44px;
    }

    .player-lookup {
      grid-column: 1 / -1;
    }

    .app-header:has(.player-profile:not([hidden])) .player-lookup {
      grid-column-end: 3;
    }
  }

  @media (width < 901px) {
    :root {
      --sidebar-width: min(350px, calc(100vw - 48px));
    }

    .menu-button {
      display: grid;
      width: 44px;
      height: 44px;
      flex: none;
      margin: 0;
      background: var(--color-accent);
    }

    html {
      scroll-padding-top: var(--header-offset);
    }

    .brand {
      font-size: clamp(1rem, 4vw, 1.5rem);
      white-space: normal;
    }

    .sidebar {
      box-shadow: 1.5rem 0 4rem rgb(0 0 0 / 55%);
      transform: translateX(-105%);
    }

    .sidebar:dir(rtl):not(.is-open) {
      transform: translateX(105%);
    }

    .sidebar.is-open {
      transform: translateX(0);
    }

    .drawer-backdrop {
      position: fixed;
      z-index: 30;
      inset: var(--header-offset) 0 0;
      display: block;
      background: rgb(0 0 0 / 62%);
      opacity: 0;
      pointer-events: none;
      transition: opacity 220ms ease;
    }

    .drawer-backdrop.is-visible {
      opacity: 1;
      pointer-events: auto;
    }

    .drawer-open {
      overflow: hidden;
    }

    .main-content {
      height: auto;
      min-height: 100dvh;
      margin-inline-start: 0;
      overflow: visible;
      padding: calc(var(--header-offset) + 21px) 20px 20px;
    }

    .home-page {
      height: auto;
    }

    .home-hero {
      height: auto;
    }

    .home-hero-image {
      height: auto;
      aspect-ratio: 16 / 9;
    }

  }

  @media (max-width: 700px) {
    .game-hero-overlay {
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .achievement-search {
      flex-basis: 100%;
      margin-inline-start: 0;
    }

    .achievement-browser {
      grid-template-columns: minmax(0, 1fr);
    }

    .filter-options {
      margin-inline-start: 0;
    }
  }

  @media (max-width: 500px) {
    .home-title {
      font-size: clamp(1.5rem, 8vw, 2.5rem);
      line-height: 1.2;
    }

    .home-description {
      font-size: 21.3333px;
      line-height: 28px;
    }

    .home-hero-content {
      margin-top: -0.625px;
      padding: 1.25rem 1rem 2rem;
    }

    .settings-card {
      grid-template-columns: 40px minmax(0, 1fr);
    }

    .settings-card select,
    .settings-actions {
      grid-column: 2;
    }

    .settings-card select {
      max-width: 100%;
    }


  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      transition-duration: 0.01ms !important;
    }


    .app-background {
      display: none;
    }
  }
}
