/* ============================================================
   «Живой Ярослав Мудрый» — стили интерфейса
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #14100a;
  font-family: Georgia, 'Times New Roman', serif;
  color: #f3e7cd;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a-scene { width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- Оверлеи (старт / ошибка) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, #2a1d0e 0%, #0f0b06 70%);
}

.start-card {
  max-width: 420px;
  width: 100%;
  background: linear-gradient(180deg, rgba(58, 42, 22, 0.97), rgba(38, 27, 14, 0.97));
  border: 2px solid #c9a227;
  border-radius: 18px;
  padding: 34px 26px 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 162, 39, 0.25);
}

.start-badge {
  font-size: 34px;
  color: #e8c45c;
  margin-bottom: 8px;
}

.start-card h1 {
  font-size: 40px;
  line-height: 1.08;
  color: #e8c45c;
  text-shadow: 0 2px 0 #6b4e14;
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.start-card h2 {
  font-size: 26px;
  color: #e8c45c;
  margin-bottom: 14px;
}

.start-card p {
  font-size: 17px;
  line-height: 1.45;
  color: #d9c9a3;
  margin-bottom: 18px;
}

.hints {
  list-style: none;
  text-align: left;
  margin: 0 auto 26px;
  max-width: 300px;
  font-size: 15px;
  color: #c9b98f;
  line-height: 1.9;
}

.btn-gold {
  display: inline-block;
  padding: 14px 44px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  color: #241a08;
  background: linear-gradient(180deg, #f4d77a, #c9a227);
  border: none;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(201, 162, 39, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-gold:active { transform: scale(0.96); }

/* ---------- UI поверх камеры ---------- */
#ui {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
#ui > * { pointer-events: auto; }

.pill {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 6, 0.82);
  border: 1px solid rgba(201, 162, 39, 0.5);
  color: #f0dda2;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 14px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

.round-btn {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: rgba(30, 21, 10, 0.85);
  font-size: 19px;
  cursor: pointer;
  color: #f0dda2;
}
#mute-btn { right: 12px; }
#demo-btn { right: 64px; }

/* ---------- Чипы вопросов ---------- */
.chips {
  position: absolute;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  background: rgba(30, 21, 10, 0.9);
  border: 1px solid rgba(201, 162, 39, 0.55);
  color: #f0dda2;
  padding: 9px 16px;
  border-radius: 22px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.chip:active { transform: scale(0.95); background: rgba(201, 162, 39, 0.25); }
.chip:disabled { opacity: 0.5; }

/* ---------- Ввод ---------- */
#input-row {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

#chat-input {
  flex: 1;
  min-width: 0;
  background: rgba(30, 21, 10, 0.92);
  border: 1px solid rgba(201, 162, 39, 0.5);
  color: #f3e7cd;
  border-radius: 26px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}
#chat-input::placeholder { color: #8d7c54; }

.icon-btn {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.6);
  background: linear-gradient(180deg, #3a2b12, #241a08);
  color: #f0dda2;
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.5; }

.icon-btn.recording {
  background: #7a2222;
  border-color: #ff6b6b;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 8px rgba(255, 80, 80, 0.15); }
}

.busy {
  position: absolute;
  bottom: calc(152px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 6, 0.85);
  border: 1px solid rgba(201, 162, 39, 0.4);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: #d9c9a3;
  white-space: nowrap;
}

/* ---------- Тестовый постер (для проверки на компьютере) ---------- */
.demo-poster {
  position: fixed;
  z-index: 30;
  right: 16px;
  bottom: 130px;
  width: 30vw;
  max-width: 260px;
  border: 3px solid #c9a227;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
/* ---------- Видоискатель ---------- */
#viewfinder {
  position: absolute;
  top: 45%; left: 50%;
  transform: translate(-50%, -50%);
  width: 65vw; height: 90vw;
  max-width: 280px; max-height: 380px;
  pointer-events: none;
  animation: scan-pulse 2.5s infinite;
}
.vf-corner {
  position: absolute;
  width: 35px; height: 35px;
  border: 4px solid #c9a227;
  opacity: 0.8;
  border-radius: 4px;
}
.vf-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.vf-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.vf-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.vf-br { bottom: 0; right: 0; border-left: none; border-top: none; }

@keyframes scan-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.02); opacity: 0.3; }
}
