/* ═══════════════════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════════════════ */
:root {
  --bg-0:   #09090f;
  --bg-1:   #111118;
  --bg-2:   #16161e;
  --bg-3:   #1d1d28;
  --bg-4:   #242432;

  --border:       rgba(255, 255, 255, 0.18);
  --border-hi:    rgba(255, 255, 255, 0.28);

  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #475569;
  --text-4: #2d3748;

  --accent:   #6366f1;
  --accent-h: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --want-color:     #93c5fd;
  --want-bg:        rgba(37,  99,  235, 0.18);
  --want-border:    rgba(59,  130, 246, 0.38);
  --want-dot:       #3b82f6;

  --play-color:     #fde68a;
  --play-bg:        rgba(161, 98,  7,   0.18);
  --play-border:    rgba(234, 179, 8,   0.38);
  --play-dot:       #eab308;

  --done-color:     #86efac;
  --done-bg:        rgba(21,  128, 61,  0.18);
  --done-border:    rgba(34,  197, 94,  0.38);
  --done-dot:       #22c55e;

  --danger-color:   #f87171;
  --danger-bg:      rgba(239, 68,  68,  0.15);
  --danger-border:  rgba(239, 68,  68,  0.35);

  --r-xs: 4px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;

  --header-h: 60px;

  --shadow-card:  0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 40px 80px rgba(0, 0, 0, 0.75);
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, span, div, h1, h2, h3, p, a, input, label { text-transform: lowercase; }

html { color-scheme: dark; }

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT — sidebar + main
═══════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #13131f;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
  padding: 4px 8px 6px;
}

.sidebar-filter,
.sidebar-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.sidebar-sort { justify-content: flex-start; }
.sidebar-sort[data-sort="az"] { text-transform: uppercase; }
.sidebar-filter:hover,
.sidebar-sort:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
}
.sidebar-filter.active,
.sidebar-sort.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.40);
  color: #c4b5fd;
}
.sidebar-filter.active .pill-count {
  background: rgba(99, 102, 241, 0.28);
  color: #c4b5fd;
}

.sidebar-item-text { flex: 1; }

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 10px 4px;
}


.main-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 48px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-3); }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.btn-primary:hover {
  background: var(--accent-h);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary:active { box-shadow: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-1);
  border-color: var(--border-hi);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.28); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Browse Library — indigo tint, matches Pick Tonight weight */
.btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light, #a5b4fc);
  border: 1px solid rgba(99, 102, 241, 0.30);
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-browse:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

/* Pick Tonight — amber accent */
.btn-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(234, 179, 8, 0.1);
  color: var(--play-color);
  border: 1px solid rgba(234, 179, 8, 0.28);
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-pick:hover {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.5);
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.25);
}


/* ═══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(9, 9, 15, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 12px;
}
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(99, 102, 241, 0.75);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-1);
}

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

/* ── Sidebar count badge ────────────────────────────────── */
.pill-count {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 13px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
  color: var(--text-3);
}


/* ═══════════════════════════════════════════════════════════
   GAME GRID
═══════════════════════════════════════════════════════════ */
.game-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 20px;
  padding: 24px;
}

/* ═══════════════════════════════════════════════════════════
   GAME CARD (portrait 2:3)
═══════════════════════════════════════════════════════════ */
.game-card {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.18s;
  -webkit-user-select: none;
  user-select: none;
}
.game-card:hover {
  transform: translateY(-7px) scale(1.025);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.7);
  border-color: var(--border-hi);
}
.game-card:active { transform: translateY(-2px) scale(1.01); }

/* Cover fills the card */
.card-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.game-card:hover .card-cover { transform: scale(1.04); }

/* No-cover placeholder */
.card-no-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 14px 48px;
  background: linear-gradient(160deg, #1a1928 0%, #231b42 50%, #1a2438 100%);
}
.card-no-cover-title {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

/* Bottom gradient so stars & badge are readable */
.card-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 28%),
    linear-gradient(to top,    rgba(0,0,0,0.75) 0%, transparent 40%);
  pointer-events: none;
}

/* Status badge — top right */
.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.card-badge.want   { color: var(--want-color); border-color: rgba(59, 130, 246, 0.4); }
.card-badge.play   { color: var(--play-color); border-color: rgba(234, 179, 8, 0.4); }
.card-badge.done   { color: var(--done-color); border-color: rgba(34, 197, 94, 0.4); }

/* Star rating — bottom left */
.card-stars {
  position: absolute;
  bottom: 8px;
  left: 10px;
  display: flex;
  gap: 1px;
  font-size: 12px;
  line-height: 1;
}
.card-star-on  { color: #fbbf24; }
.card-star-off { color: rgba(255, 255, 255, 0.2); }


/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
  display: none;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty-state.visible { display: block; }
.empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { font-size: 15px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 15px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   MODAL BASE
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  transform: scale(0.96) translateY(12px);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
  transition: all 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.14); color: var(--text-1); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 0 24px 22px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}
