/* CSS Variables for Role Colors and Design System */
:root {
  --retailer: #60a5fa;     /* blue - exact from draft1.html */
  --wholesaler: #a78bfa;   /* purple - exact from draft1.html */
  --distributor: #f59e0b;  /* amber - exact from draft1.html */
  --factory: #f87171;      /* red - exact from draft1.html */
  --customer: #10b981;     /* emerald green - for complete 5-stage supply chain */
  --grid: rgba(255, 255, 255, .15);
  
  /* Design system colors from draft1.html */
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #d1d5db;
  --text-muted: #6b7280;
  --accent: #f59e0b;
  --border: rgba(255, 255, 255, 0.1);
  --overlay: rgba(40, 40, 40, 0.85);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden; /* Prevent body scroll like draft1.html */
  font-feature-settings: "tnum" 1; /* Enable tabular numbers globally */
}

/* Snap Scroll Layout */
main {
  scroll-snap-type: y proximity;
  height: 100vh;
  overflow-y: auto;
}

.section {
  min-height: 100vh;
  scroll-snap-align: start;
  display: grid;
  place-items: center;
  padding: 6rem 1.25rem;
  text-align: center;
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .4s ease, transform .4s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.in-view {
    transition: none;
    transform: none;
    opacity: 1;
  }
}

/* Typography */
h1 {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.1;
}

/* Beer Game highlighting - direct and specific */
.highlight-text {
  color: #f59e0b !important; /* Amber color */
  font-weight: 600 !important;
}

#hero-title .highlight-text,
#bullwhip-title .highlight-text {
  color: #f59e0b !important;
  font-weight: 600 !important;
}

h2 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 auto;
}

#hero-kicker {
  font-size: 1.5rem; /* Larger subtitle like draft1.html */
}

/* Authors Section */
.authors-section {
  margin: 2rem 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.author {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.author a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.author a:hover {
  color: var(--accent);
}

.affiliation {
  color: white;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .authors-section {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Lab Logos */
.lab-logos {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  margin: 1.5rem 0;
}

.lab-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  opacity: 0.8;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.lab-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* Binary Decode Animation for IT Lab Logo */
.binary-decode-logo {
  display: block;
  position: relative;
  font-family: 'Doto', monospace;
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1.3;
  text-align: center;
  padding: 0.1rem 0;
  min-width: 200px;
  letter-spacing: 0.1em; /* Increased for more stable spacing during animation */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: #FFFFFF; /* Default color for "The" and "Laboratory" */
}

.logo-line-1, .logo-line-2 {
  display: block;
  text-align: center;
}

.binary-part {
  color: #f59e0b; /* Amber yellow to match Beer Game theme */
}

.harvard-part {
  color: #f59e0b; /* Same amber as animated text, but not animated */
}

@media (max-width: 768px) {
  .lab-logos {
    gap: 1rem;
  }
  
  .lab-logo {
    height: 50px;
  }
  
  .binary-decode-logo {
    font-size: 1.28rem;
    min-width: 160px;
  }
  
  .binary-part {
    color: #f59e0b; /* Maintain consistent amber color on mobile */
  }
  
  .harvard-part {
    color: #f59e0b; /* Maintain consistent amber color on mobile */
  }
}

/* Beer Game Info Section */
.beer-game-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1000px;
  margin: 2rem auto 0;
  gap: 3rem;
}

.beer-game-text {
  text-align: center;
  max-width: 80ch;
}

.beer-game-image {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.board-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.board-image:hover {
  transform: scale(1.02);
}

.image-caption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

@media (max-width: 768px) {
  .beer-game-content {
    gap: 2rem;
  }
  
  .board-image {
    max-width: 450px;
  }
}

/* Hero Section */
#hero {
  background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.05) 0%, transparent 70%);
}

.scroll-hint {
  margin-top: 2rem;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1.6;
}

.desktop-hint {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin-top: 0.75rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: desktopPulse 3s ease-in-out infinite;
}

@keyframes desktopPulse {
  0%, 100% {
    border-color: var(--accent);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
  }
  50% {
    border-color: var(--accent);
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }
}

/* Make desktop hint MORE prominent on mobile since the site doesn't work well on mobile */
@media (max-width: 768px) {
  .desktop-hint {
    font-size: 1.1rem;
    padding: 0.75rem 1.25rem;
    margin-top: 1rem;
    border-width: 3px;
    animation: desktopPulseMobile 2s ease-in-out infinite;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  }
  
  @keyframes desktopPulseMobile {
    0%, 100% {
      transform: scale(1);
      border-color: var(--accent);
    }
    50% {
      transform: scale(1.05);
      border-color: #fbbf24;
    }
  }
}

.scroll-indicator {
  margin-top: 3rem;
  font-size: 1.5rem;
  color: var(--accent);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Beer Game Dynamics Section - Scroll-based Version */
#beer-game-dynamics-section {
  height: 400vh;
  scroll-snap-align: start;
  position: relative;
}

/* Beer Game Mechanics Section - Scroll-based Version */
#beer-game-mechanics-section {
  height: 400vh;
  scroll-snap-align: start;
  position: relative;
}

.dynamics-sticky-wrapper {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 3rem 2rem 2rem;
  overflow: hidden;
}

/* Dynamics Header */
.dynamics-header {
  text-align: center;
  margin-bottom: 1rem;
  width: 100%;
}

