/* LILI 2026 — modern visual layer. Behavior remains owned by existing JS. */
:root {
  --lili-bg: #070b14;
  --lili-panel: rgba(15, 23, 42, 0.72);
  --lili-panel-strong: rgba(12, 19, 35, 0.92);
  --lili-line: rgba(148, 163, 184, 0.16);
  --lili-line-bright: rgba(103, 232, 249, 0.36);
  --lili-text: #f8fafc;
  --lili-muted: #94a3b8;
  --lili-cyan: #67e8f9;
  --lili-blue: #38bdf8;
  --lili-violet: #8b5cf6;
  --lili-success: #34d399;
  --lili-danger: #fb7185;
  --lili-radius-lg: 28px;
  --lili-radius-md: 18px;
  --lili-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  background: var(--lili-bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  display: block;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  color: var(--lili-text);
  text-align: left;
  font-family: "Oxygen", "Archivo", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at 8% 10%, rgba(56, 189, 248, 0.14), transparent 31rem),
    radial-gradient(circle at 88% 8%, rgba(139, 92, 246, 0.15), transparent 34rem),
    linear-gradient(145deg, #060a12 0%, #0a1020 50%, #070b14 100%);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%);
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

::selection { background: rgba(103, 232, 249, 0.28); color: #fff; }

a, button, input, textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
input:not([type="checkbox"]):not([type="radio"]),
textarea {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button { touch-action: manipulation; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(103, 232, 249, 0.45) !important;
  outline-offset: 3px;
}

.info-banner {
  height: 34px;
  padding: 9px 0;
  border-bottom: 1px solid var(--lili-line);
  color: #cbd5e1;
  background: rgba(7, 11, 20, 0.78);
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.banner-content span {
  color: #a5b4c7;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.two-column-container {
  display: -webkit-flex;
  display: flex;
  width: calc(100% - 48px);
  max-width: 1440px;
  width: min(1440px, calc(100% - 48px));
  min-height: calc(100vh - 34px);
  margin: 0 auto;
  padding: 72px 0 42px;
  gap: 0;
  align-items: stretch;
}

.left-column,
.right-column {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--lili-line);
  border-radius: var(--lili-radius-lg);
  background: linear-gradient(155deg, rgba(20, 30, 52, 0.8), rgba(9, 15, 28, 0.72));
  box-shadow: var(--lili-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  backdrop-filter: blur(22px) saturate(135%);
}

.left-column::before,
.right-column::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.46), transparent);
}

.left-column {
  flex: 0 0 44%;
  margin-right: 24px;
  padding: 30px 34px 34px;
}

.right-column {
  max-height: calc(100vh - 116px);
  min-height: 650px;
  padding: 30px;
  background: linear-gradient(155deg, rgba(13, 21, 38, 0.86), rgba(8, 13, 25, 0.8));
  overflow: overlay;
}

.mobile { width: 100%; }

.lili-kicker {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 2px 0 11px;
  color: var(--lili-cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.lili-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lili-success);
  box-shadow: 0 0 14px var(--lili-success);
  margin-right: 9px;
}

.lili-hero-title,
.mobile h1 {
  margin: 0;
  color: #fff;
  text-align: center;
  font-family: "Raleway", sans-serif !important;
  font-size: 42px;
  font-size: clamp(32px, 3.35vw, 48px);
  font-weight: 760;
  line-height: 0.98;
  letter-spacing: -0.055em;
  white-space: nowrap;
  text-shadow: none;
}

.lili-hero-title strong,
.mobile h1 strong {
  color: var(--lili-cyan);
  background: linear-gradient(100deg, var(--lili-cyan), #a5b4fc 65%, #c4b5fd);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .lili-hero-title strong,
  .mobile h1 strong {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  }
}

.lili-hero-subtitle {
  max-width: 440px;
  margin: 14px auto 0;
  color: var(--lili-muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

.mobile > .container {
  width: 290px !important;
  height: 290px !important;
  max-width: 74vw;
  max-height: 74vw;
  width: min(290px, 74vw) !important;
  height: min(290px, 74vw) !important;
  margin: 34px auto 28px !important;
  padding: 8px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 50%;
  background: rgba(6, 11, 22, 0.78);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.48), 0 0 60px rgba(56, 189, 248, 0.08);
}

.gradient-border {
  top: -3px !important;
  right: -3px !important;
  bottom: -3px !important;
  left: -3px !important;
  inset: -3px !important;
  width: calc(100% + 6px) !important;
  height: calc(100% + 6px) !important;
  background: linear-gradient(135deg, var(--lili-violet), var(--lili-cyan), var(--lili-success));
  background: conic-gradient(from 90deg, var(--lili-violet), var(--lili-cyan), var(--lili-success), var(--lili-violet));
  filter: blur(0.2px);
  opacity: 0.75;
  animation-duration: 9s;
}

#av-display-element { border: 6px solid #09111f; }

.interaction-controls {
  position: relative;
  z-index: 3;
  display: -webkit-inline-flex;
  display: inline-flex;
  width: auto;
  width: fit-content;
  min-height: 70px;
  margin: 12px auto 18px !important;
  padding: 9px;
  gap: 0;
  border: 1px solid var(--lili-line);
  border-radius: 999px;
  background: rgba(6, 11, 22, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.interaction-controls > * + * { margin-left: 8px; }

.button,
.mode-button,
#voice-button {
  position: relative;
  z-index: 4;
  min-height: 50px;
  margin: 0;
  padding: 0 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.84);
  box-shadow: none;
  font-family: "Oxygen", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.button::before,
.button::after { display: none; }

.button:hover,
.mode-button:hover {
  border-color: rgba(103, 232, 249, 0.42);
  color: #fff;
  background: rgba(42, 55, 78, 0.9);
  transform: translateY(-2px);
}

#voice-button {
  width: 54px;
  min-width: 54px;
  height: 54px;
  padding: 0;
  color: #061019;
  border: none;
  background: linear-gradient(135deg, var(--lili-cyan), var(--lili-blue));
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.28);
}

#voice-button:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 36px rgba(56, 189, 248, 0.38);
}

#voice-button .fa-microphone { font-size: 22px !important; }

.stop-mic-button {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(136, 19, 55, 0.88);
  box-shadow: 0 10px 30px rgba(244, 63, 94, 0.22);
}

.lili-live-call-btn {
  position: relative;
  z-index: 1;
  min-width: 190px;
  min-height: 52px;
  padding: 0 24px !important;
  border: 1px solid rgba(52, 211, 153, 0.34) !important;
  border-radius: 999px !important;
  color: #d1fae5 !important;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.28), rgba(15, 118, 110, 0.18)) !important;
  box-shadow: 0 12px 34px rgba(16, 185, 129, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease !important;
  touch-action: manipulation;
  isolation: isolate;
}

.lili-live-call-btn .live-call-ring { pointer-events: none !important; }

.lili-live-call-btn:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(52, 211, 153, 0.7) !important;
  box-shadow: 0 16px 42px rgba(16, 185, 129, 0.23) !important;
}

.lili-live-call-btn + div {
  margin-top: 8px !important;
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 0.15em !important;
  text-transform: uppercase;
}

.response-audio-control {
  width: 100%;
  margin: 12px auto 4px;
  text-align: center;
}

.response-audio-control[hidden] { display: none !important; }

.response-audio-toggle {
  display: -webkit-inline-flex;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 166px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 999px;
  color: #cffafe;
  background: rgba(8, 47, 73, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-family: "Oxygen", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  touch-action: manipulation;
}

.response-audio-toggle i { margin-right: 8px; }

.response-audio-toggle:hover,
.response-audio-toggle:focus-visible {
  border-color: rgba(103, 232, 249, 0.68);
  background: rgba(14, 116, 144, 0.42);
}

#chat-form {
  width: min(100%, 560px);
  margin: 24px auto 0;
  padding: 16px;
  gap: 0;
  border: 1px solid var(--lili-line);
  border-radius: var(--lili-radius-md);
  background: rgba(6, 11, 22, 0.62);
}

#chat-form > * + * { margin-top: 10px; }

#chat-form input[type="text"] {
  width: 100%;
  max-width: none;
  min-height: 50px;
  margin: 0;
  padding: 0 17px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.9);
  font-family: "Oxygen", sans-serif;
  font-size: 14px;
}

