/* Fonts are now imported from fonts.css */

/* Performance Optimization Additions */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Hardware acceleration for better performance */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Optimized root styles for better rendering */
html {
  /* Prevent font size changes on orientation change */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Smooth scrolling */
  scroll-behavior: smooth;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  /* Enable hardware acceleration */
  will-change: transform;
}

body {
  font-family: var(--secondary-font);
  background-color: #0f0f0f;
  background-image: linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00ff00;
  /* Optimize repaints */
  contain: layout style paint;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  gap: 20px;
  text-align: center;
  z-index: 10;
  position: relative;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  /* GPU layer promotion */
  will-change: transform;
  transform: translateZ(0);
}

.pixel-box {
  background-color: #2a2a2a;
  border: 2px solid;
  border-image: linear-gradient(45deg, #666666, #000000) 1;
  border-radius: 0;
  padding: 40px;
  box-shadow: 0 0 0 2px #0f0f0f, 0 0 0 6px #666666,
    0 0 20px rgba(102, 102, 102, 0.3);
  width: min(90vw, 90vh, 600px);
  height: min(90vw, 90vh, 600px);
  aspect-ratio: 1 / 1;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Performance optimizations */
  contain: layout style paint;
  will-change: transform;
  transform: translateZ(0);
}

.pixel-box::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #333333, #555555, #333333);
  z-index: -1;
  /* Optimize animation */
  will-change: opacity;
  animation: borderGlow 2s ease-in-out infinite alternate;
}

.pixel-title {
  font-family: var(--primary-font);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 30px;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Performance optimization */
  will-change: transform, color;
  transform: translateZ(0);
}

.pixel-title:hover .letter {
  animation: colorCycle 0.5s ease-in-out infinite, glitch 0.3s ease-in-out;
}

.play-button-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 15px;
  /* GPU acceleration */
  transform: translateZ(0);
}

.play-button {
  width: 120px;
  height: 60px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Performance optimization */
  will-change: transform, filter;
  transform: translateZ(0);
}

.play-button:hover {
  transform: scale(1.1) translateZ(0);
  filter: brightness(1.2);
}

.scene-select-button {
  width: 120px;
  height: 60px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Performance optimization */
  will-change: transform, filter;
  transform: translateZ(0);
}

.scene-select-button:hover {
  transform: scale(1.1) translateZ(0);
  filter: brightness(1.2);
}

/* Scene background optimization */
.scene-background {
  /* Optimize image scaling */
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* GPU acceleration */
  will-change: opacity;
  transform: translateZ(0);
  /* Prevent layout shift */
  contain: layout style paint;
}

/* Dialogue elements optimization */
.dialogue-text {
  /* Optimize text rendering */
  text-rendering: optimizeSpeed;
  /* GPU acceleration for smooth typing */
  will-change: contents;
  transform: translateZ(0);
  /* Prevent layout thrashing */
  contain: layout style;
}

/* Choice container optimization */
.choice-container {
  /* GPU acceleration */
  will-change: opacity, transform;
  transform: translateZ(0);
  /* Optimize paint */
  contain: layout style paint;
}

/* Character image optimization */
.character-image {
  /* Optimize image rendering */
  image-rendering: auto;
  /* GPU acceleration */
  will-change: opacity, transform;
  transform: translateZ(0);
  /* Prevent layout shift */
  contain: layout style paint;
}

/* Loading screen styles with optimizations */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
  /* Performance optimization */
  will-change: opacity;
  transform: translateZ(0);
  contain: layout style paint;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-family: "Orbitron", monospace;
  font-size: 24px;
  color: #00ff00;
  margin-bottom: 20px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  transition: all 0.3s ease;
  /* Performance optimization */
  will-change: transform, text-shadow;
  transform: translateZ(0);
}