.dynamics-header h2 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.dynamics-header p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Flow Direction Indicator */
.flow-direction-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  font-size: 1rem;
  margin-top: 0;
}

.beer-direction {
  color: var(--accent);
  font-weight: 600;
  transition: color 0.3s ease;
}

.beer-direction.highlighted {
  color: var(--accent);
  font-weight: 600;
}

.beer-direction.dimmed {
  color: var(--text-secondary);
  font-weight: 600;
}

.order-direction {
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.3s ease;
}

.order-direction.highlighted {
  color: var(--accent);
  font-weight: 600;
}

.order-direction.dimmed {
  color: var(--text-secondary);
  font-weight: 600;
}

.divider {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Dynamics Content - Vertical Layout */
.dynamics-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  justify-content: flex-start;
  align-items: center;
  flex: none;
}

/* Supply Chain System - Centered */
.supply-chain-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5rem 2rem 1rem;
  position: relative;
  width: 100%;
  flex: none;
}

.supply-chain-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
}

/* Arrow Flow System */
.arrow-flow {
  position: relative;
  width: 100px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arrow-visual {
  font-size: 3rem;
  color: rgba(245, 158, 11, 0.8);
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s ease;
}

.arrow-visual.reverse {
  transform: scaleX(-1);
}

/* Beer Flow Animation */
.beer-flow {
  position: absolute;
  top: -25px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-evenly;
  z-index: 5;
}

.beer-icon {
  font-size: 1.2rem;
  opacity: 0;
}

.beer-icon.animate {
  animation: flowBeer 3s linear infinite;
}

.arrow-flow:nth-child(2) .beer-icon:nth-child(1) { animation-delay: 0s; }
.arrow-flow:nth-child(4) .beer-icon:nth-child(1) { animation-delay: 0s; }
.arrow-flow:nth-child(4) .beer-icon:nth-child(2) { animation-delay: 1.5s; }
.arrow-flow:nth-child(6) .beer-icon:nth-child(1) { animation-delay: 0s; }
.arrow-flow:nth-child(6) .beer-icon:nth-child(2) { animation-delay: 1.5s; }
.arrow-flow:nth-child(8) .beer-icon:nth-child(1) { animation-delay: 0s; }
.arrow-flow:nth-child(8) .beer-icon:nth-child(2) { animation-delay: 1.5s; }

@keyframes flowBeer {
  0% {
    opacity: 0;
    transform: translateX(80px);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-20px);
  }
}

/* Stage Nodes - Icon Only (No Circles) */
.stage-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.4s ease;
  z-index: 10;
  padding: 0.5rem;
  gap: 0.5rem;
}

.stage-node i {
  font-size: 3rem;
  transition: all 0.4s ease;
}

/* Visual States */
.stage-node.excess {
  /* No scaling - maintain consistent size */
}

.stage-node.excess i {
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.8));
}

.stage-node.normal {
  /* No scaling - maintain consistent size */
}

.stage-node.backlog {
  /* No scaling - maintain consistent size */
  animation: pulse 1.5s infinite;
}

.stage-node.backlog i {
  filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.8));
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Removed border-color since no circles */

.stage-node.customer i {
  color: var(--customer);
}


/* Removed border-color since no circles */

.stage-node.retailer i {
  color: var(--retailer);
}

/* Removed border-color since no circles */

.stage-node.wholesaler i {
  color: var(--wholesaler);
}

/* Removed border-color since no circles */

.stage-node.distributor i {
  color: var(--distributor);
}

/* Removed border-color since no circles */

.stage-node.factory i {
  color: var(--factory);
}

.stage-node.highlight {
  /* No scaling - maintain consistent size */
}

.stage-node.highlight i {
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.7));
}

/* Inventory Grid for Beer Piles */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  margin-top: 0.5rem;
  width: 60px;
  height: 60px;
  justify-self: center;
  align-self: center;
}

.beer-emoji {
  font-size: 1rem;
  text-align: center;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beer-emoji.arriving-beer {
  display: none; /* Completely hidden by default */
  transform: scale(1);
  transition: all 0.5s ease;
}

.beer-emoji.arriving-beer.highlight {
  display: flex; /* Show when highlighted */
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1.2);
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
}

.beer-emoji.arriving-beer.permanent {
  display: flex; /* Show when permanent */
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1);
  filter: none;
}

/* Order Boxes for Supply Chain Steps */
/* Order Container for positioning */
.order-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
}

