:root {
  --bg: #061127;
  --topbar: #07142f;
  --rail: #07142c;
  --surface: #0a1835;
  --surface-soft: #0d2045;
  --line: #18345f;
  --text: #f4f8ff;
  --muted: #9eb2d1;
  --brand: #1478ff;
  --brand-2: #5ee7ff;
  --accent: #ffb000;
  --danger: #ff4d66;
  --sidebar-rail: 52px;
  --sidebar-expanded: 224px;
  --header: 70px;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(7, 20, 47, 0.98);
  border-bottom: 1px solid rgba(24, 52, 95, 0.75);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  display: grid;
  gap: 14px;
  grid-template-columns: auto auto minmax(220px, 1fr) auto;
  height: var(--header);
  left: 0;
  padding: 0 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 30;
}

.icon-button {
  align-items: center;
  background: #09214c;
  border: 1px solid #173a70;
  border-radius: 12px;
  color: #d9e9ff;
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  width: 42px;
}

.icon-button:hover,
.icon-button.is-active {
  background: #102d62;
  border-color: #2a5a9a;
  transform: translateY(-1px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 24px;
  font-weight: 850;
  gap: 10px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.search {
  max-width: 620px;
  position: relative;
  width: 100%;
}

.search input {
  background: #071b3f;
  border: 1px solid #153869;
  border-radius: 16px;
  color: #eef6ff;
  height: 46px;
  outline: none;
  padding: 0 48px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  width: 100%;
}

.search input:focus {
  background: #082049;
  border-color: #2b69b2;
  box-shadow: 0 12px 32px rgba(2, 9, 24, 0.28);
}

.search input::placeholder {
  color: #d7e5ff;
}

.search-icon,
.search-clear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.search-icon {
  color: var(--muted);
  left: 16px;
}

.search-clear {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: none;
  right: 14px;
}

.search.has-value .search-clear {
  display: block;
}

.search-results {
  background: #081936;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
  display: none;
  left: 0;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 54px;
  z-index: 40;
}

.search-results.is-open {
  display: block;
}

.search-result {
  align-items: center;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  padding: 10px;
}

.search-result:hover {
  background: var(--surface-soft);
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.signin {
  background: #62ddf5;
  border: 0;
  border-radius: 14px;
  color: #031225;
  cursor: pointer;
  font-weight: 750;
  height: 42px;
  padding: 0 18px;
}

.sidebar {
  background: rgba(7, 20, 44, 0.99);
  border-right: 1px solid rgba(28, 59, 105, 0.78);
  bottom: 0;
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 6px 28px;
  position: fixed;
  top: var(--header);
  transition: transform 180ms ease, width 180ms ease, box-shadow 180ms ease;
  width: var(--sidebar-rail);
  z-index: 35;
}

.sidebar:hover,
.sidebar:focus-within {
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.32);
  width: var(--sidebar-expanded);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #244a82;
  border-radius: 999px;
}

.sidebar-section {
  border-bottom: 1px solid rgba(28, 59, 105, 0.56);
  display: grid;
  gap: 4px;
  padding: 10px 0;
}

.sidebar-link {
  align-items: center;
  border-radius: 15px;
  color: #c4d9ff;
  display: flex;
  font-size: 14px;
  font-weight: 680;
  gap: 14px;
  min-height: 38px;
  padding: 9px 10px;
  white-space: nowrap;
  width: calc(var(--sidebar-expanded) - 16px);
}

.sidebar-link:hover,
.sidebar-link.is-active {
  background: #1677ff;
  color: #fff;
}

.dot {
  align-items: center;
  background: linear-gradient(135deg, #21e5ff, #1677ff 48%, #ffd25c);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 6px 14px rgba(0, 0, 0, 0.22);
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  line-height: 1;
  width: 22px;
}

.language {
  position: relative;
}

.language-menu {
  background: #0a1835;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
  display: none;
  gap: 4px;
  margin-top: 8px;
  padding: 8px;
}

.language-menu.is-open {
  display: grid;
}

.main {
  margin-left: var(--sidebar-rail);
  padding: calc(var(--header) + 24px) 24px 56px;
  transition: margin-left 180ms ease;
}

.hero-strip {
  align-items: center;
  background: radial-gradient(circle at top left, rgba(20, 120, 255, 0.24), transparent 36%), #081936;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
  min-height: 120px;
  overflow: hidden;
  padding: 22px;
}

.hero-strip h1 {
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.04;
  margin: 0 0 8px;
}

.hero-strip p {
  color: var(--muted);
  margin: 0;
  max-width: 680px;
}

.hero-badge {
  background: #102d62;
  border-radius: 16px;
  color: #fff;
  font-weight: 850;
  padding: 16px 18px;
  text-align: center;
  white-space: nowrap;
}

.game-row {
  margin: 0 0 30px;
}

.row-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.row-title {
  align-items: center;
  display: flex;
  gap: 12px;
}

.row-title h2 {
  font-size: 22px;
  line-height: 1.1;
  margin: 0;
}

.section-icon {
  align-items: center;
  background: linear-gradient(135deg, #ffcf48, #ff4d66);
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.view-more {
  color: var(--brand);
  font-size: 14px;
  font-weight: 760;
}

.row-controls {
  display: flex;
  gap: 8px;
}

.is-expanded .row-header {
  background: rgba(6, 17, 39, 0.94);
  border-bottom: 1px solid rgba(24, 52, 95, 0.5);
  margin-left: -2px;
  margin-right: -2px;
  padding: 8px 2px 14px;
  position: sticky;
  top: calc(var(--header) + 8px);
  z-index: 10;
}

.carousel {
  display: grid;
  grid-auto-columns: minmax(150px, 184px);
  grid-auto-flow: column;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

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

.game-card {
  background: #0a1835;
  border: 1px solid rgba(55, 82, 125, 0.72);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.game-card:hover {
  border-color: #315d9f;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
  transform: translateY(-3px);
}

.game-card:focus-visible {
  border-color: var(--brand-2);
  outline: 2px solid rgba(94, 231, 255, 0.24);
  outline-offset: 2px;
}

.thumb {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, rgba(20, 120, 255, 0.26), rgba(94, 231, 255, 0.18)), #0f2448;
  color: #9db5d8;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-thumb {
  overflow: hidden;
  position: relative;
}

.game-thumb img {
  height: 58%;
  max-width: 72%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.is-expanded .game-card {
  min-width: 0;
}

.is-expanded .game-thumb {
  background: #102646;
}

.is-expanded .game-thumb img {
  height: 100%;
  max-width: none;
  object-fit: cover;
  width: 100%;
}

.game-thumb strong {
  color: #eef6ff;
  font-size: 54px;
  letter-spacing: 0;
  line-height: 1;
  position: relative;
  text-transform: uppercase;
  z-index: 1;
}

.game-thumb span {
  background: rgba(3, 18, 37, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  bottom: 10px;
  color: #d9e9ff;
  font-size: 11px;
  left: 10px;
  letter-spacing: 0;
  padding: 5px 8px;
  position: absolute;
  text-transform: none;
  z-index: 2;
}

.card-body {
  min-height: 84px;
  padding: 12px 12px 13px;
}

.card-title {
  display: block;
  font-size: 14px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
  margin-top: 4px;
}

.card-meta strong {
  color: var(--brand-2);
  font-size: 15px;
}

.card-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-panel {
  background: #081936;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #c7d7ef;
  line-height: 1.7;
  margin-top: 26px;
  padding: 26px;
}

.content-panel h1,
.content-panel h2,
.content-panel h3 {
  color: var(--text);
  line-height: 1.2;
}

.content-panel h1 {
  font-size: 30px;
}

.faq-item {
  border-top: 1px solid var(--line);
}

.faq-question {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  font-weight: 800;
  justify-content: space-between;
  padding: 16px 0;
  text-align: left;
  width: 100%;
}

.faq-answer {
  color: var(--muted);
  display: none;
  padding-bottom: 16px;
}

.faq-item.is-open .faq-answer {
  display: block;
}

.footer {
  color: var(--muted);
  font-size: 13px;
  margin-top: 28px;
  text-align: center;
}

.game-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.game-layout--play {
  align-items: start;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.game-main-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.game-hero,
.game-info-card,
.player-shell {
  background: #081936;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.game-hero {
  display: grid;
  gap: 18px;
  grid-template-columns: 210px minmax(0, 1fr);
  padding: 18px;
}

.game-hero--compact {
  align-items: start;
  grid-template-columns: 180px minmax(0, 1fr);
  margin-top: 0;
}

.game-hero--compact h1 {
  font-size: clamp(30px, 4vw, 54px);
}

.breadcrumb {
  color: #8ea9ff;
  font-size: 13px;
  font-weight: 760;
  margin-bottom: 12px;
}

.poster {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.game-hero h1 {
  font-size: clamp(28px, 4vw, 48px);
  margin: 0 0 10px;
}

.play-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 0;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
  height: 54px;
  padding: 0 28px;
}

.play-button--secondary {
  font-size: 15px;
  height: 44px;
  margin-top: 12px;
  padding: 0 18px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.stat {
  background: var(--surface-soft);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  padding: 9px 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #0d2e65;
  border-radius: 999px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 780;
  padding: 8px 12px;
}

.player-shell {
  margin-top: 24px;
  overflow: hidden;
}

.player-shell--hero {
  margin-top: 0;
}

.player-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.player-actions {
  display: flex;
  gap: 8px;
}

.player {
  align-items: center;
  aspect-ratio: var(--game-aspect-ratio, 16 / 9);
  background: radial-gradient(circle at center, rgba(111, 66, 255, 0.22), transparent 35%), #11131d;
  color: #c9d2e5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: var(--game-min-height, 520px);
  position: relative;
  text-align: center;
}

.player-shell--hero .player {
  min-height: clamp(540px, calc(100dvh - var(--header) - 64px), var(--game-min-height, 760px));
}

.player strong {
  color: #fff;
  font-size: clamp(22px, 3vw, 40px);
}

.player-placeholder {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
}

.game-player-frame,
[data-game-frame] {
  background: #000;
  border: 0;
  display: none;
  inset: 0;
  position: absolute;
  width: 100%;
  height: 100%;
}

.player-shell.is-loaded .player-placeholder {
  display: none;
}

.player-shell.is-loaded [data-game-frame] {
  display: block;
}

.player-shell:fullscreen {
  background: #000;
}

.player-shell:fullscreen .player {
  min-height: calc(100vh - 67px);
}

.side-stack {
  display: grid;
  gap: 16px;
}

.side-stack--play {
  position: sticky;
  top: calc(var(--header) + 24px);
}

.game-info-card {
  padding: 18px;
}

.game-info-card h3 {
  margin: 0 0 12px;
}

.facts {
  display: grid;
  gap: 12px;
}

.fact {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.fact span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}

.play-next-card {
  padding: 16px;
}

.play-next-list {
  display: grid;
  gap: 12px;
}

.play-next-item {
  background: #101a2c;
  border: 1px solid rgba(83, 103, 143, 0.48);
  border-radius: 10px;
  display: grid;
  gap: 9px;
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease;
}

.play-next-item:hover {
  border-color: #4c79c5;
  transform: translateY(-2px);
}

.play-next-thumb {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #102646;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.play-next-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.play-next-thumb strong {
  color: #eef6ff;
  font-size: 44px;
}

.play-next-title {
  display: block;
  font-size: 14px;
  font-weight: 820;
  overflow: hidden;
  padding: 0 10px 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-copy-panel {
  margin-top: 0;
}

.modal-backdrop {
  align-items: center;
  background: rgba(11, 14, 24, 0.48);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 60;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  background: #081936;
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.modal h2 {
  margin-top: 0;
}

.overlay {
  background: rgba(15, 20, 34, 0.35);
  display: none;
  inset: var(--header) 0 0 0;
  position: fixed;
  z-index: 15;
}

.overlay.is-open {
  display: block;
}

.is-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-rail)));
}

.is-collapsed .main {
  margin-left: 0;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto auto 1fr auto;
  }

  .brand span:last-child {
    display: none;
  }

  .top-actions .signin {
    display: none;
  }

  .sidebar {
    box-shadow: 14px 0 36px rgba(18, 24, 40, 0.18);
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .main,
  .is-collapsed .main {
    margin-left: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-strip,
  .game-layout,
  .game-hero {
    grid-template-columns: 1fr;
  }

  .hero-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-layout {
    display: grid;
  }

  .player {
    aspect-ratio: auto;
    min-height: var(--game-mobile-min-height, 560px);
  }

  .side-stack {
    order: -1;
  }

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

  .game-layout--play .side-stack {
    order: 2;
  }

  .side-stack--play {
    position: static;
  }

  .player-shell--hero .player {
    min-height: var(--game-mobile-min-height, 560px);
  }
}

@media (max-width: 620px) {
  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .search {
    max-width: none;
  }

  .search input {
    height: 42px;
    padding-left: 38px;
  }

  .icon-button {
    height: 38px;
    width: 38px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .icon-button:nth-child(2) {
    display: none;
  }

  .carousel {
    grid-auto-columns: minmax(132px, 43vw);
  }

  .game-grid {
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  }

  .row-title h2 {
    font-size: 18px;
  }

  .row-controls {
    display: none;
  }
}
