/* =========================================================================
   Game Vault — Design System
   Tokens (primitive → semantic → component) + components + motion.
   Tema único oscuro, deliberado: uso nocturno de coleccionista, en línea
   con Steam / PS Store. Un solo acento (violeta, heredado de la marca).
   ========================================================================= */

:root {
  /* ---- Primitive: color ---- */
  --gray-950: #0a0b0f;
  --gray-900: #101218;
  --gray-850: #14161e;
  --gray-800: #191c26;
  --gray-750: #1f222e;
  --gray-700: #262a38;
  --gray-600: #363b4d;
  --gray-500: #4b5169;
  --gray-400: #6d738c;
  --gray-300: #9298b0;
  --gray-200: #b9bdd0;
  --gray-100: #dcdee8;
  --gray-50:  #f2f3f7;

  --violet-400: #a599ff;
  --violet-500: #8672ff;
  --violet-600: #7159ef;
  --violet-700: #5c45cc;

  --emerald-400: #4ade95;
  --emerald-500: #2fbf7d;
  --coral-400: #ff7a86;
  --coral-500: #fb5261;
  --amber-400: #ffbd63;
  --sky-400: #6cc8ff;

  /* ---- Semantic: surfaces ---- */
  --bg: var(--gray-950);
  --surface-0: var(--gray-900);   /* header, page chrome */
  --surface-1: var(--gray-850);   /* cards, panels */
  --surface-2: var(--gray-800);   /* raised / hovered cards */
  --surface-3: var(--gray-750);   /* inputs, wells inside cards */
  --glass-bg: rgba(16, 18, 24, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* ---- Semantic: text ---- */
  --text-primary: var(--gray-50);
  --text-secondary: var(--gray-300);
  --text-tertiary: var(--gray-400);
  --text-disabled: var(--gray-500);
  --text-on-accent: #ffffff;

  /* ---- Semantic: accent + status ---- */
  --accent: var(--violet-500);
  --accent-hover: var(--violet-400);
  --accent-active: var(--violet-700);
  --accent-soft-bg: rgba(134, 114, 255, 0.14);
  --accent-soft-border: rgba(134, 114, 255, 0.34);

  --good: var(--emerald-400);
  --good-soft-bg: rgba(74, 222, 149, 0.13);
  --good-soft-border: rgba(74, 222, 149, 0.32);

  --hot: var(--coral-400);
  --hot-soft-bg: rgba(255, 122, 134, 0.14);
  --hot-soft-border: rgba(255, 122, 134, 0.34);

  --warn: var(--amber-400);
  --info: var(--sky-400);

  /* ---- Primitive: type ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.375rem;

  /* ---- Primitive: space (rem) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ---- Primitive: radius ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ---- Primitive: shadow (tinted, offset + blur — never flat) ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 26px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 0 1px var(--accent-soft-border), 0 12px 32px -10px rgba(134, 114, 255, 0.4);
  --shadow-glow-hot: 0 0 0 1px var(--hot-soft-border), 0 12px 32px -10px rgba(255, 122, 134, 0.35);

  /* ---- Primitive: motion ---- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 260ms;
  --dur-dialog: 220ms;
}

/* ========================================================================= */
/* Reset & base                                                              */
/* ========================================================================= */

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 560px at 12% -8%, rgba(134, 114, 255, 0.10), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(74, 222, 149, 0.05), transparent 55%);
  background-repeat: no-repeat;
  color: var(--text-primary);
  font: var(--text-base)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* Fondo ambiental: la carátula del juego bajo el cursor, difuminada detrás de
   toda la página (mismo lenguaje que PS5 / Apple TV / Spotify). Dos capas para
   poder cruzar (crossfade) de un juego a otro sin parpadeo. Solo se inyecta en
   dispositivos con hover real (ver initAmbientHover en app.js). */
.ambient-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ambient-layer {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  opacity: 0;
  filter: blur(70px) saturate(130%) brightness(0.5);
  transition: opacity 900ms var(--ease-out);
}
.ambient-layer.is-visible { opacity: 0.5; }

/* Browser surfaces: theme what you didn't draw. */
::selection { background: var(--accent-soft-border); color: var(--text-primary); }

* { scrollbar-color: var(--gray-600) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gray-600);
  border-radius: var(--radius-pill);
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================================================= */
/* Typography                                                                */
/* ========================================================================= */

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-md); letter-spacing: -0.005em; }