.order-box {
  visibility: hidden; /* Hidden but reserves space */
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  min-width: 3.5rem;
  min-height: 2.8rem;
  display: flex; /* Always flex, just hidden */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

.order-box.order-show {
  visibility: visible; /* Show but space already reserved */
  opacity: 1;
  transform: translateY(0);
}

/* Role-specific order box colors - matching downstream partners */
.order-box[data-role="retailer"] {
  color: var(--customer);      /* Retailer orders from Customer */
  border-color: var(--customer);
}

.order-box[data-role="wholesaler"] {
  color: var(--retailer);      /* Wholesaler orders from Retailer */
  border-color: var(--retailer);
}

.order-box[data-role="distributor"] {
  color: var(--wholesaler);    /* Distributor orders from Wholesaler */
  border-color: var(--wholesaler);
}

.order-box[data-role="factory"] {
  color: var(--distributor);   /* Factory orders from Distributor */
  border-color: var(--distributor);
}

/* Status Icons for Order Boxes */
.status-icon {
  display: none; /* Hidden by default */
  position: absolute;
  top: -8px;
  right: -12px;
  font-size: 1.4rem;
  font-weight: bold;
  z-index: 10;
}

.status-icon.status-show {
  display: block;
}

.success-icon {
  color: #10b981; /* Green for success */
}

.fail-icon {
  color: #ef4444; /* Red for failure */
}

/* Beer Removal Animation */
.beer-emoji.step3-remove {
  opacity: 1;
  transition: all 0.8s ease;
}

.beer-emoji.step3-remove.removing {
  opacity: 0;
  transform: scale(0.5);
}

/* Backlog Beer Styling */
.beer-emoji.backlog-beer {
  color: #ef4444; /* Red color for backlog */
  display: none; /* Hidden by default */
}

.beer-emoji.backlog-beer.step3-show {
  display: flex;
}

/* Backlog Label */
.backlog-label {
  font-size: 0.7rem;
  color: #ef4444;
  font-weight: 600;
  text-align: center;
  margin: 0.25rem 0 0 0;
  display: none !important; /* Hidden by default with importance */
}

.backlog-label.show-step3 {
  display: block !important; /* Show with importance */
}

/* Backlog Indicator Container */
.backlog-indicator-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Backlog Background for Inventory Grid - Rectangular */
.inventory-grid.backlog-background {
  background-color: #dc2626;
  border-radius: 8px;
  padding: 8px 12px;
  margin: -4px -6px;
  width: 80px;
  transform: translateX(0);
}

/* Backlog Indicator (Arrow + Text) */
.backlog-indicator {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  z-index: 10;
}

.backlog-indicator.show-step3 {
  display: flex;
}

.backlog-arrow {
  font-size: 1.2rem;
  color: #dc2626;
  font-weight: bold;
}

.backlog-text {
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 600;
  white-space: nowrap;
}

/* Step 3 Show Elements */
.step3-show {
  display: none; /* Hidden by default */
}

/* Step 4 Question Mark Elements */
.step4-show {
  display: none; /* Hidden by default */
}

.step4-show.show-step4 {
  display: inline; /* Show as inline when step 4 is active */
}

.order-number.step4-hide {
  display: none; /* Hide numbers during step 4 */
}

.step3-show.show-step3 {
  display: block;
}

/* Removed text elements - keeping visual only */

/* Flow Arrows */
.flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  padding: 0 0.5rem;
}

.arrow-line {
  font-size: 2rem;
  color: rgba(245, 158, 11, 0.5);
  font-weight: normal;
}

.delay-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: none;
  border: none;
}

.flow-arrow.with-delay .delay-label {
  color: #ef4444;
}

.in-transit {
  display: none;
}

.transit-item {
  display: none;
}

/* Explanation Panel - Bottom Fixed */
.explanation-panel-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem 2rem;
}

/* Legacy explanation panel for other sections */
.explanation-panel {
  flex: 1;
  max-width: 450px;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bottom explanation content */
.explanation-content-bottom {
  width: 100%;
  max-width: 1200px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.explanation-content-bottom.visible {
  opacity: 1;
  transform: translateY(0);
}

.explanation-content-bottom h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.explanation-content-bottom p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: none;
}

/* Legacy explanation content for other sections */
.explanation-content {
  background: rgba(42, 42, 42, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.5s ease;
}

.explanation-content.visible {
  opacity: 1;
  transform: translateX(0);
}

.explanation-content h3 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-weight: 600;
}

.explanation-content p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Explanation Container */
.explanation-container {
  position: absolute;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  width: 350px;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  opacity: 0;
  transition: all 0.5s ease;
}

.explanation-container.visible {
  opacity: 1;
}

.explanation-title {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.explanation-text {
  color: var(--text-primary);
  line-height: 1.6;
}

/* Slides Container */
.slides-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

/* Slide System */
.slide {
  display: none;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.5s ease-in-out;
}

.slide[data-active="true"] {
  display: flex;
}

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

/* Slide Navigation */
.slide-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0;
  margin-top: auto;
}

.slide-nav-button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.slide-nav-button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.slide-nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.slide-indicator {
  display: flex;
  gap: 0.5rem;
}

.slide-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.slide-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* Week Indicator */
.week-pill {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 10;
}

/* Visual Legend */
.visual-legend {
  position: absolute;
  top: 2rem;
  left: 2rem;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-icon {
  min-width: 20px;
}

.backlog-color {
  color: #ef4444;
  font-weight: bold;
}

/* Beer Board Container */
.beer-board-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 2rem 1rem;
  margin: 0 auto;
}

/* Slide 1: Board Overview */
.board-overview {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
}

.board-overview .beer-board-container {
  gap: 1rem;
  padding: 1rem;
  justify-content: space-evenly;
}

/* Slide 2: Wholesaler Focus */
.wholesaler-focus {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  justify-content: center;
}

.wholesaler-focus .board-stage {
  min-width: 250px;
  padding: 2rem;
}

/* Slide 3: Factory Focus */
.factory-focus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
}

/* Slide 4: Retailer Focus */
.retailer-focus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
}

