.library-view {
  --library-glow: rgba(79, 216, 255, 0.42);
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(79, 216, 255, 0.12), transparent 34%),
    radial-gradient(circle at 78% 0%, rgba(157, 79, 224, 0.14), transparent 36%);
}

.library-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 18px 26px 12px;
  border-bottom: 1px solid rgba(79, 216, 255, 0.14);
}

.library-eyebrow,
.library-section-kicker {
  margin: 0;
  color: var(--nebula-color-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.library-title {
  margin: 4px 0 0;
  font-size: clamp(38px, 4.5vw, 62px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.library-topbar-right,
.library-actions,
.library-system-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.library-system-status {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--nebula-radius-pill);
  background: rgba(10, 16, 34, 0.74);
  color: var(--nebula-color-muted);
  font-size: 13px;
}

.library-system-status strong {
  color: var(--nebula-color-text);
  font-size: 16px;
}

.library-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nebula-color-success);
  box-shadow: 0 0 14px rgba(79, 255, 136, 0.55);
}

.library-action,
.library-category-tab,
.library-genre-tab,
.library-filter-chip,
.library-sort-option,
.library-detail-button {
  color: var(--nebula-color-text);
  border: 2px solid rgba(255, 255, 255, 0.09);
  background: rgba(15, 23, 46, 0.82);
  box-shadow: none;
}

.library-action {
  min-width: 132px;
  padding: 12px 18px;
  border-radius: var(--nebula-radius-pill);
  font-weight: 800;
}

.library-console {
  flex: 1;
  min-height: 0;
  padding: 16px 20px 0;
}

.library-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.library-category-tabs,
.library-genre-tabs {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.library-category-tab {
  min-width: 210px;
  padding: 18px 24px;
  border-radius: var(--nebula-radius-lg);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 900;
  text-align: left;
}

.library-category-tab.is-active,
.library-genre-tab.is-active,
.library-filter-chip.is-active,
.library-sort-option.is-active {
  color: #04101d;
  background: linear-gradient(135deg, var(--nebula-color-accent), #78f0ff);
  border-color: rgba(255, 255, 255, 0.7);
}

.library-genre-tab {
  padding: 12px 18px;
  border-radius: var(--nebula-radius-pill);
  font-size: 15px;
  font-weight: 800;
}

.library-content-row {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 300px) 1fr;
  gap: 16px;
}

.library-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.library-summary-card,
.library-filter-card,
.library-grid-region,
.library-details-card,
.library-sort-card,
.library-empty-card {
  border: 1px solid rgba(79, 216, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(17, 24, 48, 0.88), rgba(8, 12, 27, 0.92)),
    rgba(10, 16, 34, 0.86);
  border-radius: var(--nebula-radius-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

.library-summary-card,
.library-filter-card {
  padding: 16px;
}

.library-summary-total {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
}

.library-summary-total strong {
  font-size: 48px;
  line-height: 0.9;
}

.library-summary-total span,
.library-sync-status p,
.library-status-copy {
  margin: 0;
  color: var(--nebula-color-muted);
}

.library-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.library-stat-grid span,
.library-sync-status {
  padding: 10px;
  border-radius: var(--nebula-radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.library-stat-grid strong {
  color: var(--nebula-color-text);
}

.library-sync-status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 12px;
}

.library-filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.library-filter-label {
  color: var(--nebula-color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.library-filter-chip {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--nebula-radius-md);
  text-align: left;
  font-weight: 800;
}

.library-grid-region {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.library-grid-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  margin-bottom: 14px;
}

.library-grid-header h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  overflow: auto;
  padding: 4px 8px 24px;
  scrollbar-width: thin;
}

.library-card {
  min-height: 330px;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 27, 0.94);
  color: var(--nebula-color-text);
  text-align: left;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  transform-origin: center;
}

.library-card.is-focused {
  border-color: var(--nebula-color-accent);
  box-shadow:
    0 0 0 2px rgba(79, 216, 255, 0.16),
    0 0 34px var(--library-glow),
    0 22px 50px rgba(0, 0, 0, 0.54);
  transform: scale(1.045) translateZ(0);
  z-index: 3;
}

.library-card-art {
  position: relative;
  min-height: 178px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--library-accent, #4fd8ff), transparent 24%), transparent 42%),
    linear-gradient(135deg, rgba(79, 216, 255, 0.16), rgba(157, 79, 224, 0.18)),
    #10182f;
}

.library-card-art.has-image {
  background:
    linear-gradient(180deg, rgba(7, 10, 20, 0), rgba(7, 10, 20, 0.58)),
    var(--library-art) center / cover no-repeat;
}

.library-card-art span,
.library-details-art span {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.library-card-art.has-image span,
.library-details-art.has-image span {
  display: none;
}

.library-verified-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 5px 8px;
  border-radius: var(--nebula-radius-pill);
  background: rgba(79, 255, 136, 0.16);
  border: 1px solid rgba(79, 255, 136, 0.42);
  color: #9effbc;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.library-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.library-card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.library-card-title-row h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.library-card-title-row span {
  flex-shrink: 0;
  color: var(--nebula-color-accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.library-card-body p,
.library-card-meta-row,
.library-card-achievements {
  margin: 0;
  color: var(--nebula-color-muted);
  font-size: 13px;
}

.library-card-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.library-card-focus-copy,
.library-card-achievements {
  display: none;
}

.library-card.is-focused .library-card-focus-copy,
.library-card.is-focused .library-card-achievements {
  display: block;
}

.library-empty-card {
  grid-column: 1 / -1;
  padding: 28px;
}

.library-empty-card h3 {
  margin: 8px 0;
  font-size: 28px;
}

.library-details-panel,
.library-sort-panel {
  display: none;
}

.library-details-panel.is-open,
.library-sort-panel.is-open {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: block;
}

.library-details-backdrop,
.library-sort-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.72);
}

.library-details-card {
  position: absolute;
  top: 30px;
  right: 30px;
  bottom: 30px;
  width: min(520px, calc(100vw - 140px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.library-details-art {
  min-height: 210px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--library-accent, #4fd8ff), transparent 24%), transparent 44%),
    linear-gradient(135deg, rgba(79, 216, 255, 0.18), rgba(157, 79, 224, 0.2));
}

.library-details-art.has-image {
  background:
    linear-gradient(180deg, rgba(7, 10, 20, 0), rgba(7, 10, 20, 0.78)),
    var(--library-detail-art) center / cover no-repeat;
}

.library-details-body {
  padding: 22px;
  overflow: auto;
}

.library-details-body h2 {
  margin: 8px 0;
  font-size: 34px;
  line-height: 1;
}

.library-details-body p {
  color: var(--nebula-color-muted);
  line-height: 1.5;
}

.library-details-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.library-details-list div {
  padding: 10px;
  border-radius: var(--nebula-radius-md);
  background: rgba(255, 255, 255, 0.05);
}

.library-details-list dt {
  color: var(--nebula-color-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.library-details-list dd {
  margin: 3px 0 0;
}

.library-details-actions,
.library-sort-options {
  display: grid;
  gap: 10px;
}

.library-detail-button,
.library-sort-option {
  padding: 14px 16px;
  border-radius: var(--nebula-radius-md);
  text-align: left;
  font-weight: 900;
}

.library-sort-card {
  position: absolute;
  right: 34px;
  bottom: 58px;
  width: min(360px, calc(100vw - 130px));
  padding: 20px;
}

.library-sort-card h2 {
  margin: 8px 0;
  font-size: 30px;
}

.library-sort-card p {
  color: var(--nebula-color-muted);
}

.library-action.is-focused,
.library-category-tab.is-focused,
.library-genre-tab.is-focused,
.library-filter-chip.is-focused,
.library-sort-option.is-focused,
.library-detail-button.is-focused {
  border-color: var(--nebula-color-accent);
  box-shadow:
    0 0 0 2px rgba(79, 216, 255, 0.14),
    0 0 26px rgba(79, 216, 255, 0.34);
  transform: scale(1.035) translateZ(0);
}

@media (max-width: 1180px) {
  .library-content-row {
    grid-template-columns: 240px 1fr;
  }

  .library-category-tab {
    min-width: 170px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* Game Detail View Styles */
.game-detail-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 24, 48, 0.95), rgba(8, 12, 27, 0.98));
}

.game-detail-header-image {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background-size: cover;
  background-position: center;
  background-color: rgba(79, 216, 255, 0.08);
  z-index: 1;
}

.game-detail-header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 10, 20, 0.3), rgba(7, 10, 20, 0.95));
  z-index: 1;
}

.game-detail-content {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.game-detail-header {
  padding: 28px 40px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}

.game-detail-title-section h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 600px;
}

.game-detail-title-section .library-section-kicker {
  display: block;
  margin-bottom: 12px;
}

.game-detail-meta {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--nebula-color-muted);
  flex-wrap: wrap;
}

.game-detail-play-button-container {
  display: flex;
  gap: 12px;
}

.game-detail-play-button {
  min-width: 160px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--nebula-color-accent), #78f0ff);
  color: #04101d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 32px rgba(79, 216, 255, 0.34);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.game-detail-play-button .play-icon {
  font-size: 20px;
}

.game-detail-play-button.is-focused {
  transform: scale(1.08);
  box-shadow:
    0 0 0 2px rgba(79, 216, 255, 0.3),
    0 16px 40px rgba(79, 216, 255, 0.42);
}

.game-detail-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  padding: 0 40px 40px;
}

.game-detail-left-column {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 700px;
}

.game-detail-right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.game-detail-section-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nebula-color-accent);
}

