:root {
  /* Layered warm-dark register — not flat black */
  --bg: #0a0c08;
  --bg-2: #0e110b;
  --surface: #14180f;
  --surface-2: #181d12;
  --surface-hi: #1c2216;
  --border: #262e1d;
  --border-hi: #33402440;
  --accent: #c3f75a;
  --accent-2: #a6e23c;
  --accent-dim: #7fa834;
  --accent-deep: #5c7d24;
  --text-primary: #f4f6ef;
  --text-secondary: #a2a89a;
  --text-muted: #74796c;
  --text-faint: #565b4f;
  --danger: #f26d4d;

  --serif: "Fraunces", "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 30px 80px rgba(0, 0, 0, 0.6);
  --glow: 0 0 60px rgba(195, 247, 90, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-2) 0%, var(--bg) 55%);
}

/* ---- Ambient background layers ---- */
.bg-vignette,
.bg-glow,
.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  background: radial-gradient(
    46% 34% at 50% 8%,
    rgba(195, 247, 90, 0.1) 0%,
    rgba(195, 247, 90, 0.04) 32%,
    transparent 70%
  );
  animation: glow-drift 12s ease-in-out infinite;
}

.bg-vignette {
  background: radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.bg-grain {
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes glow-drift {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

#root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.serif {
  font-family: var(--serif);
  font-optical-sizing: auto;
}

.screen {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 32px 20px 56px;
  }
}

/* ---- Streak / top row ---- */
.streak-line {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.streak-line .dot {
  color: var(--accent-dim);
}

.settings-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.settings-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}

/* ---- Advisor identity ---- */
.advisor-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.advisor-title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.advisor-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

/* ---- The living orb ---- */
.orb {
  position: relative;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 34% 28%, #eaffb0 0%, var(--accent) 30%, var(--accent-2) 55%, var(--accent-deep) 100%);
  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.35),
    inset -4px -6px 14px rgba(50, 70, 10, 0.6),
    var(--glow);
}

.orb::after {
  content: "";
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(195, 247, 90, 0.22) 0%, transparent 62%);
  z-index: -1;
}

.orb-32 {
  width: 34px;
  height: 34px;
  animation: breathe 4s ease-in-out infinite;
}

.orb-160 {
  width: 168px;
  height: 168px;
  margin: 0 auto;
  animation: breathe 4s ease-in-out infinite;
}

.orb-160.listening {
  animation: breathe-fast 2.2s ease-in-out infinite;
}

.orb-160.speaking {
  animation: breathe-fast 1.15s ease-in-out infinite;
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, calc(0.4 + 0.25 * var(--amp, 0.3))),
    inset -4px -6px 14px rgba(50, 70, 10, 0.6),
    0 0 calc(70px + 80px * var(--amp, 0.3)) rgba(195, 247, 90, calc(0.4 + 0.4 * var(--amp, 0.3)));
  filter: brightness(calc(1 + 0.15 * var(--amp, 0.3)));
}

.orb-160.connecting {
  animation: breathe 3s ease-in-out infinite;
  opacity: 0.62;
}

.orb-160.connecting::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(195, 247, 90, 0.7);
  animation: spin 1.1s linear infinite;
  z-index: 1;
}

/* expanding ring when listening/speaking */
.orb-160.listening::before,
.orb-160.speaking::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(195, 247, 90, 0.4);
  animation: ring 2.2s ease-out infinite;
}

.orb-160.speaking::before {
  animation-duration: 1.4s;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes breathe-fast {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.09);
  }
}

@keyframes ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .orb-160,
  .orb-32,
  .bg-glow,
  .screen,
  .chip {
    animation: none !important;
  }
  .orb-160.listening::before,
  .orb-160.speaking::before {
    display: none;
  }
}

/* ---- Insight card (hero) ---- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(195, 247, 90, 0.35), transparent);
}

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--accent-dim);
  letter-spacing: 0.16em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.card-label .tick {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-tick 2.4s ease-in-out infinite;
}

@keyframes pulse-tick {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.card-body {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 25px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  font-weight: 400;
}

@media (max-width: 640px) {
  .card {
    padding: 28px 24px 26px;
  }
  .card-body {
    font-size: 21px;
  }
}

.actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #10160a;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.005em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 6px 20px rgba(166, 226, 60, 0.22);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 10px 28px rgba(166, 226, 60, 0.32);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--sans);
  padding: 0 14px;
  height: 46px;
  border-radius: 12px;
  transition: color 0.2s ease, background 0.2s ease;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-hi);
}

/* ---- Receipts ---- */
.receipts-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  margin: 34px 0 14px;
  font-weight: 600;
}

.receipts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  animation: chip-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.chip:hover {
  border-color: var(--border-hi);
  background: var(--surface-2);
  transform: translateY(-1px);
}

@keyframes chip-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chip-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: flex;
}

.chip-source {
  color: var(--text-muted);
  font-weight: 500;
}

.chip-snippet {
  color: var(--text-secondary);
}

.sync-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.sync-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 8px;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.sync-btn:hover {
  color: var(--text-primary);
}

.sync-btn.syncing svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Secondary affordance ---- */
.secondary-row {
  margin-top: 36px;
  text-align: center;
}

.secondary-link {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--sans);
  transition: color 0.2s ease;
}

.secondary-link:hover {
  color: var(--text-secondary);
}

.drawer {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
  animation: rise 0.4s ease both;
}

.drawer textarea {
  width: 100%;
  min-height: 76px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  resize: vertical;
  outline: none;
  font-family: var(--serif);
}

.drawer textarea::placeholder {
  color: var(--text-faint);
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* ---- Talk overlay ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background:
    radial-gradient(60% 50% at 50% 18%, rgba(195, 247, 90, 0.08), transparent 70%),
    radial-gradient(120% 90% at 50% 40%, var(--bg-2) 0%, var(--bg) 60%);
  animation: fade 0.35s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.overlay-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 72px 32px 48px;
  position: relative;
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 28px;
  right: 28px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.close-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.decision-chip {
  display: inline-block;
  margin: 28px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: 999px;
  padding: 9px 18px;
  letter-spacing: 0.01em;
}

.decision-chip b {
  color: var(--text-primary);
  font-weight: 500;
}

.transcript {
  margin-top: 36px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 28px);
  mask-image: linear-gradient(to bottom, transparent, black 28px);
}

.turn-advisor {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-primary);
  font-style: italic;
  border-left: 2px solid var(--accent);
  padding-left: 14px;
}

.turn-user {
  font-size: 15px;
  color: var(--text-secondary);
  padding-left: 16px;
}

.mentor-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.mentor-bar select {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.mentor-bar select:hover {
  border-color: var(--border-hi);
}

.orb-button {
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  transition: filter 0.2s ease;
}

.orb-button:hover {
  filter: brightness(1.06);
}

.orb-button:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 8px;
}

.orb-hint {
  min-height: 16px;
  margin-top: 18px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  font-weight: 500;
}

.mute-btn {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.mute-btn:hover {
  border-color: var(--border-hi);
  color: var(--text-primary);
}

.notice {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 32px;
  line-height: 1.5;
}

/* ---- Settings modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 4, 0.72);
  backdrop-filter: blur(6px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade 0.25s ease both;
}

.modal {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: rise 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 500;
  font-family: var(--serif);
}

.modal .modal-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 20px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s ease;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  border-color: var(--accent-dim);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
