:root {
  color-scheme: dark;
  --bg: #080b12;
  --surface: #141925;
  --surface-strong: #1b2230;
  --ink: #f8f1df;
  --muted: #b9c0cc;
  --line: rgba(112, 221, 255, 0.24);
  --red: #ff4b2f;
  --red-dark: #d7331f;
  --mint: #22d6ad;
  --gold: #ffc247;
  --blue: #21b8ff;
  --violet: #6f78ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --panel-glow: 0 0 0 1px rgba(124, 224, 255, 0.18), 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 75, 47, 0.24), transparent 18rem),
    radial-gradient(circle at 88% 10%, rgba(33, 184, 255, 0.2), transparent 20rem),
    linear-gradient(180deg, rgba(8, 11, 18, 0.92), rgba(10, 12, 20, 0.98)),
    var(--bg);
  font-family: "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(124, 224, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 224, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, black, transparent 82%);
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent, rgba(8, 11, 18, 0.58)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
  content: "";
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid rgba(124, 224, 255, 0.2);
  background: rgba(8, 11, 18, 0.76);
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px) saturate(1.25);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 2px solid rgba(255, 194, 71, 0.92);
  border-radius: 0.35rem;
  overflow: hidden;
  background: #0e1119;
  box-shadow:
    0 0 0 0.18rem rgba(255, 75, 47, 0.2),
    0 0 1rem rgba(255, 194, 71, 0.36);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong {
  font-size: 1.05rem;
  color: #fff8e8;
  text-shadow: 0 0 0.7rem rgba(255, 194, 71, 0.38);
}

.brand small {
  margin-top: 0.18rem;
  color: #8fdcf3;
  font-size: 0.78rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: #d6f3ff;
  font-weight: 700;
}

.topnav button,
.topnav a {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-weight: inherit;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: min(560px, calc(100vh - 4rem));
  margin: 1rem calc(50% - 50vw) 1.2rem;
  padding: clamp(2.8rem, 6vw, 5.8rem) max(1rem, calc((100vw - 1180px) / 2)) 3.2rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(124, 224, 255, 0.16);
  background:
    linear-gradient(90deg, rgba(8, 11, 18, 0.9) 0%, rgba(8, 11, 18, 0.76) 38%, rgba(8, 11, 18, 0.26) 100%),
    linear-gradient(180deg, rgba(8, 11, 18, 0.06), rgba(8, 11, 18, 0.82)),
    url("./assets/gamehub-lobby-bg.jpg") center / cover no-repeat;
  box-shadow: inset 0 -4rem 5rem rgba(8, 11, 18, 0.9);
}

.hero::before {
  position: absolute;
  inset: 1rem max(1rem, calc((100vw - 1180px) / 2));
  z-index: -1;
  border: 1px solid rgba(124, 224, 255, 0.2);
  border-radius: 0.9rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 194, 71, 0.12),
    0 0 2rem rgba(33, 184, 255, 0.16);
  content: "";
  pointer-events: none;
}

@media (min-width: 881px) {
  .hero {
    padding-right: max(2rem, calc((100vw - 1180px) / 2 + 1.5rem));
    padding-left: max(2rem, calc((100vw - 1180px) / 2 + 1.5rem));
  }
}

.hero::after {
  position: absolute;
  right: max(1rem, calc((100vw - 1180px) / 2));
  bottom: 2rem;
  z-index: -1;
  width: min(22rem, 52vw);
  height: min(22rem, 52vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 75, 47, 0.24), transparent 64%);
  filter: blur(0.4rem);
  content: "";
  pointer-events: none;
}

.hero-copy {
  width: min(42rem, 100%);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 0.8rem rgba(255, 194, 71, 0.48);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow:
    0 0.1rem 0 #000,
    0 0 1.2rem rgba(255, 75, 47, 0.46),
    0 0 2.2rem rgba(33, 184, 255, 0.18);
}

.hero-title-panel {
  width: min(100%, 54rem);
  padding: 0;
}

.hub-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12em;
  width: 100%;
  margin-bottom: 0.85rem;
  color: #fff8e8;
  font-size: clamp(2.05rem, 7vw, 5.15rem);
  font-weight: 900;
  line-height: 0.95;
  white-space: normal;
  text-shadow:
    0 0.1rem 0 #000,
    0 0 1.35rem rgba(255, 75, 47, 0.48),
    0 0 2.2rem rgba(33, 184, 255, 0.2);
}

.hub-title-main,
.hub-title-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.15em;
  font: inherit;
  letter-spacing: 0;
}

.hub-title-main {
  padding: 0.04em 0.17em 0.1em;
  color: #fff8e8;
}

.hub-title-badge {
  padding: 0.04em 0.24em 0.1em;
  border: 0;
  border-radius: 0.16em;
  color: #050505;
  background: #ff8a00;
  box-shadow: none;
  text-shadow: none;
}

