:root {
  --bg-1: #0a1a2a;
  --bg-2: #0f2a3f;
  --bg-3: #1b4d66;
  --accent-1: #00f0ff;
  --accent-2: #66ffcc;
  --accent-3: #1bd4ff;
  --text-1: #e8fbff;
  --text-2: #b6d6e6;
  --panel: rgba(7, 20, 35, 0.72);
  --panel-strong: rgba(6, 18, 29, 0.86);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--text-1);
  background: radial-gradient(circle at top left, #11324a 0%, #0a1a2a 45%, #06121d 100%);
  overflow: auto;
}

body.consent-required {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 84px 84px;
  opacity: 0.18;
  pointer-events: none;
}

.bg-grid,
.bg-orb {
  position: fixed;
  pointer-events: none;
  inset: auto;
}

.consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 10, 18, 0.78);
  backdrop-filter: blur(14px);
}

body.consent-required .consent-overlay {
  display: flex;
}

.consent-card {
  width: min(100%, 560px);
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(13, 30, 45, 0.96), rgba(8, 18, 31, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.consent-card h2 {
  margin: 8px 0 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.consent-copy {
  margin: 14px 0 0;
  color: var(--text-1);
  line-height: 1.7;
}

.consent-actions {
  margin-top: 20px;
}

.consent-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 18px;
  font: inherit;
  font-weight: 700;
  color: #031019;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 14px 28px rgba(0, 240, 255, 0.24);
}

.bg-grid {
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 240, 255, 0.14), transparent 24%),
    radial-gradient(circle at 80% 25%, rgba(102, 255, 204, 0.14), transparent 28%),
    radial-gradient(circle at 60% 80%, rgba(27, 212, 255, 0.12), transparent 24%);
}

.bg-orb {
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.24;
}

.orb-a {
  top: -6rem;
  right: -5rem;
  background: var(--accent-1);
}

.orb-b {
  bottom: -10rem;
  left: -6rem;
  background: var(--accent-2);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  min-height: 100dvh;
  padding: 20px;
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 0 20px 24px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.6;
}

.site-footer a {
  color: var(--accent-2);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.sidebar,
.chat-shell {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.mode-picker {
  margin: 0 18px 18px;
  display: grid;
  gap: 16px;
}

.mode-picker-card,
.mode-card,
.voice-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.mode-picker-intro {
  padding: 22px;
}

.mode-picker-intro h3 {
  margin: 8px 0 0;
  font-size: 1.5rem;
  line-height: 1.1;
}

.session-email-label {
  display: block;
  margin-top: 16px;
  color: var(--text-1);
  font-size: 0.92rem;
  font-weight: 600;
}

.session-email-input {
  width: 100%;
  margin-top: 8px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(5, 15, 24, 0.72);
  color: var(--text-1);
  font: inherit;
  outline: none;
}

.session-email-input::placeholder {
  color: rgba(182, 214, 230, 0.6);
}

.mode-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mode-card {
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  text-align: left;
  color: var(--text-1);
  cursor: pointer;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(115, 244, 255, 0.28);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.26);
}

.mode-card-voice {
  background:
    radial-gradient(circle at top right, rgba(102, 255, 204, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(14, 35, 49, 0.96), rgba(8, 21, 34, 0.96));
}

.mode-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #031019;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(0, 240, 255, 0.2);
}

.mode-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.mode-card-text {
  color: var(--text-2);
  font-size: 0.96rem;
  line-height: 1.65;
}

.voice-panel {
  margin: 0 18px 18px;
  padding: 20px;
}

.voice-panel-copy p:last-child {
  margin: 8px 0 0;
  color: var(--text-1);
  line-height: 1.65;
}

.voice-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.voice-button,
.voice-stop-button,
.voice-secondary-button {
  border: 0;
  border-radius: 18px;
  min-height: 48px;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.voice-button {
  color: #031019;
  background: linear-gradient(135deg, #8cfbd8, #54e6ff);
}

.voice-stop-button,
.voice-secondary-button {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.voice-transcript {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  line-height: 1.65;
  white-space: pre-wrap;
}

.brand-card,
.sidebar-card,
.chat-header,
.composer,
.message-bubble {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
}

.brand-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #021018;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.25);
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.25);
}

.eyebrow,
.card-label,
.message-role {
  margin: 0;
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--text-2);
}

.brand-card h1,
.chat-header h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.sidebar-card {
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card-copy {
  margin: 8px 0 0;
  color: var(--text-1);
  font-size: 0.95rem;
  line-height: 1.65;
}

.card-note {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 0.84rem;
  line-height: 1.5;
}

.decision-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.decision-list span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(102, 255, 204, 0.25);
  color: var(--text-1);
  background: rgba(2, 11, 18, 0.55);
  font-size: 0.86rem;
}

.chat-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100dvh - 40px);
  overflow: hidden;
}

