/* Original GameNexus midnight-blue shell, purple brand and cover shelves. */
:root {
  --bg: #0a0d14;
  --panel: #111726;
  --raised: #1c2438;
  --line: #303a50;
  --text: #f1f5f9;
  --muted: #a4b3c9;
  --accent: #a5b4fc;
  --accent-ink: var(--ps-color-primary-foreground);
  --good: #a6e3bd;
  --warning: #f0ce92;
  --error: #ffb5b9;
  --radius: 10px;
  font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: var(--ps-font-body);
  line-height: var(--ps-line-height);
  background: var(--bg);
  color: var(--text);
}
a {
  color: var(--accent);
  text-underline-offset: 4px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 13px;
  background: var(--raised);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:hover,
.button:hover {
  background: var(--raised);
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
.primary {
  background: var(--ps-color-primary);
  border-color: var(--ps-color-border);
  color: var(--ps-color-primary-foreground);
  font-weight: 650;
}
.primary:hover {
  background: var(--ps-color-primary);
}
.danger {
  color: var(--error);
}
input,
select,
textarea {
  min-height: 42px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
}
input[type='checkbox'] {
  min-height: 22px;
  width: 22px;
  accent-color: var(--accent);
}
input[type='file'] {
  width: 100%;
}
label {
  display: block;
  color: var(--muted);
  font-size: calc(12.3px * var(--ps-font-scale, 1));
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: calc(25.2px * var(--ps-font-scale, 1));
  line-height: 1.25;
  letter-spacing: -0.5px;
}
h2 {
  font-size: calc(18.2px * var(--ps-font-scale, 1));
}
h3 {
  font-size: calc(14px * var(--ps-font-scale, 1));
}
small,
.muted {
  color: var(--muted);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button:focus:not(:focus-visible) {
  outline: none;
}
[hidden] {
  display: none !important;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px;
}
.skip-link:focus {
  top: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  text-decoration: none;
  font-size: calc(17.5px * var(--ps-font-scale, 1));
  font-weight: 700;
  flex: none;
  white-space: nowrap;
}
.brand-icon {
  font-size: calc(22.4px * var(--ps-font-scale, 1));
}
.brand-badge {
  font-size: calc(12px * var(--ps-font-scale, 1));
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: normal;
  max-width: 70px;
}
.primary-nav {
  display: flex;
  gap: 5px;
  flex: none;
}
.primary-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
}
.primary-nav a:hover {
  background: var(--raised);
  color: var(--text);
}
.primary-nav a[aria-current='page'] {
  background: var(--raised);
  color: var(--text);
  font-weight: 650;
}
.gateway-state {
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
}
main {
  margin: 0 auto;
  padding: 24px 24px 60px;
  min-width: 0;
  max-width: 1440px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.page-header p {
  color: var(--muted);
  font-size: calc(12.3px * var(--ps-font-scale, 1));
  margin-top: 6px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.tabs a {
  padding: 6px 11px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 5px;
  min-height: 38px;
}
.tabs a[aria-current='page'] {
  color: var(--accent);
  background: var(--raised);
}
.count {
  font-variant-numeric: tabular-nums;
  font-size: calc(12px * var(--ps-font-scale, 1));
  margin-left: 5px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.search {
  flex: 1;
  min-width: 170px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.search label {
  flex: 1;
  min-width: 0;
}
.search input {
  width: 100%;
}
.toolbar .field {
  max-width: 180px;
}
.toolbar select {
  width: 100%;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chips:empty {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chip {
  font-size: calc(12px * var(--ps-font-scale, 1));
  min-height: 30px;
  padding: 4px 10px;
  background: var(--panel);
  color: var(--muted);
}
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
  margin-bottom: 10px;
}
.layout-toggle {
  display: flex;
  gap: 4px;
}
.layout-toggle button {
  font-size: calc(12px * var(--ps-font-scale, 1));
  min-height: 32px;
  padding: 4px 10px;
}
.layout-toggle button[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--accent);
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.game-card {
  min-width: 0;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.cover-link {
  display: block;
  aspect-ratio: 16/9;
  background: var(--raised);
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 15px;
  background: linear-gradient(145deg, #343773, #19263c);
  font-size: calc(25.2px * var(--ps-font-scale, 1));
  line-height: 1.1;
  font-weight: 700;
  overflow: hidden;
}
.cover-placeholder small {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: calc(12px * var(--ps-font-scale, 1));
  letter-spacing: 2px;
  color: #d2c8df;
}
.cover-link img {
  position: relative;
  z-index: 1;
}
.card-body {
  padding: 12px;
}
.card-title {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-meta {
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
  margin: 6px 0;
  min-height: 1.5em;
}
.card-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}
.card-actions .main-action {
  flex: 1;
  font-size: calc(12px * var(--ps-font-scale, 1));
  padding: 8px 6px;
}
.favorite {
  width: 42px;
  padding: 0;
  font-size: calc(19px * var(--ps-font-scale, 1));
}
.favorite[aria-pressed='true'] {
  color: var(--accent);
}
.badge {
  display: inline-block;
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.badge.good {
  color: var(--good);
  border-color: #3e604d;
}
.badge.warning {
  color: var(--warning);
}
.list-layout {
  display: block;
}
.list-layout .game-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.list-layout .card-body {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 220px);
  gap: 4px 15px;
  padding: 0;
  align-content: center;
}
.list-layout .card-title {
  height: auto;
}
.list-layout .card-actions {
  grid-column: 2;
  grid-row: 1/4;
}
.list-layout .card-meta {
  margin: 0;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 25px;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 40px 18px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.empty-state h2 {
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 19px;
}
.actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}
.empty-state .actions {
  justify-content: center;
}
.inline-error {
  background: var(--ps-color-muted);
  border-left: 3px solid var(--error);
  padding: 12px 16px;
  margin: 12px 0;
  white-space: pre-wrap;
  color: var(--ps-color-danger-foreground);
  overflow-wrap: anywhere;
}
.loading {
  padding: 20px;
  color: var(--muted);
}
.notice {
  padding: 13px 16px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  margin: 12px 0;
  color: var(--muted);
}
.page-section {
  margin-top: 25px;
}
.page-section h2 {
  margin-bottom: 12px;
}
.detail-heading {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin: 20px 0;
}
.detail-art {
  width: 260px;
  max-width: 40%;
  flex: none;
}
.detail-art .cover-link {
  aspect-ratio: 3/4;
}
.detail-summary {
  min-width: 0;
  flex: 1;
}
.detail-summary h2 {
  font-size: calc(25.9px * var(--ps-font-scale, 1));
  overflow-wrap: anywhere;
}
.detail-summary .actions {
  margin: 18px 0;
}
.detail-summary p {
  margin: 12px 0;
  color: var(--muted);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.facts dt {
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
}
.facts dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}
.description {
  max-width: 820px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.source-row,
.task-row,
.scan-row {
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
}
.source-row p,
.task-row p {
  font-size: calc(12.3px * var(--ps-font-scale, 1));
  color: var(--muted);
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.source-row h3 {
  overflow-wrap: anywhere;
}
.source-row .actions {
  align-self: center;
}
.task-row progress {
  width: min(350px, 100%);
  height: 8px;
  accent-color: var(--accent);
}
.task-error {
  color: var(--error) !important;
}
.task-phase {
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--accent);
}
.task-row time {
  color: var(--muted);
  font-size: calc(12px * var(--ps-font-scale, 1));
}
.scan-row {
  grid-template-columns: 24px minmax(0, 1fr) minmax(90px, 140px);
  align-items: center;
}
.scan-row small {
  display: block;
  overflow-wrap: anywhere;
}
.scan-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.scan-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 16px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}
.scan-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.rom-scan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.rom-scan-toolbar .path-field {
  flex: 1;
  min-width: 240px;
}
.rom-item-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 6px;
}
.rom-item-row:hover {
  background: var(--panel);
}
.rom-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  width: 100%;
}
.rom-title-input:focus {
  border-color: var(--accent);
  background: var(--bg);
}
.disc-badge {
  background: #3b2d18;
  color: #fbbf24;
  border: 1px solid #78350f;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 600;
}
.batch-actions-bar {
  position: sticky;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(17, 23, 38, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 12px 20px;
  margin-top: 16px;
  z-index: 10;
}
.settings-group {
  max-width: 650px;
  display: grid;
  gap: 16px;
}
.settings-group label {
  display: grid;
  gap: 7px;
}
.settings-group .inline-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.path-field {
  width: 100%;
}
.compact-menu {
  display: grid;
  gap: 14px;
}
.compact-menu label {
  display: grid;
  gap: 6px;
}
.compact-menu .actions {
  margin-top: 4px;
}
.diagnostics {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: monospace;
  font-size: calc(12px * var(--ps-font-scale, 1));
  background: var(--panel);
  padding: 14px;
}
.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.file-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.rank-list {
  margin: 15px 0;
  padding: 0;
  list-style: none;
}
.rank-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.rank-number {
  font-family: monospace;
  color: var(--accent);
  font-size: calc(16.8px * var(--ps-font-scale, 1));
}
.rank-title {
  font-weight: 600;
}
.rank-list small {
  display: block;
}
.support-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(12.6px * var(--ps-font-scale, 1));
}
.support-table th,
.support-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.preferences-compact .game-grid {
  gap: 12px;
}
.preferences-compact .source-row,
.preferences-compact .task-row {
  padding: 10px 0;
}
dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  box-shadow: 0 20px 80px #0008;
}
dialog::backdrop {
  background: #08050dc9;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}
.dialog-header h2 {
  font-size: calc(16.1px * var(--ps-font-scale, 1));
}
#dialog-description {
  color: var(--muted);
  margin: 8px 0 18px;
}
#dialog-content {
  display: grid;
  gap: 14px;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 18px;
  background: var(--ps-color-primary);
  color: var(--ps-color-primary-foreground);
  border-radius: 8px;
  z-index: 130;
  box-shadow: 0 4px 20px #0006;
}
.player {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #100e17;
  display: flex;
  flex-direction: column;
}
.player-bar {
  background: var(--panel);
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
}
.player-bar h2 {
  font-size: calc(14px * var(--ps-font-scale, 1));
  margin-right: auto;
}
.player-bar span {
  font-size: calc(12px * var(--ps-font-scale, 1));
  color: var(--muted);
}
#player-frame {
  flex: 1;
  min-height: 0;
}
#runner-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.continue-player {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--accent);
  color: var(--accent-ink);
  z-index: 60;
}
.player #player-error {
  margin: 0;
}
.player-paused #player-frame {
  opacity: 0.65;
}
@media (min-width: 1440px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}
@media (max-width: 900px) {
  main {
    padding: 24px 20px;
  }
  .detail-art {
    width: 210px;
  }
  .toolbar .field {
    max-width: 145px;
  }
}
@media (max-width: 640px) {
  .primary-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }
  .primary-nav a {
    padding: 8px 2px;
    justify-content: center;
    min-height: 44px;
    font-size: calc(12px * var(--ps-font-scale, 1));
    white-space: normal;
    text-align: center;
  }
  main {
    margin-left: 0;
    padding: 18px 16px 60px;
  }
  .page-header {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
  }
  h1 {
    font-size: calc(21.7px * var(--ps-font-scale, 1));
  }
  .page-header p {
    font-size: calc(12px * var(--ps-font-scale, 1));
  }
  .page-header .button {
    padding: 8px 10px;
    white-space: nowrap;
    font-size: calc(12px * var(--ps-font-scale, 1));
  }
  .toolbar {
    gap: 8px;
  }
  .search {
    flex-basis: 100%;
  }
  .toolbar .field {
    flex: 1;
    max-width: none;
    min-width: 100px;
  }
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }
  .card-actions .main-action {
    font-size: calc(12px * var(--ps-font-scale, 1));
    min-height: 44px;
  }
  .favorite {
    width: 36px;
    min-height: 44px;
  }
  .card-title {
    font-size: calc(12.6px * var(--ps-font-scale, 1));
  }
  .card-meta {
    font-size: calc(12px * var(--ps-font-scale, 1));
  }
  .cover-placeholder {
    font-size: calc(18.2px * var(--ps-font-scale, 1));
    padding: 10px;
  }
  .detail-heading {
    display: block;
  }
  .detail-art {
    max-width: 100%;
    width: 100%;
    margin-bottom: 18px;
  }
  .detail-art .cover-link {
    aspect-ratio: 2.5/1;
  }
  .detail-summary h2 {
    font-size: calc(21px * var(--ps-font-scale, 1));
  }
  .source-row,
  .task-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .list-layout .game-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }
  .list-layout .card-body {
    display: block;
  }
  .list-layout .card-actions {
    margin-top: 7px;
  }
  .rank-list li {
    grid-template-columns: 26px minmax(0, 1fr);
  }
  .rank-list .actions {
    grid-column: 2;
  }
  .player-bar {
    padding: 8px;
    gap: 5px;
  }
  .player-bar h2 {
    flex-basis: 100%;
  }
  .player-bar button {
    font-size: calc(12px * var(--ps-font-scale, 1));
    padding: 6px 8px;
    min-height: 40px;
  }
  .scan-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }
  .scan-row select {
    grid-column: 2;
  }
  .support-table th,
  .support-table td {
    padding: 8px 4px;
  }
  .tabs a {
    padding: 6px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* --- Gamepad Navigation & Big Picture Handheld / TV Mode --- */
.gamepad-focus,
:focus-visible.gamepad-focus {
  outline: 3px solid #818cf8 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 16px rgba(129, 140, 248, 0.6) !important;
  transform: scale(1.03) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, outline 0.15s ease;
  z-index: 10 !important;
}

.gamepad-hud {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 23, 38, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line, #303a50);
  border-radius: 20px;
  padding: 6px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  font-size: 13px;
  color: var(--text, #f1f5f9);
  pointer-events: none;
}
.gamepad-hud .hud-content {
  display: flex;
  align-items: center;
  gap: 14px;
}
.gamepad-hud .hud-status {
  color: var(--accent, #a5b4fc);
  font-weight: 600;
}
.gamepad-hud kbd {
  background: #2a344a;
  border: 1px solid #4a5568;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 11px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Primary fills can be too dark for small link text. Keep the accent underline
   and use the theme's readable foreground for ranking navigation and sources. */
.ranking-page .tabs a[aria-current='page'],
.ranking-page .ranking-segments a[aria-current='page'],
.ranking-page .ranking-more,
.ranking-page .ranking-board-footer a {
  color: var(--text);
}

/* Big Picture Mode (TV & Handheld Layout) */
body.big-picture-mode {
  --radius: 14px;
  font-size: 18px;
}
body.big-picture-mode .game-card {
  min-height: 280px;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1);
}
body.big-picture-mode .cover-shelf {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
body.big-picture-mode .page-header {
  padding: 24px 32px;
}
body.big-picture-mode .page-header h1 {
  font-size: 32px;
}
body.big-picture-mode .actions button,
body.big-picture-mode .button {
  min-height: 52px;
  font-size: 16px;
  padding: 10px 18px;
}

/* --- High-Value Playnite Extensions --- */

/* 1. Completion Status & Badges */
.badge.completion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.badge.completion-badge.accent {
  background: rgba(165, 180, 252, 0.18);
  color: var(--accent);
  border-color: rgba(165, 180, 252, 0.4);
}
.badge.completion-badge.good {
  background: rgba(166, 227, 189, 0.18);
  color: var(--good);
  border-color: rgba(166, 227, 189, 0.4);
}
.badge.completion-badge.warning {
  background: rgba(240, 206, 146, 0.18);
  color: var(--warning);
  border-color: rgba(240, 206, 146, 0.4);
}
.badge.completion-badge.muted {
  background: rgba(164, 179, 201, 0.12);
  color: var(--muted);
  border-color: rgba(164, 179, 201, 0.25);
}

.completion-select-label select {
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  min-height: 42px;
}

/* 2. Edition Stacking & Game Linking */
.badge.edition-stack-badge {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.4);
}
.badge.edition-child-badge {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}
.edition-link-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius);
}
.edition-master-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.section-header-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.linked-editions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.edition-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.edition-item.is-master {
  background: var(--raised);
  border-color: rgba(165, 180, 252, 0.35);
}
.edition-item .edition-badge.master {
  background: var(--accent);
  color: #0a0d14;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.edition-item .edition-title-tag {
  background: rgba(165, 180, 252, 0.15);
  color: var(--accent);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}
.edition-item .edition-name {
  flex: 1;
  text-decoration: none;
}
.edition-item .edition-actions {
  display: flex;
  gap: 8px;
}

/* 3. Savegame Time-Capsule & Snapshots */
.snapshots-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.snapshot-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.snapshot-card:hover {
  border-color: rgba(165, 180, 252, 0.3);
}
.snapshot-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.snapshot-source-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}
.snapshot-source-tag.auto {
  background: rgba(165, 180, 252, 0.18);
  color: var(--accent);
}
.snapshot-source-tag.manual {
  background: rgba(166, 227, 189, 0.18);
  color: var(--good);
}
.snapshot-actions {
  display: flex;
  gap: 8px;
}
.button.warning {
  border-color: rgba(240, 206, 146, 0.4);
  color: var(--warning);
}
.button.warning:hover {
  background: rgba(240, 206, 146, 0.12);
}
.button.danger {
  border-color: rgba(255, 181, 185, 0.4);
  color: var(--error);
}
.button.danger:hover {
  background: rgba(255, 181, 185, 0.12);
}