.loading-text:hover {
  transform: scale(1.05) translateZ(0);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.loading-bar {
  width: 300px;
  height: 20px;
  border: 2px solid #666666;
  border-radius: 10px;
  overflow: hidden;
  background: #333;
  /* Performance optimization */
  contain: layout style paint;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, #ff1493, #00ff00, #1e90ff, #ff4500);
  width: 0%;
  transition: width 0.3s ease;
  /* Optimize animation */
  will-change: width, box-shadow;
  animation: loadingGlow 2s ease-in-out infinite alternate;
}

/* Optimized animations */
@keyframes loadingGlow {
  0% {
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
  }
  100% {
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  }
}

@keyframes glow {
  0% {
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    color: #00ff00;
  }
  100% {
    text-shadow: 0 0 20px rgba(0, 255, 0, 1), 0 0 30px rgba(0, 255, 0, 0.8);
    color: #66ff66;
  }
}

/* Enhanced animations with will-change */
@keyframes borderGlow {
  0% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

@keyframes colorCycle {
  0% {
    color: #00ff00;
  }
  25% {
    color: #ff00ff;
  }
  50% {
    color: #00ffff;
  }
  75% {
    color: #ffff00;
  }
  100% {
    color: #00ff00;
  }
}

@keyframes glitch {
  0% {
    transform: translateX(0) translateZ(0);
  }
  20% {
    transform: translateX(-2px) translateZ(0);
  }
  40% {
    transform: translateX(2px) translateZ(0);
  }
  60% {
    transform: translateX(-1px) translateZ(0);
  }
  80% {
    transform: translateX(1px) translateZ(0);
  }
  100% {
    transform: translateX(0) translateZ(0);
  }
}

/* Hide main content initially */
.main-content {
  opacity: 0;
  transition: opacity 0.5s ease;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.main-content.loaded {
  opacity: 1;
}

.character-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 800px;
  width: 100%;
}

.hooded-figure {
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.character-image {
  width: 120px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

.speech-bubble {
  background-color: #1a1a1a;
  border: 2px solid #666666;
  border-radius: 15px;
  padding: 12px 16px;
  position: relative;
  max-width: 240px;
  box-shadow: 0 0 0 1px #0f0f0f, 0 0 0 4px #666666,
    0 0 15px rgba(102, 102, 102, 0.3);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.speech-arrow {
  position: absolute;
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 15px solid #666666;
}

.speech-arrow::before {
  content: "";
  position: absolute;
  left: -18px;
  top: -12px;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 12px solid #1a1a1a;
}

.pixel-text {
  font-family: var(--tech-font);
  font-size: 12px;
  line-height: 1.8;
  color: #cccccc;
  text-shadow: 1px 1px 0px #000000;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.pixel-link {
  color: #00ffff;
  text-decoration: none;
  text-shadow: 1px 1px 0px #000000;
  transition: all 0.3s ease;
  border-bottom: 1px solid transparent;
}

.pixel-link:hover {
  color: #ffff00;
  text-shadow: 0 0 5px #ffff00, 1px 1px 0px #000000;
  border-bottom: 1px solid #ffff00;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
    gap: 15px;
  }

  .pixel-box {
    padding: 20px;
    margin: 5px;
    width: min(95vw, 95vh, 400px);
    height: min(95vw, 95vh, 400px);
  }

  .pixel-title {
    font-size: 18px;
    margin-bottom: 20px;
  }

  .play-button {
    width: 80px;
    height: 40px;
  }

  .pixel-text {
    font-size: 10px;
  }

  .character-section {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 90vw;
  }

  .character-image {
    width: 60px;
  }

  .speech-bubble {
    max-width: 200px;
    padding: 10px 12px;
  }

  .speech-arrow {
    right: 50%;
    top: -15px;
    transform: translateX(50%) rotate(-90deg);
  }
}

@media (max-width: 480px) {
  .pixel-box {
    padding: 15px;
    width: min(98vw, 98vh, 320px);
    height: min(98vw, 98vh, 320px);
  }

  .pixel-title {
    font-size: 16px;
    margin-bottom: 15px;
  }

  .play-button {
    width: 70px;
    height: 35px;
  }

  .container {
    padding: 5px;
    gap: 10px;
  }
}

/* Warning overlay for unsupported screen sizes */
.screen-warning {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  color: #ff4444;
  font-family: var(--primary-font);
  text-align: center;
  padding: 20px;
}

.screen-warning.active {
  display: flex;
}

.warning-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: warningPulse 2s ease-in-out infinite;
}

.warning-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.warning-message {
  font-size: 16px;
  line-height: 1.5;
  max-width: 400px;
  opacity: 0.9;
}

@keyframes warningPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Version Display Styles */
.version-display {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.version-text {
  font-family: var(--tech-font);
  font-size: 12px;
  color: #666666;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 0px #000000;
  border-bottom: 1px solid transparent;
  padding: 2px 4px;
}

.version-text:hover {
  color: #00ffff;
  text-shadow: 0 0 5px #00ffff, 1px 1px 0px #000000;
  border-bottom: 1px solid #00ffff;
}

/* Changelog Page Styles */
.changelog-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0f0f0f;
  background-image: linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.changelog-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: #2a2a2a;
  border: 2px solid #666666;
  border-radius: 0;
  padding: 30px;
  box-shadow: 0 0 0 2px #0f0f0f, 0 0 0 6px #666666,
    0 0 20px rgba(102, 102, 102, 0.3);
}

.changelog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.changelog-title {
  font-family: var(--primary-font);
  font-size: 28px;
  color: #00ff00;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  margin: 0;
}

.back-button {
  font-family: var(--tech-font);
  font-size: 14px;
  background-color: #1a1a1a;
  color: #00ffff;
  border: 2px solid #666666;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 0px #000000;
}

.back-button:hover {
  background-color: #333333;
  color: #ffff00;
  border-color: #ffff00;
  text-shadow: 0 0 5px #ffff00, 1px 1px 0px #000000;
}

.changelog-content {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.changelog-entry {
  background-color: #1a1a1a;
  border: 1px solid #444444;
  padding: 20px;
  border-radius: 5px;
}

.version-header {
  font-family: var(--primary-font);
  font-size: 20px;
  color: #00ffff;
  margin: 0 0 15px 0;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-list li {
  font-family: var(--tech-font);
  font-size: 14px;
  color: #cccccc;
  line-height: 1.6;
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
  text-shadow: 1px 1px 0px #000000;
}

.changelog-list li::before {
  content: "▶";
  position: absolute;
  left: 0;
  color: #00ff00;
  font-size: 12px;
}

/* Responsive Design for Changelog */
@media (max-width: 768px) {
  .changelog-page {
    padding: 10px;
  }

  .changelog-container {
    padding: 20px;
  }

  .changelog-title {
    font-size: 22px;
  }

  .changelog-header {
    flex-direction: column;
    align-items: stretch;
  }

  .back-button {
    align-self: flex-start;
  }

  .version-display {
    bottom: 10px;
  }

  .version-text {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .changelog-container {
    padding: 15px;
  }

  .changelog-title {
    font-size: 18px;
  }

  .version-header {
    font-size: 16px;
  }

  .changelog-list li {
    font-size: 12px;
  }
}

/* Hide warning on larger screens */
@media (min-width: 768px) and (min-height: 600px) {
  .screen-warning {
    display: none !important;
  }
}

/* Show warning on very small screens */
@media (max-width: 767px), (max-height: 599px) {
  .main-content,
  .container {
    display: none !important;
  }

  .screen-warning {
    display: flex !important;
  }
}

/* Scene Selection Modal */
.scene-selection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.scene-selection-modal {
  background-color: #2a2a2a;
  border: 3px solid #666666;
  border-radius: 10px;
  padding: 30px;
  width: 90%;
  max-width: 700px;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(102, 102, 102, 0.5);
  position: relative;
}

.scene-selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 2px solid #666666;
  padding-bottom: 15px;
}

.scene-selection-title {
  font-family: var(--primary-font);
  font-size: 24px;
  color: #00ff00;
  margin: 0;
}

.close-button {
  background: #ff4444;
  border: 2px solid #cc3333;
  color: white;
  font-size: 18px;
  width: 35px;
  height: 35px;
  cursor: pointer;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: #ff6666;
  transform: scale(1.1);
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.scene-card {
  background-color: #1a1a1a;
  border: 2px solid #444444;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.scene-card:hover {
  border-color: #00ff00;
  /* transform: translateY(-3px); */
  box-shadow: 0 5px 15px rgba(0, 255, 0, 0.3);
}

.scene-thumbnail {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 10px;
  image-rendering: auto;
}

.scene-info {
  text-align: center;
}

.scene-title {
  font-family: var(--secondary-font);
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 5px;
}

.scene-id {
  font-family: var(--secondary-font);
  font-size: 14px;
  color: #888888;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.nav-button {
  background: #333333;
  border: 2px solid #666666;
  color: white;
  font-size: 16px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
  font-family: var(--secondary-font);
}

.nav-button:hover:not(:disabled) {
  background: #00ff00;
  color: #000000;
  border-color: #00ff00;
}

.nav-button:disabled {
  background: #1a1a1a;
  border-color: #333333;
  color: #555555;
  cursor: not-allowed;
}

.page-info {
  font-family: var(--secondary-font);
  color: #ffffff;
  font-size: 14px;
}
