@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://unpkg.com/nes.css/css/nes.min.css');

:root {
  --bg-color: #0d0f12;
  /* Dark stoner cyber background */
  --neon-green: #39ff14;
  --cyber-purple: #9d00ff;
  --text-main: #fff;
  --accent: #ff0055;
  --panel-bg: #1a1e24;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  background-image:
    linear-gradient(rgba(13, 15, 18, 0.8), rgba(13, 15, 18, 0.9)),
    url("./grow_tent_bg_1775918736304.png");
  /* Image à la racine */
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Press Start 2P', cursive;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* CRT Scanline effect */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
  z-index: 9999;
  pointer-events: none;
}

/* LOADING SCREEN */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  z-index: 9000;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
  width: 80%;
  max-width: 400px;
}

.blink-text {
  color: var(--neon-green);
  animation: blinkFast 0.8s infinite step-end;
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

@keyframes blinkFast {
  50% {
    opacity: 0;
  }
}

.pixel-text-small {
  font-size: 0.6rem;
  margin-top: 1rem;
  color: #aaa;
}

.game-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 10;
}

/* HEADER HUD */
.hud-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  text-align: center;
}

.hud-stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  color: var(--neon-green);
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 1rem;
}

.game-title {
  color: var(--cyber-purple);
  text-shadow: 3px 3px 0 var(--neon-green), -1px -1px 0 #000;
  font-size: 2.5rem;
  margin: 1rem 0 2rem 0;
  line-height: 1.4;
}

.hud-menu {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-btn {
  font-size: 0.8rem;
}

.nav-btn:hover {
  transform: scale(1.05);
}

/* OVERRIDE NES.CSS DARK THEME */
.nes-container.is-dark {
  background-color: var(--panel-bg);
  border-color: #555;
  color: #fff;
}

.nes-container.with-title>.title {
  background-color: var(--bg-color);
  color: var(--neon-green);
}

/* DIALOG BOX */
.dialog-box {
  margin-bottom: 2rem;
  position: relative;
}

.dialog-content {
  min-height: 80px;
  position: relative;
  line-height: 1.8;
  font-size: 0.9rem;
}

.dialog-arrow {
  position: absolute;
  bottom: 0;
  right: 0;
  animation: blink 1s infinite step-end;
  color: var(--neon-green);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* SCREENS */
.screen {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* GRID LAYOUT (INVENTORY) & FILTERS */
.sub-menu-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.sub-menu-filter .filter-btn {
  font-size: 0.6rem;
  padding: 5px 10px;
}

.sub-menu-filter .filter-btn.active {
  box-shadow: 0 0 10px var(--neon-green);
  border-color: var(--neon-green);
}

.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.strain-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.strain-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(57, 255, 20, 0.2);
}

.strain-card.is-vip {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(30, 30, 30, 1) 0%, rgba(20, 20, 0, 1) 100%);
  position: relative;
  overflow: hidden;
}

.strain-card.is-vip::before {
  content: '★ VIP ★';
  position: absolute;
  top: 5px;
  right: -25px;
  background: #ffd700;
  color: #000;
  font-size: 0.5rem;
  padding: 5px 30px;
  transform: rotate(45deg);
  z-index: 10;
  font-weight: bold;
}

.strain-card.is-vip:hover {
  box-shadow: 0 5px 25px rgba(255, 215, 0, 0.4);
}

.pixel-img-wrapper {
  background: #000;
  border: 4px solid #333;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  height: 180px;
  image-rendering: pixelated;
  /* CRITICAL FOR 8-BIT IMAGES */
}

.pixel-art {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.strain-name {
  font-size: 1rem;
  color: var(--neon-green);
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  padding: 5px 10px;
  font-size: 0.6rem;
  margin-bottom: 10px;
  align-self: flex-start;
  border: 2px solid;
}

.is-sativa {
  color: #ffeb3b;
  border-color: #ffeb3b;
}

.is-indica {
  color: var(--cyber-purple);
  border-color: var(--cyber-purple);
}

.is-hybrid {
  color: #00e5ff;
  border-color: #00e5ff;
}

.strain-desc {
  font-size: 0.7rem;
  flex-grow: 1;
  color: #ccc;
  line-height: 1.4;
}

.stat-bar {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
}

progress.nes-progress {
  height: 20px;
}

/* TERPENE LAB */
.lab-intro {
  font-size: 0.8rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: #bbb;
}

.terpene-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.terpene-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px !important;
}

.terpene-item:hover {
  border-color: var(--cyber-purple) !important;
}

.potion-img {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.terpene-item:hover .potion-img {
  transform: rotate(10deg) scale(1.1);
}

.terpene-info h4 {
  color: var(--cyber-purple);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.terpene-info .aroma {
  color: #aaa;
  font-size: 0.6rem;
}

.terpene-info p {
  font-size: 0.7rem;
  line-height: 1.5;
  color: #ddd;
}

/* MODAL STYLES */
dialog.nes-dialog {
  max-width: 600px;
  width: 90%;
  background-color: var(--panel-bg);
  border: 4px solid var(--neon-green);
  color: var(--text-main);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content-flex {
  display: flex;
  gap: 20px;
  margin: 20px 0;
  align-items: flex-start;
}

.modal-img {
  width: 150px;
  height: 150px;
  image-rendering: pixelated;
  border: 2px dashed #444;
  padding: 5px;
  background: #000;
}

.modal-details {
  flex: 1;
}

.modal-details p {
  font-size: 0.7rem;
  margin-bottom: 10px;
}

.modal-details span {
  color: var(--neon-green);
}

.modal-desc {
  font-size: 0.75rem;
  line-height: 1.6;
  color: #ccc;
  border-top: 1px solid #444;
  padding-top: 15px;
}

.dialog-menu {
  margin-top: 20px;
  text-align: right;
}

/* RESPONSIVE MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  .game-title {
    font-size: 1.8rem;
  }

  .hud-menu {
    flex-direction: column;
    width: 100%;
  }

  .nav-btn {
    width: 100%;
  }

  .terpene-list {
    grid-template-columns: 1fr;
  }

  .terpene-item {
    flex-direction: column;
    text-align: center;
  }

  .dialog-content {
    font-size: 0.7rem;
  }

  .modal-content-flex {
    flex-direction: column;
    align-items: center;
  }
}