/* 4. Smart Dynamic Shelves Bar */
.smart-shelves-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.shelf-bar-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}
.smart-shelf-pill {
  display: inline-flex;
  align-items: center;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.smart-shelf-pill:hover {
  border-color: var(--accent);
}
.smart-shelf-pill .shelf-apply-btn {
  border: none;
  background: none;
  color: var(--text);
  padding: 4px 10px;
  font-size: 12px;
  min-height: 28px;
  cursor: pointer;
}
.smart-shelf-pill .shelf-delete-btn {
  border: none;
  background: none;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  min-height: 28px;
  cursor: pointer;
}
.smart-shelf-pill .shelf-delete-btn:hover {
  color: var(--error);
}

/* 5. Career Dashboard (生涯统计看板) */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4px 0 32px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.metric-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.metric-value small {
  font-size: 14px;
  font-weight: normal;
  color: var(--muted);
}
.metric-value.highlight {
  color: var(--accent);
}
.metric-value.good {
  color: var(--good);
}
.metric-value.accent {
  color: #818cf8;
}
.metric-sub {
  font-size: 12px;
  color: var(--muted);
}
.dashboard-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.dashboard-section .section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dashboard-section .section-header h2 {
  font-size: 18px;
  margin: 0;
}
.dashboard-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .dashboard-split-grid {
    grid-template-columns: 1fr;
  }
}

