/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #161616;
  --border: #1e1e1e;
  --green: #33ff33;
  --green-dim: #1a9a1a;
  --green-glow: rgba(51, 255, 51, 0.3);
  --pink: #ff0066;
  --pink-glow: rgba(255, 0, 102, 0.3);
  --gold: #ffd700;
  --text: #cccccc;
  --text-dim: #777777;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;

  /* Platform colors */
  --color-gba: #8b5cf6;
  --color-snes: #3b82f6;
  --color-mastersystem: #ec7b99;
  --color-megadrive: #10b981;
  --color-megacd: #06b6d4;
  --color-ps1: #6b7280;
  --color-pc: #f59e0b;
  --color-amiga: #ef4444;
  --color-gamegear: #ec4899;
  --color-atarist: #f97316;

  /* Theme colors (overridden by theme-amber) */
  --accent: var(--green);
  --accent-dim: var(--green-dim);
  --accent-glow: var(--green-glow);
}

/* Amber theme */
body.theme-amber {
  --accent: #ffb000;
  --accent-dim: #a07000;
  --accent-glow: rgba(255, 176, 0, 0.3);
  --green: #ffb000;
  --green-dim: #a07000;
  --green-glow: rgba(255, 176, 0, 0.3);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

.amiga-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    #0a0a0a 0%,
    #0d0618 8%,
    #140a2e 15%,
    #1a0c3a 20%,
    #220e44 25%,
    #1a1252 30%,
    #0e1a5a 35%,
    #082260 40%,
    #062a55 45%,
    #043a4a 50%,
    #064a3a 55%,
    #0a5a2e 60%,
    #186828 65%,
    #2a7020 70%,
    #44781a 75%,
    #5a6a18 80%,
    #6a5a16 85%,
    #703818 88%,
    #5a1a1a 92%,
    #3a0e14 96%,
    #0a0a0a 100%
  );
  opacity: 0.5;
}

/* ===== CRT EFFECTS ===== */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 2px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .scanlines, .vignette { display: none; }
}

/* ===== HEADER ===== */
.site-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.site-title {
  font-family: var(--font-pixel);
  font-size: 2rem;
  color: var(--green);
  text-shadow:
    0 0 7px var(--green),
    0 0 20px var(--green),
    0 0 42px var(--green-glow);
  letter-spacing: 2px;
}

.typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--green);
  width: 0;
  animation: typing 2s steps(16) 0.5s forwards, blink-caret 0.7s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 16ch; }
}

@keyframes blink-caret {
  50% { border-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .typewriter {
    width: auto;
    border-right: none;
    animation: none;
  }
}

.site-subtitle {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 0.05rem;
  letter-spacing: 1px;
}

.theme-toggle {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.55rem 0.6rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

/* Amber gradient */
body.theme-amber .amiga-gradient {
  background: linear-gradient(
    180deg,
    #0a0a0a 0%,
    #18100a 8%,
    #2e1a08 15%,
    #3a2206 20%,
    #442a04 25%,
    #523608 30%,
    #5a420e 35%,
    #604e14 40%,
    #555a18 45%,
    #4a5a1a 50%,
    #3a5a1a 55%,
    #2a5218 60%,
    #1e4816 65%,
    #163e14 70%,
    #103410 75%,
    #0c2a0c 80%,
    #0a200a 85%,
    #08180a 88%,
    #060e08 92%,
    #0a0a0a 100%
  );
}

/* ===== FILTER BAR ===== */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-platforms {
  justify-content: center;
}

.filter-categories {
  justify-content: center;
  gap: 1.5rem;
}

.filter-controls {
  justify-content: center;
  gap: 0.75rem;
}

.filter-btn, .category-btn {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.filter-btn:hover, .category-btn:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

.filter-btn.active {
  color: var(--bg);
  background: var(--green);
  border-color: var(--green);
  text-shadow: none;
}

.category-btn.active {
  color: var(--bg);
  background: var(--pink);
  border-color: var(--pink);
}

/* Category checkboxes */
.category-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.category-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s;
}

.category-checkbox input[type="checkbox"]:checked {
  background: var(--pink);
  border-color: var(--pink);
}

#filter-multiplayer:checked {
  background: #fff;
  border-color: #fff;
}

#filter-multiplayer:checked::after {
  color: #000;
}

#filter-multiplayer:checked + .checkbox-label {
  color: #fff;
}

.category-checkbox input[type="checkbox"]:checked::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
}

