@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --primary: #ff6b35;
  --secondary: #f7c59f;
  --accent: #efefd0;
  --bg-dark: #004e89;
  --text-dark: #2b2d42;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'VT323', monospace;
  background: var(--secondary);
  color: #fff;
  image-rendering: pixelated;
  overflow: hidden;
  image-rendering: pixelated;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

.game-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 1024px;
  min-height: 768px;
}

/* Scene settings with repeated background */
.scene {
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-rows: 2.5fr 1fr;
  position: fixed;
  overflow: hidden;
  
  background-repeat: no-repeat;
  background-position: center 0%;
  background-size: 35% auto;
  min-width: 1024px;
}

/* New analysis-loading rule for full-screen analysis view */
.analysis-loading {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Use a background color that covers the blue background */
  background: var(--secondary);
}

/* Status Display Base Styles (without animation) */
.status-display {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 3;
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  border: 4px solid var(--accent);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  will-change: transform;
}

/* Only apply animation when .animate is added */
.status-display.animate {
  animation: slideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.dialogue-box {
  background: var(--secondary);
  padding: 1rem 1.5rem;
  border-top: 4px solid var(--primary);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: slideUp 1s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  position: relative;
  z-index: 1;
  overflow: visible;
  grid-row: 2;
  min-height: 220px;
  margin-top: -20px;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.scenario-text {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.3rem;
  line-height: 1.6;
  color: var(--text-dark);
  text-align: center;
  margin: 0;
  padding: 0.8rem;
  background: var(--accent);
  border: 4px solid var(--primary);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.1);
  min-height: 70px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0 1rem;
  height: auto;
  min-height: 100px;
  max-width: 1600px;
  margin: 0 auto;
  width: 98%;
  align-items: stretch;
}

/* Update the third button styling */
.choices > :last-child:nth-child(2n + 1) {
  grid-column: 1 / -1;
  max-width: 800px;
  justify-self: center;
  margin-bottom: 1rem;
}

.choice-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.9rem;
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: white;
  border: 4px solid var(--accent);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  min-height: 65px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, box-shadow;
  white-space: normal;
  line-height: 1.5;
  word-break: break-word;
  hyphens: auto;
}

.choice-btn:hover {
  transform: translate(-4px, -4px);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.2);
}

.choice-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

/* Analysis Scene Styles */
.analysis-scene {
  display: grid;
  grid-template-columns: 250px 1fr;
  height: 100vh;
  background: var(--secondary);
  overflow: hidden;
}

.analysis-sidebar {
  background: var(--primary);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  border-right: 4px solid var(--accent);
  overflow-y: auto;
}

.scenario-btn {
  background: var(--accent);
  color: var(--text-dark);
  padding: 0.8rem;
  border: 3px solid var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
}

/* New style for the overall results button */
.scenario-btn.overall-btn {
  font-size: 1.4rem;
  font-weight: bold;
  padding: 1rem;
  margin-bottom: 1rem;
  border-width: 4px;
  text-align: center;
  background: white;
}

.scenario-btn:hover {
  transform: translateX(4px);
  background: white;
}

.scenario-btn.active {
  background: white;
  transform: translateX(4px);
  border-color: var(--primary);
}

#insights-display {
  padding: 2rem;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

#insights-display h2 {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.5rem;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 4px solid var(--primary);
}

.insights-text {
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--text-dark);
  max-width: 800px;
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 2rem auto;
  border: 4px solid var(--accent);
  border-top: 4px solid var(--primary);
  border-radius: 0;
  animation: spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Introduction Screen Styles */
.intro-screen {
  width: 100%;
  height: 100vh;
  background: var(--secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  animation: fadeIn 0.8s ease;
}

.intro-content {
  background: var(--accent);
  padding: 2rem;
  border: 4px solid var(--primary);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2);
  max-width: 800px;
  width: 90%;
  text-align: center;
}

.intro-content h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 2rem;
  line-height: 1.4;
}

.intro-text {
  font-family: 'VT323', monospace;
  font-size: 1.8rem;
  color: var(--text-dark);
  margin-bottom: 2rem;
  text-align: left;
  line-height: 1.4;
}

.intro-text ul {
  list-style: none;
  padding: 1rem 0;
  margin: 1rem 0;
}

.intro-text li {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--primary);
}

/* Style for both Start Journey and Play Again buttons */
.start-btn, .play-again {
  font-size: 1.5rem !important;
  padding: 1.5rem 3rem !important;
  margin: 2rem auto;
  display: block;
  width: fit-content;
  animation: pulse 2s infinite;
}

