/* ==============================
   GARDAV — style.css
   Dark minimalist PWA game
   ============================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: #0a0e14;
  color: #e8e8e8;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  /* Disable double-tap zoom */
}

body {
  position: relative;
}

/* --- Vignette overlay --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ==============================
   SCREEN SYSTEM
   ============================== */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateX(0);
  padding: 2rem;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 10;
}

/* Slide animations */
.screen.slide-in-right {
  animation: slideInRight 0.35s ease forwards;
}

.screen.slide-in-left {
  animation: slideInLeft 0.35s ease forwards;
}

.screen.slide-out-right {
  animation: slideOutRight 0.35s ease forwards;
}

.screen.slide-out-left {
  animation: slideOutLeft 0.35s ease forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }

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

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(-100px);
  }
}

/* ==============================
   MAIN MENU
   ============================== */

.menu-title {
  font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.15),
    0 0 60px rgba(100, 200, 255, 0.08);
  margin-bottom: 3rem;
  text-align: center;
  line-height: 1;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 280px;
}

.menu-buttons-row {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.options-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: space-between;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #4caf50;
  transition: width 0.3s ease;
}

/* --- Pill Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2.4rem;
  border-radius: 30px;
  corner-shape: squircle;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #e8e8e8;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-square {
  padding: 0;
  width: 3.5rem;
  min-width: 3.5rem;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn.active-lang {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: #fff;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.04);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn:hover::before,
.btn:active::before {
  opacity: 1;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.04);
}

.btn:active {
  transform: scale(0.97);
}

/* Button accent variants */
.btn-play {
  border-color: rgba(0, 210, 255, 0.5);
  color: #00d2ff;
  text-shadow: 0 0 20px rgba(0, 210, 255, 0.2);
}

.btn-play:hover {
  border-color: rgba(0, 210, 255, 0.8);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.15);
}

.btn-tuto {
  border-color: rgba(255, 180, 50, 0.4);
  color: #ffb432;
  text-shadow: 0 0 20px rgba(255, 180, 50, 0.15);
}

.btn-tuto:hover {
  border-color: rgba(255, 180, 50, 0.7);
  box-shadow: 0 0 25px rgba(255, 180, 50, 0.12);
}

.btn-credits {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
}

.btn-credits:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.85);
}

/* --- Back button (top-left) --- */
.btn-back {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  z-index: 10;
}

.btn-back:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.8);
}

/* --- Top Right Icon Button --- */
.btn-icon {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 20;
}

.btn-icon:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.top-right {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}


/* ==============================
   TUTO & CREDITS PAGES
   ============================== */

.page-content {
  max-width: 600px;
  width: 100%;
  text-align: left;
  overflow-y: auto;
  max-height: 80vh;
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.page-content::-webkit-scrollbar {
  width: 4px;
}

.page-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* --- Tuto Terminal Aesthetic --- */
.tuto-content {
  font-family: 'Courier New', Courier, monospace;
  color: #e0e0e0;
}

.tuto-title,
.tuto-subtitle {
  font-family: 'Courier New', Courier, monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

.tuto-title {
  font-size: 1.8rem;
  text-align: center;
  border-bottom: none;
}

.tuto-content p {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
  color: #b0b0b0;
}

.tuto-content strong,
.tuto-content .highlight {
  color: #fff;
  font-weight: bold;
}

.tuto-content .highlight {
  background: rgba(255, 255, 255, 0.1);
  padding: 0 4px;
}

.tuto-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.85rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tuto-table th,
.tuto-table td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem 0.5rem;
}

.tuto-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.vertical-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.tuto-table td.victory-collective {
  color: #4caf50;
}

.tuto-table td.victory-interroge,
.tuto-content .highlight.interroge-text {
  color: #00d2ff;
}

.tuto-table td.victory-interrogateurs,
.tuto-content .highlight.interrogateur-text {
  color: #b088ff;
}

.tuto-table td.defeat-collective {
  color: #f44336;
}

.tuto-table td.empty {
  border: none;
  background: transparent;
}


.change-player-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.6;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.change-player-text {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 500;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 2.5rem;
}

.btn-next {
  border-color: rgba(0, 210, 255, 0.5);
  color: #00d2ff;
}

.btn-next:hover {
  border-color: rgba(0, 210, 255, 0.8);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.15);
}

/* --- Swipe hint --- */
.swipe-hint {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.1em;
  animation: fadeInUp 1s ease 0.5s both;
}

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

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

.swipe-hint-arrow {
  display: inline-block;
  margin-left: 0.4em;
  animation: arrowBounce 1.5s ease-in-out infinite;
}

@keyframes arrowBounce {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(6px);
  }
}

/* ==============================
   RANDOM SCREEN — IMAGE
   ============================== */

#screen-random {
  overflow: visible;
}

#random-content {
  overflow: visible;
  position: relative;
}

.random-image {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
  touch-action: none;
  /* Let JS handle all touch on images */
  will-change: transform;
  transform-origin: center center;
}

/* ==============================
   RANDOM SCREEN — QUESTION MARK
   ============================== */

.question-mark-container {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  width: min(90vw, 80vh * 3 / 4);
  max-height: 80vh;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
  touch-action: none;
  /* Let JS handle all touch */
  will-change: transform;
  transform-origin: center center;
  position: relative;
}

.question-mark {
  font-size: clamp(12rem, 50vw, 28rem);
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0 30px rgba(255, 255, 255, 0.15),
    0 0 80px rgba(255, 255, 255, 0.06);
  line-height: 1;
  animation: questionPulse 3s ease-in-out infinite;
}

@keyframes questionPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }

  50% {
    transform: scale(1.03);
    opacity: 1;
  }
}

/* ==============================
   HISTORY INDICATOR
   ============================== */

.history-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.history-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.history-dot.active {
  background: rgba(255, 255, 255, 0.7);
  width: 8px;
  height: 8px;
}

/* ==============================
   LOADING / FADE
   ============================== */

.image-loading {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.image-loaded {
  opacity: 1;
}

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

@media (max-width: 480px) {
  .screen {
    padding: 1.5rem;
  }

  .menu-buttons {
    max-width: 240px;
  }

  .btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
  }

  .btn-back {
    top: 1rem;
    left: 1rem;
  }

  .swipe-hint {
    bottom: 1.5rem;
  }
}

@media (min-width: 768px) {
  .random-image {
    max-width: 70vw;
    max-height: 85vh;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .menu-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
  }

  .menu-buttons {
    flex-direction: row;
    max-width: none;
    gap: 0.8rem;
  }

  .change-player-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
  }

  .change-player-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .question-mark {
    font-size: clamp(8rem, 30vh, 14rem);
  }
}
/* --- Credits: privacy link --- */
.credits-legal {
  margin-top: 2rem;
  text-align: center;
}

.credits-legal a {
  color: rgba(255, 255, 255, 0.45);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.credits-legal a:hover {
  color: rgba(0, 210, 255, 0.9);
}
