:root {
  --brand-deep: #004A64;
  --brand-medium: #3F778A;
  --brand-mist: #7FA4B1;
  --bg: #07131A;
  --bg-2: #0A1820;
  --surface: rgba(8, 20, 27, 0.90);
  --surface-strong: rgba(9, 21, 29, 0.98);
  --border: rgba(127, 164, 177, 0.16);
  --text: #EEF6F8;
  --text-soft: #A8BDC4;
  --shadow: 0 56px 152px rgba(0, 0, 0, 0.66);
  --font-head: Manrope, Inter, Arial, sans-serif;
  --font-body: Inter, Arial, sans-serif;
  --max-width: 1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { color-scheme: dark; }
body {
  position: relative;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 14% 14%, rgba(63, 119, 138, 0.18) 0%, rgba(63, 119, 138, 0) 28%),
    radial-gradient(circle at 84% 8%, rgba(0, 74, 100, 0.20) 0%, rgba(0, 74, 100, 0) 30%),
    radial-gradient(circle at 50% 120%, rgba(127, 164, 177, 0.08) 0%, rgba(127, 164, 177, 0) 38%),
    linear-gradient(180deg, #07131A 0%, #081720 52%, #07131A 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 72px;
  right: -180px;
  width: min(760px, 72vw);
  height: 520px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(63, 119, 138, 0.12) 0%, rgba(63, 119, 138, 0.04) 26%, rgba(63, 119, 138, 0) 60%),
    radial-gradient(circle at 42% 54%, rgba(127, 164, 177, 0.08) 0%, rgba(127, 164, 177, 0) 56%);
  filter: blur(6px);
  opacity: 0.8;
}

body::after {
  left: -140px;
  bottom: 8%;
  width: min(520px, 54vw);
  height: 520px;
  border: 1px solid rgba(127, 164, 177, 0.05);
  border-radius: 50%;
  box-shadow:
    0 0 0 44px rgba(127, 164, 177, 0.018),
    0 0 0 112px rgba(63, 119, 138, 0.015);
  opacity: 0.7;
}

button, input { font: inherit; }
input::placeholder { color: rgba(168, 189, 196, 0.74); }

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--max-width), calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  margin-bottom: 28px;
  border-radius: 24px;
  background: rgba(7, 19, 26, 0.52);
  border: 1px solid rgba(127, 164, 177, 0.08);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.18);
}

.brand-lockup {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: min(240px, 42vw);
  height: auto;
  display: block;
}

.brand-lockup p {
  margin: 0;
  max-width: 70ch;
  color: var(--text-soft);
  line-height: 1.65;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(63, 119, 138, 0.16);
  border: 1px solid rgba(127, 164, 177, 0.22);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid rgba(127, 164, 177, 0.18);
  background: rgba(127, 164, 177, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.ghost-button:hover {
  background: rgba(127, 164, 177, 0.12);
  border-color: rgba(127, 164, 177, 0.24);
}

.experience {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.experience::before,
.experience::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  border-radius: 50%;
}

.experience::before {
  top: 154px;
  left: -72px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at center, rgba(63, 119, 138, 0.14) 0%, rgba(63, 119, 138, 0) 70%);
  filter: blur(10px);
}

.experience::after {
  right: -96px;
  top: 300px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(127, 164, 177, 0.04);
  box-shadow: 0 0 0 36px rgba(127, 164, 177, 0.015);
  opacity: 0.7;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 8px 20px 4px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand-mist);
  font-size: 11px;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 0;
  max-width: 12ch;
  font-family: var(--font-head);
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.94;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.intro {
  margin: 0;
  width: min(760px, 100%);
  color: var(--text-soft);
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.48;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.chat-stage {
  position: relative;
  z-index: 1;
  padding-top: 6px;
}

.chat-stage::before,
.chat-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.chat-stage::before {
  inset: 18px -36px -18px;
  border-radius: 42px;
  background:
    radial-gradient(circle at 18% 50%, rgba(63, 119, 138, 0.10) 0%, rgba(63, 119, 138, 0) 28%),
    radial-gradient(circle at 82% 30%, rgba(0, 74, 100, 0.12) 0%, rgba(0, 74, 100, 0) 30%),
    linear-gradient(180deg, rgba(127, 164, 177, 0.03) 0%, rgba(127, 164, 177, 0) 46%, rgba(127, 164, 177, 0.03) 100%);
  opacity: 0.82;
}

.chat-stage::after {
  inset: 30px -12px -10px;
  border-radius: 36px;
  background:
    radial-gradient(circle at center, rgba(8, 20, 27, 0.02) 0%, rgba(8, 20, 27, 0.18) 40%, rgba(7, 19, 26, 0.42) 100%),
    radial-gradient(circle at center, rgba(0, 74, 100, 0.10) 0%, rgba(0, 74, 100, 0) 64%);
  opacity: 0.95;
  z-index: 0;
}

.chat-card {
  position: relative;
  z-index: 1;
  width: 100%;
  background: rgba(8, 20, 27, 0.992);
  border: 1px solid rgba(127, 164, 177, 0.26);
  border-radius: 30px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(127, 164, 177, 0.07) inset;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.chat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(127, 164, 177, 0.13);
  background: rgba(10, 24, 32, 0.982);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-title > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--brand-deep);
  color: var(--text);
  font-weight: 800;
  font-family: var(--font-head);
}

.chat-title strong {
  display: block;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.chat-title span {
  display: block;
  max-width: 44ch;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: 22px;
  min-height: 430px;
  max-height: 58vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: rgba(10, 24, 32, 0.94);
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(127, 164, 177, 0.18);
  border-radius: 999px;
}

.message {
  max-width: 84%;
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.7;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.012em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.message.assistant {
  background: var(--brand-deep);
  border: 1px solid rgba(0, 74, 100, 0.86);
  color: var(--text);
  border-top-left-radius: 10px;
}

.message.user {
  margin-left: auto;
  background: rgba(63, 119, 138, 0.96);
  border: 1px solid rgba(127, 164, 177, 0.18);
  color: var(--text);
  border-top-right-radius: 10px;
}

.message.system {
  max-width: 100%;
  background: rgba(127, 164, 177, 0.08);
  border: 1px solid rgba(127, 164, 177, 0.10);
  color: var(--text-soft);
  box-shadow: none;
}

.message.thinking {
  background: rgba(127, 164, 177, 0.08);
  border: 1px solid rgba(127, 164, 177, 0.14);
  color: var(--text-soft);
  box-shadow: none;
}

.message.thinking .message-content {
  color: var(--text);
}

.message-role {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.8;
}

.message-content {
  color: inherit;
}

.prompt-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  padding: 16px 22px 18px;
  border-top: 1px solid rgba(127, 164, 177, 0.13);
  background: linear-gradient(180deg, rgba(10, 24, 32, 0.91), rgba(10, 24, 32, 0.985));
}

.prompt-panel-copy {
  display: grid;
  gap: 4px;
}

.prompt-panel-copy strong {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-mist);
}

.prompt-panel-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(127, 164, 177, 0.22);
  background: rgba(63, 119, 138, 0.24);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.45;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.prompt:hover {
  background: rgba(63, 119, 138, 0.30);
  border-color: rgba(127, 164, 177, 0.30);
}

.prompt:active {
  transform: translateY(1px);
}

.prompt.is-active {
  background: rgba(63, 119, 138, 0.38);
  border-color: rgba(127, 164, 177, 0.36);
  box-shadow: inset 0 0 0 1px rgba(127, 164, 177, 0.08);
}

.composer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(127, 164, 177, 0.13);
  background: rgba(10, 24, 32, 0.982);
}

