/* Recomp Atlas - Stylesheet
   Dark theme by default with light theme support via prefers-color-scheme & data-theme.
   Mobile-first, accessible, system font stack.
*/

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Dark theme colors (default) */
  --bg-body: #0d1117;
  --bg-surface: #161b22;
  --bg-surface-hover: #1c2128;
  --bg-surface-elevated: #212836;
  --bg-input: #090d13;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-subtle: rgba(56, 139, 253, 0.15);

  /* Status and badge colors */
  --badge-win-bg: rgba(0, 120, 212, 0.18);
  --badge-win-text: #58a6ff;
  --badge-win-border: rgba(0, 120, 212, 0.4);

  --badge-lin-bg: rgba(240, 136, 62, 0.18);
  --badge-lin-text: #f0883e;
  --badge-lin-border: rgba(240, 136, 62, 0.4);

  --badge-mac-bg: rgba(187, 128, 255, 0.18);
  --badge-mac-text: #d2a8ff;
  --badge-mac-border: rgba(187, 128, 255, 0.4);

  --badge-runs-bg: rgba(46, 160, 67, 0.18);
  --badge-runs-text: #3fb950;
  --badge-runs-border: rgba(46, 160, 67, 0.4);

  --badge-build-bg: rgba(56, 139, 253, 0.18);
  --badge-build-text: #58a6ff;
  --badge-build-border: rgba(56, 139, 253, 0.4);

  --badge-source-bg: rgba(210, 153, 34, 0.18);
  --badge-source-text: #d29922;
  --badge-source-border: rgba(210, 153, 34, 0.4);

  --badge-listed-bg: rgba(110, 118, 129, 0.18);
  --badge-listed-text: #8b949e;
  --badge-listed-border: rgba(110, 118, 129, 0.4);

  --badge-gone-bg: rgba(248, 81, 73, 0.18);
  --badge-gone-text: #f85149;
  --badge-gone-border: rgba(248, 81, 73, 0.4);

  --badge-warn-bg: rgba(248, 81, 73, 0.18);
  --badge-warn-text: #f85149;
  --badge-warn-border: rgba(248, 81, 73, 0.4);

  --chip-bg: #21262d;
  --chip-border: #30363d;
  --chip-text: #c9d1d9;
  --chip-active-bg: #1f6feb;
  --chip-active-border: #388bfd;
  --chip-active-text: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* Light theme support */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-body: #f6f8fa;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f3f4f6;
    --bg-surface-elevated: #ffffff;
    --bg-input: #ffffff;
    --border: #d0d7de;
    --border-focus: #0969da;
    --text-main: #1f2328;
    --text-muted: #656d76;
    --text-dim: #8c959f;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --accent-subtle: rgba(9, 105, 218, 0.1);

    --badge-win-bg: #ddf4ff;
    --badge-win-text: #0969da;
    --badge-win-border: #54aeff;

    --badge-lin-bg: #fff1e5;
    --badge-lin-text: #9a4904;
    --badge-lin-border: #ffb87a;

    --badge-mac-bg: #fbefff;
    --badge-mac-text: #8250df;
    --badge-mac-border: #d2a8ff;

    --badge-runs-bg: #dafbe1;
    --badge-runs-text: #1a7f37;
    --badge-runs-border: #4ac26b;

    --badge-build-bg: #ddf4ff;
    --badge-build-text: #0969da;
    --badge-build-border: #54aeff;

    --badge-source-bg: #fff8c5;
    --badge-source-text: #9a6700;
    --badge-source-border: #d4a72c;

    --badge-listed-bg: #f6f8fa;
    --badge-listed-text: #656d76;
    --badge-listed-border: #d0d7de;

    --badge-gone-bg: #ffebe9;
    --badge-gone-text: #cf222e;
    --badge-gone-border: #ff8182;

    --badge-warn-bg: #ffebe9;
    --badge-warn-text: #cf222e;
    --badge-warn-border: #ff8182;

    --chip-bg: #f6f8fa;
    --chip-border: #d0d7de;
    --chip-text: #24292f;
    --chip-active-bg: #0969da;
    --chip-active-border: #0969da;
    --chip-active-text: #ffffff;

    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.08);
    --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.12);
    --shadow-lg: 0 8px 24px rgba(31, 35, 40, 0.16);
  }
}

