:root {
  --bg-cream: #FAF9F6;
  --text-charcoal: #3D3D3D;
  --text-light: #6B6B6B;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-cream);
  color: var(--text-charcoal);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  padding: 1.5rem 0;
  opacity: 0.9;
  animation: fadeIn 1s ease-out;
}

.app-title {
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-charcoal);
  margin-bottom: 0.25rem;
}

.tagline {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1rem;
  color: var(--text-light);
}

/* Story Selector */
.story-selector {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 1rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  animation: fadeIn 1s ease-out 0.2s both;
}

.story-selector::-webkit-scrollbar {
  display: none;
}

.story-card {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.story-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.story-card.selected {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1), 0 0 40px rgba(255, 255, 255, 0.8) inset;
}

.story-icon {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
  opacity: 0.8;
}

.story-title {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 1s ease-out 0.4s both;
}

/* Visualization Area */
.visualization-area {
  position: relative;
  border-radius: 24px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  transition: background 0.6s ease;
}

.visualization-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.narrative-text {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--text-charcoal);
  text-align: center;
  transition: opacity 0.5s ease;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Info Panel */
.info-panel {
  text-align: center;
}

.info-toggle {
  background: none;
  border: none;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.3s ease;
}

.info-toggle:hover {
  color: var(--text-charcoal);
}

.info-text {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-light);
  padding: 1rem;
  animation: fadeIn 0.4s ease;
}

/* Control Panel */
.control-panel {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.05);
}

.control-group {
  margin-bottom: 1.25rem;
}

.control-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  text-align: center;
}

.primary-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #E8E4E0, #D0CCC8);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.primary-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: white;
  border: 3px solid var(--accent, #A67F7F);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.primary-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 0 12px var(--accent, #A67F7F);
}

.primary-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: white;
  border: 3px solid var(--accent, #A67F7F);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Time Controls */
.time-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.play-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent, #A67F7F);
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-button:hover {
  background: var(--accent, #A67F7F);
  color: white;
}

.play-button.playing {
  background: var(--accent, #A67F7F);
  color: white;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.speed-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-light);
  min-width: 2rem;
}

.speed-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #E8E4E0;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--text-light);
  border-radius: 50%;
  cursor: pointer;
}

.reset-button {
  background: none;
  border: 1px solid #E8E4E0;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.8rem;
  color: var(--text-light);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-button:hover {
  border-color: var(--text-light);
  color: var(--text-charcoal);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0 1rem;
  opacity: 0.7;
  animation: fadeIn 1s ease-out 0.6s both;
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.footer a {
  color: var(--text-charcoal);
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.footer a:hover {
  opacity: 0.7;
}

.footer-cta {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .app-container {
    padding: 1rem;
  }
  
  .app-title {
    font-size: 1.5rem;
  }
  
  .story-card {
    width: 70px;
    height: 70px;
  }
  
  .visualization-area {
    min-height: 280px;
    padding: 1.5rem;
  }
  
  .visualization-canvas {
    width: 320px;
    height: 240px;
  }
  
  .narrative-text {
    font-size: 0.9rem;
  }
  
  .control-panel {
    padding: 1rem;
  }
  
  .time-controls {
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .app-container {
    max-width: 700px;
  }
  
  .visualization-area {
    min-height: 400px;
  }
  
  .visualization-canvas {
    width: 500px;
    height: 375px;
  }
}