.req { color: var(--accent); font-weight: 500; }
.opt { font-weight: 500; letter-spacing: 0; color: var(--text-3); }

input[type="text"],
input[type="url"],
select {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 13px;
  color: var(--text-1);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
input::placeholder { color: var(--text-4); }

.select-wrap {
  position: relative;
}
.select-wrap select { padding-right: 36px; cursor: pointer; }
.select-arrow {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   STATUS TOGGLE
═══════════════════════════════════════════════════════════ */
.status-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.status-opt {
  flex: 1;
  background: transparent;
  color: var(--text-3);
  padding: 9px 6px;
  font-size: 15px;
  font-weight: 500;
  border-right: 1px solid var(--border);
  transition: all 0.15s;
}
.status-opt:last-child { border-right: none; }
.status-opt:hover { background: rgba(255,255,255,0.05); color: var(--text-2); }

.status-opt.active[data-status="Want to Play"] {
  background: var(--want-bg);
  color: var(--want-color);
}
.status-opt.active[data-status="Playing"] {
  background: var(--play-bg);
  color: var(--play-color);
}
.status-opt.active[data-status="Finished"] {
  background: var(--done-bg);
  color: var(--done-color);
}

/* ═══════════════════════════════════════════════════════════
   STAR RATING INPUT
═══════════════════════════════════════════════════════════ */
.star-input {
  display: flex;
  align-items: center;
  gap: 2px;
}
.star-btn {
  font-size: 26px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: color 0.1s, transform 0.1s;
  padding: 2px;
  background: none;
  border: none;
}
.star-btn.active { color: #fbbf24; }
.star-btn.hovered { color: #fde68a; transform: scale(1.15); }

.star-clear {
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  margin-left: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  transition: all 0.15s;
  line-height: 1;
}
.star-clear:hover { color: var(--text-2); background: rgba(255,255,255,0.06); }
.star-clear.hidden { opacity: 0; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════
   COVER UPLOAD + AUTO-FETCH (add modal)
═══════════════════════════════════════════════════════════ */
.cover-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.cover-upload-btn:hover {
  background: var(--bg-4);
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text-1);
}

#cover-file-input { display: none; }

.cover-upload-hint {
  font-size: 12px;
  color: var(--text-3);
}

.cover-auto-area { margin-top: 10px; }

.cover-auto-found {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cover-auto-img {
  width: 60px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-hi);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   DETAIL MODAL
═══════════════════════════════════════════════════════════ */
.modal-detail-container {
  max-width: 600px;
  overflow: hidden;
  position: relative;
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
}

.detail-layout {
  display: flex;
  min-height: 320px;
}

.detail-cover-wrap {
  width: 210px;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-1);
  overflow: hidden;
}
.detail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  background: linear-gradient(160deg, #1a1928, #2d1b4e);
}

.detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 24px 24px;
  min-width: 0;
}

.detail-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.25;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-platform-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 15px;
  font-weight: 500;
}
.detail-platform-badge:empty { display: none; }

.detail-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
}
.detail-status-badge.want {
  background: var(--want-bg);
  color: var(--want-color);
  border-color: var(--want-border);
}
.detail-status-badge.play {
  background: var(--play-bg);
  color: var(--play-color);
  border-color: var(--play-border);
}
.detail-status-badge.done {
  background: var(--done-bg);
  color: var(--done-color);
  border-color: var(--done-border);
}
.detail-status-badge .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.detail-status-badge.want .status-dot { background: var(--want-dot); }
.detail-status-badge.play .status-dot { background: var(--play-dot); }
.detail-status-badge.done .status-dot { background: var(--done-dot); }

.detail-stars {
  display: flex;
  gap: 3px;
  font-size: 22px;
}
.detail-stars .son  { color: #fbbf24; }
.detail-stars .soff { color: rgba(255, 255, 255, 0.12); }
.detail-stars .snone { color: var(--text-4); font-size: 13px; font-family: inherit; }

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════
   PICK TONIGHT MODAL
═══════════════════════════════════════════════════════════ */
.modal-pick-container { max-width: 400px; }

#pick-body { display: flex; flex-direction: column; }
#pick-empty { display: none; }

.pick-cover-wrap {
  width: 150px;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
  position: relative;
  margin: 24px auto 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.pick-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  background: linear-gradient(160deg, #1a1928, #2d1b4e);
}

.pick-info {
  text-align: center;
  padding: 20px 24px 8px;
}
.pick-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.2;
}

.pick-footer {
  justify-content: center;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 24px;
}

.pick-empty-state {
  text-align: center;
  padding: 30px 24px 24px;
  color: var(--text-2);
}
.pick-empty-state strong { color: var(--text-1); }

/* ═══════════════════════════════════════════════════════════
   DELETE MODAL
═══════════════════════════════════════════════════════════ */
.modal-sm-container { max-width: 380px; }
.delete-msg { font-size: 15px; color: var(--text-2); line-height: 1.55; }
.delete-msg strong { color: var(--text-1); }

/* ═══════════════════════════════════════════════════════════
   CATALOG MODAL
═══════════════════════════════════════════════════════════ */
.modal-search-container {
  max-width: 860px;
  height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.catalog-search-row {
  padding: 14px 24px 10px;
  flex-shrink: 0;
}
.catalog-search-row input {
  width: 100%;
}
.catalog-search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.catalog-genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 24px 12px;
  flex-shrink: 0;
}
.catalog-genre-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.catalog-genre-pill:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
}
.catalog-genre-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
  padding: 4px 24px 24px;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.catalog-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border);
}

