:root {
  color-scheme: light;
  --bg-deep: #073b52;
  --bg-sea: #0a6a8a;
  --ink: #0f2430;
  --muted: #5b7280;
  --accent: #ff8f3f;
  --accent-strong: #ef6a1f;
  --line: rgba(15, 36, 48, 0.12);
  --shadow: 0 20px 40px rgba(7, 59, 82, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(180deg, #8fd7f1 0%, #4cb6d6 26%, #0b6989 62%, #08506a 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 24%),
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.32), transparent 10%),
    radial-gradient(circle at 82% 10%, rgba(255, 212, 160, 0.22), transparent 14%);
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.topbar {
  display: grid;
  gap: 14px;
  padding: 6px 2px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, #0f8ec0, #ffd08d);
  box-shadow: 0 14px 28px rgba(4, 53, 73, 0.22);
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-sub,
.topbar-note,
.chat-sub,
.status,
.library-note,
.hero p,
.library p {
  color: var(--muted);
}

.topbar-note {
  font-size: 0.92rem;
}

.layout {
  display: grid;
  gap: 16px;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(248, 251, 253, 0.94), rgba(248, 251, 253, 0.88)),
    rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero,
.chat,
.library {
  padding: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 143, 63, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.hero h1,
.library h2 {
  margin: 16px 0 12px;
  font-family: "Fraunces", serif;
  line-height: 0.97;
}

.hero h1 {
  font-size: clamp(2.2rem, 7vw, 4.6rem);
  max-width: 12ch;
}

.hero p,
.library p {
  font-size: 1rem;
  line-height: 1.65;
  margin: 0 0 18px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-chip,
.topic-pill,
.ghost-btn,
.send-btn {
  appearance: none;
  border: 0;
  font: inherit;
}

.prompt-chip {
  padding: 12px 14px;
  border-radius: 18px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
  text-align: left;
}

.chat {
  display: grid;
  gap: 14px;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.chat-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.ghost-btn {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(7, 59, 82, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
}

.chat-body {
  min-height: 320px;
  max-height: 58vh;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.bubble {
  max-width: 92%;
  padding: 14px 16px;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(7, 59, 82, 0.06);
}

.bubble p {
  margin: 0;
  line-height: 1.6;
}

.bubble-user {
  margin-left: auto;
  background: linear-gradient(135deg, #0f7da3, #11658a);
  color: #f8fbfd;
  border-bottom-right-radius: 6px;
}

.bubble-assistant {
  background: #fff9f0;
  border: 1px solid rgba(239, 106, 31, 0.12);
  border-bottom-left-radius: 6px;
}

.bubble-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 59, 82, 0.06);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.chat-form {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

textarea:focus,
.prompt-chip:focus,
.ghost-btn:focus,
.send-btn:focus {
  outline: 3px solid rgba(255, 143, 63, 0.24);
  outline-offset: 2px;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status {
  font-size: 0.92rem;
}

.send-btn {
  min-width: 96px;
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #ffc45f);
  color: #42210b;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(255, 143, 63, 0.26);
}

.send-btn[disabled] {
  opacity: 0.7;
}

.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.topic-pill {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(11, 105, 137, 0.08);
  border: 1px solid rgba(11, 105, 137, 0.1);
  color: var(--ink);
  font-weight: 700;
}

.library-note {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(7, 59, 82, 0.16);
}

.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 (min-width: 960px) {
  .shell {
    padding: 26px 22px 54px;
  }

  .layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
    align-items: start;
  }

  .hero {
    grid-column: 1 / -1;
  }

  .chat {
    min-height: 720px;
  }

  .library {
    position: sticky;
    top: 22px;
  }
}