p { margin: 0; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ========================================================================= */
/* Layout                                                                    */
/* ========================================================================= */

main { max-width: 1180px; margin: 0 auto; padding: var(--space-8) var(--space-6) var(--space-20); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-head h2 { display: flex; align-items: baseline; gap: var(--space-2); }
.page-head .count { font-size: var(--text-sm); font-weight: 500; color: var(--text-tertiary); }

.section { margin-bottom: var(--space-12); }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.section-title h3 { font-size: var(--text-lg); display: flex; align-items: center; }
.section-title .meta { font-size: var(--text-sm); color: var(--text-tertiary); }

/* Punto en directo: única excepción a "sin puntos decorativos" porque refleja
   un estado real (Twitch ahora mismo), no decoración. */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hot);
  margin-right: var(--space-2);
  box-shadow: 0 0 0 0 rgba(255, 122, 134, 0.45);
  animation: live-pulse 2s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 134, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(255, 122, 134, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 134, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/* ========================================================================= */
/* Header — translucent material, content scrolls under it                  */
/* ========================================================================= */

header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-3) var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  position: sticky;
  top: 0;
  z-index: 20;
}
@media (prefers-reduced-transparency: reduce) {
  header { background: var(--surface-0); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text-primary); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(155deg, var(--violet-400), var(--violet-700));
  box-shadow: 0 4px 14px -4px rgba(134, 114, 255, 0.55), inset 0 1px 0 rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-size: var(--text-md); font-weight: 700; letter-spacing: -0.01em; }

header nav { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }

header nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 550;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
header nav a:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
header nav a.active { color: var(--text-primary); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-default); }

.badge {
  display: none;
  background: var(--hot);
  color: #2a0508;
  border-radius: var(--radius-pill);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 750;
  align-items: center;
  justify-content: center;
}
.badge.show { display: inline-flex; animation: pop-in var(--dur-slow) var(--ease-out); }

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

/* ========================================================================= */
/* Icons                                                                     */
/* ========================================================================= */

.icon { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ========================================================================= */
/* Buttons                                                                   */
/* ========================================================================= */

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

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-on-accent);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 9px 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, var(--shadow-sm);
  transition: background-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

button.ghost {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: none;
}
button.ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }

button.danger {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-tertiary);
  box-shadow: none;
}
button.danger:hover { color: var(--hot); border-color: var(--hot-soft-border); background: var(--hot-soft-bg); }

button.icon-btn {
  padding: 8px;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
}

/* ========================================================================= */
/* Inputs                                                                    */
/* ========================================================================= */

input, select, textarea {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--text-disabled); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-bg);
}

/* ---- Search hero ---- */

.hero { padding: var(--space-10) 0 var(--space-8); text-align: center; }
.hero-eyebrow-free h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
  background: linear-gradient(155deg, var(--text-primary) 20%, var(--gray-200));
  -webkit-background-clip: text;
  background-clip: text;
}
.hero p.lead { color: var(--text-secondary); font-size: var(--text-md); max-width: 46ch; margin: 0 auto var(--space-8); }

.search-bar {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}
.search-bar .icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary); font-size: 18px; pointer-events: none;
}
.search-bar input {
  width: 100%;
  font-size: var(--text-md);
  padding: 15px 18px 15px 46px;
  background: var(--surface-1);
  border-color: var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.search-bar input:focus-visible { box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-soft-bg); }

.filters { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.filters select { min-width: 150px; }

/* ========================================================================= */
/* Cards (search results, collection, popular)                              */
/* ========================================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: var(--space-5);
}
.grid.grid-lg { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
}
.card:active { transform: translateY(-1px) scale(0.995); }

.card .cover {
  aspect-ratio: 3 / 4;
  width: 100%;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}

/* Carátula con tilt 3D + brillo que sigue al cursor (ver initTilt en app.js). */
.cover-tilt { position: relative; display: block; }
.cover-tilt > img {
  display: block;
  transition: transform 420ms var(--ease-out);
}
.cover-tilt.is-active > img { transition: transform 50ms linear; will-change: transform; }
.cover-tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.18), transparent 55%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}
.cover-tilt.is-active::after { opacity: 1; }

