/* Global settings */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #f3f3f3;
  font-family: 'Barlow Condensed', sans-serif;
}

/* Container structure */
#container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

#mainContent {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Diagram area */
#diagram {
  flex: 1 1 62%;
  background: #f3f3f3;
  position: relative;
  overflow: hidden;
  touch-action: none;
  box-sizing: border-box;
}
#diagram svg {
  width: 100%;
  height: 100%;
  display: block;
}

#modeControl {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  flex-direction: row-reverse; /* NEW: switch comes first, text expands left */
  gap: 8px;
  z-index: 5;
}

#modeLabel {
  font-size: 1rem;
  white-space: nowrap; /* No wrapping */
  text-align: right;   /* (optional) align text nicely to switch */
}

/* Cinema card area */
#cinema {
  flex: 1 1 38%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin: 16px 16px 16px 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 500px;
  box-sizing: border-box;
}

/* Cinema image wrapper - fixed 1.66:1 aspect ratio */
.cinema-image-wrapper {
  width: 100%;
  aspect-ratio: 1.66 / 1;
  background: #ddd;
  border-radius: 0;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  display: block;
}

/* Cinema image inside wrapper */
#cinemaImage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  display: block;
  background: #ddd;
}

/* Caption under cinema */
#caption {
  font-family: 'Barlow', sans-serif;
  font-size: 1rem;
  margin-top: 0;
  text-align: center;
  width: 100%; /* changed from max-width: 90% */
  color: #333;
  letter-spacing: 0.02em;
}

a{
    color: #00A95C;
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Barlow', sans-serif;
  background: #7b1fa2;
  color: #fafafa;
  padding: 1rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.75);
  border-radius: 8px;
  z-index: 1000;
  max-width: 280px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  pointer-events: none;
}

.popup h1{
font-size: 2em;
margin-bottom: 1rem;
font-weight: 600;
}

.popup p{
  font-size: 1em;
  font-weight: 400;
}

.popup h1{
  font-size: 2em;
  margin-bottom: 1rem;
  font-weight: 600;
}  

.popup.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.popup.hidden {
  display: none;
}

.hidden {
  display: none;
}

/* Intro overlay */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(200, 210, 200, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.intro-content {
  width: 100%;
  margin: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.08);
  text-align: left;
  max-width: 25vw;
  max-height: 75vh; overflow-y: auto;
}

.intro-content *{
  font-family: 'Barlow', sans-serif;
  margin-block: 0;
  margin: 0;
  padding: 0;
}

.intro-content h1 {
  font-size: 2em;
  margin-bottom: 1rem;
  font-weight: 600;
}
.intro-content h2 {
  margin-top: 1em;
  font-size: 1em;
  font-weight: 600;
}

.intro-content strong {
  margin-top: 1em;
  font-size: 1em;
  font-weight: 500;
  font-style: italic;
}

.intro-content p {
  font-size: 1em;
  margin-bottom: 1em;
}

.intro-content ul {
  list-style-type: "🕸  ";
  font-size: 1em;
  margin-bottom: 1em;
  margin-left: 1.5em;
}

.start-button-wrapper {
  padding-block: 2em; /* prevents collapsing */
}

#startButton {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  cursor: pointer;
  background: rgba(0, 169, 92, 0.9);
  color: #fafafa;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: background 0.3s, box-shadow 0.2s, transform 0.2s;
}

#startButton:hover {
  box-shadow: 0 4px 10px rgba(0, 169, 92, 0.5);
  transform: translateY(1px);
}

#startButton:active {
  transform: translateY(0);
}

/* Toggle switch style */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 32px;
}
.switch input {
  display: none;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  transition: .4s;
  border-radius: 36px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background: #00A95C;
}
input:checked + .slider:before {
  transform: translateX(26px);
}

/* Clickable next node visual style */
.manual-next-node {
  stroke: #00ccff;
  stroke-width: 3px;
  cursor: pointer;
}
.manual-next-node:hover {
  stroke-width: 6px;
}

/* Link color styles */
.link { color: #999; stroke: #999; stroke-width: 1.5; }
.link.current { color: red; stroke: red; stroke-width: 3.5; }
.link.next    { color: orange; stroke: orange; stroke-width: 2.5; }
.link.visited { color: #6a5acd; stroke: #6a5acd; stroke-width: 1.5; }

@media (max-width: 768px) {
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #f3f3f3;
    overscroll-behavior: none;
    overflow-x: hidden;
    overflow-y: auto; /* allow vertical scrolling */
  }

  .intro-content {
    width: 75vw;
    height: 75vh;
    max-width: none;
    max-height: none;
  }

  #startButton:active {
    box-shadow: 0 4px 10px rgba(0, 169, 92, 0.5);
    transform: translateY(1px);
  }

  #mainContent {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* make sure whole screen height is used */
    width: 100%;
    box-sizing: border-box;
  }

  #diagram {
    flex: 0 0 auto;
    height: 60vh; /* or 60vh */
    max-height: none;
    min-height: 300px;
    overflow: visible; /* allow diagram edges to show slightly */
    position: relative;
  }

  #cinema {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
  }

  .cinema-image-wrapper {
    width: 100%;
    aspect-ratio: 1.66 / 1;
    background: #ddd;
    margin-bottom: 16px;
    border-radius: 0;
    overflow: hidden;
  }

  #cinemaImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #ddd;
  }

  #caption {
    font-family: 'Barlow', sans-serif;
    font-size: 0.8rem;
    text-align: center;
    color: #333;
    letter-spacing: 0.02em;
    margin: 0;
  }

  #diagram::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50px;
    background: linear-gradient(to top, #f3f3f3 0%, transparent 100%);
    pointer-events: none;
    z-index: 5;
  }

}