/* Slide 5: Bullwhip Effect */
.bullwhip-visualization {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Zoom View Container */
.zoom-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
}

/* Week Steps */
.week-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  opacity: 0.5;
  transition: all 0.3s ease;
}

.week-step.active {
  opacity: 1;
  background: var(--overlay);
  transform: translateX(10px);
}

.step-number {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: 50%;
  font-weight: bold;
}

.step-text {
  flex: 1;
  color: var(--text-primary);
}

/* Incoming/Outgoing Areas */
.incoming-area, .outgoing-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.pipeline-incoming, .pipeline-outgoing {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slots {
  display: flex;
  gap: 0.5rem;
}

.slot {
  padding: 0.5rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 6px;
  text-align: center;
  min-width: 80px;
  transition: all 0.3s ease;
}

.slot.highlight {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  animation: pulse 1s ease-in-out;
}

.slot.week1 {
  border-color: var(--accent);
}

.slot.week2 {
  opacity: 0.7;
}

.slot.week3 {
  opacity: 0.5;
}

/* Wholesaler Main */
.wholesaler-main, .factory-main, .retailer-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--bg-secondary);
  border: 3px solid var(--wholesaler);
  border-radius: 12px;
  min-width: 300px;
}

.factory-main {
  border-color: var(--factory);
}

.retailer-main {
  border-color: var(--retailer);
}

.inventory-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.on-hand {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.backlog {
  color: #ef4444;
  font-weight: 600;
}

.decision-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 8px;
  width: 100%;
}

.decision-box label {
  font-weight: 600;
  color: var(--text-secondary);
}

.decision-box input {
  width: 80px;
  padding: 0.5rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--accent);
  border-radius: 6px;
}

/* Factory Timeline */
.factory-timeline {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 1rem;
}

.timeline-item {
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border-radius: 6px;
  font-weight: 600;
}

.timeline-item.highlight {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Production Pipeline */
.production-pipeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 2px solid var(--factory);
  border-radius: 8px;
}

.pipeline-title {
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.pipeline-stages {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* Customer and Retailer Focus */
.customer-side, .retailer-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}

.demand-reveal {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.demand-week {
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.demand-week.highlight {
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: bold;
  transform: scale(1.1);
}

.twist-reveal {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid var(--accent);
  border-radius: 8px;
  animation: fadeIn 1s ease-in-out;
}

.twist-icon {
  font-size: 2rem;
}

.advantage {
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}

.ships-immediately {
  color: var(--text-secondary);
  font-style: italic;
}

.retailer-decision {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 8px;
  text-align: center;
}

.order-amount {
  color: var(--accent);
  font-weight: bold;
  font-size: 1.2rem;
}

.reasoning {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
}

/* Bullwhip View */
.bullwhip-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  padding: 2rem;
}

.demand-origin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-weight: 600;
}

.simple {
  color: var(--accent);
  font-size: 0.9rem;
}

.amplification-chain {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.amp-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  min-width: 120px;
}

.amp-stage i {
  font-size: 2rem;
}

.amp-arrow {
  font-size: 2rem;
  color: var(--accent);
}

.orders {
  font-weight: 600;
  color: var(--text-primary);
}

.orders.highlight {
  color: var(--accent);
  font-size: 1.1rem;
}

.bullwhip-explanation {
  text-align: center;
  max-width: 600px;
  padding: 1.5rem;
  background: var(--overlay);
  border-radius: 8px;
}

.bullwhip-explanation h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

#bullwhipMiniChart {
  width: 100%;
  max-width: 800px;
  height: 300px;
}

/* Overview Stage Styles */
.overview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  min-width: 100px;
}

.overview-stage.customer {
  border-color: var(--customer);
}

.overview-stage.retailer {
  border-color: var(--retailer);
}

.overview-stage.wholesaler {
  border-color: var(--wholesaler);
}

.overview-stage.distributor {
  border-color: var(--distributor);
}

.overview-stage.factory {
  border-color: var(--factory);
}

.demand-bubble, .inventory-bubble {
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: 6px;
  font-weight: 600;
}

.pipeline-viz {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pipeline-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.pipeline-boxes {
  display: flex;
  gap: 0.25rem;
}

.transit-box {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.flow-indicators {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}

.flow-arrow {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-weight: 600;
}

.flow-arrow.orders {
  color: var(--accent);
}

.flow-arrow.shipments {
  color: var(--text-primary);
}

/* Board Stages */
.board-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-secondary);
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 180px;
  position: relative;
  flex-shrink: 0;
}

/* Stage Colors */
#customer-stage { border-color: var(--customer); }
#retailer-stage { border-color: var(--retailer); }
#wholesaler-stage { border-color: var(--wholesaler); }
#distributor-stage { border-color: var(--distributor); }
#factory-stage { border-color: var(--factory); }

.stage-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.stage-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

#customer-stage .stage-icon { color: var(--customer); }
#retailer-stage .stage-icon { color: var(--retailer); }
#wholesaler-stage .stage-icon { color: var(--wholesaler); }
#distributor-stage .stage-icon { color: var(--distributor); }
#factory-stage .stage-icon { color: var(--factory); }

.stage-label {
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Customer Demand Area */
.demand-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.demand-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.demand-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--customer);
  background: rgba(16, 185, 129, 0.1);
  padding: 1rem;
  border-radius: 50%;
  border: 2px solid var(--customer);
  min-width: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inventory Area */