.card .body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.card h3 { font-size: var(--text-sm); font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { color: var(--text-tertiary); font-size: var(--text-xs); }
.card .actions { display: flex; gap: 6px; margin-top: auto; padding-top: var(--space-3); }
.card .actions button {
  flex: 1;
  min-width: 0;
  padding: 7px 6px;
  font-size: var(--text-xs);
  gap: 5px;
}
.card .actions button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================================================= */
/* Empty / loading states                                                    */
/* ========================================================================= */

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
  text-align: center; padding: var(--space-16) var(--space-6);
  color: var(--text-secondary);
}
.empty .empty-icon {
  width: 56px; height: 56px; border-radius: var(--radius-lg);
  background: var(--surface-1); border: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
}
.empty .empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { color: var(--text-primary); font-size: var(--text-md); }
.empty p { max-width: 40ch; font-size: var(--text-sm); color: var(--text-tertiary); }
.empty a { color: var(--accent-hover); font-weight: 600; text-decoration: none; }
.empty a:hover { text-decoration: underline; }

.skeleton-card { background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.skeleton-card .cover { aspect-ratio: 3/4; }
.skeleton-card .sk-line { height: 10px; margin: var(--space-3) var(--space-4) 0; border-radius: 5px; }
.skeleton-card .sk-line:last-child { margin-bottom: var(--space-4); width: 60%; }

.sk {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; opacity: 0.6; }
}

/* ========================================================================= */
/* Deal / stat strip (asymmetric, not four identical boxes)                  */
/* ========================================================================= */

.stat-panel {
  display: flex;
  align-items: stretch;
  gap: var(--space-8);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.stat-hero { flex: none; }
.stat-hero .label { font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-1); }
.stat-hero .value { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; }
.stat-hero .value small { font-size: var(--text-md); color: var(--text-tertiary); font-weight: 500; margin-left: var(--space-1); }

.stat-rest { display: flex; gap: var(--space-8); flex-wrap: wrap; align-items: center; border-left: 1px solid var(--border-subtle); padding-left: var(--space-8); flex: 1; }
@media (max-width: 720px) { .stat-rest { border-left: none; padding-left: 0; } }

.stat-item .label { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--space-1); }
.stat-item .value { font-size: var(--text-lg); font-weight: 650; }

.genre-bars { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.genre-bar-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.genre-bar-row .g-name { color: var(--text-secondary); width: 74px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.genre-bar-row .g-track { flex: 1; height: 5px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.genre-bar-row .g-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--violet-600), var(--violet-400)); }

/* ========================================================================= */
/* Wishlist deal cards                                                       */
/* ========================================================================= */

.deal-list { display: flex; flex-direction: column; gap: var(--space-4); }

.deal-card {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: var(--space-5);
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .deal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-default); }
}
.deal-card.is-deal { border-color: var(--hot-soft-border); box-shadow: var(--shadow-glow-hot); }
.deal-card.is-target { border-color: var(--good-soft-border); }

.deal-card .cover-tilt { width: 84px; aspect-ratio: 3/4; flex: none; border-radius: var(--radius-md); overflow: hidden; }
.deal-card .cover-tilt img { width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }

.deal-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.deal-info h3 { font-size: var(--text-md); font-weight: 650; }
.deal-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.deal-sub { font-size: var(--text-xs); color: var(--text-tertiary); }
.deal-sub .listing { font-style: italic; }

.deal-price { display: flex; align-items: center; gap: var(--space-5); }
.deal-price-block { text-align: right; min-width: 128px; }
.deal-price-block .amount { font-size: var(--text-xl); font-weight: 750; letter-spacing: -0.01em; }
.deal-price-block .amount.is-deal-color { color: var(--hot); }
.deal-price-block .amount.is-target-color { color: var(--good); }
.deal-price-block .shop { color: var(--text-tertiary); font-size: var(--text-xs); margin-top: 2px; }
.deal-price-block .delta { font-size: var(--text-xs); font-weight: 600; margin-top: 4px; }
.deal-price-block .delta.pos { color: var(--good); }
.deal-price-block .delta.neg { color: var(--text-tertiary); }
.deal-price-block a.view-offer {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent-hover); font-size: var(--text-xs); font-weight: 600;
  text-decoration: none; margin-top: 6px;
}
.deal-price-block a.view-offer:hover { text-decoration: underline; }

