:root {
  --teal: #4fc3b6;
  --teal-deep: #2fa89a;
  --purple: #a98ce0;
  --ink: #2b3440;
  --muted: #8a95a3;
  --line: #eef1f4;
  --danger: #ff5a5a;
  --card-radius: 22px;
  --shadow: 0 30px 70px -25px rgba(38, 70, 83, 0.45);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
}

body {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(18px, 4vh, 48px) 18px;
  background: linear-gradient(120deg, #b9a7e8 0%, #7fd3c8 45%, #4fc3b6 100%);
  background-attachment: fixed;
}

.stage {
  width: 100%;
  max-width: 1240px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.app-card {
  width: 100%;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
/* Only the chat screen needs the big stage; the landing sizes to its content. */
.app-card.in-chat { height: min(88vh, 860px); }

.footer-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  letter-spacing: 0.2px;
}

/* ---------- SEO / info card ---------- */
.info-card {
  width: 100%;
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: clamp(26px, 4vw, 56px);
  color: var(--ink);
  line-height: 1.65;
  text-align: left;
}
.info-section { margin-bottom: clamp(30px, 4vw, 46px); }
.info-section:last-of-type { margin-bottom: clamp(20px, 3vw, 30px); }
.info-card h2 {
  font-size: clamp(22px, 2.8vw, 30px);
  margin: 0 0 14px;
  letter-spacing: -0.3px;
}
.info-card h3 { font-size: clamp(15px, 1.8vw, 18px); margin: 0 0 6px; }
.info-card p { color: #4a5561; font-size: clamp(14.5px, 1.6vw, 16.5px); margin: 0 0 14px; }
.info-card p:last-child { margin-bottom: 0; }
.info-card strong { color: var(--ink); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.info-tile {
  background: #f7fbfa;
  border: 1px solid #e7f2ef;
  border-radius: 16px;
  padding: clamp(18px, 2.2vw, 26px);
}
.info-num {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px; margin-bottom: 12px;
  font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
}
.info-tile p { margin: 0; }

.info-list { margin: 0; padding: 0; list-style: none; }
.info-list li {
  position: relative; padding-left: 30px; margin-bottom: 12px;
  color: #4a5561; font-size: clamp(14.5px, 1.6vw, 16.5px);
}
.info-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--teal-deep); background: #e4f5f1;
}

.faq {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.faq summary {
  cursor: pointer; list-style: none;
  padding: 12px 34px 12px 2px; position: relative;
  font-weight: 600; font-size: clamp(15px, 1.7vw, 17.5px);
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 22px; font-weight: 400; color: var(--teal-deep); transition: transform .2s ease;
}
.faq[open] summary::after { content: "−"; }
.faq p { padding: 0 2px 12px; }

.info-footer { border-top: 1px solid var(--line); padding-top: 22px; }
.info-footer p { margin: 0 0 6px; }
.info-footer .fine { font-size: 13px; color: var(--muted); }

/* ---------- Screens ---------- */
.screen { display: none; }
.screen.active { display: flex; }

/* ---------- Landing ---------- */
.landing { align-items: center; justify-content: center; text-align: center; padding: clamp(48px, 8vw, 104px) clamp(24px, 5vw, 56px); }
.landing-inner { width: 100%; max-width: 640px; }

.brand {
  display: flex; align-items: center; justify-content: center; gap: clamp(12px, 1.6vw, 18px);
  margin-bottom: 6px;
}
.brand-mark {
  display: grid; place-items: center;
  width: clamp(56px, 7vw, 78px); height: clamp(56px, 7vw, 78px); border-radius: clamp(15px, 1.8vw, 20px);
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  box-shadow: 0 10px 22px -8px rgba(47, 168, 154, 0.7);
}
.brand-mark svg { width: clamp(30px, 4vw, 44px); height: auto; }
.brand-mark.small {
  width: 30px; height: 30px; border-radius: 9px;
  box-shadow: none;
}
.brand-mark.small svg { width: 18px; }
.brand h1 { font-size: clamp(34px, 5.5vw, 56px); font-weight: 700; margin: 0; letter-spacing: -0.5px; }
.brand h1 span { color: var(--teal-deep); }

.tagline { color: var(--muted); font-size: clamp(15px, 2vw, 20px); margin: clamp(8px,1.5vw,14px) 0 clamp(26px,4vw,40px); line-height: 1.5; }

.mode-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.6vw, 20px); margin-bottom: clamp(22px, 3.5vw, 34px); }
.mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 0.8vw, 8px);
  padding: clamp(18px, 2.6vw, 30px) 8px clamp(14px, 2vw, 24px); border: 2px solid var(--line); border-radius: clamp(16px, 1.8vw, 20px);
  background: #fbfcfd; color: var(--muted); cursor: pointer;
  font-family: inherit; transition: all .18s ease;
}
.mode-btn svg { width: clamp(26px, 3.4vw, 38px); height: auto; color: var(--muted); transition: color .18s ease; }
.mode-btn span { font-weight: 600; font-size: clamp(14px, 1.8vw, 19px); color: var(--ink); }
.mode-btn small { font-size: clamp(11px, 1.3vw, 14px); }
.mode-btn:hover { border-color: #cfe9e4; }
.mode-btn.active {
  border-color: var(--teal);
  background: #effaf8;
  box-shadow: 0 8px 20px -12px rgba(47, 168, 154, 0.7);
}
.mode-btn.active svg { color: var(--teal-deep); }

.primary-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: clamp(15px, 2.1vw, 22px) 22px; border: none; border-radius: clamp(14px, 1.6vw, 18px); cursor: pointer;
  font-family: inherit; font-size: clamp(16px, 2.1vw, 22px); font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  box-shadow: 0 14px 26px -10px rgba(47, 168, 154, 0.8);
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary-btn svg { width: clamp(20px, 2.4vw, 26px); height: auto; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 30px -10px rgba(47, 168, 154, 0.9); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .6; cursor: default; transform: none; }

.disclaimer { color: var(--muted); font-size: clamp(11.5px, 1.4vw, 14px); margin: clamp(18px,2.6vw,26px) 0 0; line-height: 1.5; }
.online-line {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: clamp(12px, 1.8vw, 18px); color: var(--muted); font-size: clamp(12.5px, 1.5vw, 15px);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(79, 195, 182, .18); }

/* ---------- Chat screen ---------- */
.chat { flex-direction: column; height: 100%; width: 100%; }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fff;
  min-height: 56px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-left strong { font-size: 16px; letter-spacing: -0.2px; }
.mode-badge {
  font-size: 11px; font-weight: 600; color: var(--teal-deep);
  background: #effaf8; padding: 4px 10px; border-radius: 999px;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.status-pill.live .dot { background: #35c759; box-shadow: 0 0 0 4px rgba(53,199,89,.18); }
.status-pill.searching .dot { background: #f5a623; box-shadow: 0 0 0 4px rgba(245,166,35,.18); }

.header-right { display: flex; align-items: center; gap: 10px; }
.header-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; transition: all .15s ease;
}
.header-next { color: var(--teal-deep); background: #effaf8; border-color: #d5f0eb; }
.header-next:hover { background: #dff5f1; }
.header-exit { color: var(--danger); background: #fff0f0; border-color: #ffdcdc; }
.header-exit:hover { background: #ffe3e3; }
@media (max-width: 640px) {
  .header-btn span { display: none; }
  .header-btn { padding: 9px; }
}

.chat-body { flex: 1; display: flex; min-height: 0; }

/* Stage */
.stage-area {
  position: relative; flex: 1; min-width: 0;
  background: radial-gradient(circle at 50% 40%, #2b3440, #171d24);
  overflow: hidden;
}
.remote-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #171d24; opacity: 0; transition: opacity .4s ease;
}
.remote-video.on { opacity: 1; }

.stage-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; color: #eef1f4;
  text-align: center; padding: 20px;
}
.stage-overlay.hidden { display: none; }
.overlay-text { margin: 0; font-size: 15px; font-weight: 500; opacity: .92; }
.overlay-avatar {
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; color: #cdd6df;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}

.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.18);
  border-top-color: var(--teal);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Self view (picture-in-picture) */
.self-view {
  position: absolute; left: 18px; bottom: 92px;
  width: 168px; aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden;
  background: #0f141a; border: 2px solid rgba(255,255,255,.7);
  box-shadow: 0 12px 26px -10px rgba(0,0,0,.6);
  z-index: 3;
}
.local-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self-view.audio-mode .local-video { display: none; }
.self-view.hidden { display: none; }
.self-label {
  position: absolute; left: 8px; bottom: 6px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,.42); padding: 2px 8px; border-radius: 999px;
}

/* Controls */
.controls {
  position: absolute; left: 0; right: 0; bottom: 20px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  z-index: 4;
}
.ctrl-btn {
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; color: var(--ink);
  background: #fff; box-shadow: 0 10px 24px -8px rgba(0,0,0,.5);
  transition: transform .14s ease, background .14s ease, color .14s ease;
}
.ctrl-btn:hover { transform: translateY(-2px); }
.ctrl-btn.off { background: #39424d; color: #fff; }
.ctrl-stop { background: var(--danger); color: #fff; box-shadow: 0 10px 24px -8px rgba(255,90,90,.7); }
.ctrl-stop svg { transform: rotate(135deg); }
.ctrl-next {
  width: 62px; height: 62px;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep)); color: #fff;
  box-shadow: 0 12px 26px -8px rgba(47,168,154,.9);
}

/* Chat panel */
.chat-panel {
  width: 320px; flex-shrink: 0; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: #fff; min-height: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; margin: 0; }
.typing-indicator { font-size: 12px; color: var(--teal-deep); font-style: italic; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.sys-msg { align-self: center; color: var(--muted); font-size: 12.5px; padding: 4px 0; }
.msg {
  max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.msg.me { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #f1f4f7; color: var(--ink); border-bottom-left-radius: 4px; }

.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  font-family: inherit; font-size: 14px; outline: none; transition: border-color .15s ease;
}
.composer input:focus { border-color: var(--teal); }
.composer input:disabled { background: #f6f8fa; }
.send-btn {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  transition: transform .14s ease;
}
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* Mode-specific layout tweaks */
.chat.text-only .stage-area { display: none; }
.chat.text-only .chat-panel { width: 100%; border-left: none; }
.chat.audio-only .self-view { bottom: 92px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  body { padding: 0; align-items: stretch; }
  .stage { gap: 0; }
  .app-card { border-radius: 0; }
  .app-card.in-chat { height: 100vh; }        /* chat goes full screen */
  .landing { padding: clamp(56px, 14vw, 90px) 22px; min-height: 88vh; } /* fills phone nicely, not cramped */
  .footer-note { padding: 16px 0; }
  .chat-body { flex-direction: column; }
  .chat-panel { width: 100%; height: 40%; border-left: none; border-top: 1px solid var(--line); }
  .chat.text-only .chat-panel { height: 100%; }
  .self-view { width: 118px; bottom: 88px; left: 12px; }
  .info-card { border-radius: 0; }
  .info-grid { grid-template-columns: 1fr; }
}