.game-detail-description {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-detail-description p {
  margin: 0;
  color: var(--nebula-color-muted);
  line-height: 1.6;
}

.game-detail-description .long-description {
  color: var(--nebula-color-muted);
  opacity: 0.85;
}

.game-detail-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-detail-info-list {
  display: grid;
  gap: 12px;
}

.game-detail-info-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: var(--nebula-radius-md);
  background: rgba(79, 216, 255, 0.05);
  border: 1px solid rgba(79, 216, 255, 0.08);
}

.game-detail-info-list dt {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nebula-color-accent);
}

.game-detail-info-list dd {
  margin: 0;
  color: var(--nebula-color-muted);
  word-break: break-word;
}

/* Screenshots Section */
.game-detail-screenshots {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screenshots-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.screenshot-item {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(79, 216, 255, 0.12);
  background: rgba(10, 16, 34, 0.6);
}

.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Achievements Section */
.game-detail-achievements {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: var(--nebula-radius-lg);
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.08), rgba(157, 79, 224, 0.08));
  border: 1px solid rgba(79, 216, 255, 0.12);
}

.achievements-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.achievements-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.achievement-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.achievement-number {
  font-size: 20px;
  font-weight: 900;
  color: var(--nebula-color-accent);
}

.achievement-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--nebula-color-muted);
  margin-top: 4px;
}