.spark { display: block; overflow: visible; flex: none; }
.spark .spark-fill { opacity: 0.6; }
.spark .spark-line { fill: none; stroke: var(--accent-hover); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark .spark-dot { fill: var(--accent-hover); }

.deal-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.deal-actions button { font-size: var(--text-xs); padding: 6px 11px; white-space: nowrap; }

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.tag.low { background: var(--hot-soft-bg); color: var(--hot); border-color: var(--hot-soft-border); }
.tag.target { background: var(--good-soft-bg); color: var(--good); border-color: var(--good-soft-border); }
.tag.cond { background: var(--surface-2); color: var(--text-tertiary); border-color: var(--border-default); }

.src {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid;
}
.src-itad { color: var(--info); border-color: rgba(108, 200, 255, 0.35); background: rgba(108, 200, 255, 0.1); }
.src-ebay { color: var(--warn); border-color: rgba(255, 189, 99, 0.35); background: rgba(255, 189, 99, 0.1); }
.src-manual { color: var(--text-tertiary); border-color: var(--border-default); background: var(--surface-2); }

.hint { color: var(--text-tertiary); font-size: var(--text-sm); margin: 0 0 var(--space-4); }

/* ========================================================================= */
/* Notices                                                                   */
/* ========================================================================= */

.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  background: rgba(255, 189, 99, 0.08);
  border: 1px solid rgba(255, 189, 99, 0.25);
  color: var(--gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
}
.notice .icon { color: var(--warn); margin-top: 2px; }
.notice code { background: rgba(0, 0, 0, 0.35); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
.notice a { color: var(--sky-400); }

.notice.notice-info {
  background: rgba(108, 200, 255, 0.07);
  border-color: rgba(108, 200, 255, 0.22);
}
.notice.notice-info .icon { color: var(--info); }
.notice.notice-info strong { color: var(--text-primary); }

/* Último mínimo visto en Telegram para el físico: cambia a menudo, así que se
   marca como "último mínimo" y no como precio actual. Verde si ya está por
   debajo de tu precio objetivo. */
.physical-row {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.physical-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.physical-label { color: var(--text-tertiary); }
.physical-amount { font-weight: 700; color: var(--text-primary); }
.physical-row.is-low { border-color: var(--good-soft-border); }
.physical-row.is-low .physical-amount { color: var(--good); }
.physical-link {
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
  margin-top: 4px;
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
}
.physical-link:hover { text-decoration: underline; }
.physical-link .icon { width: 12px; height: 12px; }

/* Fecha en las tarjetas de lanzamientos: es el dato principal de esa sección,
   así que se destaca más que el resto de metadatos. */
.release-date {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
}
.release-date .icon { width: 12px; height: 12px; }

/* Estado de sesión en la barra de navegación. */
.session {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-subtle);
}
.session form { margin: 0; display: inline; }
.session-user {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-link {
  font: inherit;
  font-size: var(--text-sm);
  background: none;
  border: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  cursor: pointer;
}
.session-link:hover { color: var(--text-primary); background: var(--surface-2); }
.session-link.is-primary { color: var(--accent-hover); font-weight: 600; }

/* ========================================================================= */
/* Acceso y registro                                                         */
/* Dos columnas: el formulario manda, y al lado una franja con el acento de  */
/* la marca para que no parezca un trámite administrativo.                   */
/* ========================================================================= */

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: var(--space-5); }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 380px);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 820px;
  width: 100%;
}
@media (max-width: 800px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 420px; }
  .auth-aside { display: none; }
}

.auth-card { padding: var(--space-8) var(--space-8) var(--space-6); }
.auth-brand {
  display: inline-flex; align-items: center; gap: var(--space-2);
  text-decoration: none; color: var(--text-primary); margin-bottom: var(--space-6);
}
.auth-card h1 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.auth-lead { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--space-5); }

.auth-error {
  background: var(--hot-soft-bg);
  border: 1px solid var(--hot-soft-border);
  color: var(--hot);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-form label {
  display: flex; flex-direction: column; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--text-secondary);
}
.auth-form input {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font: inherit;
}
.auth-form input:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: -1px; }

/* Campo de contraseña con el botón de verla dentro, a la derecha. */
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 2.9rem; }

.password-toggle {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
}
.password-toggle:hover { color: var(--text-primary); background: var(--surface-2); }
.password-toggle:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 1px; }
.password-toggle svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.auth-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: calc(var(--space-2) * -1); }

.auth-submit {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font: inherit; font-weight: 650;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.auth-submit:hover { background: var(--accent-hover); }

.auth-foot {
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-align: center;
}
.auth-foot a { color: var(--accent-hover); }

.auth-aside {
  padding: var(--space-8);
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-3);
  background:
    radial-gradient(600px 300px at 80% 10%, var(--accent-soft-bg), transparent 70%),
    var(--surface-2);
  border-left: 1px solid var(--border-subtle);
}
.auth-quote { font-size: var(--text-lg); font-weight: 650; letter-spacing: -0.01em; }
.auth-sub { color: var(--text-secondary); font-size: var(--text-sm); }