.category-checkbox input[type="checkbox"]:hover {
  border-color: #fff;
  margin-left: 4px;
}

#filter-multiplayer:hover {
  border-color: #fff;
  margin-left: 40px;
}

#filter-multiplayer:hover + .checkbox-label {
  color: #fff;
}

.checkbox-label {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-dim);
  transition: color 0.2s;
}

.category-checkbox input[type="checkbox"]:checked + .checkbox-label {
  color: var(--pink);
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  color: var(--green);
  border: 1px solid var(--border);
  outline: none;
  width: 220px;
  transition: border-color 0.2s;
  padding-right: 2.5rem;
}

.search-clear {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.search-clear:hover {
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.sort-select {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--green);
}

/* View toggle */
.view-toggle {
  font-size: 1rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.view-toggle:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

.view-toggle .hidden {
  display: none;
}

/* ===== LIST VIEW ===== */
.reviews-grid.list-view {
  grid-template-columns: 1fr;
  gap: 0;
}

.list-view .review-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-top: none;
}

.list-view .review-card:first-child {
  border-top: 1px solid var(--border);
}

.list-view .card-header {
  display: contents;
}

.list-view .card-title {
  flex: 1;
  order: 1;
}

.list-view .card-platforms {
  margin-bottom: 0;
  flex-shrink: 0;
  order: 2;
}

.list-view .card-rating {
  order: 3;
  min-width: 6rem;
  text-align: left;
}

.list-view .card-excerpt {
  display: none;
}

/* ===== STATS BAR ===== */
.stats-bar {
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  text-align: center;
}

#review-count {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-dim);
}

/* ===== REVIEWS GRID ===== */
.reviews-grid {
  max-width: 1200px;
  margin: 1rem auto 2rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* ===== REVIEW CARD ===== */
.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.25s;
  opacity: 0;
  animation: fadeInUp 0.4s forwards;
}

.review-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--green-dim);
  box-shadow: 0 0 15px var(--green-glow);
  transform: translateY(-2px);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--green);
  line-height: 1.6;
  flex: 1;
}

.card-rating {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  margin-top: -0.2rem;
}

/* Stars */
.star.full {
  color: var(--gold);
}

.half-star {
  display: inline-block;
  position: relative;
}

.half-star .star-empty {
  color: var(--text-dim);
}

.half-star .star-filled {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  width: 50%;
  color: var(--gold);
}

.card-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.platform-badge {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  color: #fff;
  letter-spacing: 0.5px;
}

.badge-GBA { background: var(--color-gba); }
.badge-SNES { background: var(--color-snes); }
.badge-Master-System { background: var(--color-mastersystem); }
.badge-Megadrive { background: var(--color-megadrive); }
.badge-Mega-CD { background: var(--color-megacd); }
.badge-PS1 { background: var(--color-ps1); }
.badge-PC { background: var(--color-pc); }
.badge-Amiga { background: var(--color-amiga); }
.badge-Atari-ST { background: var(--color-atarist); }
.badge-Game-Gear { background: var(--color-gamegear); }
.badge-Master-System { background: #d946ef; }

.category-badge {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  background: var(--pink);
  color: #fff;
}

.players-badge {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.4rem;
  border-radius: 50%;
  background: #fff;
  color: #000;
  min-width: 1.8rem;
  min-height: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.year-badge {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  background: var(--text-dim);
  color: #000;
  margin-left: auto;
}

.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 30px var(--green-glow);
  max-width: 750px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  font-size: 1.5rem;
  color: var(--text-dim);
  background: var(--bg);
  border: none;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  z-index: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--pink);
}

.modal-nav {
  display: none;
}

.modal-title {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--green);
  line-height: 1.8;
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.modal-rating {
  font-family: var(--font-pixel);
  font-size: 1.3rem;
  color: var(--gold);
  line-height: 1;
  position: relative;
  margin-top: 2px;
  top: -0.3rem;
}

.modal-year {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
  background: var(--text-dim);
  color: #000;
  margin-left: auto;
}

.modal-review p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: #aaaaaa;
}

.modal-review p:last-child {
  margin-bottom: 0;
}

/* Bonus section */
.modal-bonus {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-bonus h3 {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--pink);
  margin-bottom: 0.75rem;
}

.bonus-ratings-list {
  list-style: none;
}