#chat-form input[type="text"]:focus {
  border-color: var(--lili-cyan);
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.1);
  transform: none;
}

#send-button {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  color: #051018;
  border: none;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--lili-cyan), #60a5fa);
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.2);
}

.username-welcome {
  width: 100%;
  margin: 0 0 2px;
  padding: 9px 12px;
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 12px;
  background: rgba(14, 116, 144, 0.12);
}

.lili-response-label {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 20px;
  color: var(--lili-cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.lili-response-label::before {
  content: "P";
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 10px;
  color: #07111d;
  background: linear-gradient(135deg, var(--lili-cyan), #a5b4fc);
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.18);
  font-size: 13px;
  margin-right: 10px;
}

.bot-response {
  min-height: 100%;
  margin: 0;
  padding: 0;
  color: #dbe7f5;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  line-height: 1.72;
}

.bot-response h2 { display: none; }

#response-text {
  color: #dbe7f5;
  font-family: "Oxygen", sans-serif;
  font-size: 15px;
  line-height: 1.75;
}

#response-text h1,
#response-text h2,
#response-text h3,
#response-text h4 { color: #f8fafc; letter-spacing: -0.02em; }

#response-text a { color: var(--lili-cyan); }

#response-text .user-message,
#response-text .bot-message {
  max-width: 88%;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--lili-line);
  border-radius: 16px 16px 16px 5px;
  background: rgba(30, 41, 59, 0.62);
}

