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

:root {
  --orange: #ff9933;
  --lilac: #cc99ff;
  --blue: #6699ff;
  --pink: #ff66b2;
  --dark: #0a0a1a;
  --darker: #050510;
  --text: #e0e0e0;
  --gold: #ffd700;
  --red: #ff3333;
  --green: #33ff66;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--darker);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  line-height: 1.8;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* === Scanline Overlay === */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* === Screens === */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
  background: var(--darker);
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

/* === LCARS Bars === */
.lcars-bar {
  display: flex;
  width: 90%;
  max-width: 800px;
  height: 12px;
  gap: 6px;
  position: absolute;
}

.lcars-bar-top {
  top: 20px;
}

.lcars-bar-bottom {
  bottom: 20px;
}

.lcars-segment {
  flex: 1;
  border-radius: 6px;
}

.lcars-segment.orange { background: var(--orange); }
.lcars-segment.lilac { background: var(--lilac); }
.lcars-segment.blue { background: var(--blue); }
.lcars-segment.pink { background: var(--pink); }

/* === Landing Screen === */
.landing-content {
  text-align: center;
  padding: 20px;
}

.stardate {
  color: var(--orange);
  font-size: 10px;
  letter-spacing: 4px;
  margin-bottom: 30px;
}

.title {
  font-size: 28px;
  color: var(--pink);
  text-shadow: 0 0 20px rgba(255, 102, 178, 0.5);
  margin-bottom: 30px;
  line-height: 1.4;
}

.subtitle {
  color: var(--lilac);
  font-size: 10px;
  margin-bottom: 50px;
  line-height: 2;
}

/* === Pixel Buttons === */
.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 16px 32px;
  border: 4px solid var(--blue);
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  image-rendering: pixelated;
  transition: all 0.2s;
  min-width: 48px;
  min-height: 48px;
}

.pixel-btn:hover, .pixel-btn:active {
  background: var(--blue);
  color: var(--darker);
  box-shadow: 0 0 20px rgba(102, 153, 255, 0.4);
}

.pixel-btn.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(102, 153, 255, 0.3); }
  50% { box-shadow: 0 0 25px rgba(102, 153, 255, 0.6); }
}

/* === Task Header === */
.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 800px;
  padding: 10px 0;
  position: absolute;
  top: 15px;
}

.task-label {
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 2px;
}

.task-counter {
  color: var(--green);
  font-size: 11px;
}

.task-instruction {
  position: absolute;
  bottom: 15px;
  color: var(--lilac);
  font-size: 9px;
  text-align: center;
  padding: 0 20px;
  line-height: 2;
}

/* === Canvas === */
.canvas-wrapper {
  width: 90%;
  max-width: 800px;
  aspect-ratio: 8 / 5;
  position: relative;
}

.canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* === Task 3 === */
.task3-content {
  width: 90%;
  max-width: 700px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 60px 10px 60px;
}

.task3-title {
  color: var(--red);
  font-size: 14px;
  text-align: center;
  margin-bottom: 25px;
}

.passage {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: 15px;
  margin-bottom: 15px;
  line-height: 2.2;
  font-size: 10px;
}

.pronoun {
  color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
  padding: 2px 6px;
  cursor: pointer;
  border: 2px solid var(--gold);
  transition: all 0.2s;
  min-width: 48px;
  min-height: 48px;
  display: inline-block;
  text-align: center;
  line-height: 2;
}

.pronoun:hover {
  background: rgba(255, 215, 0, 0.3);
}

.pronoun.replaced {
  color: var(--red);
  background: rgba(255, 0, 0, 0.15);
  border-color: var(--red);
  cursor: default;
}

/* Hammer & Sickle */
.hammer-sickle {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
}

.hammer-sickle.hidden {
  display: none;
}

/* === Valentine Screen === */
.valentine-content {
  text-align: center;
  padding: 20px;
}

.valentine-question {
  font-size: 22px;
  color: var(--pink);
  text-shadow: 0 0 30px rgba(255, 102, 178, 0.5);
  margin-bottom: 50px;
  line-height: 1.6;
}

.valentine-buttons {
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.pixel-btn-yes {
  border-color: var(--green);
  color: var(--green);
}

.pixel-btn-yes:hover, .pixel-btn-yes:active {
  background: var(--green);
  color: var(--darker);
  box-shadow: 0 0 20px rgba(51, 255, 102, 0.4);
}

.pixel-btn-no {
  border-color: var(--red);
  color: var(--red);
  transition: opacity 0.5s ease;
}

.pixel-btn-no:hover, .pixel-btn-no:active {
  background: var(--red);
  color: var(--darker);
  box-shadow: 0 0 20px rgba(255, 51, 51, 0.4);
}

.pixel-btn-no.fade-out {
  opacity: 0;
  pointer-events: none;
}

.no-message {
  color: var(--gold);
  font-size: 11px;
  margin-top: 30px;
  line-height: 2;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.no-message.hidden {
  display: none;
}

/* === Finale Screen === */
.finale-screen {
  background: #111 !important;
}

.finale-screen::before {
  display: none;
}

.finale-content {
  text-align: center;
  padding: 20px;
  width: 100%;
  max-width: 700px;
}

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 30px;
  background: #000;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.finale-text {
  font-family: 'Georgia', serif;
  font-size: 28px;
  color: #fff;
  font-weight: normal;
  letter-spacing: 2px;
}

/* === Overlay === */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.mission-complete-text {
  font-size: 28px;
  color: var(--green);
  text-shadow: 0 0 30px rgba(51, 255, 102, 0.5);
  animation: missionPulse 1s ease-in-out infinite;
}

@keyframes missionPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* === Starfield (for valentine screen) === */
.screen#screen-valentine {
  overflow: hidden;
}

/* === Glitch Text === */
.glitch {
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0%, 90%, 100% { text-shadow: 0 0 20px rgba(255, 102, 178, 0.5); }
  92% { text-shadow: -2px 0 var(--blue), 2px 0 var(--red); }
  94% { text-shadow: 2px 0 var(--blue), -2px 0 var(--red); }
  96% { text-shadow: 0 0 20px rgba(255, 102, 178, 0.5); }
}

/* === Responsive === */
@media (max-width: 600px) {
  .title {
    font-size: 18px;
  }

  .valentine-question {
    font-size: 16px;
  }

  .mission-complete-text {
    font-size: 20px;
  }

  .pixel-btn {
    font-size: 12px;
    padding: 14px 24px;
  }

  .task-header {
    width: 95%;
  }

  .task-label, .task-counter {
    font-size: 9px;
  }

  .task-instruction {
    font-size: 8px;
  }

  .stardate {
    font-size: 8px;
  }

  .subtitle {
    font-size: 8px;
  }

  .finale-text {
    font-size: 22px;
  }

  .passage {
    font-size: 9px;
  }

  .task3-title {
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .title {
    font-size: 14px;
  }

  .valentine-question {
    font-size: 13px;
  }
}
