* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
  overflow: hidden;
}
.intro-overlay.hidden { display: none; }

#introVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

#actionVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .9s ease;
}
#actionVideo.visible { opacity: 1; }

#portal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
#portal.visible { display: block; }

#audioPlayer { display: none; }

.subtitle-veil {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 260px;
  background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.response-text {
  position: absolute;
  left: 50%;
  bottom: 190px;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 40px));
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 17px;
  line-height: 1.4;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6);
}

.image-preview-wrap {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 210px;
  transform: translateX(-50%);
}

.image-preview {
  display: block;
  max-width: min(220px, calc(100vw - 60px));
  max-height: 220px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .55), 0 0 0 1px rgba(201, 162, 39, .3);
  opacity: 0;
  transition: opacity .3s ease;
}
.image-preview[hidden] { display: none; }
.image-preview.visible { opacity: 1; }

.image-save-btn {
  pointer-events: auto;
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(201, 162, 39, .85);
  color: #1a1a1a;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.image-save-btn[hidden] { display: none; }

.attach-btn {
  display: none;
  pointer-events: auto;
  border: 0;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  background: rgba(201, 162, 39, .28);
  color: #f3e4b8;
  font-size: 14px;
  cursor: pointer;
}
.attach-btn:disabled { opacity: .4; cursor: default; }
.subtitle-root.active .attach-btn { display: flex; align-items: center; justify-content: center; }

.subtitle-root {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.subtitle-trigger {
  pointer-events: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #e8c667;
  font-family: inherit;
  font-weight: 300;
  font-size: 17px;
  letter-spacing: .04em;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .75);
  padding: 6px 10px;
  animation: subtitle-glow 2s ease-in-out infinite;
}
.subtitle-trigger[hidden] { display: none; }

@keyframes subtitle-glow {
  0%, 100% {
    opacity: .22;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .75);
  }
  50% {
    opacity: 1;
    text-shadow: 0 2px 34px rgba(232, 198, 103, .85), 0 2px 10px rgba(0, 0, 0, .75);
  }
}

@keyframes subtitle-glow-reduced {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .subtitle-trigger { animation: subtitle-glow-reduced 6s ease-in-out infinite; }
}

.subtitle-popup {
  pointer-events: auto;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(10, 10, 10, .55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(201, 162, 39, .3);
  white-space: nowrap;
}
.subtitle-popup[hidden] { display: none; }

.subtitle-popup button {
  border: 0;
  background: transparent;
  color: #f3e4b8;
  font-family: inherit;
  font-weight: 400;
  font-size: 13px;
  padding: 8px 22px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}
.subtitle-popup button:hover { background: rgba(201, 162, 39, .16); }

.subtitle-line {
  display: none;
  pointer-events: auto;
  border: 0;
  background: transparent;
  padding: 14px 30px;
  cursor: pointer;
}
.subtitle-line::after {
  content: '';
  display: block;
  width: 46px;
  height: 1.5px;
  background: rgba(232, 198, 103, .55);
  animation: subtitle-breathe 4.5s ease-in-out infinite;
}
.subtitle-root.active .subtitle-line { display: block; }
.subtitle-root.active .subtitle-trigger { display: none; }

@keyframes subtitle-breathe {
  0%, 100% { opacity: .35; }
  50% { opacity: .9; }
}

.subtitle-textform {
  pointer-events: auto;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(300px, calc(100vw - 48px));
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgba(10, 10, 10, .5);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(201, 162, 39, .3);
}
.subtitle-textform[hidden] { display: none; }

#textInput {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 0;
}
#textInput::placeholder { color: rgba(255, 255, 255, .45); }
#textInput:disabled { opacity: .5; }

#sendTextBtn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  background: rgba(201, 162, 39, .28);
  color: #f3e4b8;
  cursor: pointer;
}
#sendTextBtn:disabled { opacity: .4; cursor: default; }

.ai-disclosure {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 2;
  margin: 0;
  font-size: 11px;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  pointer-events: none;
}

@media (max-width: 640px) {
  .response-text { bottom: 175px; font-size: 16px; }
  .subtitle-root { bottom: 34px; width: calc(100vw - 32px); }
  .subtitle-trigger { font-size: 15px; }
  .subtitle-veil { height: 220px; }
  .ai-disclosure { top: 10px; left: 12px; font-size: 10px; }
}