.chat-header {
  margin: 18px;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ghost-button,
.composer button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.ghost-button {
  padding: 12px 16px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.composer button {
  padding: 0 20px;
  min-width: 112px;
  font-weight: 600;
  color: #031019;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 14px 24px rgba(0, 240, 255, 0.2);
}

.ghost-button:hover,
.composer button:hover {
  transform: translateY(-1px);
}

.chat-board {
  min-height: 0;
  padding: 0 22px 88px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.floating-end-pill {
  position: absolute;
  right: 26px;
  bottom: 104px;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  color: #04131c;
  cursor: pointer;
  background: linear-gradient(135deg, #8cfbd8, #54e6ff);
  box-shadow: 0 18px 40px rgba(0, 240, 255, 0.22);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.floating-end-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 42px rgba(0, 240, 255, 0.28);
}

.floating-end-pill:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  flex: 0 0 auto;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 240, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
}

.message-bubble {
  width: min(860px, calc(100% - 52px));
  border-radius: 22px;
  padding: 16px 18px;
}

.message.user .message-bubble {
  background: linear-gradient(180deg, rgba(9, 28, 44, 0.95), rgba(8, 18, 31, 0.92));
}

.message-text {
  margin-top: 8px;
  line-height: 1.75;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  margin: 0 18px 18px;
  border-radius: 24px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.composer textarea {
  width: 100%;
  resize: none;
  max-height: 180px;
  background: transparent;
  border: 0;
  color: var(--text-1);
  font: inherit;
  line-height: 1.6;
  outline: none;
}

.composer textarea::placeholder {
  color: rgba(182, 214, 230, 0.72);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 14px;
    gap: 14px;
  }

  .site-footer {
    padding: 0 14px 18px;
  }

  .chat-shell {
    order: 1;
    min-height: 72svh;
  }

  .sidebar {
    order: 2;
    padding: 16px;
  }

  .brand-card h1 {
    font-size: 1.05rem;
  }

  .chat-header {
    margin: 14px;
    padding: 16px 18px;
  }

  .mode-picker,
  .voice-panel {
    margin: 0 14px 14px;
  }

  .chat-board {
    padding: 0 14px 82px;
  }

  .composer {
    margin: 0 14px 14px;
  }

  .floating-end-pill {
    right: 20px;
    bottom: 96px;
  }
}

@media (max-width: 640px) {
  .consent-card {
    padding: 20px;
    border-radius: 22px;
  }

  .consent-card h2 {
    font-size: 1.28rem;
  }

  .shell {
    padding: 10px;
    gap: 10px;
  }

  .site-footer {
    padding: 0 12px 16px;
  }

  .site-footer p {
    font-size: 0.86rem;
  }

  .sidebar,
  .chat-shell {
    border-radius: 20px;
  }

  .sidebar {
    padding: 12px;
    gap: 12px;
  }

  .brand-card,
  .sidebar-card {
    border-radius: 18px;
    padding: 14px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 1rem;
  }

  .eyebrow,
  .card-label,
  .message-role {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
  }

  .brand-card h1,
  .chat-header h2 {
    font-size: 1rem;
  }

  .card-copy {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .decision-list {
    gap: 8px;
  }

  .decision-list span {
    font-size: 0.82rem;
    padding: 7px 11px;
  }

  .chat-shell {
    min-height: calc(100svh - 20px);
  }

  .chat-header {
    margin: 10px;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .mode-picker,
  .voice-panel {
    margin: 0 10px 10px;
  }

  .mode-picker-intro,
  .voice-panel {
    padding: 16px;
  }

  .mode-picker-intro h3 {
    font-size: 1.24rem;
  }

  .mode-picker-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-card {
    padding: 16px;
    gap: 12px;
  }

  .mode-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .mode-card-title {
    font-size: 1rem;
  }

  .mode-card-text {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .voice-actions {
    flex-direction: column;
  }

  .voice-button,
  .voice-stop-button,
  .voice-secondary-button {
    width: 100%;
  }

  .ghost-button {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
  }

  .chat-board {
    padding: 0 10px 84px;
    gap: 12px;
  }

  .message {
    gap: 10px;
  }

  .message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .message-bubble {
    width: min(100%, calc(100% - 44px));
    border-radius: 18px;
    padding: 14px;
  }

  .message-text {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .composer {
    margin: 0 10px 10px;
    padding: 12px;
    border-radius: 18px;
    grid-template-columns: 1fr;
    gap: 10px;
    position: sticky;
    bottom: 10px;
    background: linear-gradient(180deg, rgba(12, 27, 41, 0.96), rgba(7, 20, 35, 0.96));
    backdrop-filter: blur(20px);
  }

  .floating-end-pill {
    position: static;
    margin: 0 10px 10px;
    width: calc(100% - 20px);
    padding: 12px 16px;
    font-size: 0.92rem;
    text-align: center;
  }

  .composer textarea {
    font-size: 0.96rem;
    min-height: 84px;
  }

  .composer button {
    min-height: 46px;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 8px;
  }

  .floating-end-pill {
    margin: 0 8px 8px;
    width: calc(100% - 16px);
  }

  .site-footer {
    padding: 0 10px 14px;
  }

  .sidebar,
  .chat-shell {
    border-radius: 18px;
  }

  .brand-card,
  .sidebar-card,
  .chat-header,
  .composer,
  .message-bubble {
    border-radius: 16px;
  }

  .brand-card {
    gap: 12px;
  }

  .brand-card h1 {
    font-size: 0.96rem;
  }

  .chat-header h2 {
    font-size: 0.96rem;
  }

  .message-text {
    font-size: 0.92rem;
  }
}
