:root {
  color-scheme: light;
  --navy: #10263a;
  --navy-deep: #0a1b2b;
  --blue: #2584d8;
  --blue-soft: #eaf5ff;
  --paper: #f5f7fa;
  --white: #ffffff;
  --ink: #152333;
  --muted: #778391;
  --line: #e1e7ed;
  --danger: #d94545;
  --content: min(1280px, calc(100% - 48px));
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.games-page {
  min-height: 100vh;
  background: var(--paper);
}

.topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1280px) / 2));
  background: var(--navy);
  box-shadow: 0 2px 12px rgb(8 28 44 / 18%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--white);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: #ffc84b;
  color: var(--navy-deep);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -.04em;
}

.brand strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
}

.game-search {
  position: relative;
  display: flex;
  width: min(250px, 42vw);
  align-items: center;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-link {
  color: #cfe8ff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--white);
}

.game-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 20px;
  outline: none;
  background: rgb(255 255 255 / 9%);
  color: var(--white);
  transition: border-color 160ms ease, background 160ms ease;
}

.game-search input::placeholder {
  color: rgb(255 255 255 / 58%);
}

.game-search input:focus {
  border-color: rgb(255 255 255 / 46%);
  background: rgb(255 255 255 / 14%);
}

.search-icon {
  position: absolute;
  left: 16px;
  z-index: 1;
  width: 13px;
  height: 13px;
  border: 2px solid rgb(255 255 255 / 70%);
  border-radius: 50%;
  pointer-events: none;
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  background: rgb(255 255 255 / 70%);
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.games-main {
  width: var(--content);
  margin: 0 auto;
  padding: 38px 0 72px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.game-section {
  margin-top: 38px;
}

.game-section h2 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
}

.game-section h2::before {
  width: 4px;
  height: 16px;
  border-radius: 3px;
  background: var(--blue);
  content: "";
}

.game-section h2 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 24px 18px;
}

.game-tile {
  display: block;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.game-cover {
  position: relative;
  display: block;
  aspect-ratio: 1;
}

.game-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 220ms ease;
}

.game-name {
  display: block;
  margin-top: 10px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.game-tile:hover .game-cover img {
  transform: scale(1.035);
}

a.game-tile:focus-visible {
  outline: 3px solid rgb(37 132 216 / 28%);
  outline-offset: 5px;
  border-radius: 9px;
}

.catalog-message {
  grid-column: 1 / -1;
  margin: 18px 0 34px;
  color: var(--muted);
  text-align: center;
}

.rtp-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 18%, rgb(37 132 216 / 18%), transparent 30%),
    linear-gradient(145deg, #edf4fa 0%, #f8fafc 52%, #eaf1f7 100%);
}

.rtp-main {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 90px;
}

.rtp-hero {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.rtp-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 58px);
  letter-spacing: -.055em;
}

.rtp-hero > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.rtp-panel {
  margin-top: 40px;
  padding: 38px;
  border: 1px solid rgb(16 38 58 / 9%);
  border-radius: 22px;
  background: rgb(255 255 255 / 84%);
  box-shadow: 0 22px 60px rgb(19 51 75 / 11%);
  backdrop-filter: blur(14px);
}

.rtp-value {
  display: flex;
  align-items: flex-start;
  color: var(--navy);
}

.rtp-value strong {
  font-size: clamp(64px, 14vw, 112px);
  line-height: .85;
  letter-spacing: -.08em;
}

.rtp-value span {
  margin: 6px 0 0 10px;
  color: var(--blue);
  font-size: 28px;
  font-weight: 900;
}

.rtp-panel label {
  display: block;
  margin-top: 34px;
  font-size: 13px;
  font-weight: 800;
}

#rtp-range {
  width: 100%;
  margin: 18px 0 0;
  accent-color: var(--blue);
}

.rtp-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

#rtp-apply {
  min-width: 150px;
  margin-top: 26px;
  padding: 12px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  font-weight: 800;
}

#rtp-apply:disabled {
  cursor: wait;
  opacity: .55;
}

#rtp-simulate {
  padding: 11px 18px;
  border: 1px solid var(--navy);
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

#rtp-simulate:disabled {
  cursor: wait;
  opacity: .55;
}

.rtp-message {
  display: inline-block;
  margin: 0 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.rtp-message.is-error {
  color: var(--danger);
}

.rtp-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.rtp-metrics article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 68%);
}

.rtp-metrics span,
.rtp-metrics strong {
  display: block;
}

.rtp-distribution {
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 78%);
}

.rtp-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.rtp-section-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 26px;
}

.rtp-table-wrap {
  margin-top: 22px;
  overflow-x: auto;
}

.rtp-distribution table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.rtp-distribution th,
.rtp-distribution td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.rtp-distribution th:first-child,
.rtp-distribution td:first-child {
  padding-left: 0;
  text-align: left;
}

.rtp-distribution th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rtp-distribution td {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.rtp-distribution .rtp-message {
  margin: 18px 0 0;
}

.rtp-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.rtp-metrics strong {
  margin-top: 9px;
  color: var(--navy);
  font-size: 22px;
}

@media (max-width: 680px) {
  .topbar-actions {
    gap: 10px;
  }

  .admin-link {
    font-size: 12px;
  }

  .rtp-panel {
    padding: 28px 22px;
  }

  .rtp-message {
    display: block;
    margin: 14px 0 0;
  }

  .rtp-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .rtp-section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

.launch-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--navy-deep);
}

.launch-stage {
  position: relative;
  width: min(500px, calc(100% - 32px));
  padding: 58px 48px;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 80px rgb(0 0 0 / 25%);
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.launch-stage h1 {
  margin: 14px 0 10px;
  font-size: clamp(28px, 7vw, 42px);
  letter-spacing: -.04em;
}

.launch-stage p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.launch-stage > a {
  display: inline-block;
  margin-top: 26px;
  color: var(--navy);
  text-underline-offset: 4px;
}

.launch-stage button {
  margin-top: 22px;
  padding: 11px 20px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: var(--white);
  cursor: pointer;
  font-weight: 700;
}

.launch-progress {
  height: 3px;
  margin-top: 28px;
  overflow: hidden;
  border-radius: 3px;
  background: #e7edf2;
}

.launch-progress span {
  display: block;
  width: 36%;
  height: 100%;
  background: var(--blue);
  animation: travel 1.5s ease-in-out infinite alternate;
}

.launch-error .launch-progress span {
  width: 100%;
  animation: none;
  background: var(--danger);
}

.launch-orbit {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

@keyframes travel {
  from { transform: translateX(-20%); }
  to { transform: translateX(195%); }
}

@media (max-width: 640px) {
  :root {
    --content: calc(100% - 28px);
  }

  .topbar {
    min-height: 64px;
    padding: 0 14px;
  }

  .brand strong {
    display: none;
  }

  .game-search {
    width: min(220px, calc(100vw - 82px));
  }

  .games-main {
    padding-top: 26px;
  }

  .page-title {
    font-size: 21px;
  }

  .game-section {
    margin-top: 30px;
  }

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

  .game-name {
    margin-top: 8px;
    font-size: 13px;
  }

  .launch-stage {
    padding: 48px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