.bonus-ratings-list li {
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.bonus-ratings-list li > :first-child {
  flex: 0 0 280px;
}

.bonus-ratings-list li:last-child {
  border-bottom: none;
}

.bonus-rating-stars {
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
  margin-top: -2px;
  margin-left: auto;
}

.bonus-rating-link {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.bonus-rating-link:hover {
  color: var(--green);
}

/* Links */
.modal-links {
  margin-top: 1.25rem;
}

.modal-link {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--green);
  text-decoration: none;
  border: 1px solid var(--green-dim);
  padding: 0.4rem 0.6rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  transition: all 0.2s;
}

.modal-link:hover {
  background: var(--green);
  color: var(--bg);
}

/* Screenshots */
.modal-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.25rem 0;
}

.modal-screenshot {
  max-width: 48%;
  height: auto;
  border: 1px solid var(--border);
  image-rendering: auto;
}

@media (max-width: 768px) {
  .modal-screenshot {
    max-width: 100%;
  }
}

/* YouTube embed */
.video-container {
  position: relative;
  width: 60%;
  padding-bottom: 33.75%;
  margin: 1rem auto;
  background: #000;
}

@media (max-width: 768px) {
  .video-container {
    width: 100%;
    padding-bottom: 56.25%;
  }
}

.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ===== SCROLL TOP ===== */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 4000;
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  color: var(--green);
  border: 1px solid var(--green-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.scroll-top:hover {
  background: var(--green);
  color: var(--bg);
}

.scroll-top.hidden {
  display: none;
}

.hidden {
  display: none;
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-dim);
}

.rss-btn {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.rss-btn:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

/* ===== NO RESULTS ===== */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--text-dim);
}

/* ===== RESPONSIVE ===== */

/* Tablettes */
@media (max-width: 768px) {
  .site-title {
    font-size: 1.2rem;
  }

  .site-subtitle {
    font-size: 0.5rem;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .filter-bar {
    padding: 0 1rem;
  }

  .search-input {
    width: 100%;
  }

  .filter-controls {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .sort-select {
    flex: 1;
    min-width: 0;
  }

  .modal-content {
    max-height: 95vh;
    padding: 1.25rem;
  }

  .modal-title {
    font-size: 0.7rem;
  }

  /* Vue liste tablette */
  .list-view .review-card {
    gap: 0.75rem;
    padding: 0.6rem 1rem;
  }

  .list-view .card-title {
    font-size: 0.55rem;
  }

  .list-view .card-rating {
    min-width: 5rem;
    font-size: 0.85rem;
  }
}

/* Smartphones */
@media (max-width: 480px) {
  .site-header {
    padding: 1.5rem 0.75rem 1rem;
  }

  .site-title {
    font-size: 0.85rem;
  }

  .site-subtitle {
    font-size: 0.45rem;
  }

  .filter-bar {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .filter-btn {
    font-size: 0.42rem;
    padding: 0.4rem 0.45rem;
  }

  .category-checkbox {
    gap: 0.3rem;
  }

  .checkbox-label {
    font-size: 0.45rem;
  }

  .search-input {
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
  }

  .sort-select {
    font-size: 0.42rem;
    padding: 0.45rem 0.5rem;
  }

  .reviews-grid {
    padding: 0 0.75rem;
    gap: 1rem;
  }

  .stats-bar {
    padding: 0 0.75rem;
  }

  /* Cartes mobile */
  .review-card {
    padding: 1rem;
  }

  .card-title {
    font-size: 0.55rem;
  }

  .card-rating {
    font-size: 0.85rem;
  }

  .card-excerpt {
    font-size: 0.8rem;
  }

  /* Vue liste mobile : empiler titre, tags, étoiles */
  .list-view .review-card {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.75rem;
  }

  .list-view .card-title {
    flex-basis: 100%;
    order: 1;
    font-size: 0.5rem;
  }

  .list-view .card-platforms {
    order: 2;
  }

  .list-view .card-rating {
    order: 3;
    min-width: auto;
    font-size: 0.8rem;
  }

  /* Modal mobile */
  .modal {
    padding: 0;
  }

  .modal-content {
    max-height: 100vh;
    max-width: 100%;
    padding: 1rem;
    border: none;
  }

  .modal-title {
    font-size: 0.6rem;
    padding-right: 1.5rem;
  }

  .modal-rating {
    font-size: 1rem;
  }

  .modal-review p {
    font-size: 0.85rem;
    line-height: 1.7;
  }

  .modal-close {
    font-size: 1.2rem;
  }

  .video-container {
    width: 100%;
    padding-bottom: 56.25%;
  }

  .scroll-top {
    bottom: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
    font-size: 0.7rem;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--green-dim);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}