.hero-text {
  max-width: 34rem;
  color: #d8e4eb;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1.8;
  white-space: pre-line;
  text-shadow: 0 0.1rem 0 rgba(0, 0, 0, 0.55);
}

.hero-title-panel .hero-text {
  max-width: 100%;
  margin-bottom: 0;
  color: #fff;
}

.hero-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-top: 2rem;
}

.player-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
  gap: 1rem;
  margin: -1.8rem 0 2.5rem;
  position: relative;
  z-index: 2;
}

.energy-card,
.daily-quests {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(124, 224, 255, 0.32);
  border-radius: 0.65rem;
  background:
    linear-gradient(135deg, rgba(33, 184, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(27, 34, 48, 0.94), rgba(13, 17, 28, 0.94));
  box-shadow: var(--panel-glow);
}

.energy-card::before,
.daily-quests::before,
.game-card::before,
.modal::before,
.confirm-modal::before,
.about::before,
.empty-state::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--blue), transparent 28%, transparent 72%, var(--red)) top / 100% 2px no-repeat,
    linear-gradient(90deg, rgba(255, 194, 71, 0.86), transparent 32%) bottom left / 42% 2px no-repeat;
  content: "";
}

.energy-card {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.energy-card.is-full {
  background:
    linear-gradient(135deg, rgba(255, 194, 71, 0.26), transparent 44%),
    linear-gradient(180deg, rgba(34, 214, 173, 0.18), rgba(13, 17, 28, 0.94));
  box-shadow:
    var(--panel-glow),
    0 0 1.7rem rgba(34, 214, 173, 0.34);
}

.energy-card.is-celebrating {
  animation: full-energy-pop 900ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.daily-quests {
  display: grid;
  grid-template-columns: minmax(7rem, 0.56fr) minmax(0, 1fr);
  gap: 0.85rem;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(255, 75, 47, 0.15), transparent 44%),
    linear-gradient(180deg, rgba(27, 34, 48, 0.94), rgba(13, 17, 28, 0.94));
}

.energy-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.energy-card h2,
.daily-quests h2 {
  margin: 0;
  font-size: clamp(1.28rem, 3vw, 2rem);
  line-height: 1.1;
}

.energy-card-head strong {
  flex: 0 0 auto;
  min-width: 5.3rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(34, 214, 173, 0.72);
  border-radius: 999px;
  color: #081016;
  background: linear-gradient(180deg, #7dffd9, var(--mint));
  text-align: center;
  box-shadow:
    0 0 0.75rem rgba(34, 214, 173, 0.42),
    inset 0 -0.18rem 0 rgba(0, 0, 0, 0.22);
}

.energy-meter {
  height: 1rem;
  margin: 1rem 0 0.65rem;
  overflow: hidden;
  border: 1px solid rgba(124, 224, 255, 0.42);
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.09) 0 0.4rem,
      rgba(255, 255, 255, 0.02) 0.4rem 0.8rem
    ),
    #070a10;
  box-shadow: inset 0 0 0.75rem rgba(0, 0, 0, 0.52);
}

.energy-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-right: 2px solid rgba(255, 255, 255, 0.56);
  background: linear-gradient(90deg, var(--red), var(--gold), var(--mint));
  box-shadow: 0 0 1rem rgba(34, 214, 173, 0.48);
  transition: width 260ms ease;
}

.energy-card.is-full .energy-meter span {
  background: linear-gradient(90deg, var(--gold), var(--mint), var(--blue));
}

@keyframes full-energy-pop {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.018);
    box-shadow:
      0.22rem 0.22rem 0 rgba(32, 26, 22, 0.9),
      0 0 1.8rem 0.45rem rgba(244, 182, 63, 0.72);
  }

  100% {
    transform: scale(1);
  }
}

.energy-caption {
  margin: 0;
  color: #c5d5dd;
  line-height: 1.6;
}

.daily-quests-head {
  min-width: 0;
}

