:root {
  --bg-primary: #0b1017;
  --bg-secondary: #121923;
  --bg-elevated: #192331;
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f7fb;
  --text-secondary: #a4b1c2;
  --accent: #6be3a9;
  --accent-strong: #33c781;
  --danger: #ff7a7a;
  --shadow-color: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  background:
    radial-gradient(circle at top, rgba(107, 227, 169, 0.14), transparent 30%),
    linear-gradient(180deg, #0c1219 0%, #0a0f15 100%);
  color: var(--text-primary);
}

body.modal-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.ads {
  text-align: center;
}

.ads--top {
  margin-top: 4px;
}

.ads--bottom {
  margin-bottom: 20px;
}

.side_ad_left,
.side_ad_right {
  z-index: 10;
}

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

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(17, 25, 36, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px var(--shadow-color);
}

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

.brand-lockup__logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.brand-lockup__text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.hero-card,
.catalog-card,
.player-shell {
  border: 1px solid var(--border);
  background: rgba(18, 25, 35, 0.95);
  box-shadow: 0 18px 50px var(--shadow-color);
}

.hero-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
  border-radius: 28px;
}

.hero-card__logo {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.hero-card__copy h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}

.hero-card__description,
.catalog-card__subtext,
.catalog-status,
.empty-state p,
.player-status,
.player-toolbar__eyebrow {
  color: var(--text-secondary);
}

.hero-card__description,
.catalog-card__subtext {
  margin: 0;
  max-width: 60ch;
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.catalog-card {
  margin-top: 22px;
  padding: 28px;
  border-radius: 28px;
}

.catalog-card__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.catalog-card__header h2,
.empty-state h3,
.player-toolbar__brand h2 {
  margin: 8px 0;
}

.search-field {
  width: min(100%, 320px);
}

.search-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.search-field input::placeholder {
  color: var(--text-secondary);
}

.search-field input:focus {
  border-color: rgba(107, 227, 169, 0.5);
  box-shadow: 0 0 0 4px rgba(107, 227, 169, 0.12);
  transform: translateY(-1px);
}

.catalog-status {
  min-height: 24px;
  margin: 0 0 18px;
}

.games-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding-right: 10px;
}

.games-container::-webkit-scrollbar {
  width: 8px;
}

.games-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.games-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.games-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.game-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  appearance: none;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.game-card:hover,
.game-card:focus-visible {
  background: var(--bg-primary);
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 5px 20px var(--shadow-color);
}

.game-card:focus-visible {
  outline: 2px solid rgba(107, 227, 169, 0.4);
  outline-offset: 2px;
}

.game-card:hover .game-name,
.game-card:focus-visible .game-name {
  background: rgba(11, 16, 23, 0.92);
}

.game-cover {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  background: var(--bg-secondary);
  content-visibility: auto;
  contain-intrinsic-size: 130px 130px;
}

.game-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 8px 6px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.7rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(11, 16, 23, 0.85);
  backdrop-filter: blur(4px);
  transition: background 0.2s ease;
}

.empty-state {
  margin-top: 12px;
  padding: 30px;
  border: 1px dashed var(--border);
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(4, 7, 11, 0.72);
  backdrop-filter: blur(10px);
}

.player-shell {
  width: min(1680px, calc(100vw - 24px));
  height: min(960px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
}

.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(11, 16, 23, 0.96);
  border-bottom: 1px solid var(--border);
}

.player-toolbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.player-toolbar__brand img {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.player-toolbar__brand h2 {
  overflow: hidden;
  font-size: 1.1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-toolbar__eyebrow {
  margin: 0 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.player-toolbar__actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.player-status {
  margin: 0;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.player-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  flex: 1;
  background: #ffffff;
}

.player-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  background: #ffffff;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(107, 227, 169, 0.25);
  border-radius: 12px;
  background: rgba(107, 227, 169, 0.1);
  color: var(--text-primary);
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(107, 227, 169, 0.45);
  background: rgba(107, 227, 169, 0.16);
}

.ghost-button--danger {
  border-color: rgba(255, 122, 122, 0.25);
  background: rgba(255, 122, 122, 0.08);
}

.ghost-button--danger:hover,
.ghost-button--danger:focus-visible {
  border-color: rgba(255, 122, 122, 0.45);
  background: rgba(255, 122, 122, 0.14);
}

.ghost-button--icon {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
}

.close-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.close-icon::before,
.close-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.close-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.is-hidden {
  display: none !important;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 28px;
  padding: 0 20px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

@media (min-width: 1200px) {
  .page-shell {
    width: min(1120px, calc(100% - 680px));
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .page-shell {
    width: min(1120px, calc(100% - 400px));
  }
}

@media (max-width: 1023px) {
  .side_ad_left,
  .side_ad_right {
    display: none;
  }
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .hero-card,
  .catalog-card,
  .player-shell {
    border-radius: 22px;
  }

  .hero-card,
  .catalog-card__header,
  .player-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-card {
    padding: 24px;
    text-align: center;
  }

  .hero-card__logo {
    margin: 0 auto;
  }

  .search-field {
    width: 100%;
  }

  .player-shell {
    width: min(100vw - 16px, 1680px);
    height: calc(100vh - 16px);
  }

  .player-toolbar__actions {
    justify-content: stretch;
  }

  .player-toolbar__actions > * {
    flex: 1 1 140px;
  }
}

@media (max-width: 640px) {
  .top-bar {
    margin: 10px;
    padding: 10px 12px;
  }

  .page-shell {
    width: min(100% - 20px, 1120px);
    margin-top: 18px;
  }

  .games-container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .catalog-card,
  .hero-card {
    padding: 20px;
  }
}
