:root {
  color-scheme: dark;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #082b3a;
  color: #e4f2ec;
}
/* Keep the shell in the viewport; only its middle panel scrolls. */
html {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}
/* Keep the policy on the actual hit target and every scroll-container boundary,
   including the overflow-hidden body. Allow scrolling and pinch zoom. */
* {
  box-sizing: border-box;
  touch-action: inherit;
}
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 80% 0, #19536188, transparent 65%);
}
main {
  width: 100%;
  max-width: 1040px;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "header" "content" "install" "offline" "footer";
  gap: 16px;
  padding: max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}
header {
  grid-area: header;
}
h1 {
  font-size: clamp(32px, 6vw, 44px);
  letter-spacing: -1px;
  font-weight: 650;
  margin: 0;
}
h1 span {
  display: block;
  font-size: 18px;
  letter-spacing: 3px;
  color: #f2d492;
  margin-top: 8px;
}
p {
  line-height: 1.75;
  color: #aac7cb;
  font-size: 14px;
}
header p {
  margin: 8px 0 0;
}
.games,
.install-guide {
  grid-area: content;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #6d9d9b #103644;
}
.games {
  list-style: none;
  padding: 4px;
  margin: 0 -4px;
  display: grid;
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}
.games > li {
  padding: 0;
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
.game-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  overflow: hidden;
  background: #123844;
  border: 1px solid #6d9d9b55;
  border-radius: 16px;
  transition: border-color 180ms ease-out, background-color 180ms ease-out;
}
.game-cover {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center top;
  background: #204a48;
}
.game-copy {
  min-width: 0;
  padding: 16px 0 18px 20px;
}
.game-card strong {
  display: block;
  font-size: 21px;
  font-weight: 650;
}
.game-card small {
  display: block;
  color: #a5c3c6;
  margin-top: 6px;
  line-height: 1.65;
}
.game-arrow {
  color: #f2d492;
  width: 24px;
  height: 24px;
  transition: transform 180ms ease-out;
}
.game-card:active {
  background: #1b4b56;
  border-color: #f2d492;
}
@media (hover: hover) {
  .game-card:hover {
    border-color: #c6b985;
    background: #1a4651;
  }
  .game-card:hover .game-arrow {
    transform: translateX(3px);
  }
  button:hover:not(:disabled):not(.primary):not(.update-button):not([aria-pressed="true"]) {
    background: #265563;
    border-color: #a6bdaf;
  }
  .primary:hover:not(:disabled),
  .update-button:hover:not(:disabled) {
    background: #ffe5af;
  }
}
.install-card {
  grid-area: install;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #6d9d9b33;
  border-radius: 16px;
  background: #05243288;
}
.install-icon.ui-icon {
  color: #f2d492;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}
.ui-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.install-card > div {
  flex: 1;
  min-width: 0;
}
h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 550;
}
.install-card p {
  font-size: 12px;
  margin: 4px 0 0;
}
button {
  font: inherit;
  font-size: 13px;
  color: #f2d492;
  border: 1px solid #6d9d9b55;
  border-radius: 10px;
  background: #153e4c;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}
#install-toggle {
  flex-shrink: 0;
}
button:focus-visible,
a:focus-visible,
.games:focus-visible {
  outline: 2px solid #a3e4cd;
  outline-offset: 2px;
}
.install-guide {
  margin: 0;
  padding: 0 16px 16px;
  background: #103644;
  border: 1px solid #6d9d9b55;
  border-radius: 16px;
  scroll-padding-top: 76px;
}
.guide-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  background: #103644;
}
#install-close {
  padding: 0;
  width: 44px;
  flex-shrink: 0;
}
.platforms {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}
.platforms button {
  flex: 1;
  color: #aac7cb;
}
.platforms [aria-pressed="true"] {
  border-color: #f2d492;
  color: #f2d492;
  background: #414b3f;
}
ol {
  padding-left: 24px;
  margin: 0;
}
li {
  color: #bed3d4;
  font-size: 14px;
  line-height: 1.9;
  padding-left: 4px;
  margin-bottom: 12px;
}
li strong {
  color: #eef4ed;
  font-weight: 550;
}
.guide-note {
  font-size: 12px;
  margin: 16px 0 0;
  color: #8eafb6;
}
.primary {
  background: #f2d492;
  color: #15323c;
  width: 100%;
}
#install-status {
  color: #b2e9d4;
}
footer {
  grid-area: footer;
  font-size: 11px;
  color: #8eafb6;
  letter-spacing: 2px;
}
.brand-icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.12em;
  border-radius: 0.22em;
}
.offline-card {
  grid-area: offline;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 16px;
  border: 1px solid #6d9d9b33;
  border-radius: 16px;
}
.offline-summary {
  flex: 1 1 240px;
  min-width: 0;
}
.offline-card p {
  font-size: 12px;
  margin: 0;
}
#offline-progress {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: #e4f2ec;
}
#offline-percent {
  min-width: 4ch;
  text-align: right;
}
#offline-meter {
  display: block;
  width: 0;
  flex: 1;
  height: 6px;
  margin: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  appearance: none;
  background: #28515e;
  color: #a3e4cd;
}
#offline-meter::-webkit-progress-bar {
  background: #28515e;
}
#offline-meter::-webkit-progress-value {
  background: #a3e4cd;
}
#offline-meter::-moz-progress-bar {
  background: #a3e4cd;
}
#offline-detail {
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.offline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.update-button {
  background: #f2d492;
  color: #15323c;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
.game-card[aria-disabled="true"] {
  opacity: 0.55;
  cursor: wait;
}
#offline-status[data-state="ready"] {
  color: #a3d8c4;
}
#offline-status[data-state="error"] {
  color: #f3bb9f;
}
#offline-status[data-state="update"],
#offline-status[data-state="blocked"] {
  color: #f2d492;
}
[hidden] {
  display: none !important;
}
@media (max-width: 480px) {
  main {
    gap: 12px;
    padding: max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .game-card {
    grid-template-columns: minmax(0, 1fr) 40px;
  }
  .game-cover {
    max-height: 156px;
  }
  .game-copy {
    padding: 12px 0 14px 14px;
  }
  .game-card strong {
    font-size: 18px;
  }
  .install-card,
  .offline-card {
    padding: 12px;
  }
  .install-icon {
    display: none;
  }
  #install-toggle {
    padding-inline: 8px;
  }
}
@media (max-height: 600px) {
  main {
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  h1 {
    font-size: 28px;
  }
  h1 span {
    display: inline-block;
    font-size: 14px;
    letter-spacing: 1px;
    margin: 0 0 0 12px;
  }
  header p {
    font-size: 12px;
    margin-top: 4px;
  }
  .install-card,
  .offline-card {
    padding-block: 8px;
  }
  .game-cover {
    max-height: 130px;
  }
  .guide-heading {
    padding-block: 4px;
  }
}
@media (min-width: 481px) and (max-height: 600px) {
  .game-card:has(.game-cover) {
    grid-template-columns: 104px minmax(0, 1fr) 32px;
    min-height: 116px;
  }
  .game-cover {
    grid-column: auto;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    object-position: center;
  }
  .game-copy {
    padding: 12px;
  }
  .game-card strong {
    font-size: 18px;
  }
  .offline-card {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .offline-summary {
    flex-basis: 0;
  }
  .offline-actions {
    flex-direction: column;
  }
  main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "header header" "content content" "install offline" "footer footer";
  }
  .install-icon {
    display: none;
  }
}

.resource-page {
  width: 100%;
  max-width: 1120px;
  height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "header" "content" "offline";
  gap: 12px;
}
.resource-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.resource-heading h2 {
  font-size: 24px;
  font-weight: 600;
}
#offline-resources-close {
  flex-shrink: 0;
}
.resource-page #offline-resources-open {
  display: none;
}
#offline-groups {
  grid-area: content;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: manipulation;
  scrollbar-width: thin;
  scrollbar-color: #6d9d9b #103644;
  scroll-padding-top: 116px;
}
.resource-hint {
  margin: 4px 0 0;
  font-size: 13px;
}
.resource-group {
  border-top: 1px solid #6d9d9b55;
}
.resource-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 14px 36px 14px 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #103641;
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}
.resource-summary::-webkit-details-marker {
  display: none;
}
.resource-summary::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 21px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #f2d492;
  border-bottom: 2px solid #f2d492;
  transform: rotate(45deg);
}
.resource-group[open] > .resource-summary::after {
  transform: rotate(225deg);
  top: 25px;
}
.resource-title {
  color: #eef4ed;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.resource-count,
.resource-sizes,
.resource-file-status {
  font-size: 12px;
  color: #aac7cb;
}
.resource-sizes {
  grid-column: 1 / -1;
}
.resource-files {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.resource-file {
  margin: 0;
  padding: 12px;
}
.resource-file + .resource-file {
  border-top: 1px solid #6d9d9b33;
}
.resource-filename,
.resource-file-status {
  display: block;
  overflow-wrap: anywhere;
}
.resource-filename {
  color: #e4f2ec;
  font-size: 14px;
  line-height: 1.5;
}
.resource-file-status {
  margin: 4px 0 6px;
  font-variant-numeric: tabular-nums;
}
.resource-meter {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  appearance: none;
  background: #28515e;
  color: #a3e4cd;
}
.resource-meter::-webkit-progress-bar {
  background: #28515e;
}
.resource-meter::-webkit-progress-value {
  background: #a3e4cd;
}
.resource-meter::-moz-progress-bar {
  background: #a3e4cd;
}
.resource-file[data-state="downloading"] .resource-meter::-webkit-progress-value,
.resource-file[data-state="verifying"] .resource-meter::-webkit-progress-value,
.resource-file[data-state="saving"] .resource-meter::-webkit-progress-value {
  background: #f2d492;
}
.resource-file[data-state="downloading"] .resource-meter::-moz-progress-bar,
.resource-file[data-state="verifying"] .resource-meter::-moz-progress-bar,
.resource-file[data-state="saving"] .resource-meter::-moz-progress-bar {
  background: #f2d492;
}
.resource-file[data-state="downloading"],
.resource-file[data-state="verifying"],
.resource-file[data-state="saving"] {
  background: #1b4248;
}
.resource-file[data-state="ready"] .resource-meter {
  opacity: 0.55;
}
.resource-group[data-state="ready"] .resource-count,
.resource-file[data-state="ready"] .resource-file-status {
  color: #a3d8c4;
}
.resource-group[data-state="failed"] .resource-count,
.resource-file[data-state="failed"] .resource-file-status {
  color: #f3bb9f;
}
.resource-summary:focus-visible,
#offline-groups:focus-visible {
  outline: 2px solid #a3e4cd;
  outline-offset: -2px;
}
@media (min-width: 700px) {
  .resource-file {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 6px 24px;
  }
  .resource-file-status {
    margin: 0;
  }
}
@media (max-height: 500px) {
  .resource-page {
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .resource-heading h2 {
    font-size: 20px;
  }
  .resource-hint {
    display: none;
  }
  .resource-page .offline-actions {
    flex-direction: row;
  }
}
@media (max-width: 360px) {
  .resource-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}
::selection {
  background: #f2d492;
  color: #082b3a;
}
@media (prefers-reduced-motion: reduce) {
  .game-card,
  .game-arrow,
  button {
    transition: none;
  }
}