.quest-list {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.quest-item {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.35rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid rgba(124, 224, 255, 0.22);
  border-radius: 0.4rem;
  color: #dce8ef;
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.92rem;
  font-weight: 700;
}

.quest-item.is-complete {
  border-color: rgba(34, 214, 173, 0.5);
  color: #9dffe3;
  background: rgba(34, 214, 173, 0.12);
  box-shadow: inset 0 0 1rem rgba(34, 214, 173, 0.08);
}

.quest-check {
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 0.28rem;
  font-size: 0.9rem;
  line-height: 1;
  background: rgba(0, 0, 0, 0.24);
}

.quest-label {
  min-width: 0;
}

.quest-item strong {
  color: var(--gold);
  text-shadow: 0 0 0.65rem rgba(255, 194, 71, 0.44);
  white-space: nowrap;
}

.primary-action,
.secondary-action,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  border: 1px solid rgba(124, 224, 255, 0.42);
  border-radius: 0.35rem;
  cursor: pointer;
  font-weight: 900;
  text-transform: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-action {
  gap: 0.5rem;
  padding: 0.75rem 1.15rem;
  color: #fffaf0;
  background:
    linear-gradient(180deg, #ff6d42, var(--red-dark)),
    var(--red);
  box-shadow:
    0 0.28rem 0 #6d140d,
    0 0 1.2rem rgba(255, 75, 47, 0.38);
}

.dice-icon {
  position: relative;
  flex: 0 0 auto;
  width: 1.72rem;
  height: 1.72rem;
  margin-right: 0.12rem;
  transform: rotate(-8deg) skewY(-2deg);
}

.dice-face {
  position: absolute;
  display: block;
  border: 2px solid #10141d;
  background: #fffaf0;
}

.dice-front {
  inset: 0.22rem 0.18rem 0.04rem 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border-radius: 0.32rem;
  z-index: 3;
}

.dice-front i {
  width: 0.28rem;
  height: 0.28rem;
  place-self: center;
  border-radius: 50%;
  background: var(--red);
}

.dice-front i:nth-child(1) {
  grid-area: 1 / 1;
}

.dice-front i:nth-child(2) {
  grid-area: 2 / 2;
}

.dice-front i:nth-child(3) {
  grid-area: 3 / 3;
}

.dice-top {
  top: 0;
  left: 0.2rem;
  right: 0;
  height: 0.36rem;
  border-bottom: 0;
  border-radius: 0.32rem 0.32rem 0 0;
  background: #ffe0d8;
  transform: skewX(-35deg);
  transform-origin: bottom left;
  z-index: 2;
}

.dice-side {
  top: 0.2rem;
  right: 0;
  bottom: 0.2rem;
  width: 0.36rem;
  border-left: 0;
  border-radius: 0 0.32rem 0.32rem 0;
  background: #e8d5cf;
  transform: skewY(-35deg);
  transform-origin: top left;
  z-index: 1;
}

.secondary-action,
.filter-button {
  padding: 0.72rem 1rem;
  color: #e9f8ff;
  background: rgba(12, 18, 30, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0.22rem 0 rgba(0, 0, 0, 0.48);
}

.primary-action.is-unavailable,
.secondary-action.is-unavailable {
  border-color: rgba(129, 139, 150, 0.42);
  color: #8993a1;
  background: rgba(73, 80, 93, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.primary-action.is-disabled,
.secondary-action:disabled {
  border-color: rgba(129, 139, 150, 0.36);
  color: #8d95a1;
  background: #343a45;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 3rem 0 1.35rem;
  scroll-margin-top: 5.5rem;
}

.section-head h2,
.about h2,
.empty-state h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.12;
}

.section-title-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: center;
  width: min(100%, 40rem);
}

.section-title-row h2 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.library-search-tools {
  display: inline-flex;
  align-items: center;
  flex: 1 1 16.6rem;
  min-width: 13rem;
  max-width: 19.2rem;
  gap: 0.45rem;
}

.game-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.game-search-icon {
  position: absolute;
  left: 0.82rem;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  color: #8fdcf3;
  pointer-events: none;
}

.game-search-icon::after {
  position: absolute;
  right: -0.42rem;
  bottom: -0.25rem;
  width: 0.46rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.game-search input {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid rgba(124, 224, 255, 0.32);
  border-radius: 999px;
  padding: 0.35rem 0.85rem 0.35rem 2.25rem;
  color: #f8f1df;
  background: rgba(8, 11, 18, 0.72);
  box-shadow: inset 0 0 0.9rem rgba(0, 0, 0, 0.32);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.game-search input::placeholder {
  color: #8ea1ad;
}

.game-search input:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px rgba(124, 224, 255, 0.16),
    inset 0 0 0.9rem rgba(0, 0, 0, 0.32);
}

.history-toggle-button {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border: 1px solid rgba(124, 224, 255, 0.32);
  border-radius: 999px;
  color: #8fdcf3;
  background: rgba(8, 11, 18, 0.72);
  box-shadow: inset 0 0 0.9rem rgba(0, 0, 0, 0.32);
  cursor: pointer;
}

.history-toggle-button.is-active {
  border-color: var(--blue);
  color: #06111a;
  background: linear-gradient(135deg, #22d6ff, #22d6ad);
  box-shadow:
    0 0 0 3px rgba(124, 224, 255, 0.16),
    0 0.6rem 1.4rem rgba(33, 184, 255, 0.22);
  outline: none;
}

.history-toggle-button:focus-visible {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px rgba(124, 224, 255, 0.16),
    inset 0 0 0.9rem rgba(0, 0, 0, 0.32);
  outline: none;
}

.history-clock-icon {
  position: relative;
  width: 1.08rem;
  height: 1.08rem;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.history-clock-icon::before,
.history-clock-icon::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform-origin: 50% 0;
}

.history-clock-icon::before {
  height: 0.34rem;
  transform: translate(-50%, -0.02rem) rotate(180deg);
}

.history-clock-icon::after {
  height: 0.42rem;
  transform: translate(-50%, -0.02rem) rotate(125deg);
}

.filters {
  display: flex;
  flex: 0 1 auto;
  position: relative;
  justify-content: flex-start;
  min-width: 0;
}

.library-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
}

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

.filter-button {
  flex: 0 0 auto;
  min-height: 2.55rem;
  border-width: 1px;
  color: #c8d7df;
  white-space: nowrap;
}

.sort-control {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
}

.sort-picker {
  width: 100%;
}

.sort-trigger {
  min-width: 7.5rem;
}

.sort-menu {
  grid-template-columns: 1fr;
  width: min(9.5rem, calc(100vw - 2rem));
}

.category-picker {
  position: relative;
  flex: 0 0 auto;
}

.category-trigger {
  gap: 0.55rem;
  min-width: 7.5rem;
  justify-content: space-between;
}

.category-trigger-icon {
  width: 0.52rem;
  height: 0.52rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
}

.category-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(20rem, calc(100vh - 7rem));
  padding: 0.6rem;
  overflow-y: auto;
  border: 1px solid rgba(124, 224, 255, 0.34);
  border-radius: 0.45rem;
  background: rgba(8, 11, 18, 0.96);
  box-shadow: var(--panel-glow);
}

.category-menu[hidden] {
  display: none;
}

.category-option {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.52rem 0.7rem;
}

.view-toggle-group {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.35rem;
  padding: 0.22rem;
  border: 1px solid rgba(124, 224, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 11, 18, 0.68);
  box-shadow: inset 0 0 1rem rgba(0, 0, 0, 0.32);
}

.view-toggle-button {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #9db3c0;
  background: transparent;
  box-shadow: none;
}

.view-toggle-button[aria-pressed="true"] {
  color: #061018;
  background: linear-gradient(180deg, #7de3ff, var(--blue));
  box-shadow: 0 0 0.85rem rgba(33, 184, 255, 0.32);
}

.view-icon {
  display: grid;
  width: 1.16rem;
  height: 1.16rem;
  place-items: center;
}

.view-icon-large {
  align-content: center;
  justify-items: center;
  gap: 0.14rem;
}

.view-icon-large span {
  display: block;
  width: 0.8rem;
  height: 0.5rem;
  border: 2px solid currentColor;
  border-radius: 0.16rem;
}

.view-icon-large::after {
  display: block;
  width: 0.52rem;
  height: 0.14rem;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.view-icon-small {
  grid-template-columns: repeat(2, 0.38rem);
  grid-auto-rows: 0.38rem;
  gap: 0.16rem;
  align-content: center;
  justify-content: center;
}

.view-icon-small span {
  border: 2px solid currentColor;
  border-radius: 0.16rem;
}

.view-icon-list {
  grid-template-rows: repeat(3, 0.2rem);
  gap: 0.16rem;
  align-content: center;
  justify-content: center;
}

.view-icon-list span {
  display: grid;
  grid-template-columns: 0.2rem 0.62rem;
  gap: 0.14rem;
  align-items: center;
}

.view-icon-list span::before,
.view-icon-list span::after {
  display: block;
  content: "";
}

.view-icon-list span::before {
  width: 0.18rem;
  height: 0.18rem;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.view-icon-list span::after {
  align-self: center;
  width: 0.62rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.filter-button.is-active {
  border-color: rgba(33, 184, 255, 0.82);
  color: #061018;
  background: linear-gradient(180deg, #80e7ff, var(--blue));
  box-shadow: 0 0 1rem rgba(33, 184, 255, 0.34);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.game-grid.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.85rem;
}

.game-grid.is-list {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(124, 224, 255, 0.28);
  border-radius: 0.58rem;
  background:
    linear-gradient(180deg, rgba(27, 34, 48, 0.96), rgba(12, 17, 27, 0.96));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 1rem 2rem rgba(0, 0, 0, 0.34);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.game-card.is-explored {
  border-color: rgba(34, 214, 173, 0.58);
  box-shadow:
    0 0 0 1px rgba(34, 214, 173, 0.13),
    0 1rem 2rem rgba(0, 0, 0, 0.34),
    0 0 1.2rem rgba(34, 214, 173, 0.12);
}

.game-card.is-locked img {
  filter: saturate(0.62) brightness(0.68);
}

.game-status {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 1;
  min-height: 1.75rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(255, 194, 71, 0.7);
  border-radius: 999px;
  color: #150d04;
  background: linear-gradient(180deg, #ffe39a, var(--gold));
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0.8rem rgba(255, 194, 71, 0.34);
}

.game-card.is-explored .game-status {
  border-color: rgba(34, 214, 173, 0.78);
  color: #031510;
  background: linear-gradient(180deg, #94ffe4, var(--mint));
}

.game-card.is-locked .game-status {
  border-color: rgba(145, 154, 166, 0.5);
  color: #e1e4e9;
  background: linear-gradient(180deg, #606b7a, #3b4350);
}

.game-card.is-explored {
  border-color: #175c50;
  box-shadow: 0.25rem 0.25rem 0 rgba(23, 92, 80, 0.9);
}

.game-card.is-locked img {
  filter: saturate(0.74);
}

.game-status {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 1;
  min-height: 1.75rem;
  padding: 0.22rem 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0.12rem 0.12rem 0 rgba(32, 26, 22, 0.78);
}

.game-card.is-explored .game-status {
  color: #fff;
  background: var(--mint);
}

.game-card.is-locked .game-status {
  color: #fff;
  background: #6f655d;
}

.scroll-reveal.is-enter-ready {
  opacity: 0;
  filter: blur(8px);
  transform: translate3d(var(--reveal-enter-x, 0), 2.6rem, 0) scale(0.96);
  transition:
    opacity 520ms ease,
    filter 720ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 720ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-enter-delay, 0ms);
  will-change: opacity, filter, transform;
}

.scroll-reveal.is-enter-ready.is-enter-visible {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, 0, 0) scale(1);
}

.game-cover {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}

.game-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid rgba(124, 224, 255, 0.22);
  background: #151b27;
}

.game-grid.is-compact .game-card {
  border-radius: 0.5rem;
  box-shadow: 0 0.8rem 1.6rem rgba(0, 0, 0, 0.3);
}

.game-grid.is-list .game-card {
  display: grid;
  grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr);
  min-height: 0;
  border-radius: 0.5rem;
  box-shadow: 0 0.8rem 1.6rem rgba(0, 0, 0, 0.3);
}

.game-grid.is-compact .game-cover img,
.game-grid.is-list .game-cover img {
  aspect-ratio: 4 / 3;
}

.game-grid.is-list .game-cover img {
  height: auto;
  min-height: 0;
  align-self: start;
  border-right: 1px solid rgba(124, 224, 255, 0.22);
  border-bottom: 0;
}

.cloud-save-badge {
  position: absolute;
  top: 0.48rem;
  right: 0.48rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.2rem 0.43rem;
  border: 1px solid rgba(220, 247, 255, 0.82);
  border-radius: 0.32rem;
  color: #f3fdff;
  background: rgba(13, 74, 102, 0.86);
  box-shadow: 0 0.12rem 0.4rem rgba(0, 0, 0, 0.32);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.cloud-save-badge svg {
  width: 0.92rem;
  height: 0.92rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.game-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
}

.game-grid.is-compact .game-card-body {
  gap: 0.55rem;
  padding: 0.75rem;
}

.game-grid.is-list .game-card-body {
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
}

.game-card h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.28;
  color: #fff8e8;
  text-shadow: 0 0 0.8rem rgba(255, 194, 71, 0.16);
}

.game-grid.is-compact .game-card h3 {
  font-size: 1rem;
}

.game-grid.is-list .game-card h3 {
  font-size: 1.05rem;
}

.game-card p {
  display: -webkit-box;
  min-height: 3.1rem;
  margin: 0;
  overflow: hidden;
  color: #b8c5cf;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-grid.is-list .game-card p {
  min-height: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  -webkit-line-clamp: 1;
}

.tag-row,
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-row span,
.modal-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(124, 224, 255, 0.24);
  border-radius: 999px;
  color: #bdefff;
  background: rgba(33, 184, 255, 0.09);
  font-size: 0.82rem;
  font-weight: 700;
}

.card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.7rem;
  margin-top: auto;
}

.card-actions .primary-action,
.card-actions .secondary-action {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.7rem;
  white-space: nowrap;
}

.game-grid.is-list .tag-row {
  gap: 0.34rem;
}

.game-grid.is-list .tag-row span {
  min-height: 1.45rem;
  padding: 0.12rem 0.42rem;
  font-size: 0.74rem;
}

.game-grid.is-compact .card-actions {
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.game-grid.is-list .card-actions {
  grid-template-columns: repeat(2, minmax(0, 8rem));
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.game-grid.is-compact .card-actions .primary-action,
.game-grid.is-compact .card-actions .secondary-action {
  min-height: 2.2rem;
  padding: 0.42rem 0.5rem;
  font-size: 0.88rem;
}

.game-grid.is-list .card-actions .primary-action,
.game-grid.is-list .card-actions .secondary-action {
  min-height: 2.15rem;
  padding: 0.38rem 0.62rem;
  font-size: 0.86rem;
}

.card-video {
  background: rgba(255, 194, 71, 0.13);
  border-color: rgba(255, 194, 71, 0.44);
  color: #fff0bd;
}

.library-footer {
  margin: 2rem 0 1rem;
  padding: 1.15rem 1.4rem;
  border: 1px dashed rgba(255, 194, 71, 0.42);
  border-radius: 0.65rem;
  color: #fff0bd;
  background: rgba(255, 194, 71, 0.08);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  box-shadow: inset 0 0 1.2rem rgba(255, 194, 71, 0.08);
}

.library-footer + .about {
  margin-top: 1rem;
}

.empty-state,
.about {
  position: relative;
  overflow: hidden;
  margin: 4rem 0;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border: 1px solid rgba(124, 224, 255, 0.26);
  border-radius: 0.65rem;
  background:
    linear-gradient(135deg, rgba(255, 194, 71, 0.1), transparent 46%),
    rgba(14, 19, 30, 0.88);
  box-shadow: var(--panel-glow);
}

.about p,
.empty-state p {
  max-width: 48rem;
  margin-bottom: 0;
  color: #bac8d1;
  line-height: 1.8;
}

.about .about-version {
  width: 100%;
  max-width: none;
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(186, 200, 209, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
}

code {
  padding: 0.08rem 0.3rem;
  border-radius: 0.25rem;
  background: rgba(255, 194, 71, 0.14);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at center, rgba(33, 184, 255, 0.14), transparent 32rem),
    rgba(3, 5, 10, 0.76);
  backdrop-filter: blur(7px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(15rem, 24rem) minmax(0, 1fr);
  gap: 1.3rem;
  width: min(860px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid rgba(124, 224, 255, 0.38);
  border-radius: 0.7rem;
  background:
    linear-gradient(135deg, rgba(255, 75, 47, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(25, 32, 45, 0.98), rgba(10, 14, 23, 0.98));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 2rem 6rem rgba(0, 0, 0, 0.62),
    0 0 2rem rgba(33, 184, 255, 0.12);
}

.blind-box-celebration {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.62rem;
  height: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 0.16rem;
  background: var(--confetti-color);
  opacity: 0;
  animation: confetti-burst 1.35s cubic-bezier(0.12, 0.72, 0.25, 1) var(--delay) forwards;
}

.modal.is-revealed {
  animation: blind-box-reveal 760ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.modal.is-revealed .modal-cover-wrap {
  animation: blind-box-glow 1.35s ease-out;
}

.modal.is-revealed .modal-copy {
  animation: blind-box-copy-reveal 620ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

@keyframes confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(0);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.85) rotate(var(--spin));
  }
}

@keyframes blind-box-reveal {
  0% {
    transform: scale(0.96);
    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.62), 0 0 0 rgba(255, 201, 40, 0);
  }

  45% {
    transform: scale(1.018);
    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.62), 0 0 2.5rem 0.8rem rgba(255, 201, 40, 0.58);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.62), 0 0 0 rgba(255, 201, 40, 0);
  }
}

@keyframes blind-box-glow {
  0% {
    filter: brightness(0.88);
    box-shadow: 0 0 0 rgba(232, 58, 34, 0);
  }

  38% {
    filter: brightness(1.15) saturate(1.15);
    box-shadow: 0 0 2rem 0.5rem rgba(232, 58, 34, 0.6);
  }

  100% {
    filter: none;
    box-shadow: 0 0 0 rgba(232, 58, 34, 0);
  }
}

@keyframes blind-box-copy-reveal {
  0% {
    opacity: 0.35;
    transform: translateY(0.75rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid rgba(255, 194, 71, 0.58);
  border-radius: 0.35rem;
  color: #fff8e8;
  background: rgba(255, 75, 47, 0.22);
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 0 0.8rem rgba(255, 75, 47, 0.18);
}

.modal-cover-wrap {
  align-self: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(124, 224, 255, 0.3);
  border-radius: 0.45rem;
  background: #111724;
  box-shadow: inset 0 0 1rem rgba(0, 0, 0, 0.38);
}

.modal-cover-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-copy {
  align-self: center;
  padding: 1.25rem 3rem 1.25rem 0;
}

.modal-copy .eyebrow {
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
}

.modal-copy h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.85rem, 4.5vw, 3.1rem);
  line-height: 1.05;
}

.modal-copy p {
  color: #c4d1da;
  line-height: 1.8;
}

.confirm-modal {
  position: relative;
  overflow: hidden;
  width: min(520px, 100%);
  padding: clamp(1.5rem, 5vw, 2.2rem);
  border: 1px solid rgba(124, 224, 255, 0.38);
  border-radius: 0.7rem;
  background:
    linear-gradient(135deg, rgba(33, 184, 255, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(25, 32, 45, 0.98), rgba(10, 14, 23, 0.98));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 2rem 6rem rgba(0, 0, 0, 0.62);
}

.confirm-modal h2 {
  max-width: 10em;
  margin-bottom: 0.8rem;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  line-height: 1.1;
}

.confirm-text {
  margin-bottom: 0;
  color: #c4d1da;
  line-height: 1.8;
}

.unavailable-modal .modal-actions {
  margin-top: 1.4rem;
}

.test-password-field {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.test-password-field input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(124, 224, 255, 0.36);
  border-radius: 0.4rem;
  outline: none;
  color: var(--ink);
  background: rgba(4, 8, 15, 0.72);
  font: inherit;
}

.test-password-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 184, 255, 0.16);
}

.test-password-error {
  margin: 0.7rem 0 0;
  color: #ff9d8f;
  font-size: 0.9rem;
}

.test-password-modal .modal-actions {
  margin-top: 1.4rem;
}

.orientation-guard {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  min-width: 100vw;
  min-height: 100dvh;
  padding:
    max(1.5rem, env(safe-area-inset-top))
    max(1.5rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(255, 194, 71, 0.24), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(33, 184, 255, 0.18), transparent 22rem),
    var(--bg);
}

.orientation-guard[hidden] {
  display: none;
}

.orientation-guard-card {
  max-width: 28rem;
  text-align: center;
}

.orientation-guard-card h2 {
  margin: 0.8rem 0 0.6rem;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1.1;
}

.orientation-guard-card p:last-child {
  margin: 0;
  color: #c4d1da;
  line-height: 1.7;
}

.orientation-phone {
  position: relative;
  display: block;
  width: 4.8rem;
  height: 7.6rem;
  margin: 0 auto 1.4rem;
  border: 0.28rem solid #f8f1df;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, var(--red), #931a12);
  box-shadow: 0 0 1.5rem rgba(255, 75, 47, 0.34);
}

.orientation-phone::before {
  position: absolute;
  top: 0.45rem;
  left: 50%;
  width: 1.5rem;
  height: 0.22rem;
  border-radius: 999px;
  background: #f8f1df;
  content: "";
  transform: translateX(-50%);
}

.orientation-phone::after {
  position: absolute;
  bottom: 0.45rem;
  left: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border: 0.18rem solid #f8f1df;
  border-radius: 50%;
  content: "";
  transform: translateX(-50%);
}

body.orientation-blocked {
  overflow: hidden;
}

.achievement-toast {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 194, 71, 0.62);
  border-radius: 0.45rem;
  color: #071018;
  background: linear-gradient(180deg, #ffe39a, var(--gold));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 1.4rem rgba(255, 194, 71, 0.36),
    0 1rem 2rem rgba(0, 0, 0, 0.42);
  font-weight: 900;
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.achievement-toast[hidden] {
  display: none;
}

.achievement-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .topnav button:hover,
  .topnav a:hover {
    color: var(--gold);
    text-shadow: 0 0 0.8rem rgba(255, 194, 71, 0.58);
  }

  .primary-action:hover,
  .secondary-action:hover,
  .filter-button:hover {
    transform: translateY(-0.08rem);
    box-shadow:
      0 0.32rem 0 rgba(0, 0, 0, 0.5),
      0 0 1.1rem rgba(33, 184, 255, 0.32);
  }

  .primary-action.is-unavailable:hover,
  .secondary-action.is-unavailable:hover {
    background: rgba(93, 100, 113, 0.38);
  }

  .view-toggle-button:hover {
    color: #061018;
    background: linear-gradient(180deg, #7de3ff, var(--blue));
    box-shadow: 0 0 0.85rem rgba(33, 184, 255, 0.32);
  }

  .history-toggle-button:hover {
    border-color: var(--blue);
    color: #06111a;
    background: linear-gradient(135deg, #22d6ff, #22d6ad);
    box-shadow:
      0 0 0 3px rgba(124, 224, 255, 0.16),
      0 0.6rem 1.4rem rgba(33, 184, 255, 0.22);
  }

  .game-card:hover {
    transform: translateY(-0.16rem);
    border-color: rgba(33, 184, 255, 0.7);
    box-shadow:
      0 0 0 1px rgba(33, 184, 255, 0.18),
      0 1.25rem 2.5rem rgba(0, 0, 0, 0.42),
      0 0 1.4rem rgba(33, 184, 255, 0.18);
  }
}

@media (max-width: 880px) {
  .topbar {
    gap: 0.75rem;
    padding: 0.75rem clamp(0.75rem, 3vw, 1.5rem);
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand > span:last-child {
    min-width: 0;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.55rem;
  }

  .topnav button,
  .topnav a {
    min-height: 2.2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(124, 224, 255, 0.24);
    border-radius: 999px;
    background: rgba(13, 17, 28, 0.8);
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .hero {
    min-height: auto;
    margin-top: 0;
    background-position:
      center,
      center,
      right 34% top -2.6rem;
    background-size:
      auto,
      auto,
      auto calc(100% + 2.8rem);
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .player-panel {
    grid-template-columns: 1fr;
  }

  .library-tools {
    justify-content: flex-start;
  }

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

  .modal {
    grid-template-columns: 1fr;
  }

  .modal-copy {
    padding: 0 0.25rem 0.5rem;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .library-tools {
    gap: 0.45rem;
  }

  .category-trigger {
    min-width: 6.2rem;
    min-height: 2.2rem;
    padding: 0.48rem 0.72rem;
    font-size: 0.9rem;
  }

  .category-menu {
    max-height: min(16rem, calc(100vh - 5rem));
  }

  .view-toggle-group {
    gap: 0.2rem;
    padding: 0.18rem;
  }

  .view-toggle-button {
    width: 2rem;
    height: 2rem;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 0.55rem;
  }

  .topnav {
    width: auto;
    gap: 0.4rem;
  }

  .topnav button,
  .topnav a {
    min-height: 2.05rem;
    padding: 0.3rem 0.52rem;
    font-size: 0.85rem;
  }

  main {
    width: min(100% - 1rem, 1180px);
  }

  .hero {
    padding-top: 2rem;
    padding-bottom: 2.3rem;
    background-position:
      center,
      center,
      right 34% top -4.8rem;
    background-size:
      auto,
      auto,
      auto calc(100% + 5rem);
  }

  .category-trigger {
    min-width: 5.1rem;
    min-height: 2.2rem;
    gap: 0.38rem;
    padding: 0.42rem 0.55rem;
    font-size: 0.82rem;
  }

  .library-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.42rem;
  }

  .sort-control {
    width: 100%;
  }

  .sort-trigger {
    min-width: 0;
  }

  .view-toggle-group {
    justify-content: space-evenly;
    width: 100%;
    gap: 0.14rem;
    padding: 0.15rem;
  }

  .filters,
  .category-picker,
  .category-trigger {
    width: 100%;
  }

  .view-toggle-button {
    width: 1.8rem;
    height: 1.8rem;
  }

  .view-icon {
    width: 0.96rem;
    height: 0.96rem;
  }

  .view-icon-small {
    grid-template-columns: repeat(2, 0.3rem);
    grid-auto-rows: 0.3rem;
  }

  .view-icon-list {
    gap: 0.12rem;
    grid-template-rows: repeat(3, 0.16rem);
  }

  .category-menu {
    grid-template-columns: 1fr;
    width: min(14rem, calc(100vw - 1rem));
  }

  .hero::before {
    inset: 0.55rem;
    border-radius: 0.65rem;
  }

  h1 {
    white-space: normal;
  }

  .player-panel {
    margin-top: -1rem;
  }

  .hero-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .daily-quests {
    grid-template-columns: 1fr;
  }

  .energy-card-head {
    align-items: flex-start;
  }

  .energy-card-head strong {
    min-width: 4.8rem;
    font-size: 0.92rem;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-grid.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .game-grid.is-compact .game-card-body {
    padding: 0.58rem;
  }

  .game-grid.is-compact .card-actions .primary-action,
  .game-grid.is-compact .card-actions .secondary-action {
    min-height: 2rem;
    font-size: 0.78rem;
  }

  .game-grid.is-compact .game-status {
    top: 0.38rem;
    left: 0.38rem;
    min-height: 1.45rem;
    padding: 0.16rem 0.4rem;
    font-size: 0.68rem;
  }

  .game-grid.is-list {
    gap: 0.55rem;
  }

  .game-grid.is-list .game-card {
    grid-template-columns: minmax(6.6rem, 40%) minmax(0, 1fr);
  }

  .game-grid.is-list .game-card-body {
    gap: 0.32rem;
    padding: 0.52rem;
  }

  .game-grid.is-list .game-card h3 {
    font-size: 0.92rem;
  }

  .game-grid.is-list .game-card p {
    font-size: 0.78rem;
  }

  .game-grid.is-list .tag-row span:nth-child(n + 3) {
    display: none;
  }

  .game-grid.is-list .card-actions {
    gap: 0.35rem;
  }

  .game-grid.is-list .card-actions .primary-action,
  .game-grid.is-list .card-actions .secondary-action {
    min-height: 1.85rem;
    padding: 0.28rem 0.38rem;
    font-size: 0.72rem;
  }

  .scroll-reveal.is-enter-ready {
    transform: translate3d(0, 2.35rem, 0) scale(0.97);
  }

  .section-title-row {
    flex-wrap: wrap;
    width: 100%;
  }

  .section-title-row h2,
  .library-search-tools {
    width: 100%;
  }

  .library-search-tools {
    flex-basis: 100%;
    min-width: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .scroll-reveal.is-enter-ready,
  .scroll-reveal.is-enter-ready.is-enter-visible {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  .modal.is-revealed,
  .modal.is-revealed .modal-cover-wrap,
  .modal.is-revealed .modal-copy,
  .energy-card.is-celebrating,
  .confetti-piece {
    animation: none;
  }

  .energy-meter span,
  .achievement-toast {
    transition: none;
  }
}