.composer input,
.email-form input {
  width: 100%;
  min-width: 0;
  border-radius: 18px;
  border: 1px solid rgba(127, 164, 177, 0.14);
  background: rgba(7, 19, 26, 0.90);
  color: var(--text);
  padding: 16px 18px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.composer input:focus,
.email-form input:focus {
  border-color: rgba(127, 164, 177, 0.34);
  box-shadow: 0 0 0 1px rgba(127, 164, 177, 0.10);
  background: rgba(7, 19, 26, 0.96);
}

.composer button,
.email-form button {
  border: 0;
  border-radius: 18px;
  background: var(--brand-medium);
  color: var(--text);
  font-weight: 800;
  padding: 0 22px;
  min-height: 56px;
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease, filter 160ms ease;
  box-shadow: 0 16px 28px rgba(0, 74, 100, 0.20);
}

.composer button:hover,
.email-form button:hover {
  filter: brightness(1.04);
}

.email-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(127, 164, 177, 0.13);
  background: linear-gradient(180deg, rgba(7, 19, 26, 0.96), rgba(9, 21, 29, 0.99));
}

.email-card[hidden] {
  display: none !important;
}

.email-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.email-head small {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.email-head h2 {
  margin: 6px 0 0;
  font-family: var(--font-head);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.email-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 14px;
}

.email-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.email-form input[type="email"],
.email-form .checkbox-row,
.email-form button {
  grid-column: 1 / -1;
}

.email-form button {
  min-height: 52px;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.checkbox-row input {
  margin-top: 3px;
}

.prompt:disabled,
.ghost-button:disabled,
.composer button:disabled,
.email-form button:disabled {
  opacity: 0.58;
  cursor: default;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
  }

  .hero-copy h1 {
    max-width: 14ch;
  }

  .messages {
    min-height: 380px;
    max-height: 54vh;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 16px;
  }

  .topbar {
    position: relative;
    top: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .chat-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-pill {
    align-self: flex-start;
  }

  .messages {
    min-height: 340px;
  }

  .composer,
  .email-form {
    grid-template-columns: 1fr;
  }

  .email-form input[type="email"],
  .email-form .checkbox-row,
  .email-form button {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .brand-logo {
    width: min(210px, 56vw);
  }

  .hero-copy {
    padding-left: 10px;
    padding-right: 10px;
  }

  .hero-copy h1 {
    max-width: 11ch;
    font-size: clamp(34px, 12vw, 54px);
  }

  .intro {
    font-size: 16px;
  }

  .chat-stage::before,
  .chat-stage::after {
    inset-inline: -8px;
  }

  .messages,
  .prompt-panel,
  .composer,
  .email-card {
    padding-left: 16px;
    padding-right: 16px;
  }

  .messages {
    min-height: 320px;
    max-height: 52vh;
  }

  .message {
    max-width: 100%;
  }

  .prompt-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .composer button,
  .email-form button {
    width: 100%;
  }

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