.system-page {
  --system-accent: var(--cyan);
  --system-accent-two: var(--pink);
  --system-panel: rgba(20, 11, 31, 0.95);
}

.system-hero {
  padding: 4rem max(1.5rem, calc((100vw - 1400px) / 2));
  border-bottom: 3px solid var(--system-accent);
  background:
    linear-gradient(
      135deg,
      color-mix(
        in srgb,
        var(--system-accent) 18%,
        transparent
      ),
      transparent 55%
    ),
    rgba(7, 4, 12, 0.86);
}

.back-link {
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--system-accent);
}

.system-family {
  margin: 2rem 0 0.4rem;
  color: var(--system-accent-two);
  font-weight: 900;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.system-hero h1 {
  margin: 0;
  color: var(--system-accent);
  font-size: clamp(2.8rem, 8vw, 6.5rem);
  line-height: 1;
  text-shadow:
    4px 4px 0 color-mix(
      in srgb,
      var(--system-accent-two) 70%,
      black
    ),
    0 0 24px color-mix(
      in srgb,
      var(--system-accent) 55%,
      transparent
    );
}

.system-tagline {
  color: var(--muted);
  font-size: 1.15rem;
}

.library-shell {
  width: min(1450px, calc(100% - 2rem));
  margin: 2rem auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--system-panel);
  box-shadow: var(--shadow);
}

.library-toolbar {
  display: grid;
  grid-template-columns:
    minmax(260px, 1.5fr)
    minmax(220px, 1fr)
    minmax(160px, 0.55fr);
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.toolbar-label,
.library-search label,
.library-sort label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-toolbar input,
.library-toolbar select {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.38);
}

.breadcrumb {
  display: flex;
  min-height: 44px;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.breadcrumb button {
  padding: 0;
  color: var(--system-accent);
  border: 0;
  background: none;
}

.library-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.library-status button {
  padding: 0.45rem 0.8rem;
  color: var(--text);
  border: 1px solid var(--system-accent);
  border-radius: 0.4rem;
  background: transparent;
}

.library-list {
  display: grid;
}

.library-entry {
  display: grid;
  grid-template-columns:
    44px
    minmax(0, 1fr)
    minmax(90px, auto)
    minmax(105px, auto);
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}

.library-entry:hover {
  background: color-mix(
    in srgb,
    var(--system-accent) 8%,
    transparent
  );
}

.entry-icon {
  color: var(--system-accent);
  font-size: 1.5rem;
  text-align: center;
}

.entry-name {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.entry-name {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.entry-size,
.entry-date {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.entry-download {
  justify-self: end;
  padding: 0.55rem 0.75rem;
  color: #100714;
  border-radius: 0.4rem;
  background: var(--system-accent);
  font-weight: 900;
  text-decoration: none;
}

.library-message {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 850px) {
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .library-entry {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .entry-size,
  .entry-date {
    display: none;
  }
}

.game-card {
  display: grid;
  grid-template-columns:
    58px
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 1rem;
  min-height: 105px;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.game-card:hover {
  background: color-mix(
    in srgb,
    var(--system-accent) 8%,
    transparent
  );
}

.game-card-icon {
  color: var(--system-accent);
  font-size: 2rem;
  text-align: center;
}

.game-card-details {
  min-width: 0;
}

.game-card-details h2 {
  overflow: hidden;
  margin: 0 0 0.55rem;
  color: var(--text);
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.game-card-actions {
  display: flex;
  gap: 0.6rem;
}

.game-browse-button,
.game-zip-button {
  min-width: 125px;
  padding: 0.65rem 0.85rem;
  border-radius: 0.45rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.game-browse-button {
  color: #100714;
  border: 1px solid var(--system-accent);
  background: var(--system-accent);
}

.game-zip-button {
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.game-zip-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.2rem;
  border-top: 1px solid var(--border);
}

.catalog-pagination button {
  padding: 0.65rem 1rem;
  color: var(--text);
  border: 1px solid var(--system-accent);
  border-radius: 0.45rem;
  background: transparent;
}

.catalog-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

@media (max-width: 750px) {
  .game-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .game-card-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .game-browse-button,
  .game-zip-button {
    flex: 1;
  }
}

.game-zip-control {
  display: flex;
  min-width: 170px;
  flex-direction: column;
  gap: 0.55rem;
}

.game-zip-progress {
  min-width: 170px;
}

.game-zip-progress-track {
  overflow: hidden;
  width: 100%;
  height: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.game-zip-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--system-accent);
  transition: width 0.35s ease;
}

.game-zip-status {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}

.game-zip-button.is-ready {
  color: #100714;
  border-color: var(--system-accent);
  background: var(--system-accent);
}

.game-zip-control[data-zip-state="failed"]
.game-zip-status {
  color: #ff8c8c;
}

.game-zip-control[data-zip-state="cached"]
.game-zip-status,
.game-zip-control[data-zip-state="ready"]
.game-zip-status {
  color: var(--system-accent);
}

@media (max-width: 750px) {
  .game-zip-control {
    flex: 1;
  }
}
