body {
  background-color: #0b212c;
}

body.map-shell {
  --shell-header-height: 76px;
  --shell-panel-width: 440px;
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
}

body.map-shell .shell-frame {
  background: transparent;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  border: 0;
}

body.map-shell.lab-shell-active #frame {
  clip-path: polygon(0 0, 100% 0, 100% var(--shell-header-height), 0 var(--shell-header-height));
  height: 100vh;
  height: 100dvh;
  inset: 0;
  position: fixed;
  z-index: 100;
}

body.map-shell.lab-shell-active #lab-frame {
  height: calc(100vh - 76px);
  height: calc(100dvh - 76px);
  inset: 76px 0 0;
  position: fixed;
}

body.map-shell.lab-shell-active.lab-shell-overlay-open #frame {
  clip-path: polygon(
    0 0,
    100% 0,
    100% 100%,
    calc(100% - var(--shell-panel-width)) 100%,
    calc(100% - var(--shell-panel-width)) var(--shell-header-height),
    0 var(--shell-header-height)
  );
}

.lab-loading {
  align-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(30, 110, 133, .34), transparent 35%),
    linear-gradient(180deg, #081d28, #06151e);
  display: flex;
  inset: var(--shell-header-height) 0 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 80;
}

.lab-loading[hidden] { display: none; }

.lab-complete-prompt {
  align-items: center;
  background: radial-gradient(circle at 50% 42%, rgba(255, 199, 44, .2), rgba(3, 15, 23, .94) 68%);
  display: flex;
  inset: var(--shell-header-height) 0 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 210;
}

.lab-complete-prompt[hidden], .lab-feedback-return[hidden] { display: none; }

.lab-complete-card {
  background: linear-gradient(145deg, rgba(11, 43, 55, .98), rgba(4, 20, 30, .98));
  border: 2px solid #ffe585;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 60px rgba(255, 199, 44, .2);
  color: #f5fcff;
  font-family: Inter, system-ui, sans-serif;
  max-width: 540px;
  padding: 34px 42px 38px;
  text-align: center;
  width: 100%;
}

