body {
  padding: 0;
  margin: 0;
  background-color: #f5f5f5;
  font-family: Arial, sans-serif;

  user-select: none; /* Standard */
  -webkit-user-select: none; /* Safari (macOS + iOS) */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge (old) */
}

/* 1. Default: fullscreen (desktop & mobile landscape) */
#video-container {
  position: fixed; /* covers the viewport */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background-color: black;
}
#video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 2. Mobile portrait: “YouTube-style” tall video at top */
@media only screen and (max-width: 768px) /* mobile breakpoint */ and (orientation: portrait) {
  /* container becomes relative & only as tall as the video */
  #video-container {
    position: absolute;
    width: 100%;
    height: auto;
    overflow: hidden;
    background-color: black;
  }

  /* enforce a portrait aspect ratio, e.g. 9:16 */
  #video-container video {
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 16; /* modern browsers */
    max-height: 25vh; /* so it never overflows the viewport */
    object-fit: cover; /* fill the portrait box */
  }

  /* push down the rest of your page content */
  body {
    margin-top: calc(100vw * (16 / 9));
    /* or use height of video-container if dynamic */
  }

  #subtitle-text {
    right: 0px;
    top: -150px;
    width: 90vw;
  }
}

/**********************************************/

#subtitle-text {
  /* Typography */
  color: white;
  font-family: "Arial", sans-serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;

  /* Text enhancement for better readability */
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); /* Sharp shadow for readability */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Layout */
  padding: 8px 0;
  margin: 0;
  min-height: 36px; /* Ensures consistent height even when empty */
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;

  /* Animation for smooth text appearance */
  transition: opacity 0.3s ease;

  /* Optional: text stroke for better visibility on any background */
  -webkit-text-stroke: 0.5px black;

  position: absolute;
  right: 350px;
  top: 150px;
  width: 400px;
}

.container {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 350px;
  height: max-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: 0.3s;
  z-index: 1;
}

#unity-container {
  position: relative;
  width: 80%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#unity-canvas {
  background: #4bb4e6;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 2px solid #000;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #000;
  font-size: 24px;
  font-weight: bold;
  position: relative;
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mic-button {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #4bb4e6;
  border: 2px solid #000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  z-index: 2;
}

.mic-button:hover {
  background: #31799b;
}

.control-buttons {
  display: flex;
  justify-content: space-between;
  width: 80%;
  margin-top: 10px;
}

.control-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #4bb4e6;
  border: 2px solid #000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.control-button:hover {
  background: #31799b;
}

.call-button {
  width: 80%;
  height: 60px;
  border-radius: 30px;
  background: #4bb4e6;
  border: 2px solid #000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  font-weight: bold;
  margin-top: 10px;
  transition: 0.3s;
  cursor: pointer;
}

.call-button:hover {
  background: #31799b;
}

#type-container {
  display: flex;
  flex-direction: row;
  width: 80%;
  margin: 5px 0px;
}

#type-button.typebuttonactive {
  background: yellow;
}

.input-group {
  display: flex;
  align-items: center;
}

.input {
  min-height: 45px;
  width: 80%;
  padding: 0 1rem;
  color: #000000;
  font-size: 15px;
  border: 2.5px solid #4bb4e6;
  border-radius: 6px 0 0 6px;
}

.button--submit {
  min-height: 50px;
  padding: 0.5em 1em;
  border: none;
  border-radius: 0 6px 6px 0;
  background-color: #4bb4e6;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.3s ease-in-out;
}

.button--submit:hover {
  background-color: #31799b;
}

.input:focus,
.input:focus-visible {
  border-color: #3898ec;
  outline: none;
}

.chat-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 350px;
  height: 500px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 1;
}

.chat-container.visible {
  transform: translateY(0);
  opacity: 1;
}

