:root {
  --bg: #0f0c14;
  --panel: #1a1622;
  --panel-2: #221c2d;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --purple: #3d2d63;
  --text: #f5f1e8;
  --muted: #bfb5c9;
  --danger: #b14b4b;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: radial-gradient(circle at top, #231936, var(--bg) 36%); color: var(--text); min-height: 100%; }
body { min-height: 100vh; }
h1, h2, h3, h4 { margin: 0; font-family: Georgia, "Times New Roman", serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
input, select, textarea {
  width: 100%;
  background: #120f18;
  color: var(--text);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
}
input::placeholder, textarea::placeholder { color: #9588a5; }
textarea { resize: vertical; }
label { display: grid; gap: 8px; margin-bottom: 14px; }
label span { color: var(--muted); font-size: 0.92rem; }
a { color: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 310px;
  background: linear-gradient(180deg, rgba(34,28,45,0.98), rgba(19,15,26,0.98));
  border-right: 1px solid rgba(212,175,55,0.18);
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  transform: translateX(0);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.sidebar.closed { transform: translateX(-102%); }
.sidebar-header,
.topbar,
.modal-header,
.module-head,
.game-header,
.row-between,
.entry-actions,
.steam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-nav,
.sidebar-section,
.sidebar-footer { margin-top: 22px; }
.sidebar-footer { display: grid; gap: 10px; }
.section-title, .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--gold);
}

.nav-link, .category-nav-link {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 8px;
  background: transparent;
  color: var(--text);
}
.nav-link.active, .category-nav-link.active, .nav-link:hover, .category-nav-link:hover {
  background: linear-gradient(180deg, rgba(212,175,55,0.16), rgba(61,45,99,0.28));
}

.main-content { flex: 1; width: 100%; padding: 20px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 12, 20, 0.82);
  backdrop-filter: blur(10px);
  padding: 8px 0 16px;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.search-wrap { width: min(420px, 100%); }
.search-wrap input { background: rgba(18,15,24,0.96); }
.view { display: grid; gap: 18px; padding-bottom: 40px; }
.hidden { display: none !important; }

.card, .recent-card, .category-card, .game-card, .module-card, .stat-card {
  background: linear-gradient(180deg, rgba(34, 28, 45, 0.95), rgba(24, 20, 31, 0.95));
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .category-card, .module-card, .game-card { padding: 18px; }
.recent-list, .category-grid, .module-grid, .favorites-grid, .search-results-grid, .steam-results {
  display: grid;
  gap: 14px;
}
.recent-list, .favorites-grid, .search-results-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.category-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.module-grid { grid-template-columns: 1fr; }

.section-block { display: grid; gap: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h3 { font-size: 1.3rem; }
.recent-card, .game-card { padding: 18px; }
.recent-card h4, .game-card h4, .category-card h4, .module-card h4 { margin-bottom: 8px; }
.subtext, .muted { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  font-size: 0.82rem;
  border: 1px solid rgba(212, 175, 55, 0.2);
}
.game-banner {
  height: 160px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(61,45,99,0.8), rgba(212,175,55,0.22));
  border: 1px solid rgba(212,175,55,0.18);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 1.2rem;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.game-banner.has-image {
  align-items: end;
  justify-items: start;
  padding: 16px;
}
.game-banner .banner-fade {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(10,8,14,0.1), rgba(10,8,14,0.7));
}
.steam-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.module-card { display: grid; gap: 12px; }
.entry-list { display: grid; gap: 10px; }
.entry-item {
  background: rgba(10, 8, 14, 0.56);
  border: 1px solid rgba(212,175,55,0.12);
  border-radius: 14px;
  padding: 12px 14px;
}
.entry-item.check-item { display: flex; align-items: center; gap: 10px; }
.entry-item.check-item input { width: auto; }
.entry-item.is-complete span,
.entry-item.is-complete strong { text-decoration: line-through; opacity: 0.65; }
.entry-actions { margin-top: 10px; justify-content: flex-end; }
.entry-actions .ghost-btn { padding: 6px 0; }

.icon-btn, .primary-btn, .secondary-btn, .danger-btn, .ghost-btn {
  border-radius: 12px;
  padding: 11px 14px;
}
.icon-btn {
  background: rgba(212,175,55,0.1);
  color: var(--gold);
  min-width: 42px;
}
.primary-btn {
  background: linear-gradient(180deg, #e0bf57, #c79c28);
  color: #1b1405;
  font-weight: 700;
}
.secondary-btn {
  background: rgba(212,175,55,0.12);
  color: var(--text);
  border: 1px solid rgba(212,175,55,0.18);
}
.danger-btn {
  background: rgba(177, 75, 75, 0.14);
  color: #ffb4b4;
  border: 1px solid rgba(177, 75, 75, 0.25);
}
.ghost-btn {
  background: transparent;
  color: var(--gold);
  padding: 0;
}
.import-btn { display: flex; align-items: center; justify-content: center; cursor: pointer; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 15;
}
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(94vw, 560px);
}
.modal-wide { width: min(96vw, 760px); }
.modal::backdrop { background: rgba(0,0,0,0.62); }
.modal-card {
  background: linear-gradient(180deg, rgba(34,28,45,0.98), rgba(18,15,24,0.98));
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.form-grid { display: grid; gap: 12px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.steam-box {
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 18px;
  padding: 16px;
  background: rgba(212,175,55,0.05);
  margin-bottom: 12px;
}
.steam-results { margin-top: 14px; }
.steam-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  background: rgba(10, 8, 14, 0.56);
  border: 1px solid rgba(212,175,55,0.12);
  border-radius: 14px;
  padding: 10px;
}
.steam-card img { width: 120px; height: 45px; object-fit: cover; border-radius: 8px; }
.steam-card.selected { border-color: rgba(212,175,55,0.55); box-shadow: 0 0 0 1px rgba(212,175,55,0.2) inset; }

.empty-state {
  padding: 28px;
  text-align: center;
  border: 1px dashed rgba(212,175,55,0.24);
  border-radius: var(--radius);
  color: var(--muted);
}
.tiny { font-size: 0.82rem; }

@media (max-width: 760px) {
  .form-grid.cols-2, .steam-card { grid-template-columns: 1fr; }
  .topbar-right { width: 100%; justify-content: stretch; }
  .search-wrap { width: 100%; }
}

@media (min-width: 980px) {
  .sidebar.closed { transform: translateX(0); }
  .sidebar { position: sticky; height: 100vh; }
  .main-content { padding: 20px 26px; }
  #openSidebarBtn, #closeSidebarBtn, .overlay { display: none !important; }
}
