:root {
  color-scheme: light;
  --blue-50: #f2fbff;
  --blue-100: #dff5ff;
  --blue-200: #b9e9ff;
  --blue-300: #7bd2fb;
  --blue-500: #189ce0;
  --blue-700: #0873b4;
  --ink: #12212d;
  --muted: #5d7180;
  --line: #c9e6f5;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(8, 115, 180, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(123, 210, 251, 0.22), transparent 34rem),
    linear-gradient(180deg, var(--blue-50), var(--white) 26rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(201, 230, 245, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-300));
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(24, 156, 224, 0.26);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.79rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-button,
.text-button,
.segmented button,
.favorite-button,
.play-button,
.close-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--blue-700);
  min-height: 2.5rem;
  border-radius: 0.5rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  font-size: 1.4rem;
  font-weight: 800;
}

.text-button,
.play-button {
  padding: 0 0.95rem;
  font-weight: 750;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 0.55fr);
  align-items: end;
  gap: clamp(1.2rem, 4vw, 3rem);
  min-height: 21rem;
  padding: clamp(2rem, 6vw, 4.8rem) 0 1.2rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--blue-700);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  max-width: 12ch;
  color: #0a3756;
  font-size: clamp(2.6rem, 7vw, 5.3rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 42rem;
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.hero-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.hero-panel div {
  min-width: 0;
  padding: 1rem 0.8rem;
  border-radius: 0.5rem;
  background: var(--blue-50);
}

.hero-panel strong,
.hero-panel span {
  display: block;
}

.hero-panel strong {
  color: var(--blue-700);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.hero-panel span {
  color: var(--muted);
  font-size: 0.82rem;
}

.controls {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(10rem, 14rem);
  gap: 0.8rem;
  align-items: center;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(8, 115, 180, 0.08);
}

.search-field input,
select {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--white);
  color: var(--ink);
}

.search-field input {
  padding: 0 1rem;
}

select {
  padding: 0 0.75rem;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(4.5rem, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 0.65rem;
  background: var(--blue-100);
}

.segmented button {
  min-height: 2.25rem;
  border: 0;
  background: transparent;
  font-weight: 750;
}

.segmented button.is-active {
  color: var(--white);
  background: var(--blue-500);
  box-shadow: 0 8px 18px rgba(24, 156, 224, 0.24);
}

.library-strip {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--muted);
}

.library-strip p {
  margin: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.game-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--white);
  box-shadow: 0 10px 26px rgba(8, 115, 180, 0.08);
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 8.8rem;
  background: var(--thumb);
  color: var(--white);
}

.thumb svg {
  width: 56%;
  max-width: 8rem;
  filter: drop-shadow(0 14px 18px rgba(4, 51, 80, 0.2));
}

.game-card-body {
  padding: 0.95rem;
}

.game-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.7rem;
}

.game-title-row h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.favorite-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.1rem;
  min-height: 2.1rem;
  color: #8aa0ad;
}

.favorite-button.is-on {
  color: var(--blue-700);
  background: var(--blue-100);
}

.meta {
  margin: 0.45rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  min-height: 4.1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 750;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.play-button {
  border-color: transparent;
  color: var(--white);
  background: var(--blue-500);
}

.game-dialog {
  width: min(42rem, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.game-dialog::backdrop {
  background: rgba(11, 42, 61, 0.38);
}

.close-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.1rem;
  min-height: 2.1rem;
  font-weight: 800;
}

.dialog-hero {
  min-height: 12rem;
  padding: 1.3rem;
  background: var(--thumb);
  color: var(--white);
}

.dialog-hero h2 {
  max-width: 13rem;
  margin: 0;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0;
}

.dialog-body {
  padding: 1.2rem;
}

.dialog-body p {
  color: var(--muted);
  line-height: 1.6;
}

.demo-stage {
  position: relative;
  overflow: hidden;
  min-height: 13rem;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, var(--blue-50), var(--white));
}

.demo-target {
  position: absolute;
  left: 42%;
  top: 38%;
  display: grid;
  place-items: center;
  width: 3rem;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--blue-500);
  color: var(--white);
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(24, 156, 224, 0.28);
}

.demo-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 860px) {
  .hero,
  .controls {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 2.6rem;
  }

  h1 {
    max-width: 10ch;
  }
}

@media (max-width: 620px) {
  .app-header {
    align-items: start;
    flex-direction: column;
  }

  .top-actions,
  .text-button {
    width: 100%;
  }

  .text-button {
    justify-content: center;
  }

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

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

  .library-strip {
    display: block;
  }
}