.chat-header {
  background-color: #0ea5e9;
  color: white;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.message {
  max-width: 80%;
  padding: 10px 15px;
  margin-bottom: 10px;
  border-radius: 18px;
  animation: fadeIn 0.3s ease;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.system {
  background-color: #f1f5f9;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

.message.user {
  background-color: #0ea5e9;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

.chat-footer {
  padding: 15px;
  border-top: 1px solid #e5e7eb;
  display: flex;
}

.chat-toggle {
  position: fixed;
  bottom: 80px;
  left: 20px;
  background-color: #0ea5e9;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: transform 0.3s ease;
}

.chat-toggle:hover {
  transform: scale(1.05);
}

@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  /* Styles for phones in landscape mode */
  .container {
    transform: scale(0.7);
    bottom: -10px;
    right: -20px;
  }
  .chat-toggle {
    transform: scale(0.7);
    bottom: 60px;
  }
  .chat-container.visible {
    transform: translateY(0) scale(0.6);
    bottom: -25px;
    left: -25px;
  }
}

/**
 * STT.css - Styling for the Speech-to-Text component with improved visualizer
 */

/* Microphone button */
.stt-mic-button {
  width: 48px;
  height: 48px;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  position: relative;
  transition: all 0.3s ease;
  margin: 10px 0;
}

.stt-mic-button:hover {
  background-color: #e9e9e9;
  transform: scale(1.05);
}

.stt-mic-button:active {
  transform: scale(0.95);
}

#stop-button {
  background-color: #ffffff;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: none;
  height: 48px;
}

/* Microphone icon */
.stt-mic-icon {
  width: 24px;
  height: 24px;
  fill: #666;
  transition: all 0.3s ease;
  position: absolute;
  z-index: 0;
}

/* State: Connecting */
.stt-mic-button.connecting {
  background-color: #fff3e0;
}

.stt-mic-button.connecting .stt-mic-icon {
  fill: #ff9800;
  animation: stt-pulse 1.5s infinite;
}

/* State: Connected */
.stt-mic-button.connected {
  background-color: #e8f5e9;
}

.stt-mic-button.connected .stt-mic-icon {
  fill: #4caf50;
}

/* State: Recording */
.stt-mic-button.recording {
  background-color: #e8f5e9;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.stt-mic-button.recording .stt-mic-icon {
  opacity: 0;
  transform: scale(0.8);
}

/* State: Error */
.stt-mic-button.error {
  background-color: #ffebee;
}

.stt-mic-button.error .stt-mic-icon {
  fill: #f44336;
}

/* Audio visualizer - improved for centered layout */
.stt-visualizer {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.stt-mic-button.recording .stt-visualizer {
  display: flex;
}

.stt-bar {
  width: 3px;
  background-color: #4caf50;
  border-radius: 2px;
  transition: height 0.1s ease;
  position: absolute;
  transform-origin: bottom center;
  margin: 0px 2px;
}

/* Position the bars */
.stt-bar-left {
  left: 7.5px;
  height: 30%;
}

.stt-bar-center {
  height: 40%;
}

.stt-bar-right {
  right: 7.5px;
  height: 30%;
}

/* Toast notifications */
.stt-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.stt-toast.show {
  opacity: 1;
}

/* Transcript styling */
.stt-transcript-container {
  margin-top: 10px;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 4px;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
}

.stt-utterance {
  margin-bottom: 10px;
  line-height: 1.5;
}

.stt-final {
  color: #000;
}

.stt-interim {
  color: #666;
  font-style: italic;
}

.stt-language {
  font-size: 12px;
  background-color: #e0e0e0;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
  color: #666;
}

/* Animations */
@keyframes stt-sound-wave {
  0% {
    height: 5px;
  }
  100% {
    height: 22px;
  }
}

@keyframes stt-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .stt-mic-button {
    width: 42px;
    height: 42px;
  }

  .stt-mic-icon {
    width: 20px;
    height: 20px;
  }

  .stt-toast {
    width: 80%;
    text-align: center;
  }
}
