/* ================================================
   STYLES GLOBAUX - Smash or Pass
   ================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "Inter",
    -apple-system,
    sans-serif;
  background: radial-gradient(
    circle at top right,
    var(--color-primary, #351a3f) 0%,
    var(--color-secondary, #150f24) 40%,
    var(--color-tertiary, #0a0612) 100%
  );
  color: var(--color-text, #e0e0e0);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(209, 77, 114, 0.15) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(136, 68, 172, 0.1) 0%,
      transparent 40%
    );
  z-index: -1;
}

.hidden {
  display: none !important;
}

/* ================================================
   NAVBAR
   ================================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
  background: var(--color-secondary, #150f24);
  border-bottom: 1px solid var(--color-border, #2a2a4a);
}

.nav-brand {
  font-size: 1rem;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(209, 77, 114, 0.3);
}

.nav-brand .accent {
  color: var(--color-accent, #ef83a8);
}

.nav-links {
  display: flex;
  gap: 0.3rem;
}

.nav-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted, #999);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
  color: var(--color-accent, #ef83a8);
  background: rgba(239, 131, 168, 0.1);
}

.nav-btn-danger:hover {
  color: var(--color-pass, #ff4d6d);
  background: rgba(255, 77, 109, 0.1);
}

/* ================================================
   LAYOUT
   ================================================ */

.game-layout {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 1100px;
  margin: 68px auto 2rem;
  padding: 0 1.5rem;
  flex: 1;
  align-items: flex-start;
}

/* ================================================
   RULES PANEL (Left)
   ================================================ */

.rules-panel {
  width: 220px;
  flex-shrink: 0;
  background: rgba(22, 19, 42, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.2rem;
  position: sticky;
  top: 68px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.rules-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-accent, #ef83a8);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border, #2a2a4a);
}

.rule {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  align-items: flex-start;
}

.rule-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1.3;
}