:root[data-theme="light"] {
  --bg-body: #f6f8fa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f3f4f6;
  --bg-surface-elevated: #ffffff;
  --bg-input: #ffffff;
  --border: #d0d7de;
  --border-focus: #0969da;
  --text-main: #1f2328;
  --text-muted: #656d76;
  --text-dim: #8c959f;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-subtle: rgba(9, 105, 218, 0.1);

  --badge-win-bg: #ddf4ff;
  --badge-win-text: #0969da;
  --badge-win-border: #54aeff;

  --badge-lin-bg: #fff1e5;
  --badge-lin-text: #9a4904;
  --badge-lin-border: #ffb87a;

  --badge-mac-bg: #fbefff;
  --badge-mac-text: #8250df;
  --badge-mac-border: #d2a8ff;

  --badge-runs-bg: #dafbe1;
  --badge-runs-text: #1a7f37;
  --badge-runs-border: #4ac26b;

  --badge-build-bg: #ddf4ff;
  --badge-build-text: #0969da;
  --badge-build-border: #54aeff;

  --badge-source-bg: #fff8c5;
  --badge-source-text: #9a6700;
  --badge-source-border: #d4a72c;

  --badge-listed-bg: #f6f8fa;
  --badge-listed-text: #656d76;
  --badge-listed-border: #d0d7de;

  --badge-gone-bg: #ffebe9;
  --badge-gone-text: #cf222e;
  --badge-gone-border: #ff8182;

  --badge-warn-bg: #ffebe9;
  --badge-warn-text: #cf222e;
  --badge-warn-border: #ff8182;

  --chip-bg: #f6f8fa;
  --chip-border: #d0d7de;
  --chip-text: #24292f;
  --chip-active-bg: #0969da;
  --chip-active-border: #0969da;
  --chip-active-text: #ffffff;

  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.12);
  --shadow-lg: 0 8px 24px rgba(31, 35, 40, 0.16);
}

/* Base resets & typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg-body);
  color: var(--text-main);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Layout container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Site Header */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1f6feb, #8957e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-hover);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text-main);
  background-color: var(--accent-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

/* Main content */
.main-content {
  flex: 1;
  padding: 24px 0 48px;
}

/* Page Intro */
.page-intro {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--text-main);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 800px;
}

/* Search and Filter Panel */
.catalog-controls {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.search-bar-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 38px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  outline: none;
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
  background-color: transparent;
}

.search-clear-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-elevated);
}

.sort-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.sort-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.sort-select {
  height: 42px;
  padding: 0 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
}

/* Filter Sections */
.filters-accordion {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.maker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.maker-tab {
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition-fast);
}

.maker-tab:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-hover);
}

.maker-tab.active {
  color: var(--accent);
  background-color: var(--accent-subtle);
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  background-color: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--chip-text);
  user-select: none;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.chip-btn.active {
  background-color: var(--chip-active-bg);
  border-color: var(--chip-active-border);
  color: var(--chip-active-text);
}

.chip-count {
  font-size: 0.75rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

/* Secondary filter row: OS, Status, Inactive Toggle */
.filter-row-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.filter-subgroup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border);
  transition: var(--transition-fast);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-fast);
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* Filter Summary Bar */
.filter-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-count-text {
  font-weight: 600;
  color: var(--text-main);
}

.clear-filters-btn {
  font-size: 0.85rem;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.clear-filters-btn:hover {
  text-decoration: underline;
}

/* Active Tags */
.active-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
}

.active-tag-remove {
  font-weight: bold;
  cursor: pointer;
  padding: 0 2px;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 680px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Game Card */
.game-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  text-align: left;
  position: relative;
}

.game-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.game-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  word-break: break-word;
}

.console-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background-color: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.console-tag.unconfirmed {
  border-color: var(--badge-lin-border);
  color: var(--badge-lin-text);
  background-color: var(--badge-lin-bg);
}

.card-project-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.project-name {
  color: var(--text-main);
  font-weight: 500;
}

