:root {
  --bg: #050505;
  --fg: #ffffff;
  --muted: #a3a3ad;
  --accent-1: #5b4fd6;
  --accent-2: #ef6b57;
  --bubble-user: #2a2a33;
  --bubble-assistant: #16161c;
  --pill-bg: #17171d;
  --border: #2a2a33;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 10px;
}
.header-icon {
  color: var(--accent-2);
  font-size: 14px;
}
.header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
.header-close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
/* Main / welcome */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px 24px 16px;
}

.welcome {
  text-align: center;
  padding-top: 16px;
}

.orb-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 28px;
}
.orb {
  /* The source GIF's canvas background is solid white, not transparent,
     and has the "BETA" badge baked into its top-right corner -- cropping
     to a circle hides the white square but also clips that badge, so a
     separate CSS badge is rendered on top instead (see .beta-badge). */
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: block;
}
.beta-badge {
  position: absolute;
  top: 4px;
  right: -4px;
  background: #fff;
  color: #000;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.orb-arrow {
  position: absolute;
  left: -26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  font-size: 14px;
}
.welcome-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 12px;
}
.welcome-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 10px;
}
.welcome-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
.welcome-list li::before {
  content: "\2022";
  color: var(--accent-2);
  display: inline-block;
  width: 1em;
  margin-right: 0.3em;
}

.talk-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}
.talk-cta-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(239, 107, 87, 0.35);
}
.talk-cta-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.talk-cta-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

/* Chat messages */
.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 4px;
}
.messages:empty { display: none; }

.msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--bubble-user);
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bubble-assistant);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.assistant.pending {
  color: var(--muted);
  font-style: italic;
}

.status {
  min-height: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--accent-2);
  padding: 4px 0;
}

/* Composer */
.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 20px;
}
.composer-arrow {
  color: var(--accent-2);
  font-size: 13px;
  flex-shrink: 0;
}
.composer-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 8px 6px 16px;
}
.composer-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 15px;
  min-width: 0;
}
.composer-input::placeholder {
  color: #6f6f78;
}
.mic-btn, .send-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mic-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.mic-btn.listening {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  animation: pulse 1.1s ease-in-out infinite;
}
.mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 107, 87, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(239, 107, 87, 0); }
}

/* Access-token gate */
.gate {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}
.gate-box {
  max-width: 360px;
  text-align: center;
}
.gate-box h2 { margin: 0 0 10px; font-size: 19px; }
.gate-box p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }
.gate-box code {
  background: var(--pill-bg);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Voice call page (call.html -- a standalone page, opened in its own
   browser tab/window, not an in-page overlay -- see app.js/call.js) */
.call-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
}

.call-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 420px;
}

.call-orb-wrap {
  width: 120px;
  height: 120px;
}
.call-orb {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}
.call-orb.speaking {
  animation: pulse 1.1s ease-in-out infinite;
}

.call-status {
  color: var(--muted);
  font-size: 14px;
}

.call-controls {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
.call-mute-btn,
.call-hangup-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-mute-btn {
  background: var(--pill-bg);
  color: var(--fg);
  border: 1px solid var(--border);
}
.call-mute-btn.muted {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-color: transparent;
}
.call-hangup-btn {
  background: #e5484d;
  color: #fff;
}