/* Activity Heatmap Grid */
.heatmap-wrapper {
  overflow-x: auto;
  padding-bottom: 8px;
}
.heatmap-grid {
  display: inline-flex;
  gap: 3px;
  padding: 8px 0;
}
.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.heatmap-day {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  transition: transform 0.1s ease;
}
.heatmap-day:hover {
  transform: scale(1.3);
  outline: 1px solid var(--accent);
}
.heatmap-day.level-0 {
  background: rgba(255, 255, 255, 0.05);
}
.heatmap-day.level-1 {
  background: rgba(165, 180, 252, 0.3);
}
.heatmap-day.level-2 {
  background: rgba(165, 180, 252, 0.55);
}
.heatmap-day.level-3 {
  background: rgba(165, 180, 252, 0.8);
}
.heatmap-day.level-4 {
  background: #c7d2fe;
  box-shadow: 0 0 6px rgba(199, 210, 254, 0.6);
}
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 11px;
  margin-top: 10px;
}
.heatmap-legend .heatmap-day {
  width: 10px;
  height: 10px;
}

/* Completion breakdown rows */
.completion-bars-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.completion-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.status-icon {
  font-size: 18px;
}
.status-name {
  flex: 1;
  font-weight: 500;
}
.status-count-tag {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}
.status-count-tag.accent {
  background: rgba(165, 180, 252, 0.2);
  color: var(--accent);
}
.status-count-tag.good {
  background: rgba(166, 227, 189, 0.2);
  color: var(--good);
}
.status-count-tag.warning {
  background: rgba(240, 206, 146, 0.2);
  color: var(--warning);
}

/* Platform progress bars */
.platform-stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.platform-stat-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.stat-platform-name {
  font-weight: 600;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--raised);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a5b4fc);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Top played leaderboard */
.top-played-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.top-played-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.top-rank {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  min-width: 36px;
}
.top-rank.top-three {
  color: var(--warning);
}
.top-cover {
  width: 44px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}
.top-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.top-cover .cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 20px;
}
.top-info {
  flex: 1;
  min-width: 0;
}
.top-info h3 {
  margin: 0 0 4px;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-info h3 a {
  text-decoration: none;
  color: var(--text);
}
.top-info h3 a:hover {
  color: var(--accent);
}
.top-info p {
  margin: 0;
  font-size: 12px;
}
.top-actions {
  flex-shrink: 0;
}