.inventory-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.inventory-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.inventory-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.inventory-display {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.beer-units {
  font-size: 1.2rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  max-width: 120px;
  text-align: center;
}

.inventory-count {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
}

.backlog-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}


.backlog-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ef4444;
  min-height: 1.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.backlog-value:not(:empty) {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
}

/* Pipeline Areas */
.pipeline-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0.5rem;
  flex-shrink: 0;
}

.pipeline-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.5rem 0;
}

.pipeline-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  font-weight: 600;
}

.pipeline-slots {
  display: flex;
  gap: 0.5rem;
}

.pipeline-slot {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.9rem;
  min-width: 45px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.pipeline-slot::before {
  content: attr(data-delay) "w";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.order-slot {
  border-color: var(--accent);
  color: var(--accent);
}

.shipment-slot {
  border-color: var(--retailer);
  color: var(--retailer);
}

.production-slot {
  border-color: var(--factory);
  color: var(--factory);
}

/* Step Navigation */
.step-navigation {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
}

.nav-button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-button:hover {
  background: var(--text-primary);
  transform: translateY(-2px);
}

.nav-button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.step-indicator {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Explanation Container */
#dynamics-explanation-container {
  position: absolute;
  top: 20%;
  right: 2rem;
  max-width: 350px;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 15;
}

#dynamics-explanation-container.visible {
  opacity: 1;
}

.dynamics-explanation-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.dynamics-explanation-text {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Animation Classes */
.board-stage.highlight {
  border-color: var(--accent) !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
  transform: scale(1.05);
}

.board-stage.pulse {
  animation: pulse 1s ease-in-out;
}

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

.inventory-count.pulse,
.backlog-value.pulse,
.pipeline-slot.pulse,
.beer-units.pulse {
  animation: numberPulse 0.8s ease-in-out;
}

@keyframes numberPulse {
  0%, 100% { 
    background: transparent;
    transform: scale(1);
  }
  50% { 
    background: var(--accent);
    color: var(--bg-primary);
    transform: scale(1.2);
    border-radius: 4px;
  }
}

.pipeline-area.highlight {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
}

.pipeline-area.highlight .pipeline-slot {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent);
}

/* Moving Items Animation */
@keyframes moveRight {
  0% { transform: translateX(-20px); opacity: 0; }
  50% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(20px); opacity: 0; }
}

@keyframes moveLeft {
  0% { transform: translateX(20px); opacity: 0; }
  50% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-20px); opacity: 0; }
}

.pipeline-slot.moving-right {
  animation: moveRight 1.5s ease-in-out;
}