/* Remove the regular scenario-btn styling from play-again */
.scenario-btn.play-again {
  background: var(--primary);
  color: white;
  border: 4px solid var(--accent);
  font-family: 'Press Start 2P', cursive;
  font-size: 1.2rem !important;
  padding: 1rem 2rem !important;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

.scenario-btn.play-again:hover {
  transform: translateY(-4px);
  box-shadow: 4px 8px 0 rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.05) translateY(-2px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

.final-metrics {
  background: var(--accent);
  padding: 2rem;
  border: 4px solid var(--primary);
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: center;
}

.final-metrics h2 {
  font-family: 'Press Start 2P', cursive;
  color: var(--text-dark);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.metrics-display {
  font-family: 'VT323', monospace;
  font-size: 2rem;
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.metrics-display p {
  margin: 0;
  padding: 0.5rem;
}

/* Common styles for both boxes */
.current-grade,
.rules-display {
  position: fixed;
  top: 35%;
  transform: translateY(-50%);
  z-index: 4;
  background: var(--primary);
  padding: 2rem;
  border: 4px solid var(--accent);
  text-align: center;
  min-width: 280px;
  min-height: 220px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Initial animation only */
.current-grade.animate,
.rules-display.animate {
  animation: slideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Position specific */
.current-grade {
  left: 100px;
}

.rules-display {
  right: 100px;
}

/* Common header styles */
.current-grade h3,
.rules-display h3 {
  font-family: 'Press Start 2P', cursive;
  color: white;
  font-size: 1.2rem;
  margin-bottom: 1.2rem;
  text-align: center;
  white-space: nowrap;
}

.current-grade .grade {
  font-family: 'Press Start 2P', cursive;
  font-size: 3.5rem;
  color: white;
  padding: 1.2rem;
  background: var(--text-dark);
  border: 4px solid var(--accent);
  min-width: 120px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

/* Grade colors */
.grade.grade-A-plus {
  background: #2ecc71; /* Bright green for A+ */
}

.grade.grade-A {
  background: #27ae60; /* Green for A */
}

.grade.grade-B {
  background: #f1c40f; /* Yellow for B */
}

.grade.grade-C {
  background: #e67e22; /* Orange for C */
}

.grade.grade-D {
  background: #e74c3c; /* Light red for D */
}

.grade.grade-F {
  background: #c0392b; /* Dark red for F */
}

/* Remove the border-right styles */
/* Update border styles to only keep right border */
.border-right {
  display: none; /* Or you can delete this entire block */
}

/* Add after the root variables */
@keyframes twinkle {
  0% { opacity: 0.9; }
  50% { opacity: 0.3; }
  100% { opacity: 0.9; }
}

@keyframes float {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(100vh) rotate(360deg); }
}

@keyframes sway {
  0% { transform: translateX(0); }
  50% { transform: translateX(20px); }
  100% { transform: translateX(0); }
}

/* Background pattern with more stars and varied sizes */
.scene::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(3px 3px at 20px 30px, white 50%, transparent 50%),
    radial-gradient(2px 2px at 40px 70px, var(--accent) 50%, transparent 50%),
    radial-gradient(4px 4px at 50px 160px, white 50%, transparent 50%),
    radial-gradient(2px 2px at 90px 40px, var(--primary) 50%, transparent 50%),
    radial-gradient(3px 3px at 130px 80px, white 50%, transparent 50%),
    radial-gradient(2px 2px at 160px 120px, var(--accent) 50%, transparent 50%),
    radial-gradient(4px 4px at 200px 90px, white 50%, transparent 50%),
    radial-gradient(3px 3px at 240px 110px, var(--primary) 50%, transparent 50%),
    radial-gradient(2px 2px at 280px 50px, white 50%, transparent 50%);
  background-repeat: repeat;
  opacity: 0.6;
  z-index: -1;
  animation: twinkle 2s infinite alternate;
}

/* Floating shapes */
.scene::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    /* Squares */
    linear-gradient(45deg, var(--primary) 25%, transparent 25%),
    linear-gradient(-45deg, var(--accent) 25%, transparent 25%),
    /* Circles */
    radial-gradient(circle at 50% 50%, var(--primary) 10%, transparent 10%),
    /* Diamonds */
    linear-gradient(45deg, transparent 75%, var(--accent) 75%),
    linear-gradient(-45deg, transparent 75%, var(--primary) 75%);
  background-size: 100px 100px, 100px 100px, 80px 80px, 60px 60px, 60px 60px;
  background-position: 0 0, 20px 20px, 0 0, 10px 10px, -10px -10px;
  background-repeat: repeat;
  opacity: 0.15;
  z-index: -2;
}

/* Add falling snowflakes/pixels */
.scene {
  position: relative;
}

.snowflakes {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
}

.snowflake {
  position: fixed;
  width: 4px;
  height: 4px;
  animation: float 10s linear infinite, sway 3s ease-in-out infinite;
  opacity: 0.7;
}

/* Different shapes for snowflakes */
.snowflake:nth-child(3n) {
  background: var(--primary);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); /* Diamond */
  width: 6px;
  height: 6px;
}

.snowflake:nth-child(3n+1) {
  background: white;
  border-radius: 50%; /* Circle */
}

.snowflake:nth-child(3n+2) {
  background: var(--accent);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%); /* Triangle */
  width: 5px;
  height: 5px;
}

/* Varied speeds and delays */
.snowflake:nth-child(1) { left: 10%; animation-duration: 7s, 3s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 9s, 4s; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 8s, 3.5s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 10s, 4.5s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 6s, 3s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 8.5s, 4s; }
.snowflake:nth-child(7) { left: 70%; animation-duration: 7.5s, 3.5s; }
.snowflake:nth-child(8) { left: 80%; animation-duration: 9.5s, 4.5s; }
.snowflake:nth-child(9) { left: 90%; animation-duration: 8s, 3s; }
.snowflake:nth-child(10) { left: 95%; animation-duration: 7s, 4s; }

.rules-display .rules-text {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: white;
  line-height: 1.4;
  text-align: center;
}

.rules-display .rules-text p {
  margin-bottom: 1rem;
}

.rules-display .rules-list {
  list-style: none;
  padding: 0;
  margin: 1rem auto;
  max-width: 80%;
}

.rules-display .rules-list li {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.analysis-content {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.final-metrics-panel {
  background: var(--accent);
  padding: 1.5rem;
  border: 4px solid var(--primary);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.final-metrics-panel h2 {
  font-family: 'Press Start 2P', cursive;
  color: var(--text-dark);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.final-metrics-panel .metrics-display {
  font-family: 'VT323', monospace;
  font-size: 2rem;
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.final-metrics-panel .metrics-display p {
  margin: 0;
  padding: 0.5rem;
  text-align: center;
}
