/* Shared console chrome and catalogue layout */
:root {
  --chrome-height: 66px;
  --page-width: 1540px;
  --gutter: clamp(16px, 3.2vw, 60px);
  --section-gap: clamp(12px, 1.6vh, 20px);
  --grid-columns: 4;
  --list-columns: 1;
  --list-rows: 8;
  --rank-columns: 3;
}

.topbar {
  height: var(--chrome-height);
  gap: clamp(18px, 3vw, 50px);
  padding-inline: max(var(--gutter), calc((100vw - var(--page-width)) / 2));
  background: #0b101c;
  border-bottom: 1px solid var(--rc-line);
}
.topbar::after, .library-section::before { content: none; }
.brand small { margin-top: 5px; color: #a3b7d6; font-size: 8px; letter-spacing: .18em; }
.main-nav {
  position: static;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  width: auto;
  height: auto;
  padding: 3px;
  gap: 2px;
  border-radius: 12px;
  background: #101725;
  box-shadow: none;
  transform: none;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 35px;
  padding: 0 14px;
  gap: 7px;
  font-size: 13px;
  border-radius: 9px;
}
.main-nav a.active { background: #233551; border-color: #415a82; box-shadow: none; }
.main-nav a.active span { color: #80ded8; }
.main-nav a:hover { transform: none; }
.profile-button { min-width: 0; }
.profile-label strong { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-button[aria-label="Iniciar sesión"] .profile-label { display: grid; }

.console-page {
  inset: var(--chrome-height) 0 0;
  height: auto;
  padding: clamp(16px, 2.6vh, 36px) max(var(--gutter), calc((100vw - var(--page-width)) / 2)) 12px;
  overflow: hidden auto;
  scrollbar-color: #445574 transparent;
}
.library-section .section-heading, .ranking-section .section-heading {
  flex: none;
  align-items: center;
  margin: 0 0 var(--section-gap);
  gap: 12px;
}
.section-heading .eyebrow { margin: 0 0 6px; }
.section-heading .page-subtitle { margin: 5px 0 0; font-size: .84rem; }
.library-toolbar {
  position: static;
  display: flex;
  flex: none;
  flex-wrap: wrap;
  padding: 5px;
  gap: 5px;
  margin: 0 0 var(--section-gap);
  box-shadow: none;
}
.search-box { flex: 1 1 150px; max-width: 330px; height: 38px; }
.filter-tabs { flex: 0 1 auto; justify-content: flex-start; }
.select-wrap { display: grid; margin-inline-start: auto; padding-inline-start: 10px; border-radius: 9px; }
.select-wrap select { height: 36px; }
.library-viewport { flex: 1 0 auto; height: auto; min-height: 0; }
.library-viewport:has(.carousel-view) {
  display: grid;
  grid-template-rows: minmax(min-content, 1fr) auto;
  isolation: isolate;
}
.game-grid.carousel-view { display: grid; grid-template: auto / 1fr; height: auto; }
.carousel-view .game-card {
  position: relative;
  inset: auto;
  grid-area: 1 / 1;
  grid-template: auto / minmax(0, 1fr) minmax(0, .95fr);
  gap: clamp(22px, 4vw, 70px);
  padding: clamp(18px, 3vh, 44px) clamp(60px, 5.8vw, 96px);
}
.carousel-view .game-card::after {
  background: linear-gradient(100deg, rgba(9,14,25,.96) 12%, rgba(11,17,29,.88) 48%, rgba(10,15,25,.32));
}
.carousel-view .game-cover {
  display: grid;
  place-items: center;
  width: fit-content;
  max-width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  transform: none !important;
}
.carousel-view .cover-image {
  position: static;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(190px, 33vh, 370px);
  object-fit: contain;
}
.carousel-view .game-info { padding: 0; max-width: 62ch; }
.carousel-view .game-system-code { margin-bottom: 9px; font-size: .68rem; }
.carousel-view .game-topline { gap: 8px; }
.carousel-view .game-topline h3 { font-size: clamp(2.3rem, 4.1vw, 4.8rem); line-height: 1.02; letter-spacing: -.06em; overflow-wrap: anywhere; }
.carousel-view .game-info > p {
  display: block;
  min-height: 0;
  margin: 12px 0;
  color: #bdc8da;
  font-size: clamp(.875rem, 1vw, 1rem);
  line-height: 1.5;
  white-space: normal;
}
.carousel-view .game-feature-tags { gap: 5px; }
.carousel-view .score-line { display: flex; align-items: center; margin-top: 14px; padding-top: 12px; }
.card-play-button { gap: 14px; font-size: .74rem; border-radius: 9px; }
.game-cover::after, .game-cover .cover-art { display: none; }
.game-cover .favorite-btn { left: auto; }
.game-cover:focus-within .favorite-btn { opacity: 1; }
.carousel-arrow {
  position: relative;
  grid-area: 1 / 1;
  align-self: center;
  justify-self: start;
  inset: auto !important;
  width: 36px;
  height: 46px;
  margin: 0 10px;
  transform: none;
}
.carousel-arrow.next { justify-self: end; }
.carousel-view { grid-area: 1 / 1; }
.carousel-rail {
  position: static;
  grid-row: 2;
  align-items: stretch;
  height: auto;
  padding: 12px clamp(15px, 2vw, 32px);
  gap: 9px;
  scroll-padding-inline: 12px;
  background: #0d1320;
}
.carousel-rail-item, .carousel-rail-item.is-active {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  flex: 0 0 clamp(92px, 9.5vw, 165px);
  width: auto;
  height: clamp(72px, 10.5vh, 110px);
  overflow: hidden;
  border-radius: 8px;
  opacity: .83;
  transform: none;
  box-shadow: none;
  transition: background .18s, border-color .18s;
}
.carousel-rail-item.is-active { opacity: 1; border-color: #77d8da; background: #203745; }
.carousel-rail-item:hover { transform: none; opacity: 1; }
.carousel-rail-item img { min-height: 0; border-radius: 0; }
.carousel-rail-item span {
  position: static;
  display: block;
  width: 100%;
  padding: 5px 4px;
  color: #e0e9f8;
  font: 600 .68rem/1.15 Manrope,sans-serif;
  opacity: 1;
  transform: none;
}
.library-console-footer { display: flex; flex: none; min-height: 36px; gap: 10px; margin-top: 6px; }
.surprise-button { margin-left: auto; }
.library-viewport:has(.grid-view), .library-viewport:has(.list-view) { flex: 0 0 auto; }
.game-grid.grid-view, .game-grid.list-view {
  height: auto;
  grid-template-rows: none;
  align-content: start;
  gap: 10px;
  padding: 12px;
}
.game-grid.grid-view { grid-template-columns: repeat(var(--grid-columns),minmax(0,1fr)); }
.grid-view .game-card { grid-template-rows: auto auto; }
.grid-view .game-cover { height: clamp(96px, 16vh, 195px); }
.grid-view .game-info { padding: 8px 7px 5px; }
.grid-view .game-topline h3 { font-size: 1rem; }
.grid-view .score-line > span { display: inline; }
.grid-view .score-line { justify-content: flex-start; align-items: center; gap: 7px; }
.game-grid.list-view { grid-template-columns: repeat(var(--list-columns),minmax(0,1fr)); }
.game-grid.list-view .game-card { grid-template-columns: clamp(64px, 6.2vw, 100px) minmax(0,1fr); gap: 12px; padding: 8px; align-items: center; }
.game-grid.list-view .game-cover { aspect-ratio: 1.4; height: auto; }
.game-grid.list-view .game-info { padding: 0 4px 0 0; }
.list-view .game-info > p { min-height: 0; color: #abb8cd; }
.list-view .card-play-button { min-width: 0; }
.empty-state:not([hidden]) { flex: 1; align-content: center; border: 1px dashed var(--rc-line); border-radius: 16px; }

.ranking-summary-grid {
  flex: 0 0 auto;
  grid-template-columns: repeat(var(--rank-columns),minmax(0,1fr));
  grid-template-rows: none;
  gap: 14px;
  overflow: visible;
}
.ranking-summary-card {
  display: flex;
  flex-direction: column;
  height: auto;
  padding: 0;
  background: #101725;
}
.ranking-summary-card > header { grid-template-columns: 44px minmax(0,1fr) auto; padding: 12px 14px; gap: 12px; }
.ranking-summary-card > header img { width: 44px; height: 45px; }
.ranking-summary-card > header span { font-size: 8px; }
.ranking-summary-card ol { margin: 0; padding: 3px 14px; }
.ranking-summary-card li { min-height: 26px; grid-template-columns: 19px 20px minmax(0,1fr) auto; }
.ranking-summary-card li > strong, .ranking-summary-card li > em { font-size: 11px; }
.ranking-summary-card li.empty { opacity: .64; }
.ranking-summary-card > footer { display: flex; min-height: 38px; margin: 0; padding: 6px 14px; }
.ranking-summary-card > footer a { font-size: 9px; }
.ranking-pagination { flex: none; padding: 12px 0; }

.settings-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
.settings-layout { flex: 1 1 auto; min-height: 0; }
.settings-content { min-width: 0; overscroll-behavior: contain; }
.panel-dialog { color-scheme: dark; background: #101725; }
.panel-dialog .dialog-header, .settings-dialog .dialog-footer { flex: none; gap: 12px; }
.panel-dialog .close-button { flex: 0 0 40px; }
.settings-nav button.active { color: #c6e9ff; border-color: var(--rc-cyan); background: #203044; }
.profile-hero { background: linear-gradient(110deg,#20344a,#131c2c 75%); }
.profile-hero h3, .profile-hero p, .account-card { overflow-wrap: anywhere; }
.profile-stats, .online-profile-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.online-lobby-game { min-height: 0; overflow-y: auto; }
:where(.app-shell,.panel-dialog) :focus-visible { outline: 2px solid #83e4e4; outline-offset: 2px; }
.carousel-rail :focus-visible { outline-offset: -3px; }

@media (max-width: 1179px) {
  :root { --grid-columns: 3; --rank-columns: 2; --list-rows: 3; }
  .profile-button[aria-label="Iniciar sesión"] .profile-label small { display: none; }
}
@media (max-width: 859px) {
  .filter-tabs button:nth-of-type(n+4) { display: block; }
  .select-wrap { display: grid; }
  .topbar .brand > span:last-child { display: grid; }
  .carousel-view .game-card { padding-inline: 52px; gap: 18px; }
}
@media (max-width: 759px) {
  :root { --grid-columns: 2; --rank-columns: 1; --list-columns: 1; --list-rows: 5; --chrome-height: 60px; }
  .topbar { gap: 8px; padding-inline: 12px; }
  .main-nav { gap: 0; padding: 2px; }
  .main-nav a { padding: 0 8px; font-size: 12px; }
  .main-nav a span, .topbar .brand > span:last-child { display: none; }
  .header-actions { gap: 4px; }
  .console-page { padding-inline: 12px; }
  .filter-tabs { order: 1; display: flex; width: 100%; flex-wrap: wrap; overflow: visible; }
  .filter-tabs button { flex: none; padding-inline: 9px; }
  .library-toolbar .search-box { max-width: none; }
  .settings-layout { display: flex; flex-direction: column; }
  .settings-nav { flex: none; display: flex; padding: 3px; }
  .settings-nav button { padding: 10px 5px; text-align: center; }
  .settings-content { min-height: 0; }
}
@media (max-width: 600px) {
  .topbar .profile-button { padding: 4px 6px; gap: 4px; }
  .profile-button[aria-label="Iniciar sesión"] .avatar { display: none; }
  .carousel-view .game-card { grid-template: auto auto / minmax(0,1fr); padding: 16px 38px; gap: 14px; }
  .carousel-view .game-cover { grid-area: 1 / 1; justify-self: center; }
  .carousel-view .cover-image { max-height: clamp(110px,21vh,190px); }
  .carousel-view .game-info { grid-area: 2 / 1; width: 100%; padding: 0; }
  .carousel-view .game-topline { flex-wrap: wrap; gap: 4px 8px; }
  .carousel-view .game-topline h3 { font-size: 1.7rem; }
  .carousel-view .game-info > p { margin: 6px 0; font-size: .82rem; }
  .carousel-view .score-line { margin-top: 4px; padding-top: 8px; }
  .carousel-arrow { width: 28px; height: 40px; margin: 0 4px; }
  .carousel-progress { gap: 6px; letter-spacing: 0; }
  .online-profile-grid div { padding-inline: 12px; }
}
.account-navigation { position: relative; }
.account-options { position: absolute; right: 0; top: calc(100% + 8px); width: 205px; padding: 6px; background: #151e2e; border: 1px solid #39485f; border-radius: 12px; box-shadow: 0 14px 44px #0008; }
.account-options button { display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 7px; text-align: left; background: transparent; color: #edf4ff; cursor: pointer; }
.account-options button:hover, .account-options button:focus-visible { background: #293a50; }
.account-options button:last-child { border-top: 1px solid #354055; color: #ffc3b5; }
.settings-dialog[open] { height: min(790px, calc(100dvh - 32px)); }
.settings-dialog .settings-layout { flex: 1; }
.settings-dialog .settings-content { scrollbar-gutter: stable; }
.settings-dialog [data-settings-panel]:not([hidden]) { animation: settingsIn .24s ease-out; }
@keyframes settingsIn { from { opacity: .2; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .settings-dialog [data-settings-panel]:not([hidden]) { animation: none; } }
.ranking-section::before { content: none; }
.ranking-section { --page-width: 1960px; }
.ranking-summary-card > header h3 { font-size: clamp(16px, 1.35vw, 28px); }
.ranking-summary-card > header span, .ranking-summary-card footer a { font-size: clamp(10px,.8vw,15px); }
.ranking-summary-card li > strong, .ranking-summary-card li > em { font-size: clamp(13px,1vw,20px); }
.ranking-summary-card li { min-height: clamp(26px,3.25vh,56px); }
.ranking-summary-card > header { padding-block: clamp(10px,1.4vh,24px); grid-template-columns: auto minmax(0,1fr) auto; }
.ranking-summary-card > header img { width: clamp(46px,4.2vw,84px); height: clamp(46px,5.4vh,85px); }
.ranking-summary-card > footer { min-height: clamp(39px,4.6vh,66px); }
.ranking-pagination { font-size: clamp(11px,.85vw,15px); }
@media (min-width: 1000px) { .ranking-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }

.carousel-view .game-card {
  grid-template: auto / minmax(0,1fr);
  min-height: clamp(330px, 45vh, 640px);
  cursor: pointer;
}
.carousel-view .game-backdrop {
  inset: 6px 0;
  width: 100%;
  height: calc(100% - 12px);
  opacity: 1;
  filter: none;
  transform: none;
}
.carousel-view .game-card::after { background: none; }
.carousel-view .game-info {
  grid-area: 1 / 1;
  width: fit-content;
  max-width: min(62ch, 100%);
  padding: clamp(14px, 2vw, 32px);
  background: rgba(0,0,0,.73);
  backdrop-filter: blur(7px);
  border-radius: 16px;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.carousel-view .hero-launch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.hero-launch:focus-visible { outline: 3px solid #54e8cf; outline-offset: -5px; }
.carousel-view .favorite-btn { left: auto; right: 14px; top: 14px; }
.carousel-view .favorite-btn:focus-visible { opacity: 1; }
.carousel-view .game-feature-tags { flex-wrap: wrap; }
.carousel-view .game-info > p { -webkit-line-clamp: unset; color: #e4e9ef; }