.pipeline-slot.moving-left {
  animation: moveLeft 1.5s ease-in-out;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .dynamics-content {
    flex-direction: column;
    gap: 2rem;
  }
  
  .supply-chain-container {
    width: 100%;
    max-width: none;
  }
  
  .explanation-panel {
    width: 100%;
    max-width: 600px;
    padding: 1rem;
  }
  
  .explanation-panel-bottom {
    height: 160px;
    padding: 1rem;
  }
  
  .explanation-content-bottom h3 {
    font-size: 1.3rem;
  }
  
  .explanation-content-bottom p {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .beer-board-container {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .flow-direction-indicator {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .divider {
    display: none;
  }
  
  .supply-chain-flow {
    flex-direction: column;
    gap: 1rem;
  }
  
  .arrow-flow {
    transform: rotate(90deg);
    margin: 1rem 0;
  }
  
  .stage-node i {
    font-size: 2.5rem;
  }
  
  .inventory-grid {
    width: 50px;
    height: 50px;
  }
  
  .beer-emoji {
    font-size: 0.8rem;
  }
  
  .pipeline-area {
    flex-direction: row;
    min-width: auto;
    width: 100%;
    margin: 0.5rem 0;
  }
  
  .pipeline-section {
    flex: 1;
    margin: 0 0.5rem;
  }
  
  .visual-legend {
    position: relative;
    top: auto;
    left: auto;
    margin-bottom: 1rem;
  }
  
  #dynamics-explanation-container {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 1rem;
    max-width: 90%;
  }
  
  .week-pill {
    top: 1rem;
    right: 1rem;
  }
  
  .board-stage {
    min-width: auto;
    width: 100%;
  }
  
  .beer-units {
    max-width: 200px;
  }
}

/* Progressive Bullwhip Effect Section */
#bullwhip-progressive-section {
  height: 400vh; /* Tall section for scrolling through 5 steps */
  scroll-snap-align: start;
  position: relative;
}

.supply-chain-sticky-wrapper {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.bullwhip-sticky-wrapper {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.chain-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.icon-wrapper {
  transition: all 0.5s ease-in-out;
  padding: 1rem;
  border-radius: 9999px;
  border: 2px solid transparent;
  text-align: center;
  position: relative;
}

.icon-wrapper.highlight {
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(1.1);
}

/* Highlighting the border with the specific color */
.icon-wrapper.highlight-red { border-color: var(--factory); }
.icon-wrapper.highlight-purple { border-color: var(--wholesaler); }
.icon-wrapper.highlight-blue { border-color: var(--retailer); }
.icon-wrapper.highlight-amber { border-color: var(--distributor); }

/* Supply chain icons - larger than draft1.html */
.supply-chain-icon {
  font-size: 4rem !important; /* Even larger than draft1.html's text-5xl (3rem) */
}

/* Icon labels */
.icon-label {
  margin-top: 0.5rem;
  font-weight: 600;
}

/* Role-specific icon colors */
#chain-customer .supply-chain-icon { color: var(--customer); }
#chain-retailer .supply-chain-icon { color: var(--retailer); }
#chain-wholesaler .supply-chain-icon { color: var(--wholesaler); }
#chain-distributor .supply-chain-icon { color: var(--distributor); }
#chain-factory .supply-chain-icon { color: var(--factory); }

.arrow {
  font-size: 2rem;
  color: var(--text-muted);
  transition: all 0.5s ease-in-out;
}

.arrow.highlight {
  color: var(--accent);
}

/* Explanation content */
.explanation-content {
  position: absolute;
  max-width: 300px;
  width: 90%;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: all 0.5s ease-in-out;
  opacity: 0;
  transform: translateY(20px);
  z-index: 20;
}

.explanation-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.explanation-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.explanation-text {
  color: #d1d5db; /* text-gray-300 equivalent */
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Roles Grid - Perfect 2x2 Square on Desktop */
.roles-grid {
  display: grid;
  grid-template-columns: 1fr; /* Mobile: single column */
  gap: 2rem;
  max-width: 1200px;
  width: 100%;
  margin-top: 2rem;
}

/* Tablet and up: 2x2 square formation */
@media (min-width: 768px) {
  .roles-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 900px; /* Slightly narrower for perfect square proportions */
  }
}

.role-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.role-card:hover {
  transform: translateY(-4px);
}

.role-card[data-role="retailer"] {
  border-color: var(--retailer);
}

.role-card[data-role="wholesaler"] {
  border-color: var(--wholesaler);
}

.role-card[data-role="distributor"] {
  border-color: var(--distributor);
}

.role-card[data-role="factory"] {
  border-color: var(--factory);
}

.role-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.role-card[data-role="retailer"] .role-icon {
  color: var(--retailer);
}

.role-card[data-role="wholesaler"] .role-icon {
  color: var(--wholesaler);
}

.role-card[data-role="distributor"] .role-icon {
  color: var(--distributor);
}

.role-card[data-role="factory"] .role-icon {
  color: var(--factory);
}

.role-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.role-description {
  font-size: 0.95rem;
  text-align: left;
}

/* Timeline */
.timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.step-number {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
}

.step-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.timeline-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.week-description {
  margin-top: 2rem;
  font-size: 1rem;
}

/* Bullwhip Chart Container */
.bullwhip-charts-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 95%;
  max-width: 1400px;
  margin: 0 auto;
}

.bullwhip-chart-container {
  background: #374151; /* bg-gray-800 from draft1.html */
  padding: 2rem;
  border-radius: 1rem; /* rounded-2xl */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
  border: 1px solid #374151; /* border-gray-700 */
  width: 100%;
  height: 400px;
  position: relative;
}

#bullwhipProgressiveChart,
#inventoryChart {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1024px) {
  .bullwhip-charts-wrapper {
    grid-template-columns: 1fr;
  }
}

/* Bullwhip Explanation Container */
#bullwhip-explanation-container {
  position: absolute;
  top: 10%;
  left: 5%;
  max-width: 350px;
  z-index: 10;
}

.bullwhip-explanation-content {
  background: var(--overlay);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: all 0.5s ease-in-out;
  opacity: 0;
  transform: translateY(20px);
}

.bullwhip-explanation-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.bullwhip-explanation-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.bullwhip-explanation-text {
  color: #d1d5db;
  font-size: 1rem;
  line-height: 1.5;
}

/* Color-coded text for bullwhip explanations */
.customer-text {
  color: var(--distributor) !important; /* Amber #f59e0b - matches customer demand line */
}

.retailer-text {
  color: var(--retailer) !important; /* Blue #60a5fa - matches retailer orders line */
}

.wholesaler-text {
  color: var(--wholesaler) !important; /* Purple #a78bfa - matches wholesaler orders line */
}

.factory-text {
  color: var(--factory) !important; /* Red #f87171 - matches factory production line */
}

/* Legacy chart container for backward compatibility */
.chart-container {
  background: #374151;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #374151;
  margin-top: 2rem;
}

/* AI Supply Chain Diagram - Simple Layout */
.ai-supply-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: nowrap;
  margin: 2rem auto;
  max-width: 1000px;
  overflow-x: auto;
}

.ai-chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  min-width: 100px;
  flex-shrink: 0;
}

.ai-chain-node .supply-chain-icon {
  font-size: 3rem;
}

/* Robot Icons */
.robot-icon {
  font-size: 1.5rem;
  margin-top: 0.5rem;
}

.robot-icon[data-role="retailer"] { color: var(--retailer); }
.robot-icon[data-role="wholesaler"] { color: var(--wholesaler); }
.robot-icon[data-role="distributor"] { color: var(--distributor); }
.robot-icon[data-role="factory"] { color: var(--factory); }

/* AI Supply Chain Icon Colors */
.ai-chain-node:nth-child(1) .supply-chain-icon { color: var(--customer); }
.ai-chain-node:nth-child(3) .supply-chain-icon { color: var(--retailer); }
.ai-chain-node:nth-child(5) .supply-chain-icon { color: var(--wholesaler); }
.ai-chain-node:nth-child(7) .supply-chain-icon { color: var(--distributor); }
.ai-chain-node:nth-child(9) .supply-chain-icon { color: var(--factory); }