.project-type-tag {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-win {
  background-color: var(--badge-win-bg);
  color: var(--badge-win-text);
  border: 1px solid var(--badge-win-border);
}

.badge-lin {
  background-color: var(--badge-lin-bg);
  color: var(--badge-lin-text);
  border: 1px solid var(--badge-lin-border);
}

.badge-mac {
  background-color: var(--badge-mac-bg);
  color: var(--badge-mac-text);
  border: 1px solid var(--badge-mac-border);
}

.badge-runs {
  background-color: var(--badge-runs-bg);
  color: var(--badge-runs-text);
  border: 1px solid var(--badge-runs-border);
}

.badge-build {
  background-color: var(--badge-build-bg);
  color: var(--badge-build-text);
  border: 1px solid var(--badge-build-border);
}

.badge-source {
  background-color: var(--badge-source-bg);
  color: var(--badge-source-text);
  border: 1px solid var(--badge-source-border);
}

.badge-listed {
  background-color: var(--badge-listed-bg);
  color: var(--badge-listed-text);
  border: 1px solid var(--badge-listed-border);
}

.badge-gone {
  background-color: var(--badge-gone-bg);
  color: var(--badge-gone-text);
  border: 1px solid var(--badge-gone-border);
}

.badge-dim {
  background-color: var(--badge-listed-bg);
  color: var(--badge-listed-text);
  border: 1px solid var(--badge-listed-border);
}

.badge-warn {
  background-color: var(--badge-warn-bg);
  color: var(--badge-warn-text);
  border: 1px solid var(--badge-warn-border);
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.activity-date {
  font-variant-numeric: tabular-nums;
}

/* Pagination / Load More */
.load-more-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background-color: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

/* Modal / Dialog */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title-group {
  flex: 1;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  background: transparent;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-elevated);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.detail-value {
  font-size: 0.95rem;
  color: var(--text-main);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.requirement-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-main);
}

.modal-footer {
  padding: 14px 20px;
  background-color: var(--bg-surface-hover);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Consoles Page Styles */
.consoles-maker-section {
  margin-bottom: 36px;
}

.maker-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.maker-count-pill {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.consoles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .consoles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .consoles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.console-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.console-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.console-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.console-card-count {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--accent-subtle);
  color: var(--accent);
}

.console-card-note {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Learn & About Article Styles */
.article-container {
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .article-container {
    padding: 36px 32px;
  }
}

.article-section {
  margin-bottom: 32px;
}

.article-section:last-child {
  margin-bottom: 0;
}

.article-h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article-p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.article-p strong {
  color: var(--text-main);
}

.terms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (min-width: 600px) {
  .terms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.term-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.term-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.term-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Notice / Callout Box */
.notice-box {
  background-color: var(--bg-surface-elevated);
  border-left: 4px solid var(--accent);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
}

.notice-box.warning {
  border-left-color: var(--badge-warn-text);
  background-color: var(--badge-warn-bg);
}

.notice-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.notice-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Site Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 32px 0 24px;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  list-style: none;
}

.footer-nav a {
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--text-main);
}

.footer-legal-notice {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.footer-legal-notice strong {
  color: var(--text-main);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* Filter options that would return nothing right now */
.chip-btn.is-empty { opacity: 0.4; }
.chip-btn.is-empty:hover { opacity: 0.7; }

/* ===================== Wiki ===================== */
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin: 8px 0 4px; }
.breadcrumb a, .rev a, .data-table a, .info-table a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover, .rev a:hover, .data-table a:hover, .info-table a:hover { text-decoration: underline; }

.account-slot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.account-link {
  padding: 6px 10px; border-radius: var(--radius-md); font-size: 0.88rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none; background: none; border: 1px solid transparent; cursor: pointer; font-family: inherit;
}
.account-link:hover { color: var(--text-main); border-color: var(--border); }
.account-primary { color: var(--text-main); border-color: var(--border); background: var(--bg-surface); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0; overflow-x: auto; }
.tab {
  padding: 8px 14px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--text-muted); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--text-main); border-bottom-color: var(--accent); }

.form-card { max-width: 440px; margin: 32px auto; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); }
.wiki-form { display: flex; flex-direction: column; gap: 14px; margin: 12px 0 24px; }
.wiki-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 500; color: var(--text-main); }
.wiki-form input:not([type=checkbox]):not([type=radio]), .wiki-form select, .wiki-form textarea, .inline-form input, .inline-form select {
  padding: 9px 11px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-main); font: inherit; font-weight: 400; width: 100%; box-sizing: border-box;
}
.wiki-form textarea { resize: vertical; }
.wiki-form input:focus, .wiki-form select:focus, .wiki-form textarea:focus, .inline-form input:focus { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.wiki-form fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.wiki-form legend { font-size: 0.85rem; color: var(--text-muted); padding: 0 4px; }
.wiki-form .check, .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.check-row { flex-direction: row !important; flex-wrap: wrap; gap: 16px !important; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 680px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); margin: 0; }
.form-error { color: var(--badge-gone-text); font-size: 0.88rem; margin: 0; }
.trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }

.info-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.info-table th, .info-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.info-table th { width: 34%; color: var(--text-muted); font-weight: 500; font-size: 0.88rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; display: block; overflow-x: auto; margin-bottom: 24px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.rev-list { list-style: none; padding: 0; margin: 0 0 16px; }
.rev { padding: 12px 0; border-bottom: 1px solid var(--border); }
.rev-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.88rem; }
.rev-time { color: var(--text-muted); }
.rev-kind { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 1px 8px; }
.rev-summary { color: var(--text-main); font-style: italic; }
.rev-ip { font-family: var(--font-mono); font-size: 0.8rem; color: var(--badge-source-text); }
.rev-actions { display: flex; gap: 12px; margin-top: 6px; }
.diff-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.diff-field { display: inline-block; min-width: 9em; color: var(--text-muted); }
.diff-list del { color: var(--badge-gone-text); background: var(--badge-gone-bg); text-decoration: line-through; padding: 0 4px; border-radius: 3px; word-break: break-word; }
.diff-list ins { color: var(--badge-runs-text); background: var(--badge-runs-bg); text-decoration: none; padding: 0 4px; border-radius: 3px; word-break: break-word; }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-size: 0.85rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.mod-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.modal-wiki-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-wiki-actions a { text-decoration: none; }