.lab-complete-card img { filter: drop-shadow(0 14px 20px rgba(0, 0, 0, .45)); height: 150px; object-fit: contain; width: 180px; }
.lab-complete-eyebrow { color: #ffe06b !important; font-size: 12px !important; font-weight: 850; letter-spacing: .18em; margin: 5px 0 7px !important; text-transform: uppercase; }
.lab-complete-card h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1; margin: 0 0 10px; }
.lab-complete-card p { color: #b9cdd3; font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
.lab-complete-card .lab-complete-name { color: #fff; font-size: 18px; font-weight: 850; margin-bottom: 8px; }
.lab-complete-actions { display: grid; gap: 10px; }
.lab-complete-actions button { border-radius: 9px; cursor: pointer; font: 850 14px/1.2 Inter, system-ui, sans-serif; padding: 13px 18px; }
.lab-complete-actions button span { font-weight: 650; }
.lab-complete-primary { background: #ffc72c; border: 1px solid #ffc72c; color: #09232d; }
.lab-complete-primary:hover, .lab-complete-primary:focus-visible { background: #ffda68; }
.lab-complete-secondary { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .2); color: #e8f6f8; }
.lab-complete-secondary:hover, .lab-complete-secondary:focus-visible { background: rgba(255, 255, 255, .12); }

.lab-feedback-return {
  align-items: center;
  background: rgba(4, 25, 35, .97);
  border: 1px solid rgba(103, 211, 225, .42);
  border-radius: 12px;
  bottom: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
  color: #dffaff;
  display: flex;
  font: 750 13px/1.3 Inter, system-ui, sans-serif;
  gap: 18px;
  left: 50%;
  padding: 10px 12px 10px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 220;
}

.lab-feedback-return button { background: #ffc72c; border: 0; border-radius: 8px; color: #09232d; cursor: pointer; font: 900 12px/1.2 Inter, system-ui, sans-serif; padding: 10px 13px; white-space: nowrap; }

.lab-loading-card {
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(139, 229, 239, .15);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .38);
  color: #f6fbfd;
  max-width: 360px;
  padding: 32px 38px;
  text-align: center;
  width: 100%;
}

.lab-loading-ebee {
  animation: lab-loading-float 2.8s ease-in-out infinite;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .38));
  height: 178px;
  margin-bottom: 18px;
  object-fit: contain;
  width: 178px;
}

.lab-loading-card h1 { font: 750 20px/1.2 Inter, system-ui, sans-serif; margin: 0 0 8px; }
.lab-loading-card p { color: #9fb4bd; font: 14px/1.5 Inter, system-ui, sans-serif; margin: 0 0 24px; }
.lab-loading-track { background: rgba(255, 255, 255, .1); border-radius: 999px; height: 4px; overflow: hidden; }
.lab-loading-track span { animation: lab-loading-sweep 1.5s ease-in-out infinite; background: #67d3e1; border-radius: inherit; display: block; height: 100%; width: 36%; }

@keyframes lab-loading-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes lab-loading-sweep {
  0% { transform: translateX(-110%); width: 30%; }
  50% { width: 58%; }
  100% { transform: translateX(340%); width: 30%; }
}

.shell-overlay-scrim {
  -webkit-backdrop-filter: blur(2px) saturate(.75);
  backdrop-filter: blur(2px) saturate(.75);
  background: rgba(3, 12, 18, .32);
  border: 0;
  inset: var(--shell-header-height) 0 0;
  padding: 0;
  position: fixed;
  z-index: 90;
}

.shell-overlay-scrim[hidden] { display: none; }

body.map-shell .shell-frame.is-hidden {
  display: none;
}

.lab-message-debug {
  background: rgba(3, 15, 22, 0.97);
  border: 1px solid rgba(103, 211, 225, 0.48);
  border-radius: 10px;
  bottom: 14px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  color: #dffaff;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  left: 14px;
  max-width: min(680px, calc(100vw - 28px));
  position: fixed;
  width: 100%;
  z-index: 320;
}

.lab-message-debug[hidden] { display: none; }
.lab-message-debug summary { cursor: pointer; font-family: Inter, system-ui, sans-serif; font-weight: 800; padding: 11px 13px; }
.lab-message-debug summary span { color: #75e3ed; margin-left: 6px; }
.lab-message-debug-actions { display: flex; gap: 7px; padding: 0 12px 8px; }
.lab-message-debug-actions button { background: rgba(255,255,255,.08); border: 1px solid rgba(139,229,239,.25); border-radius: 6px; color: #eefcff; cursor: pointer; font: 700 11px/1 system-ui,sans-serif; padding: 7px 10px; }
.lab-message-debug-actions button:hover { background: rgba(103,211,225,.18); }
.lab-message-debug pre { border-top: 1px solid rgba(139,229,239,.16); color: #c7dbe0; margin: 0; max-height: 38vh; overflow: auto; padding: 12px; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 720px) {
  body.map-shell { --shell-header-height:64px; }
  body.map-shell.lab-shell-active #lab-frame { height:calc(100vh - 64px); height:calc(100dvh - 64px); inset:64px 0 0; }

  .lab-message-debug { bottom: 8px; left: 8px; max-width: calc(100vw - 16px); }
  .lab-message-debug pre { max-height: 45vh; }
  .lab-complete-prompt { padding: 14px; }
  .lab-complete-card { padding: 24px 20px 26px; }
  .lab-complete-card img { height: 110px; }
  .lab-feedback-return { bottom: 10px; flex-direction: column; gap: 8px; max-width: calc(100vw - 20px); padding: 12px; text-align: center; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .lab-loading-ebee { animation: none; }
  .lab-loading-track span { animation-duration: 3s; }
}

.details {
  display: none;
  position: absolute;
  z-index: 90;
  background-color: rgba(247, 249, 249, 0.9);
  padding: 10px;
  font-family: Roboto, Arial, sans-serif;
  max-height: 85vh;
  overflow: auto;
  font-size: 0.7vw;
  width: 20vw;
  padding: 1vw;

  color: darkslategray;

  box-shadow: 0 0 30px black;
  border-radius: 5px;
}

#details {
  cursor: pointer;
}

#noscript {
  display: block;
  font-size: 1vw;
  font-weight: bold;
  left: 40%;
  top: 40%;
}

#ebee-info {
  max-width: 30vw;
  width: auto;
}

.details .info-top {
  display: flex;
  align-items: center;
}

.details .logo {
  vertical-align: top;
  margin-right: 10px;
}

.details .version-container {
  margin-left: 18px;
  width: 80%;
}

.details .version {
  display: none;
  text-align: center;
  border: 2px solid darkgray;
  border-radius: 15px;
  background: lightgray;
  padding: 0 10px;
  font-size: 1rem;
  margin: 0 auto;
  max-width: 50%;
}

.details img {
  width: 7vw;
}

#ebee-info img {
  width: 5vw;
  margin-right: 1vw;
}

.details .info-container {
  padding: 10px;
}

.details .title {
  margin: 0;
  color: darkslategray;
  font-size: 1.3vw;
  padding-left: 10px;
  padding-right: 10px;
  word-wrap: break-word;
}

.details .title .subtitle {
  font-size: 0.9vw;
  font-weight: normal;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}

#ebee-info .title {
  font-size: 1vw;
}

.details .metadata-container {
  padding: 5px 10px;
  font-size: 0.75vw;
}

.details .metadata {
  margin-top: 6px;
}

.details .metadata-item {
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8em;
  opacity: 0.7;
}

.details .metadata-link {
  color: #666;
  text-decoration: none;
  font-weight: 400;
  transition: all 0.2s ease;
}

.details .metadata-link:hover {
  color: #2c5aa0;
  text-decoration: underline;
  opacity: 1;
}

.details .lab-completion {
  display: none;
}

.details .lab-completion img {
  width: 1.5rem;
  height: auto;
  vertical-align: middle;
}

.details .teaser {
  padding: 0 20px;
  font-style: italic;
}

.details .description {
  padding: 5px 20px;
  line-height: 1.6;
}

.details .description h2 {
  font-size: 1.2em;
  margin: 20px 0 10px 0;
  color: #2c5aa0;
  font-weight: 600;
}

.details .description p {
  margin: 12px 0;
  color: #444;
}

.details .description p strong {
  color: #2c5aa0;
  font-weight: 600;
}

.details .description ul {
  margin: 10px 0;
  padding-left: 0;
}

.details .description li {
  margin: 8px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.details .legend img {
  width: 30px;
}

.details .legend p {
  display: flex;
  align-items: center;
  gap: 5px;
}

.details .legend p em {
  font-style: normal;
}

.flying-ebee {
  position: absolute;
  display: none;
  transition: all 1.5s ease-in-out;
  z-index: 80;
}

.flying-ebee img {
  width: 1.8vw;
}

.selfie {
  transition: all 1.5s ease-in-out;
  z-index: 95;
}

#map {
  width: 100%;
  height: 100%;
}

#map img {
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  display: block;
}

.indicator {
  position: absolute;
  display: none;
  height: auto;
  width: auto;
  text-align: center;
  background-color: rgba(247, 249, 249, 0.9);
  margin: 3vh 1vw;
  font-weight: bold;
  padding: 1em;
  font-size: 1vw;
  letter-spacing: 0.3em;
  font-family: Roboto, Arial, sans-serif;
  color: darkslategray;

  box-shadow: 0 0 30px black;
  border-radius: 5px;
}

.indicator a {
  text-decoration: none;
  color: darkslategray;
}

.indicator a:hover {
  text-decoration: none;
}

#mosaic-indicator {
  position: absolute;
  display: none;
  z-index: 10;
  cursor: pointer;
  background-color: rgba(247, 249, 249, 0.9);
  border-radius: 6px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  padding: 0.4em;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

#mosaic-indicator:hover {
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  transform: scale(1.05);
}