.ai-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
}

/* Variables List */
.variables-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 800px;
  margin: 2rem auto 0;
}

.variables-list li {
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

/* Embed Section */
.embed-container {
  width: 100%;
  max-width: 1080px;
  margin: 2rem auto 0;
}

#hf-frame {
  width: 100%;
  height: 640px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--bg-primary);
  text-decoration: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  margin-top: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  .section {
    padding: 4rem 1rem;
  }
  
  .chain-diagram,
  .timeline {
    flex-direction: column;
    gap: 1rem;
  }
  
  .chain-arrow,
  .timeline-arrow {
    transform: rotate(90deg);
  }
  
  .roles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .variables-list {
    grid-template-columns: 1fr;
  }
  
  #hf-frame {
    height: 500px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }
  
  .section {
    padding: 3rem 1rem;
  }
  
  .role-card {
    padding: 1.5rem;
  }
  
  #hf-frame {
    height: 400px;
  }
}

/* Supply Chain Overview Diagram */
.supply-chain-overview {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 3rem auto;
  padding: 2rem;
  max-width: 1000px;
  width: 100%;
}

.supply-chain-simple-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.simple-stage-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  min-width: 100px;
  flex-shrink: 0;
}

.simple-stage-icon {
  font-size: 3rem;
  transition: all 0.3s ease;
}

.simple-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.5rem;
}

.simple-arrow .arrow-visual {
  font-size: 3rem;
  color: rgba(245, 158, 11, 0.8);
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stage-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

/* Icon Colors */
.simple-stage-node.customer .simple-stage-icon {
  color: var(--customer);
}

.simple-stage-node.retailer .simple-stage-icon {
  color: var(--retailer);
}

.simple-stage-node.wholesaler .simple-stage-icon {
  color: var(--wholesaler);
}

.simple-stage-node.distributor .simple-stage-icon {
  color: var(--distributor);
}

.simple-stage-node.factory .simple-stage-icon {
  color: var(--factory);
}

/* Label Colors */
.customer-label {
  color: var(--customer);
}

.retailer-label {
  color: var(--retailer);
}

.wholesaler-label {
  color: var(--wholesaler);
}

.distributor-label {
  color: var(--distributor);
}

.factory-label {
  color: var(--factory);
}

/* Player Labels */
.player-label {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  margin-top: 0.25rem;
  text-align: center;
  color: white;
}

/* Responsive Design for Supply Chain Overview */
@media (max-width: 768px) {
  .supply-chain-overview {
    padding: 1rem;
    margin: 2rem auto;
  }
  
  .supply-chain-simple-flow {
    gap: 0.5rem;
  }
  
  .simple-stage-node {
    min-width: 80px;
  }
  
  .simple-stage-icon {
    font-size: 2.5rem;
  }
  
  .simple-arrow .arrow-visual {
    font-size: 2.5rem;
  }
  
  .stage-label {
    font-size: 0.8rem;
  }
  
  .player-label {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .supply-chain-simple-flow {
    flex-direction: column;
    gap: 1rem;
  }
  
  .simple-arrow {
    transform: rotate(90deg);
    margin: 0.5rem 0;
  }
  
  .simple-stage-node {
    min-width: auto;
  }
}

/* Bullwhip Progressive Section */
#bullwhip-progressive-section {
  min-height: 400vh;
  position: relative;
}

.bullwhip-sticky-wrapper {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.bullwhip-header {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
}

.bullwhip-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 2.5rem;
  font-weight: 600;
}

.bullwhip-charts-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  height: 85vh;
  margin-top: 4rem;
}

.bullwhip-chart-container {
  flex: 1;
  position: relative;
  min-height: 300px;
  background: rgba(42, 42, 42, 0.8);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border);
}

/* Bullwhip Explanation Container */
#bullwhip-explanation-container {
  position: absolute !important;
  top: 4rem !important;
  left: auto !important;
  right: max(2rem, calc(50vw - 600px)) !important;
  max-width: 350px;
  z-index: 25;
  pointer-events: none;
}

.bullwhip-explanation-content {
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.bullwhip-explanation-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.bullwhip-explanation-content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bullwhip-explanation-content p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: none;
}

/* AI Section Content */
.aiq-content {
  max-width: 1000px;
  margin: 2rem auto 0;
  text-align: center;
}

.aiq-description {
  margin-top: 3rem;
}

/* AI Section Description Bullets */
.aiq-description-bullets {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 70ch;
  text-align: left;
}

.aiq-description-bullets li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.aiq-description-bullets li:last-child {
  margin-bottom: 0;
}

.aiq-description-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.5rem;
}

.aiq-description-bullets li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Orchestra-Aided Decision-Making Section */
.orchestra-content {
  max-width: 1000px;
  margin: 2rem auto 0;
  text-align: center;
}

.orchestra-description {
  margin-bottom: 3rem;
}

.orchestra-description p {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 auto;
}

.orchestra-scenarios h3 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.orchestra-scenario-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 70ch;
  text-align: left;
}

.orchestra-scenario-list li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.orchestra-scenario-list li:last-child {
  margin-bottom: 0;
}