.rule-text {
  font-size: 0.68rem;
  color: var(--color-text-muted, #999);
  line-height: 1.5;
}

.rule-text strong {
  color: #ddd;
  font-weight: 700;
}

.fav-counter {
  margin-top: 1rem;
  padding: 0.7rem;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  text-align: center;
}

.fav-counter-label {
  font-size: 0.6rem;
  color: var(--color-fav, #f59e0b);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fav-counter-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-fav, #f59e0b);
  margin-top: 0.2rem;
}

.fav-counter-num span {
  font-size: 0.9rem;
  color: #666;
  font-weight: 600;
}

/* ================================================
   CENTER COLUMN
   ================================================ */

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 380px;
  z-index: 50;
}

/* ================================================
   PAGES (for results)
   ================================================ */

.page {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 68px auto 2rem;
  padding: 0 1.5rem;
  flex: 1;
}

.page.active {
  display: flex;
}

/* ================================================
   PROGRESS
   ================================================ */

.progress-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.progress-track {
  flex: 1;
  height: 3px;
  background: var(--color-border, #2a2a4a);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-pass-hover, #ff4458);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: #555;
}

/* ================================================
   CARD
   ================================================ */

.card-area {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9/16;
  margin-bottom: 1.2rem;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: var(--color-card-bg, #222244);
  border-radius: 16px;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 2px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  cursor: grab;
  transition: box-shadow 0.2s;
  will-change: transform;
}

.card:active {
  cursor: grabbing;
}

.card.animate {
  transition:
    transform 0.35s ease-in,
    opacity 0.35s ease-in;
}

.card-img {
  width: 100%;
  height: 82%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: var(--color-card-img-bg, #1e1e38);
  pointer-events: none;
}

.card-placeholder {
  width: 100%;
  height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-card-img-bg, #1e1e38);
  color: #444;
  font-size: 4rem;
  font-weight: 800;
  pointer-events: none;
}

.card-body {
  padding: 0.6rem 1rem;
  position: relative;
}

.card-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.15rem;
}

.card-meta {
  font-size: 0.7rem;
  color: #888;
  font-weight: 400;
}

.card-stars {
  position: absolute;
  right: 1rem;
  top: 0.6rem;
  font-size: 0.65rem;
  color: #fbbf24;
  letter-spacing: 1px;
}

.card a {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  pointer-events: none;
}

/* ================================================
   DRAG INDICATORS
   ================================================ */

.drag-indicator {
  position: absolute;
  top: 40px;
  padding: 0.8rem 1.5rem;
  font-size: 2.8rem;
  font-weight: 900;
  text-transform: uppercase;
  border-radius: 12px;
  border: 4px solid;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  transition:
    opacity 0.15s ease-out,
    transform 0.15s ease-out;
  letter-spacing: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.drag-pass {
  right: 20px;
  color: var(--color-pass, #ff4d6d);
  border-color: var(--color-pass, #ff4d6d);
  background: rgba(255, 77, 109, 0.15);
  transform: rotate(15deg) scale(1);
  text-shadow: 0 0 15px rgba(255, 77, 109, 0.6);
}

.drag-smash {
  left: 20px;
  color: var(--color-smash, #4ade80);
  border-color: var(--color-smash, #4ade80);
  background: rgba(74, 222, 128, 0.15);
  transform: rotate(-15deg) scale(1);
  text-shadow: 0 0 15px rgba(74, 222, 128, 0.6);
}

/* ================================================
   BUTTONS
   ================================================ */

.buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.6rem;
}

.btn-circle {
  border-radius: 50%;
  background: #16162a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border: 2px solid;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-circle:active {
  transform: scale(0.9);
}

.btn-circle:focus-visible {
  outline: 2px solid #ff4458;
  outline-offset: 3px;
}

.btn-pass {
  width: 56px;
  height: 56px;
  border-color: var(--color-pass, #ff4d6d);
  color: var(--color-pass, #ff4d6d);
  font-size: 1.3rem;
}

.btn-pass:hover {
  background: var(--color-pass, #ff4d6d);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 77, 109, 0.4);
}

.btn-fav {
  width: 44px;
  height: 44px;
  border-color: var(--color-fav, #f59e0b);
  color: var(--color-fav, #f59e0b);
  font-size: 1rem;
}

.btn-fav:hover {
  background: var(--color-fav, #f59e0b);
  color: #fff;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.btn-fav.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-smash {
  width: 56px;
  height: 56px;
  border-color: var(--color-smash, #22c55e);
  color: var(--color-smash, #22c55e);
  font-size: 1.3rem;
}

.btn-smash:hover {
  background: var(--color-smash, #22c55e);
  color: #fff;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.keys-hint {
  font-size: 0.6rem;
  color: #aaa;
  display: flex;
  gap: 1.5rem;
}

/* ================================================
   COMPLETION OVERLAY
   ================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.95);
  text-align: center;
  gap: 1rem;
}

.overlay h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.overlay p {
  font-size: 0.85rem;
  color: #888;
}

.overlay .see-btn {
  margin-top: 0.5rem;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 25px;
  background: #ff4458;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.overlay .see-btn:hover {
  background: #e03e50;
}

/* ================================================
   RESULTS PAGE
   ================================================ */

.results-stats {
  display: flex;
  justify-content: center;
  gap: 4rem;
  margin-bottom: 2rem;
  width: 100%;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border, #2a2a4a);
}

.stat {
  text-align: center;
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 0.4rem;
}

.stat-num.c-smash {
  color: var(--color-smash, #22c55e);
}

.stat-num.c-fav {
  color: var(--color-fav, #f59e0b);
}

.stat-num.c-pass {
  color: var(--color-pass-hover, #ff4458);
}

.results-actions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.r-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--color-border, #2a2a4a);
  border-radius: 20px;
  background: #16162a;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.r-btn:hover {
  border-color: #ff4458;
  color: #ff4458;
}

.share-ok {
  font-size: 0.7rem;
  color: var(--color-smash, #22c55e);
  font-weight: 600;
}

.section {
  width: 100%;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border, #2a2a4a);
}

.section-title.t-smash {
  color: var(--color-smash, #22c55e);
}

.section-title.t-fav {
  color: var(--color-fav, #f59e0b);
}

.section-title.t-pass {
  color: var(--color-pass-hover, #ff4458);
}

/* ================================================
   GRID (Results)
   ================================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.2rem;
}

.mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(22, 22, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.mini:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  background: rgba(30, 30, 55, 0.8);
  z-index: 2;
}

.mini img,
.mini .mini-ph {
  width: 100%;
  aspect-ratio: 3/4;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
  object-position: top center;
  margin-bottom: 0.6rem;
  background: var(--color-card-img-bg, #1e1e38);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.mini-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #444;
}

.mini-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text, #e0e0e0);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  color: #555;
  font-size: 0.75rem;
  font-style: italic;
}

/* ================================================
   GALLERY PANEL (Right)
   ================================================ */

.gallery-panel {
  width: 220px;
  flex-shrink: 0;
  background: rgba(22, 19, 42, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.2rem;
  position: sticky;
  top: 68px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.gallery-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #a78bfa;
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border, #2a2a4a);
}

.gallery-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.8rem;
}

.gallery-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gallery-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border, #2a2a4a);
  text-decoration: none;
  color: #aaa;
  font-size: 0.65rem;
  font-weight: 600;
  transition: all 0.2s;
}

.gallery-link:hover {
  border-color: #a78bfa;
  color: #ddd;
  background: rgba(167, 139, 250, 0.08);
}

.gallery-link-icon {
  font-size: 0.9rem;
}

.gallery-link-label {
  flex: 1;
}

.gallery-link-arrow {
  color: #555;
  font-size: 0.7rem;
}

.gallery-info {
  margin-top: 1rem;
  padding: 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border, #2a2a4a);
  font-size: 0.6rem;
  color: #666;
  line-height: 1.5;
}

.gallery-info strong {
  color: #999;
}

/* ================================================
   PARTICLES / EFFECTS
   ================================================ */

.particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 98;
  overflow: hidden;
}

.particle {
  position: absolute;
  pointer-events: none;
  animation-fill-mode: forwards;
}

/* Confetti (smash) */
@keyframes confettiExplode {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  40% {
    transform: translate(var(--tx), var(--ty)) scale(1) rotate(var(--rot));
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), calc(var(--ty) + 400px)) scale(0.6)
      rotate(calc(var(--rot) + 180deg));
    opacity: 0;
  }
}

.confetti {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiExplode ease-out forwards;
}

/* Stars (fav) */
@keyframes starBurst {
  0% {
    transform: translate(0, 0) scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(1.5) rotate(360deg);
    opacity: 0;
  }
}

.star-particle {
  font-size: 1.5rem;
  animation: starBurst 0.8s ease-out forwards;
}

/* Shatter (pass) */
@keyframes shatterPiece {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 0.7;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0) rotate(var(--rot));
    opacity: 0;
  }
}

.shatter-particle {
  width: 6px;
  height: 6px;
  background: var(--color-pass-hover, #ff4458);
  border-radius: 1px;
  animation: shatterPiece 0.5s ease-out forwards;
}

/* ================================================
   FOOTER
   ================================================ */

.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.6rem;
  color: #333;
  border-top: 1px solid var(--color-border, #2a2a4a);
  margin-top: auto;
}

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

@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
    align-items: center;
  }

  .rules-panel,
  .gallery-panel {
    width: 100%;
    max-width: 340px;
    position: static;
  }

  .gallery-panel {
    order: -1;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0 1rem;
  }

  .game-layout {
    padding: 0 1rem;
  }

  .results-stats {
    gap: 2rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
