:root {
  --bg: #17191d;
  --surface: #202329;
  --surface-2: #282b31;
  --surface-3: #30343b;
  --border: #353940;
  --text: #f4f5f7;
  --muted: #9da3ad;
  --accent: #e6ff2f;
  --accent-dark: #131600;
  --danger: #ff6b6b;
  --sidebar-width: 224px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 18px;
  border-right: 1px solid var(--border);
  background: #1d1f24;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 8px 28px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--accent);
}

.brand-mark svg { width: 20px; fill: currentColor; }

.main-nav { display: grid; gap: 5px; }

.nav-item, .collection-item {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-item {
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  text-align: left;
  font-weight: 650;
}

.nav-item svg {
  width: 19px;
  fill: currentColor;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: var(--surface-3);
}

.nav-item.active svg { color: var(--accent); }

.nav-count {
  margin-left: auto;
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
}

.sidebar-section {
  margin-top: 28px;
  padding: 0 12px;
}

.sidebar-section p {
  margin: 0 0 10px;
  color: #717782;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.collection-item {
  gap: 10px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

.collection-item:hover { color: var(--text); }

.collection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.collection-dot.favorites { background: #f4bd50; }
.collection-dot.installed { background: #66c1a6; }

.profile {
  display: grid;
  grid-template-columns: 38px 1fr 28px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #3a3f48;
  font-weight: 800;
}

.profile strong, .profile span { display: block; }
.profile strong { font-size: 13px; }
.profile span { margin-top: 3px; color: #66c1a6; font-size: 11px; }

.main-content {
  min-width: 0;
  height: 100vh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 74px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
}

.menu-button { display: none; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(380px, 45%);
  height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
}

.search:focus-within { border-color: #555b66; }
.search svg { width: 18px; fill: #858c97; flex: none; }
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}
.search input::placeholder { color: #777f8b; }

.top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.desktop-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}
.desktop-download:hover { filter: brightness(1.08); }
.desktop-download svg { width: 17px; fill: currentColor; }

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-3); }
.icon-button svg { width: 18px; fill: var(--muted); }
.icon-button.small { width: 28px; height: 28px; border: 0; color: var(--muted); }
.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.content {
  height: calc(100vh - 74px);
  overflow-y: auto;
  padding: 28px 32px 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-heading.compact { align-items: center; margin-top: 28px; }
.section-heading h1, .section-heading h2 { margin: 0; }
.section-heading h1 { font-size: 27px; letter-spacing: -0.8px; }
.section-heading h2 { font-size: 20px; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.carousel-controls { display: flex; gap: 8px; }
.carousel-controls .icon-button { font-size: 24px; }

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.75fr);
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #24272d;
}

.hero-art {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 42%, rgba(255, 255, 255, 0.22) 0 2%, transparent 3%),
    linear-gradient(145deg, #36484a 0%, #181e25 48%, #c6a96c 49%, #7d4e35 100%);
  transition: background 300ms ease;
}
.hero-art::before, .hero-art::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.hero-art::before {
  width: 240px;
  height: 240px;
  left: 38%;
  top: 15%;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 0 100px rgba(230,255,47,.12);
}
.hero-art::after {
  width: 26px;
  height: 26px;
  left: 64%;
  top: 34%;
  background: var(--accent);
  box-shadow: 0 0 35px rgba(230,255,47,.8);
}
.hero-glow {
  position: absolute;
  width: 130%;
  height: 150px;
  left: -15%;
  bottom: -110px;
  border-radius: 50%;
  background: #d0dca5;
  filter: blur(20px);
  opacity: .45;
}
.hero-object {
  position: absolute;
  left: 54%;
  bottom: 44px;
  width: 100px;
  height: 170px;
  transform: translateX(-50%) perspective(200px) rotateY(-12deg);
  clip-path: polygon(42% 0, 58% 0, 78% 54%, 100% 100%, 0 100%, 22% 54%);
  background: linear-gradient(90deg, #101318, #424952 48%, #17191d);
  filter: drop-shadow(0 16px 18px rgba(0,0,0,.45));
}

.hero-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
  background: linear-gradient(135deg, #262a30, #202329);
}
.status-badge {
  display: inline-flex;
  height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 5px;
  color: var(--accent-dark);
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.hero-info h2 {
  margin: 16px 0 8px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -1.5px;
}
.hero-info p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  padding: 18px 0 14px;
  font-size: 17px;
  font-weight: 800;
}
.rating { color: #f5b84b; font-size: 13px; }
.rating strong { color: var(--text); }

.primary-button {
  height: 42px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent);
  font-weight: 850;
  cursor: pointer;
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button.secondary {
  color: var(--text);
  background: var(--surface-3);
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  overflow-x: auto;
}
.filter-chip {
  height: 34px;
  flex: none;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent);
}
.text-button {
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
  font-size: 13px;
}
.text-button:hover { color: var(--text); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.game-card {
  min-width: 0;
  cursor: pointer;
}
.game-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--cover);
  transition: transform 180ms ease, border-color 180ms ease;
}
.game-card:hover .game-cover {
  transform: translateY(-3px);
  border-color: #656b75;
}
.game-cover::before {
  content: "";
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  right: 8%;
  top: 12%;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 40px var(--glow);
}
.game-cover::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 58%;
  left: 18%;
  bottom: -9%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: rgba(12,14,17,.65);
  filter: drop-shadow(15px 10px 12px rgba(0,0,0,.35));
}
.game-card h3 {
  margin: 10px 0 5px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-card-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.game-card-meta strong { color: var(--text); }
.installed-label {
  display: inline-flex;
  margin-top: 7px;
  color: #66c1a6;
  font-size: 11px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.library-row {
  display: grid;
  grid-template-columns: 106px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.library-row .game-cover { aspect-ratio: 16 / 10; }
.library-row h3 { margin: 0 0 6px; font-size: 14px; }
.library-row p { margin: 0; color: var(--muted); font-size: 12px; }
.library-row button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--accent-dark);
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.hidden { display: none; }
.empty-store {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}
.empty-store-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent);
  background: var(--surface);
  font-size: 28px;
}
.empty-store h3 { margin: 0 0 6px; color: var(--text); }
.empty-store p { margin: 0; font-size: 13px; }
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 9, 11, .72);
  backdrop-filter: blur(8px);
}
.auth-overlay.hidden { display: none; }
.auth-modal {
  position: relative;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #24272d;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.auth-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface);
}
.auth-tab {
  height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.auth-tab.active {
  color: var(--accent-dark);
  background: var(--accent);
}
.auth-modal h2 { margin: 0 0 6px; }
.auth-subtitle { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.auth-field { display: grid; gap: 7px; margin-bottom: 14px; }
.auth-field.hidden { display: none; }
.auth-field span { color: #c9ccd2; font-size: 12px; font-weight: 700; }
.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: 0;
  color: var(--text);
  background: #1b1d21;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-error {
  min-height: 18px;
  margin: 2px 0 10px;
  color: #ff8181;
  font-size: 12px;
}
.auth-submit, .logout-button {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent);
  font-weight: 850;
  cursor: pointer;
}
.logout-button { margin-top: 8px; color: var(--text); background: #4a2d31; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 280px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #30343b;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
  font-size: 13px;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-card { grid-template-columns: 1.4fr .6fr; }
}

@media (max-width: 780px) {
  :root { --sidebar-width: 0px; }
  body { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 224px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 40px rgba(0,0,0,.35); }
  .topbar { height: 64px; padding: 0 16px; }
  .menu-button {
    display: grid;
    gap: 4px;
    width: 38px;
    height: 38px;
    place-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
  }
  .menu-button span { width: 16px; height: 2px; background: var(--muted); }
  .search { width: min(300px, 55%); }
  .top-actions .icon-button:first-child { display: none; }
  .content { height: calc(100vh - 64px); padding: 20px 16px 40px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-art { min-height: 230px; }
  .hero-info { min-height: 260px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; }
  .top-actions { gap: 0; }
  .search { flex: 1; width: auto; }
  .search input { min-width: 0; }
  .top-actions .icon-button { display: none; }
  .section-heading h1 { font-size: 23px; }
  .hero-art { min-height: 190px; }
  .hero-info { min-height: 250px; padding: 22px; }
  .game-grid { gap: 10px; }
  .game-card h3 { font-size: 13px; }
  .library-row { grid-template-columns: 82px 1fr auto; gap: 9px; }
}