.achievement-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.achievement-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--nebula-color-accent), #78f0ff);
  border-radius: 4px;
}

/* Features and Badges */
.game-detail-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--nebula-radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.features-grid {
  display: grid;
  gap: 10px;
}

.feature-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(79, 216, 255, 0.14);
  color: var(--nebula-color-accent);
  border: 1px solid rgba(79, 216, 255, 0.22);
}

.feature-badge.verified {
  background: rgba(79, 255, 136, 0.12);
  color: #9effbc;
  border-color: rgba(79, 255, 136, 0.24);
}

/* Actions */
.game-detail-actions {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--nebula-radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.library-detail-button {
  padding: 12px 16px;
  border-radius: var(--nebula-radius-md);
  font-weight: 900;
  font-size: 14px;
  text-align: left;
}

.library-detail-button.is-focused {
  border-color: var(--nebula-color-accent);
  box-shadow:
    0 0 0 2px rgba(79, 216, 255, 0.14),
    0 0 26px rgba(79, 216, 255, 0.34);
  transform: scale(1.03) translateZ(0);
}

/* Scrollbar styling for content area */
.game-detail-content::-webkit-scrollbar {
  width: 8px;
}

.game-detail-content::-webkit-scrollbar-track {
  background: transparent;
}

.game-detail-content::-webkit-scrollbar-thumb {
  background: rgba(79, 216, 255, 0.24);
  border-radius: 4px;
}

.game-detail-content::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 216, 255, 0.36);
}

/* Update the library-details-panel for full-screen mode */
.library-details-panel.is-open {
  display: flex;
}

.game-detail-view {
  z-index: 31;
}