/* ========================================================================= */
/* Ficha pública de juego                                                    */
/* Se renderiza en el servidor para que la indexe el buscador, así que su CSS */
/* no puede depender de nada que inyecte app.js.                             */
/* ========================================================================= */

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 264px) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
@media (max-width: 720px) {
  .game-page { grid-template-columns: 1fr; gap: var(--space-5); }
  .game-cover { max-width: 200px; }
}

.game-cover {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-md);
  background: var(--surface-2);
}
.game-page h1 { font-size: var(--text-2xl); margin-bottom: var(--space-2); }
.game-page h2 { font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-3); }
.game-meta { color: var(--text-tertiary); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.game-summary { color: var(--text-secondary); max-width: 60ch; margin-bottom: var(--space-4); }

.price-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.price-table th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  font-weight: 500;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
}
.price-table td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.price-table td.num { font-variant-numeric: tabular-nums; font-weight: 650; }
.price-table .cut { color: var(--good); font-size: var(--text-xs); font-weight: 500; }
.price-table a { color: var(--accent-hover); }

/* Botón para ir a comprar a una tienda concreta (Amazon, Wakkap…): sin precio
   propio, el enlace es lo que aporta valor. Mismo aspecto para todas. */
.shop-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  text-decoration: none;
  color: var(--text-secondary);
  justify-content: flex-end;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.shop-row-name { font-weight: 650; color: var(--warn); }
.shop-row .icon { width: 13px; height: 13px; }
.shop-row:hover { border-color: var(--warn); color: var(--text-primary); }

/* ========================================================================= */
/* Dialog                                                                    */
/* ========================================================================= */

dialog {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  min-width: 380px;
  max-width: min(460px, 92vw);
  box-shadow: var(--shadow-lg);
}
dialog[open] { animation: dialog-in var(--dur-dialog) var(--ease-out); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
dialog::backdrop {
  background: rgba(6, 7, 10, 0.6);
  backdrop-filter: blur(3px);
  animation: backdrop-in var(--dur-dialog) var(--ease-out);
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

dialog h3 { margin: 0 0 var(--space-5); font-size: var(--text-lg); }
dialog label { display: block; margin-bottom: var(--space-3); font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
dialog label input, dialog label select, dialog label textarea { width: 100%; margin-top: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: var(--text-base); color: var(--text-primary); }
dialog .buttons { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-5); }

@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: backdrop-in var(--dur-fast) linear; }
  dialog::backdrop { animation: none; }
}

/* ========================================================================= */
/* Toast                                                                     */
/* ========================================================================= */

.toast-stack {
  position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: var(--space-2);
  z-index: 100; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 550;
  animation: toast-in var(--dur-slow) var(--ease-out);
}
.toast.leaving { animation: toast-out var(--dur-base) var(--ease-in-out) forwards; }
.toast .icon { color: var(--good); }
.toast.is-error .icon { color: var(--hot); }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.96); } }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.leaving { animation-duration: 1ms !important; }
}

/* ========================================================================= */
/* Scroll-in reveal (grids)                                                  */
/* ========================================================================= */

.reveal { opacity: 0; transform: translateY(10px); animation: reveal-in var(--dur-slow) var(--ease-out) forwards; }
@keyframes reveal-in { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: fade-in var(--dur-fast) linear forwards; }
  @keyframes fade-in { to { opacity: 1; } }
}

/* ========================================================================= */
/* Responsive                                                                */
/* ========================================================================= */

@media (max-width: 720px) {
  header { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  header nav a span.label { display: none; }
  main { padding: var(--space-5) var(--space-4) var(--space-16); }
  .hero { padding: var(--space-6) 0 var(--space-6); }
  .hero-eyebrow-free h1 { font-size: var(--text-2xl); }
  .deal-card { grid-template-columns: 60px 1fr; }
  .deal-price { grid-column: 1 / -1; justify-content: space-between; padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); margin-top: var(--space-1); }
  .deal-actions { flex-direction: row; }
  .stat-panel { flex-direction: column; }
  .stat-rest { border-left: none; padding-left: 0; border-top: 1px solid var(--border-subtle); padding-top: var(--space-5); }
}

@media (max-width: 480px) {
  .spark { display: none; }
}
