/* Mobile-first Live Interpretation – aligned to text project theme */

:root {
  --text-ink: #13231d;
  --text-ink-soft: #46564f;
  --text-paper: #f3eee4;
  --text-paper-strong: #fbf8f1;
  --text-green: #1b5a49;
  --text-amber: #d57f2b;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  position: fixed;
  inset: 0;
  height: 100%;
  height: 100dvh;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  font-smoothing: antialiased;
  -webkit-font-smoothing: antialiased;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  max-height: 100dvh;
  padding: 20px 24px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  color: #fff;
  background: linear-gradient(145deg, #0a1628 0%, #0f2038 30%, #0a1a30 60%, #060e1e 100%);
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  display: flex;
}

.screen-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.logo-wrap {
  margin-bottom: 16px;
  flex-shrink: 0;
  text-align: center;
}

.screen-email .logo-wrap {
  margin-top: -50px;
  margin-bottom: 10px;
}

.screen-channels .logo-wrap {
  margin-top: -70px;
  margin-bottom: 16px;
}

.logo-img {
  display: block;
  max-width: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.room-logo {
  max-width: 100px;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.12));
}

.screen-tagline {
  color: rgba(240, 187, 130, 0.95);
  font-size: clamp(13px, 3.8vw, 15px);
  font-weight: 700;
  margin: 0 0 5px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.12em;
  text-transform: none;
}

.input-email {
  width: 100%;
  max-width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  border: 1px solid rgba(19, 35, 29, 0.16);
  border-radius: 999px;
  background: rgba(251, 248, 241, 0.92);
  color: var(--text-ink);
  outline: none;
  margin-bottom: 14px;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-email:focus {
  border-color: rgba(213, 127, 43, 0.65);
  box-shadow: 0 0 0 4px rgba(213, 127, 43, 0.18);
}

.btn-enter {
  width: 100%;
  max-width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #f0bb82, #d57f2b);
  color: #24170a;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.btn-enter:active {
  transform: scale(0.98);
}

.error-msg {
  color: #fecaca;
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
  flex-shrink: 0;
}

/* Channel selection – audio only */
.channel-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: auto;
  max-width: 100%;
  flex-shrink: 1;
  min-height: 0;
}

.screen-channels .screen-tagline {
  margin-bottom: 32px;
}

.channel-btn {
  width: min(220px, 72vw);
  min-width: 140px;
  padding: 10px 16px;
  font-size: 38px;
  font-weight: 700;
  border: 1px solid rgba(19, 35, 29, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, transform 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  line-height: 1;
}

.channel-btn:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(213, 127, 43, 0.45);
}

/* Administration — channel screen only, shown for admin role via JS */
.btn-administration {
  width: 100%;
  max-width: 100%;
  margin-top: 18px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid rgba(240, 187, 130, 0.65);
  border-radius: 16px;
  background: rgba(240, 187, 130, 0.16);
  color: #f6d7b5;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-administration:active {
  transform: scale(0.99);
  background: rgba(240, 187, 130, 0.28);
  border-color: rgba(240, 187, 130, 0.95);
}

.btn-administration.hidden {
  display: none !important;
}

/* Log out — switch account (channels + room) */
.btn-logout {
  margin-top: 16px;
  padding: 0;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.35);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.btn-logout:active {
  color: #fff3df;
  opacity: 0.95;
}

.btn-logout--room {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  margin-top: 0;
  align-self: auto;
  max-width: none;
  width: auto;
  z-index: 25;
}

.screen-channels #btn-logout-channels {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: max(8px, env(safe-area-inset-top));
  margin-top: 0;
  font-size: 14.4px;
  z-index: 25;
}

/* Room: dark background + faint centered logo (watermark); waves + Live on top */
.screen-room {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 16px;
  justify-content: flex-start;
  gap: 0;
  align-items: center;
  background: linear-gradient(145deg, #0a1628 0%, #0f2038 30%, #0a1a30 60%, #060e1e 100%);
}

.screen-room.is-live {
  background:
    radial-gradient(circle at top right, rgba(213, 127, 43, 0.2), transparent 22rem),
    radial-gradient(circle at top left, rgba(93, 154, 129, 0.12), transparent 18rem),
    linear-gradient(180deg, #10221f 0%, #0b1816 60%, #081210 100%);
}

.screen-room::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  max-height: 38vh;
  background: url("https://livingwater.education/wp-content/uploads/2025/06/desing3.png") center center / contain no-repeat;
  opacity: 0.16;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

.screen-room > * {
  position: relative;
  z-index: 1;
}

/* LIVE status (text project style): dot + label, no button/capsule */
.wave-stack {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 100px;
  max-height: 42vh;
  margin-bottom: 20px;
  padding: 0 4px;
  flex-shrink: 1;
}

.live-badge {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
  z-index: 25;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Active: interpreter transmitting or listener receiving audio */
.live-badge--on {
  border: 0;
  box-shadow: none;
}

.live-badge--on .live-dot {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: live-pulse 2s ease-in-out infinite;
}

.live-badge--on .live-text {
  color: #34d399;
}

/* Inactive: waiting / mic off */
.live-badge--off {
  border: 0;
  box-shadow: none;
}

.live-badge--off .live-dot {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  animation: none;
}

.live-badge--off .live-text {
  color: rgba(255, 255, 255, 0.35);
}

.live-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(52, 211, 153, 0.4); }
  50%      { box-shadow: 0 0 14px rgba(52, 211, 153, 0.8); }
}

.live-text {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 300ms ease;
}

/* Intro video screen (shown after login) */
.screen-intro-inner {
  justify-content: center;
}

.intro-video {
  width: 100%;
  max-width: 420px;
  border-radius: 24px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  background: rgba(0, 0, 0, 0.15);
  max-height: 48vh;
  object-fit: contain;
}

.intro-status {
  margin: 10px 0 14px;
}

.wave-wrap {
  flex: 1;
  width: 100%;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

#wave-canvas {
  width: 100%;
  height: 100%;
  min-height: 100px;
  border-radius: 24px;
  background: transparent;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(240, 187, 130, 0.12);
  position: relative;
  z-index: 1;
}

.room-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  margin: 0 0 14px;
  flex-shrink: 0;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-participants {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  margin: 0 0 10px;
  flex-shrink: 0;
}

.screen-room.is-live .room-status {
  color: rgba(247, 240, 229, 0.9);
  letter-spacing: normal;
  text-transform: none;
}

.screen-room.is-live .room-participants {
  color: rgba(247, 240, 229, 0.72);
}

/* Intro video only (Tap to hear removed – audio plays when stream arrives) */
.btn-skip-intro {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 14px;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid rgba(240, 187, 130, 0.35);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0bb82, #d57f2b);
  color: #24170a;
  cursor: pointer;
  display: block;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.btn-skip-intro:active {
  transform: scale(0.98);
}

.translator-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-mic {
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(240, 187, 130, 0.35);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0bb82, #d57f2b);
  color: #24170a;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.btn-mic.stop {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 240, 229, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
}

#listener-audio {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
}

.hidden {
  display: none !important;
}

.page-credits {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 6px 12px;
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 10;
}
