/* ---------------------------------------------------------
   Moth — design tokens
   Colors pulled from the logo gradient (indigo -> teal -> violet)
--------------------------------------------------------- */
:root{
  --bg-0: #080d18;
  --bg-1: #0c1730;
  --indigo: #33459b;
  --teal: #3fb2ab;
  --violet: #7c5cad;
  --text-hi: #eef2fa;
  --text-lo: #91a0c2;
  --card-bg: rgba(255,255,255,0.045);
  --card-border: rgba(255,255,255,0.09);
  --danger: #d9737a;

  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-hi);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body{
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

/* Letterbox on wide viewports, full-bleed on mobile */
.screen{
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  position: relative;
  display: none;
  flex-direction: column;
}
.screen--active{ display: flex; }

/* Ambient background glow, shared across onboarding screens */
.sky{
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(560px 420px at 50% -8%, rgba(63,178,171,0.20), transparent 60%),
    radial-gradient(600px 480px at 85% 90%, rgba(124,92,173,0.16), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

/* ---------------------------------------------------------
   Onboarding card
--------------------------------------------------------- */
#screen-name, #screen-volume{
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  margin: 0 auto;
}

.card{
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 36px 28px 32px;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand-icon{
  width: 88px;
  height: auto;
  margin-bottom: 6px;
  filter: drop-shadow(0 8px 24px rgba(63,178,171,0.25));
}

.wordmark{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  letter-spacing: 0.01em;
  margin: 4px 0 2px;
  background: linear-gradient(100deg, #cfd8f5 0%, #ffffff 45%, #cfd8f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline{
  font-size: 13px;
  color: var(--text-lo);
  margin: 0 0 28px;
  letter-spacing: 0.02em;
}

.field-label{
  display: block;
  text-align: left;
  font-size: 13px;
  color: var(--text-lo);
  margin-bottom: 8px;
}

.text-field{
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-hi);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 22px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.text-field:focus{
  border-color: var(--teal);
  background: rgba(255,255,255,0.07);
}
.text-field::placeholder{ color: #5f6d8c; }

.btn{
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:active{ transform: scale(0.98); }
.btn--primary{
  background: linear-gradient(100deg, var(--indigo), var(--teal) 55%, var(--violet));
  color: #05080f;
}
.btn--primary:disabled{
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------------------------------------------------------
   Volume screen — the signature ripple moment
--------------------------------------------------------- */
.ripple-icon{
  position: relative;
  width: 140px;
  height: 140px;
  margin: 4px auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ripple-icon img{
  width: 56px;
  height: auto;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 6px 18px rgba(63,178,171,0.35));
}
.ripple-icon::before,
.ripple-icon::after{
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(124,92,173,0.35);
  animation: ripple-out 2.6s ease-out infinite;
}
.ripple-icon::before{ width: 60px; height: 60px; animation-delay: 0s; }
.ripple-icon::after{ width: 60px; height: 60px; animation-delay: 1.3s; }

@keyframes ripple-out{
  0%   { width: 60px;  height: 60px;  opacity: 0.6; }
  100% { width: 150px; height: 150px; opacity: 0; }
}

.screen-title{
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 12px;
  line-height: 1.3;
}
.screen-body{
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-lo);
  margin: 0 0 14px;
}
.screen-note{
  font-size: 13px;
  color: #7986a8;
  margin: 0 0 24px;
}
.screen-error{
  font-size: 13px;
  color: var(--danger);
  margin-top: 14px;
}

/* ---------------------------------------------------------
   Chat screen
--------------------------------------------------------- */
#screen-chat{ min-height: 100dvh; }

.chat-header{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(8,13,24,0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.chat-header__icon{ width: 30px; height: auto; }
.chat-header__text{
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.chat-header__title{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.chat-header__subtitle{
  font-size: 12px;
  color: var(--text-lo);
}
.listen-indicator{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(63,178,171,0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}
.listen-indicator.is-off{
  background: #5a6684;
  animation: none;
}
@keyframes pulse-dot{
  0%   { box-shadow: 0 0 0 0 rgba(63,178,171,0.45); }
  70%  { box-shadow: 0 0 0 9px rgba(63,178,171,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,178,171,0); }
}

.chat-log{
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble{
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.4;
  word-wrap: break-word;
}
.bubble--sent{
  align-self: flex-end;
  background: linear-gradient(100deg, var(--indigo), var(--teal));
  color: #05080f;
  border-bottom-right-radius: 5px;
}
.bubble--received{
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-hi);
  border-bottom-left-radius: 5px;
}
.bubble--system{
  align-self: center;
  color: var(--text-lo);
  font-size: 12.5px;
  background: none;
  padding: 4px 8px;
}

.composer{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid var(--card-border);
  background: rgba(8,13,24,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  bottom: 0;
}
.composer__input{
  flex: 1;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-hi);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 11px 16px;
  outline: none;
}
.composer__input:focus{ border-color: var(--teal); }
.composer__input::placeholder{ color: #5f6d8c; }

.composer__send{
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--indigo), var(--teal) 60%, var(--violet));
  color: #05080f;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.composer__send:active{ transform: scale(0.94); }
.composer__send:disabled{ opacity: 0.35; cursor: not-allowed; }
.composer__send.is-sending{
  animation: send-pulse 0.9s ease-in-out infinite;
}
@keyframes send-pulse{
  0%,100%{ opacity: 1; }
  50%{ opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce){
  .ripple-icon::before, .ripple-icon::after,
  .listen-indicator, .composer__send.is-sending{
    animation: none !important;
  }
}