#response-text .user-message {
  margin-left: auto;
  border-color: rgba(56, 189, 248, 0.2);
  border-radius: 16px 16px 5px 16px;
  background: rgba(14, 116, 144, 0.2);
}

.working-message,
.typing-indicator {
  color: #bae6fd !important;
  border: 1px solid rgba(56, 189, 248, 0.22) !important;
  background: rgba(14, 116, 144, 0.12) !important;
  box-shadow: none !important;
}

.typing-text { color: #bae6fd; }

.right-column > .bot-response > img { display: none !important; }

audio {
  width: 100%;
  border-radius: 999px;
  filter: saturate(0.6) contrast(1.04);
}

footer {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto 28px;
  color: var(--lili-muted);
}

.settings-button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--lili-line-bright);
  color: var(--lili-cyan);
  background: rgba(15, 23, 42, 0.86);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* Welcome onboarding */
body .welcome-modal {
  padding: 24px;
  background: rgba(3, 7, 18, 0.78);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
}

body .welcome-modal-content {
  width: 520px;
  max-width: 100%;
  width: min(100%, 520px);
  margin: 5vh auto;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 28px;
  color: var(--lili-text);
  background: linear-gradient(155deg, rgba(19, 29, 50, 0.98), rgba(8, 14, 27, 0.98));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body .welcome-modal-header {
  padding: 28px 30px 22px;
  color: var(--lili-text);
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.22), transparent 55%),
    linear-gradient(135deg, rgba(14, 116, 144, 0.15), rgba(15, 23, 42, 0.2));
}

body .welcome-modal-header h2 {
  margin: 10px 0 5px;
  color: #fff;
  font-family: "Raleway", sans-serif;
  font-size: 27px;
  letter-spacing: -0.035em;
}

body .welcome-subtitle { color: #94a3b8; letter-spacing: 0.02em; }

body .welcome-icon,
body .avatar-fallback {
  color: #07111d !important;
  background: linear-gradient(135deg, var(--lili-cyan), #a5b4fc) !important;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.22);
}

body .welcome-modal-body { padding: 26px 30px 12px; }
body .welcome-message { color: #f8fafc; }
body .welcome-description { color: #94a3b8; line-height: 1.55; }

body .welcome-form-group label { color: #cbd5e1; }
body .form-hint { color: #64748b; }

body .welcome-modal-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  color: #f8fafc;
  background: rgba(6, 11, 22, 0.7);
  -webkit-appearance: none;
  appearance: none;
}

body .welcome-modal-input:focus {
  border-color: var(--lili-cyan);
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.1);
}

body .welcome-modal-footer { padding: 18px 30px 30px; }

body .welcome-modal-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  color: #061019;
  background: linear-gradient(100deg, var(--lili-cyan), #60a5fa);
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.22);
  font-weight: 800;
  -webkit-appearance: none;
  appearance: none;
}

/* Opaque fallbacks for browsers without glass/backdrop filtering. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .info-banner { background: #0a0f1b; }
  .left-column { background: #111a2c; }
  .right-column { background: #0d1525; }
  .settings-button { background: #111b2e; }
  body .welcome-modal { background: rgba(3, 7, 18, 0.96); }
}

@media (max-width: 1024px) {
  .two-column-container {
    width: calc(100% - 32px);
    max-width: 820px;
    width: min(820px, calc(100% - 32px));
    padding-top: 58px;
  }
  .left-column, .right-column { flex: none; }
  .left-column { margin-right: 0; margin-bottom: 20px; }
  .right-column { min-height: 420px; max-height: none; }
}

@media (max-width: 640px) {
  .info-banner { height: 30px; padding: 8px 0; }
  .two-column-container {
    width: calc(100% - 20px);
    min-height: auto;
    padding: 44px 0 20px;
    gap: 0;
  }
  .left-column, .right-column {
    padding: 22px 16px;
    border-radius: 22px;
  }
  .lili-hero-title, .mobile h1 { font-size: 38px; }
  .lili-hero-subtitle { font-size: 12px; }
  .mobile > .container { margin: 26px auto 22px !important; }
  .left-column { margin-bottom: 12px; }
  .interaction-controls { min-height: 64px; padding: 7px; gap: 0; }
  .interaction-controls > * + * { margin-left: 6px; }
  .mode-button { width: auto; padding: 0 14px; }
  #voice-button { width: 50px; min-width: 50px; height: 50px; }
  .lili-live-call-btn { min-width: 176px; }
  .right-column { min-height: 300px; }
  #response-text .user-message, #response-text .bot-message { max-width: 96%; }
  body .welcome-modal { padding: 10px; }
  body .welcome-modal-content { margin: 2vh auto; border-radius: 22px; }
  body .welcome-modal-header, body .welcome-modal-body, body .welcome-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* iOS Safari safe areas and viewport-height behavior. */
@supports (padding: max(0px)) {
  body {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }

  .info-banner {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }

  body .welcome-modal {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
