/* ── A:\GAMES — DOS Freeware Library ────────────────────────────────────────── */

/* ── Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  --bg: #05080d;
  --surface: #0d1117;
  --surface-raised: #151b25;
  --border: #222b3a;
  --border-hover: #3a4860;
  --text: #d4dae6;
  --text-secondary: #8b95a5;
  --muted: #5a6477;
  --accent: #ffb454;
  --accent-dim: #b37a2e;
  --accent-soft: rgba(255, 180, 84, 0.10);
  --accent-glow: rgba(255, 180, 84, 0.30);
  --green: #69d086;
  --green-dim: rgba(105, 208, 134, 0.15);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-display: 'Share Tech Mono', 'Courier New', monospace;
  --transition: 150ms ease;
  --sidebar-width: 240px;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── CRT Scanlines (subtle) ──────────────────────────────────────────── */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    repeating-linear-gradient(0deg,
      transparent, transparent 1px,
      rgba(0, 0, 0, 0.08) 1px,
      rgba(0, 0, 0, 0.08) 2px);
  opacity: 0.3;
}

/* ── Top bar ─────────────────────────────────────────────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
}

.brand-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
  letter-spacing: 0.03em;
}

.brand span {
  font-size: 0.6rem;
  background: var(--accent);
  color: var(--bg);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.top-bar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.game-stats {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.ghost-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: all var(--transition);
}

.ghost-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  box-shadow: 0 0 8px var(--accent-soft);
}

.action-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border: none;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn:hover {
  box-shadow: 0 0 12px var(--accent-glow);
  filter: brightness(1.1);
}

.action-btn:active { transform: scale(0.97); }

.full-width { width: 100%; }

/* ── Layout ───────────────────────────────────────────────────────── */
.library-page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: calc(100vh - 45px);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-box { position: relative; }

#gameSearch {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  color: var(--accent);
}

#gameSearch:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

#gameSearch::placeholder { color: var(--muted); opacity: 0.6; }

/* ── Filter sections ────────────────────────────────────────────────────────── */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-heading {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: all var(--transition);
}

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

.chip.active {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Sort row ──────────────────────────────────────────────────────────────── */
.sort-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sort-row label {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

#gameSort {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.3rem 0.4rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

#gameSort:focus {
  outline: none;
  border-color: var(--accent-dim);
}

/* ── Trusted sites ───────────────────────────────────────────────────────────── */
.trusted-sites {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.trusted-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.trusted-links a {
  font-size: 0.6rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.15rem 0;
  transition: color var(--transition);
}

.trusted-links a:hover { color: var(--accent); }

/* ── Content area ───────────────────────────────────────────────────────────── */
.content {
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.results-info {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 0;
}

.clear-btn { font-size: 0.6rem; padding: 0.2rem 0.5rem; }

/* ── Game grid ────────────────────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  flex: 1;
}

/* ── Game card ────────────────────────────────────────────────────────────── */
.game-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
}

.game-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px var(--accent-soft);
  transform: translateY(-2px);
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  display: block;
}

.card-badge {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.35rem;
}

.badge-ready {
  color: var(--green);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(105, 208, 134, 0.4);
}

.card-info {
  padding: 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-title {
  font-size: 0.72rem;
  font-weight: 500;
  margin: 0;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.game-card:hover .card-title { color: var(--accent); }

.card-meta {
  font-size: 0.6rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}

.card-actions {
  display: flex;
  gap: 0.3rem;
  padding: 0 0.5rem 0.5rem;
}

.btn-play, .btn-info {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all var(--transition);
  flex: 1;
}

.btn-play {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  font-weight: 600;
}

.btn-play:hover { filter: brightness(1.1); box-shadow: 0 0 8px var(--accent-glow); }

.btn-info {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-title {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0 0 0.3rem;
}

.empty-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .library-page {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 45px);
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    overflow: visible;
  }

  .brand-wrap { gap: 0.5rem; }
  .brand { font-size: 1.1rem; }
  .tagline { display: none; }

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

  .game-stats { display: none; }
}

@media (max-width: 480px) {
  .top-bar { padding: 0.4rem 0.75rem; }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.4rem;
  }

  .sidebar { padding: 0.5rem; gap: 0.5rem; }
  .content { padding: 0.5rem; }
}

/* ── Pagination ─────────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0 0.5rem;
}

.page-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