.orchestra-scenario-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.5rem;
}

.orchestra-scenario-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Lessons Section */
.lessons-content {
  max-width: 1000px;
  margin: 2rem auto 0;
  text-align: center;
}

.lessons-bullets {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 70ch;
  text-align: left;
}

.lessons-bullets li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.lessons-bullets li:last-child {
  margin-bottom: 0;
}

.lessons-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.5rem;
}

.lessons-bullets li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Live Simulation Section */
#try {
  min-height: auto;
  padding: 4rem 1.25rem;
}

.simulation-steps {
  list-style: none;
  padding: 0;
  margin: 2rem auto 0;
  max-width: 80ch;
  text-align: left;
}

.simulation-steps li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.simulation-steps li:last-child {
  margin-bottom: 0;
}

.simulation-steps li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.5rem;
}

.simulation-steps li strong {
  color: var(--text-primary);
  font-weight: 600;
}

.simulation-container {
  max-width: 800px;
  margin: 2rem auto 0;
  position: relative;
}

.simulation-link {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
}

.simulation-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.simulation-image {
  width: 100%;
  height: auto;
  display: block;
}

.simulation-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.simulation-link:hover .simulation-overlay {
  opacity: 1;
}

.play-button {
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.simulation-overlay p {
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .simulation-container {
    max-width: 90%;
    margin: 1.5rem auto;
  }
  
  .play-button {
    font-size: 3rem;
  }
  
  .simulation-overlay p {
    font-size: 1.125rem;
  }
}

/* Authors Section */
#authors {
  min-height: auto;
  padding: 4rem 1.25rem;
}

#authors-description {
  max-width: 60ch;
  margin: 0 auto 3rem;
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.authors-profiles {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem 4rem;
}

.author-profile {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  text-align: left;
}

.author-image {
  flex-shrink: 0;
}

.profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  transition: transform 0.3s ease;
}

.profile-image:hover {
  transform: scale(1.05);
}

.author-info {
  flex: 1;
}

.author-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.author-info h3 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.author-info h3 a:hover {
  color: var(--accent);
}

.author-info .affiliation {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.author-info .bio {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .authors-profiles {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  
  .author-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }
  
  .profile-image {
    width: 100px;
    height: 100px;
  }
}

/* Credits Section */
#credits {
  min-height: auto;
  padding: 4rem 1.25rem;
}

.credits-content {
  max-width: 60ch;
  margin: 2rem auto 0;
  text-align: left;
}

.credits-content p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.credits-content em {
  font-style: italic;
  color: var(--text-primary);
}

/* Bullwhip Explanation Highlighting */
.customer-text {
  color: var(--customer) !important;
}

.retailer-text {
  color: var(--retailer) !important;
}

.wholesaler-text {
  color: var(--wholesaler) !important;
}

.distributor-text {
  color: var(--distributor) !important;
}

.factory-text {
  color: var(--factory) !important;
}

/* Contact Section */
#contact {
  min-height: 100vh;
  padding: 4rem 1.25rem;
}

.contact-intro {
  font-size: 1.2rem;
  margin-bottom: 3rem;
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

/* Main Email All Authors Button */
.email-all-section {
  text-align: center;
  margin-bottom: 3rem;
}

.email-all-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent);
  color: var(--bg-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.3rem;
  padding: 1.25rem 2.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.email-all-button:hover {
  background: #e09406;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.email-all-button i {
  font-size: 1.5rem;
}

.email-all-description {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 1rem 0 0 0;
}

/* Category Cards Row */
.contact-categories-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1.5rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.contact-category-card {
  flex: 1;
  min-width: 200px;
  max-width: 220px;
}

.category-card-link {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-card-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  border-color: var(--accent);
}

.category-icon {
  width: 50px;
  height: 50px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  transition: all 0.3s ease;
}

.category-card-link:hover .category-icon {
  transform: scale(1.1);
}

.category-icon i {
  font-size: 1.3rem;
  color: var(--bg-primary);
}

.category-card-link h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  transition: color 0.3s ease;
}

.category-card-link:hover h4 {
  color: var(--accent);
}

.category-card-link p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
}

.contact-note {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.contact-note p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.contact-note i {
  color: var(--accent);
  margin-right: 0.5rem;
}

@media (max-width: 768px) {
  .contact-categories-row {
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .contact-category-card {
    min-width: 140px;
    max-width: 160px;
  }
  
  .category-card-link {
    padding: 1.25rem 0.75rem;
  }
  
  .category-icon {
    width: 45px;
    height: 45px;
    margin-bottom: 0.75rem;
  }
  
  .category-icon i {
    font-size: 1.1rem;
  }
  
  .category-card-link h4 {
    font-size: 0.9rem;
  }
  
  .category-card-link p {
    font-size: 0.8rem;
  }
  
  .email-all-button {
    font-size: 1.1rem;
    padding: 1rem 2rem;
  }
  
  .contact-intro {
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }
}

@media (max-width: 640px) {
  .contact-categories-row {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  
  .contact-category-card {
    width: 100%;
    max-width: 300px;
  }
  
  .category-card-link {
    flex-direction: row;
    text-align: left;
    padding: 1rem 1.5rem;
  }
  
  .category-icon {
    margin-bottom: 0;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  
  .category-card-content {
    flex: 1;
  }
}


