* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  position: relative;
}

/* ============================================
   LANDING PAGE
   ============================================ */
#landingPage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0a1419;
  z-index: 10;
  transition: opacity 0.5s ease, transform 0.5s ease;
  overflow: hidden;
}

#landingPage.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* Neural Network Background Canvas */
#neuralBackground {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.landing-content {
  text-align: center;
  color: white;
  animation: fadeInUp 0.8s ease;
  position: relative;
  z-index: 2;
}

.brand-badge {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(217, 232, 227, 0.5));
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-title {
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  text-shadow: 
    0 0 20px rgba(17, 76, 90, 0.5),
    0 4px 20px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(217, 232, 227, 0.3);
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #FFFFFF 0%, #D9E8E3 50%, #87CEEB 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.landing-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #114C5A, transparent);
  border-radius: 2px;
}

.landing-subtitle {
  font-size: clamp(1.1rem, 2.8vw, 1.6rem);
  margin: 1.5rem 0 3rem 0;
  opacity: 0.95;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #D9E8E3;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.start-button {
  background: linear-gradient(135deg, #114C5A 0%, #172B36 100%);
  color: #FFFFFF;
  border: 2px solid rgba(217, 232, 227, 0.3);
  padding: 1.3rem 3.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(17, 76, 90, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  overflow: hidden;
}

.start-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.start-button:hover::before {
  width: 300px;
  height: 300px;
}

.start-button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(17, 76, 90, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #172B36 0%, #114C5A 100%);
  border-color: rgba(217, 232, 227, 0.5);
}

.start-button:active {
  transform: translateY(-1px) scale(1.02);
}

.start-button span {
  position: relative;
  z-index: 1;
}

/* ============================================
   CONFIGURATION MODAL
   ============================================ */
#configModal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 20;
  animation: fadeIn 0.3s ease;
}

#configModal.visible {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.config-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(17, 76, 90, 0.1);
  animation: slideUp 0.4s ease;
  border: 1px solid rgba(17, 76, 90, 0.1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.config-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 2rem 0;
  color: #172b36;
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

.config-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #114C5A, transparent);
  border-radius: 2px;
}

.form-group {
  margin-bottom: 2rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: #114c5a;
  box-shadow: 0 0 0 3px rgba(17, 76, 90, 0.1);
}

.form-slider {
  width: 100%;
  height: 8px;
  border-radius: 5px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #114c5a;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #172b36;
}

.form-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #114c5a;
  cursor: pointer;
  border: none;
}

.slider-value {
  text-align: center;
  margin-top: 0.5rem;
  font-weight: 600;
  color: #114c5a;
}

.theme-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.theme-option {
  padding: 0.9rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.theme-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(17, 76, 90, 0.1), transparent);
  transition: left 0.5s ease;
}

.theme-option:hover::before {
  left: 100%;
}

.theme-option:hover {
  border-color: #114c5a;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(17, 76, 90, 0.15);
}

.theme-option.selected {
  border-color: #114c5a;
  background: linear-gradient(135deg, #f0f8f9 0%, #e0f0f3 100%);
  box-shadow: 0 2px 6px rgba(17, 76, 90, 0.2);
  font-weight: 600;
}

.theme-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: #172b36;
  position: relative;
  z-index: 1;
}

.theme-option.selected .theme-name {
  font-weight: 600;
  color: #114c5a;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn {
  flex: 1;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-primary {
  background: linear-gradient(135deg, #114c5a 0%, #172b36 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(17, 76, 90, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #172b36 0%, #114c5a 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(17, 76, 90, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #555;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* ============================================
   SIMULATION VIEW
   ============================================ */
#simulationView {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

#simulationView.visible {
  display: flex;
}

#container {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: min(70vh, 80%);
  max-width: 600px;
  height: 100%;
}

canvas {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  margin-top: auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

#score {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  margin-top: 20px;
  font-size: 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 500px;
}

.score-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.score-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.score-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.15;
  z-index: 0;
}

.score-label {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.score-value {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 700;
}

.score-percentage {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 0.15rem;
}

#params {
  font-family: monospace;
  font-size: 11px;
  color: #172b36;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  max-width: 100%;
  text-align: center;
}

#made {
  text-align: center;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-top: auto;
  margin-bottom: 20px;
  font-size: 11px;
  color: #555;
  opacity: 0.8;
}

#made a {
  color: #114c5a;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

#made a:hover {
  color: #172b36;
  text-decoration: underline;
}

.simulation-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.reset-button,
.new-game-button {
  background: rgba(255, 255, 255, 0.95);
  color: #172b36;
  border: 2px solid rgba(17, 76, 90, 0.2);
  padding: 0.8rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.reset-button:hover,
.new-game-button:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(17, 76, 90, 0.4);
}

.new-game-button {
  background: linear-gradient(135deg, rgba(17, 76, 90, 0.95) 0%, rgba(23, 43, 54, 0.95) 100%);
  color: white;
  border-color: rgba(217, 232, 227, 0.3);
}

.new-game-button:hover {
  background: linear-gradient(135deg, rgba(23, 43, 54, 0.95) 0%, rgba(17, 76, 90, 0.95) 100%);
  border-color: rgba(217, 232, 227, 0.5);
}