#mosaic-thumbnail {
  display: block;
  height: 100%;
  width: auto;
  border-radius: 4px;
}

#mosaic-preview {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#mosaic-preview.visible {
  display: flex;
}

#mosaic-preview-img {
  max-width: 60vw;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#mosaic-thumbnail:hover {
  transform: none;
}

#invite-title-indicator {
  position: absolute;
  display: none;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 1vw;
  padding: 0.4em 0.8em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  z-index: 80;
  margin: 0;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-family: Roboto, Arial, sans-serif;
}

.blink {
  animation: blinker 2s linear infinite;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}

.grayed {
  color: grey;
  filter: grayscale(100%);
}

@keyframes blink {
  0% {
    filter: grayscale(0%);
  }
  50% {
    filter: grayscale(100%);
  }
  100% {
    filter: grayscale(0%);
  }
}

.blinking {
  animation: blink 1s infinite;
}

/* Apply the animation to an element */
.rotating {
  animation: rotate 6s linear infinite; /* 5s duration, linear timing, infinite loop */
  filter: brightness(300%);
  z-index: 85;
}

@keyframes rotate {
  0% {
    transform: translateX(0) translateY(0) rotate(45deg);
  }
  12% {
    transform: translateX(20px) translateY(-20px) rotate(90deg);
  }
  25% {
    transform: translateX(40px) translateY(0) rotate(180deg);
  }
  37% {
    transform: translateX(20px) translateY(20px) rotate(270deg);
  }
  50% {
    transform: translateX(0) translateY(0) rotate(270deg);
  }
  62% {
    transform: translateX(-20px) translateY(-20px) rotate(270deg);
  }
  75% {
    transform: translateX(-40px) translateY(0) rotate(180deg);
  }
  87% {
    transform: translateX(-20px) translateY(20px) rotate(90deg);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0deg);
  }
}

