* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0f1020;
  color: #f5f5f5;
}

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(108, 99, 255, 0.25), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(79, 209, 255, 0.18), transparent 35%),
    linear-gradient(160deg, #0f1020 0%, #171a35 50%, #101528 100%);
}

.app {
  width: 100%;
  max-width: 520px;
  text-align: center;
  margin: 0 auto;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.login-screen {
  width: 100%;
  max-width: 960px;
}

.login-screen:not(.hidden) {
  display: block;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: stretch;
}

.auth-brand {
  position: relative;
  padding: 40px 32px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(108, 99, 255, 0.35), rgba(79, 209, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  text-align: left;
}

.brand-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  top: -60px;
  right: -40px;
  background: rgba(255, 255, 255, 0.12);
  filter: blur(40px);
  border-radius: 50%;
}

.brand-badge {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #7b73ff, #4fd1ff);
  box-shadow: 0 12px 30px rgba(108, 99, 255, 0.35);
  margin-bottom: 20px;
}

.brand-badge.small {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
}

.auth-brand h1 {
  margin: 0 0 10px;
  font-size: 3.2rem;
  letter-spacing: -1px;
}

.brand-tagline {
  margin: 0 0 28px;
  color: #dfe4ff;
  font-size: 1.1rem;
  line-height: 1.5;
}

.brand-features {
  margin: 0;
  padding-left: 20px;
  color: #c9d1ff;
  line-height: 1.9;
}

.auth-panel {
  display: flex;
  align-items: center;
}

.auth-panel-single {
  max-width: 440px;
  margin: 0 auto;
}

.auth-card {
  width: 100%;
  padding: 32px 28px;
  border-radius: 28px;
  background: rgba(12, 14, 30, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.auth-tab {
  flex: 1;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #b8c0ef;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, #6c63ff, #5a52e0);
  color: white;
  box-shadow: 0 8px 20px rgba(108, 99, 255, 0.35);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #aeb6e8;
  margin-top: 4px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-form input:focus {
  border-color: rgba(108, 99, 255, 0.8);
  background: rgba(255, 255, 255, 0.09);
}

.auth-form input::placeholder {
  color: #7f88b8;
}

.btn-primary {
  margin-top: 8px;
  padding: 15px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #6c63ff, #4fd1ff);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(108, 99, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(108, 99, 255, 0.42);
}

.text-link {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: #8fd4ff;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.text-link:hover {
  text-decoration: underline;
}

.form-title {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.form-hint {
  margin: 0 0 8px;
  color: #9aa3d4;
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-message {
  min-height: 24px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 210, 127, 0.08);
  color: #ffd27f;
  line-height: 1.5;
  font-size: 0.92rem;
}

.auth-message.success {
  background: rgba(76, 175, 80, 0.12);
  color: #9be7a0;
}

.auth-message.error {
  background: rgba(244, 67, 54, 0.15);
  color: #ffb4a9;
}

.auth-reset-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #6c63ff;
  color: white !important;
  text-decoration: none;
  font-weight: 600;
}

.auth-reset-link:hover {
  background: #5a52e0;
}

.boot-message {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #c9d1ff;
  font-size: 1rem;
  z-index: 10;
  pointer-events: auto;
}

.boot-message.hidden {
  display: none !important;
  pointer-events: none;
}

.auth-card-compact {
  padding: 28px 24px;
}

.auth-page-title {
  margin: 0 0 8px;
  font-size: 1.65rem;
  text-align: center;
  letter-spacing: -0.5px;
}

.auth-panel-single .auth-card {
  text-align: center;
}

.auth-panel-single .auth-form {
  text-align: left;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  margin: 4px 0 0;
  padding-top: 4px;
  font-size: 0.86rem;
  line-height: 1.4;
}

.auth-footer-link {
  color: #8fd4ff;
  text-decoration: none;
  white-space: nowrap;
}

.auth-footer-link:hover {
  text-decoration: underline;
}

.auth-footer-sep {
  color: #5a628f;
  user-select: none;
}

.form-hint-tight {
  margin: 0 0 4px;
}

.phone-hint {
  margin-top: 12px;
  text-align: center;
}

.auth-version {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #5a628f;
  letter-spacing: 0.02em;
}

.verify-action {
  display: inline-block;
  margin-top: 16px;
  text-decoration: none;
  text-align: center;
}

.reset-title {
  text-align: center;
  margin: 0 0 8px;
  font-size: 2rem;
}

@media (max-width: 820px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 28px 24px;
  }

  .auth-brand h1 {
    font-size: 2.4rem;
  }

  .brand-features {
    display: none;
  }

  /* backdrop-filter breaks on some phones and shows a black screen */
  .auth-card {
    background: #1a1f3d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .auth-brand {
    background: linear-gradient(145deg, #4f49b8, #2a6f8a);
  }

  .brand-glow {
    display: none;
  }

  body.auth-body {
    align-items: flex-start;
    padding-top: 12px;
  }
}

.trust-card {
  text-align: left;
}

.download-cert {
  display: inline-block;
  margin: 12px 0 20px;
  padding: 14px 20px;
  background: #6c63ff;
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: bold;
}

.download-cert.hidden {
  display: none;
}

.trust-setup {
  margin-top: 8px;
}

.trust-setup h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.trust-code {
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  color: #e8ecff;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

.trust-steps h2 {
  margin: 20px 0 8px;
  font-size: 1rem;
  color: #c9d1ff;
}

.trust-steps ol {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.6;
  color: #e8e8e8;
}

.verify-action {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  margin-top: 12px;
}

.verify-action.hidden {
  display: none;
}

.verify-link {
  display: inline-block;
  margin-top: 16px;
  color: #8fd4ff;
}

.mic-notice {
  background: rgba(255, 193, 7, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #ffe08a;
  line-height: 1.5;
  text-align: left;
}

.mic-notice a {
  color: #fff;
  word-break: break-all;
}

.notify-hint {
  background: rgba(108, 99, 255, 0.18);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  color: #c9d1ff;
  line-height: 1.5;
  text-align: left;
}

.notify-button {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #6c63ff, #4f8cff);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.hear-reply-button {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f8cff, #38bdf8);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.phone-hint {
  margin-top: 12px;
  color: #9be7a0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  margin-bottom: 8px;
}

.top-bar h1 {
  margin: 0;
}

.user-label {
  margin: 6px 0 0;
  color: #a9b0d9;
  font-size: 0.9rem;
}

.time-label {
  margin: 4px 0 0;
  color: #8fd4ff;
  font-size: 0.85rem;
}

.reminders-panel {
  margin-top: 24px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
}

.reminders-panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #c9d1ff;
}

.reminders-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #e8e8e8;
  line-height: 1.6;
}

.switch-user {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  white-space: nowrap;
}

h1 {
  margin: 0 0 8px;
  font-size: 3rem;
}

.tagline {
  margin: 0 0 40px;
  color: #c9d1ff;
}

#talkButton {
  width: 100%;
  max-width: 320px;
  padding: 28px 24px;
  border: none;
  border-radius: 999px;
  background: #6c63ff;
  color: white;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

#talkButton:hover {
  background: #5a52e0;
  transform: scale(1.02);
}

#talkButton:disabled {
  background: #4a4a68;
  cursor: not-allowed;
  transform: none;
}

#talkButton.recording {
  background: #e74c3c;
}

.or-divider {
  margin: 28px 0 16px;
  color: #a9b0d9;
}

.text-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

#messageInput {
  flex: 1;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
}

#sendButton {
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: #4caf50;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

#sendButton:disabled {
  background: #4a4a68;
  cursor: not-allowed;
}

.status {
  margin-top: 24px;
  min-height: 24px;
  color: #d6d6d6;
}

.conversation {
  margin-top: 32px;
  text-align: left;
}

.message {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 12px;
  line-height: 1.5;
}

.message.you {
  background: rgba(255, 255, 255, 0.08);
}

.message.aidan {
  background: rgba(108, 99, 255, 0.25);
}

.message strong {
  display: block;
  margin-bottom: 6px;
}