.catalog-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-no-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(160deg, #1a1928 0%, #231b42 50%, #1a2438 100%);
}

.catalog-no-cover-title {
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.catalog-card-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.catalog-card-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.catalog-cover-wrap { cursor: pointer; }
.catalog-cover-img { transition: transform 0.3s ease; }
.catalog-cover-wrap:hover .catalog-cover-img { transform: scale(1.04); }

/* Iridescent depth layer — always on, lifts on hover */
.catalog-cover-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(160, 140, 255, 0.07) 0%,
    rgba(80,  180, 255, 0.05) 40%,
    rgba(140, 255, 200, 0.05) 100%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}
.catalog-cover-wrap:hover::before { opacity: 1; }

/* Specular highlight — tight bright streak, screen-blend so it lights the image */
.catalog-cover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    112deg,
    transparent  0%,
    transparent  28%,
    rgba(255,255,255,0.03) 36%,
    rgba(255,255,255,0.22) 44%,
    rgba(255,255,255,0.65) 50%,
    rgba(255,255,255,0.22) 56%,
    rgba(255,255,255,0.03) 64%,
    transparent  72%,
    transparent  100%
  );
  background-size: 300% 100%;
  background-position: -80% 0;
  transition: background-position 0.6s cubic-bezier(0.15, 0.5, 0.3, 1);
  pointer-events: none;
  border-radius: inherit;
  mix-blend-mode: screen;
  z-index: 2;
}
.catalog-cover-wrap:hover::after {
  background-position: 50% 0;
}

/* Metallic edge: bright rim + inset top-edge catch-light + lift shadow */
.catalog-cover-wrap:hover {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 2px 8px  rgba(180, 200, 255, 0.12);
}

.catalog-card--open .catalog-cover-wrap {
  border-color: rgba(99, 102, 241, 0.5);
}

.catalog-status-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 15, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  z-index: 3;
  border-radius: inherit;
  animation: overlay-in 0.15s ease;
}

@keyframes overlay-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.catalog-status-btn {
  padding: 7px 6px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
  text-align: center;
}

.catalog-status-btn.want {
  background: var(--want-bg);
  color: var(--want-color);
  border: 1px solid var(--want-border);
}
.catalog-status-btn.want:hover { background: rgba(37, 99, 235, 0.32); }

.catalog-status-btn.play {
  background: var(--play-bg);
  color: var(--play-color);
  border: 1px solid var(--play-border);
}
.catalog-status-btn.play:hover { background: rgba(161, 98, 7, 0.32); }

.catalog-status-btn.done {
  background: var(--done-bg);
  color: var(--done-color);
  border: 1px solid var(--done-border);
}
.catalog-status-btn.done:hover { background: rgba(21, 128, 61, 0.32); }

.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1.6;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
═══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .modal-search-container { max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .app-header { padding: 0 16px; }

  .logo-text { display: none; }
  .btn-label { display: none; }

  .app-sidebar { width: 140px; }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 12px 0;
  }

  /* Detail modal: stack on mobile */
  .modal-detail-container { max-width: 100%; }
  .detail-layout { flex-direction: column; }
  .detail-cover-wrap {
    width: 100%;
    height: 200px;
  }
  .detail-cover-img { object-position: center top; }

  /* Catalog modal */
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 4px 16px 20px;
  }
  .catalog-search-row { padding: 12px 16px 8px; }
  .catalog-genre-row { padding: 4px 16px 10px; }
}

@media (max-width: 380px) {
  .game-grid {
    gap: 8px;
    padding: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════
   DRAG AND DROP
═══════════════════════════════════════════════════════════ */
.game-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.18s, opacity 0.18s ease;
  cursor: pointer;
}
body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}
.game-card.dragging {
  opacity: 0.6;
}
.sidebar-filter.drag-over {
  background: rgba(34, 197, 94, 0.12);
  outline: 2px solid #22c55e;
  outline-offset: -2px;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}
.drag-status-plus {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 5px;
  pointer-events: none;
  vertical-align: middle;
}
.drag-plus-char {
  color: #22c55e;
  line-height: 1;
}
body.is-dragging .drag-status-plus {
  display: inline-flex;
}
