.viz-placeholder {
  height: 200px;
  background-color: #c1dcf5;
  border: 2px dashed #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-weight: 500;
}

.soil-flow {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.flow-track {
  position: relative;
  width: min(650px, 100%);
  height: 4rem;
}

.flow-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-bottom: 2px dotted #999;
}

.morph-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: -3rem;
  width: 3rem;
  height: 3rem;
  animation: move-across 7s linear infinite;
}

.morph-icon .icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  opacity: 0;
}

.icon-plant {
  animation: show-plant 7s linear infinite;
}

.icon-ship {
  animation: show-ship 7s linear infinite;
}

.icon-worm {
  animation: show-worm 7s linear infinite;
}

@keyframes move-across {
  0% {
    left: -3rem;
  }
  100% {
    left: 100%;
  }
}

@keyframes show-plant {
  0% { opacity: 1; }
  30% { opacity: 1; }
  35% { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes show-ship {
  0% { opacity: 0; }
  30% { opacity: 0; }
  35% { opacity: 1; }
  65% { opacity: 1; }
  70% { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes show-worm {
  0% { opacity: 0; }
  65% { opacity: 0; }
  70% { opacity: 1; }
  100% { opacity: 1; }
}


h1 {
  font-family: "DM Serif Display", serif;
  font-size: 3.5rem;
  letter-spacing: 0.5px;
  text-align: center;
  width: 100%;
  margin-top: 8%;
  color: #184e3b;
}

body {
  font-family: "Source Sans 3", sans-serif;
}

.viz-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
  border: 1px dashed #85b572;
  border-radius: 6px;
  overflow: hidden;
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#food-map,
#trade-map {
  width: 100%;
  height: 100%;
}

.viz-wrap .leaflet-container {
  width: 100%;
  height: 100%;
  font-family: "Source Sans 3", sans-serif;
}

#production-stats {
  width: 100%;
  display: block;
  margin: 0 auto;
  text-align: center;
}

#production-stats .stats-main-card {
  margin: 0 auto;
  min-width: 260px;
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#production-stats .stats-card {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background-color: #ffffff;
  min-width: 190px;
  margin: 0 auto;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

#production-stats .stats-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  background-color: #fafafa;
}

#production-stats .stats-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #777;
  margin-bottom: 0.25rem;
}

#production-stats .stats-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
}

#production-stats .stats-subvalue {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.1rem;
}

.product-select-wrapper {
  position: relative;
  text-align: left;
}

.product-select {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background-color: #ffffff;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #333;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  outline: none;
  cursor: pointer;
  padding: 6px 28px 6px 10px;
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    background-color 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.product-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(10%);
  font-size: 0.75rem;
  color: #777;
  pointer-events: none;
}

.product-select:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.25);
  background-color: #fafafa;
}

.product-select:focus {
  transform: translateY(-1px);
  border-color: #4c78a8;
  box-shadow: 0 0 0 2px rgba(76, 120, 168, 0.25);
}

.leaflet-control .product-select {
  max-width: 180px;
}

.play-button {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background-color: #ffffff;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.play-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  background-color: #fafafa;
}

.play-button.is-running {
  background-color: rgb(71, 71, 71);
  color: #ffffff;
  border-color: rgb(50, 50, 50);
}

.trade-layout {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  box-sizing: border-box;
}

.trade-controls {
  min-width: 220px;
  font-size: 0.85rem;
}

.trade-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #777;
  margin-bottom: 0.25rem;
}

.country-list {
  max-height: 220px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 0.3rem 0.5rem;
  background-color: #ffffff;
}

.trade-chart {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.trade-chart svg {
  width: 100%;
  height: 100%;
}

#trade-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8%;
  width: 100%;
}

#trade-stats .stats-main-card {
  min-width: 260px;
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#trade-stats .stats-main-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#trade-stats .stats-card {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background-color: #ffffff;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

#trade-stats .stats-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  background-color: #fafafa;
}

#trade-stats .stats-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #777;
  margin-bottom: 0.25rem;
}

#trade-stats .stats-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
}

#trade-stats .stats-subvalue {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.1rem;
}

#production-loss-scatter svg circle {
  transition:
    fill 0.15s ease,
    stroke 0.15s ease,
    r 0.15s ease;
}

#production-loss-scatter svg * {
  pointer-events: none;
}

#production-loss-scatter svg circle {
  pointer-events: auto;
}

#production-loss-scatter,
#production-loss-stats {
  min-height: 450px;
}

#production-loss-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#production-loss-stats .stats-main-card {
  min-width: 260px;
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#production-loss-stats .stats-main-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#production-loss-stats .stats-card {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background-color: #ffffff;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

#production-loss-stats .stats-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  background-color: #fafafa;
}

#production-loss-stats .stats-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #777;
  margin-bottom: 0.25rem;
}

#production-loss-stats .stats-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
}

#production-loss-stats .stats-subvalue {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.1rem;
}

.scatter-wrap {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  border: 1px dashed #c9c9c9;
  padding: 1rem;
  overflow: visible !important;
  position: relative;
}

.scatter-wrap svg {
  overflow: visible !important;
}

#production-loss-scatter {
  position: relative;
  z-index: 50;
}

.viz-wrap,
.leaflet-container {
  z-index: 1;
}

.stats-slideshow {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 1rem;
}

.slide-window {
  overflow: hidden;
  width: 100%;
  border-radius: 16px;
}

.slide-track {
  display: flex;
  transition: transform 0.4s ease;
}

.slide {
  min-width: 100%;
  padding: 0.5rem;
}

.write-up {
  margin-top: 3%;
}

.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
  margin-top: 8%;
  margin-bottom: 3%;
  color: #184e3b;
}

.reveal-up.visible {
  opacity: 1;
  transform: translateY(0);
}