/* Lab scores */
.average-rating {
  position: relative;
  appearance: none;
  margin: 10px 0;
  color: transparent;
  width: auto;
  display: inline-block;
  vertical-align: baseline;
}

.rating-stars {
  --percent: 50%;
  display: inline-block;
  position: relative;
  color: #ccc;
}

.rating-stars::before {
  content: '★★★★★';
  position: absolute;
  top: 0;
  left: 0;
  width: var(--percent);
  height: 100%;
  color: gold;
  overflow: hidden;
  white-space: nowrap;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pulse {
  animation: pulse 1.5s infinite;
}

/* Hexagonal Progress Indicators */
.hex-progress {
  display: flex;
  gap: 3px;
  align-items: center;
  margin: 5px 0;
  padding-left: 4px; /* Prevent animation overflow on left */
}

.hex-step {
  width: 18px;
  height: 18px;
  background: #e0e0e0;
  /* Regular hexagon with proper proportions */
  clip-path: polygon(20% 0%, 80% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%);
  transition: all 0.3s ease;
  flex-shrink: 0; /* Prevent hexagons from shrinking */
}

.hex-step.completed {
  background: linear-gradient(135deg, #00bcd4, #009688);
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}

.hex-step.current {
  background: linear-gradient(135deg, #ff9800, #ff5722);
  animation: hexPulse 1.5s infinite;
  box-shadow: 0 0 12px rgba(255, 152, 0, 0.6);
}

.hex-step.future {
  background: #e0e0e0;
  opacity: 0.5;
}

@keyframes hexPulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 1;
  }
  50% { 
    transform: scale(1.15); /* Reduced scale to prevent overflow */
    opacity: 0.8;
  }
}

.progress-summary {
  font-size: 1em; /* Increased from 0.8em */
  color: #333; /* Darker for better readability */
  margin-left: 10px;
  font-weight: 600; /* Bolder for better readability */
  white-space: nowrap; /* Prevent text wrapping */
}

/* Welcome popup overlay */
#welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 85;
  pointer-events: auto;
}

/* Welcome popup close button */
#close-welcome {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 56px;
  height: 56px;
  background: none;
  border: none;
  font-size: 48px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

#close-welcome:hover {
  color: #333;
}

/* Welcome popup controls */
.welcome-controls {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  text-align: center;
}

.welcome-controls label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  color: #555;
  transition: color 0.2s ease;
}

.welcome-controls label:hover {
  color: #333;
}

.welcome-controls input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
  cursor: pointer;
}

/* Campaign error styling */
.campaign-error {
  text-align: center;
  margin: 15px 0;
}

.campaign-error p {
  margin-bottom: 15px;
  line-height: 1.4;
}

.campaign-error.error {
  color: #dc3545;
  border-left: 4px solid #dc3545;
  padding-left: 15px;
}

.campaign-error.warning {
  color: #fd7e14;
  border-left: 4px solid #fd7e14;
  padding-left: 15px;
}

.campaign-error.info {
  color: #0dcaf0;
  border-left: 4px solid #0dcaf0;
  padding-left: 15px;
}

.campaign-error .error-actions {
  margin-top: 15px;
}

.campaign-error .btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
}

.campaign-error .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
