* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #E5E5E5;
  position: relative;
}

/* Start Overlay */
.start-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(229, 229, 229, 0.97);
  z-index: 1300;
  cursor: pointer;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  animation: start-fade-in 0.6s ease both;
}

@keyframes start-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.start-logo {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-logo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid #FF6B4A;
  opacity: 0.3;
  animation: start-pulse 2s ease-in-out infinite;
}

.start-logo-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B4A, #ff8c6e);
  box-shadow: 0 6px 20px rgba(255, 107, 74, 0.4);
}

@keyframes start-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.3; }
  50%       { transform: scale(1.2); opacity: 0.6; }
}

.start-tagline {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #666;
  letter-spacing: 0.03em;
}

.start-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #FF6B4A, #ff4500);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 107, 74, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.01em;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 107, 74, 0.55);
}

.start-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.4);
}

.start-button:disabled {
  background: #c0c0c0;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  color: rgba(255, 255, 255, 0.6);
}

.start-button:disabled .start-button-icon {
  opacity: 0.4;
}

.start-button-icon {
  font-size: 14px;
  opacity: 0.9;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(229, 229, 229, 0.95);
  z-index: 1200;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 72px;
  height: 72px;
  border: 6px solid #fff;
  border-top-color: #FF6B4A;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

/* Status Indicator - Larger for accessibility */
.status-indicator {
  position: fixed;
  top: 24px;
  left: 24px;
  color: white;
  font-size: 22px;
  font-weight: 600;
  z-index: 300;
  display: none;
  background: rgba(0, 0, 0, 0.7);
  padding: 14px 28px;
  border-radius: 28px;
}

/* Speech Bubble / Closed Captions - Large for accessibility */
.speech-bubble {
  position: fixed;
  bottom: 3%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 28px 40px;
  border-radius: 16px;
  max-width: 95%;
  text-align: center;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.3px;
  z-index: 250;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.speech-bubble-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.speech-bubble-close:hover {
  background: rgba(255, 255, 255, 0.45);
}

.speech-bubble::after {
  display: none;
}

/* Category Buttons (Screen 1) */
.category-buttons {
  display: none !important;
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 90%;
  max-width: 600px;
  z-index: 200;
}

.category-button {
  background: #FF6B4A;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 20px 24px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 60px;
}

.category-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.category-button:active {
  transform: translateY(0);
}

.category-icon {
  font-size: 24px;
}

.category-text {
  flex: 1;
  text-align: left;
}

/* Sub-Options Buttons (Screen 2) */
.sub-options {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 90%;
  max-width: 600px;
  z-index: 200;
}

.sub-option-button {
  background: #FF6B4A;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 56px;
}

.sub-option-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.sub-option-button:active {
  transform: translateY(0);
}

.sub-option-button.back-button {
  background: #6C757D;
  grid-column: span 2;
}

.option-icon {
  font-size: 20px;
}

.option-text {
  flex: 1;
  text-align: left;
}

/* Map View - Large and accessible */
.mymap {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 96vw;
  max-width: none;
  height: 70vh;
  max-height: none;
  z-index: 999;
  display: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.mymap.active {
  display: block;
}

/* Close Map Button - Fixed position so the map SDK can't swallow clicks */
.close-map-button {
  position: fixed;
  top: calc(20% + 16px);
  right: calc(2vw + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  border: 3px solid #333;
  font-size: 28px;
  color: #333;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.close-map-button:hover {
  transform: scale(1.1);
  background: #f0f0f0;
}

/* QR Code Overlay - Large and accessible */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 24px;
}

.qr-overlay.active {
  display: flex;
}

.qr-modal {
  position: relative;
  background: #fff;
  padding: 48px 48px 40px;
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 520px;
  width: 100%;
}

.qr-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #333;
  background: #f5f5f5;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, background 0.2s;
}

.qr-close-button:hover {
  transform: scale(1.08);
  background: #e0e0e0;
}

.qr-code-box {
  width: 360px;
  height: 360px;
  overflow: hidden;
}

.qr-code-box img,
.qr-code-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.qr-code-label {
  font-size: 24px;
  color: #222;
  text-align: center;
  font-weight: 600;
  line-height: 1.4;
}

/* Language Menu */
.language-menu {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 400;
  min-width: 200px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 60px;
}

.language-menu.expanded {
  max-height: 400px;
}

.language-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.language-header:hover {
  background: #f5f5f5;
}

.globe-icon {
  font-size: 18px;
}

.language-flag {
  width: 24px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
}

.language-greeting {
  flex: 1;
  font-weight: 500;
  color: #333;
}

.language-caret {
  font-size: 12px;
  color: #666;
  transition: transform 0.3s;
}

.language-menu.expanded .language-caret {
  transform: rotate(180deg);
}

.language-options {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.language-menu.expanded .language-options {
  max-height: 300px;
  overflow-y: auto;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-top: 1px solid #f0f0f0;
}

.language-option:hover {
  background: #f5f5f5;
}

.language-option.active {
  background: #e3f2fd;
  font-weight: 600;
}

.language-flag {
  width: 24px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
}

.language-name {
  flex: 1;
  color: #333;
}


/* Responsive Design */
@media (max-width: 768px) {
  .speech-bubble {
    bottom: 2%;
    width: 96%;
    font-size: 20px;
    padding: 20px 24px;
  }

  .category-buttons,
  .sub-options {
    width: 95%;
    top: 20%;
  }

  .category-button,
  .sub-option-button {
    padding: 14px 18px;
    font-size: 14px;
  }

  .mymap {
    width: 98vw;
    height: 60vh;
    top: 25%;
    max-width: none;
    max-height: none;
  }

  .close-map-button {
    top: calc(25% + 12px);
    right: calc(1vw + 12px);
  }

  .qr-modal {
    padding: 32px 32px 28px;
    max-width: 90%;
  }

  .qr-code-box {
    width: 280px;
    height: 280px;
  }

  .qr-code-label {
    font-size: 20px;
  }

  .language-menu {
    top: 20px;
    right: 10px;
  }
}

/* Hide elements by default */
.category-buttons,
.sub-options {
  display: none;
}


/* Portrait baseline (phones/small screens) */
@media screen
  and (orientation: portrait)
  and (min-aspect-ratio: 9/16)
  and (max-aspect-ratio: 10/16)
  and (max-width: 899px) {

    .category-buttons,
    .sub-options {
      top: 20%;
    }

    .mymap {
      width: 98vw;
      height: 60vh;
      top: 20%;
      max-width: none;
      max-height: none;
    }

    .qr-modal {
      max-width: min(88vw, 920px);
      padding: clamp(30px, 2.6vw, 56px) clamp(30px, 2.6vw, 56px) clamp(26px, 2.2vw, 46px);
      gap: clamp(20px, 1.8vw, 34px);
    }

    .qr-code-box {
      width: clamp(320px, 42vw, 760px);
      height: auto;
      aspect-ratio: 1 / 1;
    }

    .qr-code-label {
      font-size: clamp(24px, 2vw, 42px);
    }

    /* Baseline portrait kiosk adjustments */
    .speech-bubble {
      top: calc(20% + 60vh + 1.5vh);
      bottom: auto;
      width: min(92vw, 1200px);
      font-size: clamp(30px, 2.1vw, 56px);
      padding: 30px 44px;
      line-height: 1.45;
      max-height: calc(80% - 60vh - 3vh);
      overflow-y: auto;
    }

    .language-menu {
      right: 24px;
      top: 20px;
      min-width: 260px;
      max-width: 32vw;
    }

    .language-header,
    .language-option {
      padding: 16px 20px;
    }

    .globe-icon {
      font-size: 24px;
    }

    .language-flag {
      width: 30px;
      height: 22px;
    }

    .language-greeting,
    .language-name {
      font-size: clamp(22px, 1.3vw, 32px);
    }

    .status-indicator {
      top: 28px;
      left: 28px;
      font-size: clamp(28px, 1.6vw, 44px);
      padding: 16px 28px;
      border-radius: 32px;
    }
}

/* Portrait kiosks (~1080x1920 class) */
@media screen
  and (min-width: 2000px) {
  .category-buttons,
  .sub-options {
    top: 20%;
  }

  .mymap {
    width: 98vw;
    height: 60vh;
    top: 20%;
    max-width: none;
    max-height: none;
  }

  .qr-modal {
    max-width: min(88vw, 920px);
    padding: clamp(30px, 2.6vw, 56px) clamp(30px, 2.6vw, 56px)
      clamp(26px, 2.2vw, 46px);
    gap: clamp(20px, 1.8vw, 34px);
  }

  .qr-code-box {
    width: clamp(320px, 42vw, 760px);
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .qr-code-label {
    font-size: clamp(24px, 2vw, 42px);
  }

  .language-menu {
    top: 20px;
    right: 32px;
    min-width: 420px;
    max-width: 520px;
    min-height: 120px;
    max-height: 120px;
    border-radius: 16px;
  }

  .language-menu.expanded {
    max-height: 900px;
  }

  .language-header,
  .language-option {
    padding: 22px 24px;
    min-height: 120px;
  }

  .globe-icon {
    font-size: 30px;
  }

  .language-flag {
    width: 40px;
    height: 30px;
  }

  .language-greeting,
  .language-name {
    font-size: 32px;
  }

  .language-caret {
    font-size: 20px;
  }

  .language-options {
    max-height: 0;
  }

  .language-menu.expanded .language-options {
    max-height: 720px;
  }

  .speech-bubble {
    top: calc(20% + 60vh + 1.5vh);
    bottom: auto;
    width: min(90vw, 1200px);
    font-size: 54px;
    line-height: 1.4;
    padding: 36px 48px;
    max-height: calc(80% - 60vh - 3vh);
    overflow-y: auto;
  }

  .speech-bubble-close {
    width: 64px;
    height: 64px;
    font-size: 32px;
    top: 16px;
    right: 16px;
  }

  .status-indicator {
    top: 32px;
    left: 32px;
    font-size: 34px;
    padding: 18px 30px;
    border-radius: 36px;
  }

  /* Best-effort scaling for VidBaby microphone controls */
  button[aria-label*="microphone" i],
  button[title*="microphone" i],
  [id*="microphone" i],
  [class*="microphone" i],
  [class*="mic-button" i],
  [class*="micButton" i],
  [id*="micButton" i] {
    min-width: 80px !important;
    min-height: 80px !important;
    width: 80px !important;
    height: 80px !important;
    transform: scale(1.4);
    transform-origin: center;
  }

  [aria-label*="microphone" i] svg,
  [title*="microphone" i] svg,
  [class*="microphone" i] svg {
    width: 44px !important;
    height: 44px !important;
  }
}