:root {
  color-scheme: light;
  --ink: #2b2119;
  --muted: #74665b;
  --paper: #fffdf8;
  --cream: #fff4df;
  --line: #eadbc4;
  --red: #aa3325;
  --red-dark: #7f2119;
  --green: #34755b;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(206, 91, 51, .12), transparent 28rem),
    linear-gradient(180deg, #fff8ed 0, #f7efe4 100%);
}

button, textarea, input { font: inherit; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(43, 33, 25, .62);
  backdrop-filter: blur(12px);
}
.access-gate[hidden] { display: none; }
.access-card {
  width: min(390px, 100%);
  padding: 34px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(33, 20, 12, .3);
}
.access-card .brand-mark { margin: 0 auto 18px; }
.access-card h2 { margin: 10px 0; font-size: 27px; }
.access-card > p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.access-card input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; }
.access-card input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(170, 51, 37, .1); }
.access-card button { width: 100%; margin-top: 10px; padding: 13px; color: white; background: var(--red); border: 0; border-radius: 12px; cursor: pointer; font-weight: 750; }
.access-card span { display: block; min-height: 20px; margin-top: 10px; color: var(--red); font-size: 12px; }

.shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 24px 34px;
}

.hero {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #fff8ed;
  background: var(--red);
  border-radius: 18px 18px 18px 5px;
  box-shadow: 0 10px 25px rgba(127, 33, 25, .22);
  font: 700 29px/1 Georgia, serif;
}

.eyebrow, .suggestions > p {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

h1 { margin: 0; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.04em; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}
.status span { width: 8px; height: 8px; background: #50a37f; border-radius: 50%; box-shadow: 0 0 0 5px rgba(80,163,127,.13); }

.welcome {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  margin: 34px 0 24px;
  padding: clamp(24px, 5vw, 42px);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(170, 51, 37, .14);
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(72, 44, 24, .08);
}

.label { display: inline-block; padding: 5px 10px; color: var(--red); background: #ffe8d4; border-radius: 99px; font-size: 12px; font-weight: 750; }
.welcome h2 { max-width: 520px; margin: 16px 0 12px; font-size: clamp(27px, 5vw, 45px); line-height: 1.08; letter-spacing: -.05em; }
.welcome p { max-width: 550px; margin: 0; color: var(--muted); line-height: 1.75; }
.stats { display: flex; align-items: center; gap: 28px; }
.stats div { display: grid; gap: 3px; text-align: center; }
.stats strong { color: var(--red); font: 700 32px/1 Georgia, serif; }
.stats span { color: var(--muted); font-size: 12px; white-space: nowrap; }

.suggestions { margin: 25px 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 9px; }
.chip-list button {
  padding: 10px 14px;
  color: #5f4d3e;
  background: rgba(255, 253, 248, .8);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  transition: .18s ease;
}
.chip-list button:hover { color: var(--red); border-color: #d49b79; transform: translateY(-1px); }

.conversation { display: grid; gap: 18px; margin: 20px 0; }
.message { display: flex; }
.message.user { justify-content: flex-end; }
.message.user > div { max-width: 78%; padding: 13px 17px; color: white; background: var(--red); border-radius: 20px 20px 5px 20px; line-height: 1.65; box-shadow: 0 8px 22px rgba(127, 33, 25, .16); }
.message.assistant { display: block; max-width: 88%; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px 22px 22px 22px; box-shadow: 0 10px 30px rgba(72, 44, 24, .06); }
.answer { line-height: 1.8; }
.engine { margin-top: 13px; color: var(--muted); font-size: 11px; }
.source-list { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.source-list h3 { margin: 0 0 10px; font-size: 13px; }
.source-card { padding: 9px 0; border-top: 1px dashed #eadfce; }
.source-card summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.source-card summary span { display: grid; min-width: 22px; height: 22px; place-items: center; color: white; background: var(--red); border-radius: 50%; font-size: 11px; }
.source-card summary b { font-size: 13px; }
.source-card summary em { margin-left: auto; color: var(--muted); font-size: 11px; font-style: normal; }
.source-card p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.source-card footer { color: #8b796a; font-size: 11px; overflow-wrap: anywhere; }
.source-card footer a { margin-left: 8px; color: var(--red); }

.loading { display: flex !important; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.loading i { width: 7px; height: 7px; background: var(--red); border-radius: 50%; animation: bounce .9s infinite alternate; }
.loading i:nth-child(2) { animation-delay: .15s; }
.loading i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { opacity: .25; transform: translateY(-5px); } }

.composer {
  position: sticky;
  bottom: 14px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 253, 248, .93);
  border: 1px solid #dfcdb6;
  border-radius: 20px;
  box-shadow: 0 15px 45px rgba(72, 44, 24, .15);
  backdrop-filter: blur(16px);
}
.composer textarea { width: 100%; min-height: 48px; max-height: 150px; padding: 13px 14px; resize: none; color: var(--ink); background: transparent; border: 0; outline: 0; line-height: 1.55; }
.composer button { display: flex; min-width: 100px; align-items: center; justify-content: center; gap: 7px; color: white; background: var(--red); border: 0; border-radius: 14px; cursor: pointer; font-weight: 750; }
.composer button:disabled { opacity: .5; cursor: wait; }
.composer svg { width: 19px; fill: currentColor; }
.footnote { margin: 13px 0 0; color: var(--muted); text-align: center; font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 680px) {
  .shell { padding: 18px 14px 24px; }
  .hero { grid-template-columns: 48px 1fr; gap: 12px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 14px 14px 14px 4px; font-size: 23px; }
  .status { grid-column: 2; }
  .subtitle { display: none; }
  .welcome { grid-template-columns: 1fr; gap: 22px; padding: 25px 20px; border-radius: 22px; }
  .stats { justify-content: flex-start; }
  .message.assistant, .message.user > div { max-width: 94%; }
  .composer button { min-width: 54px; }
  .composer button span { display: none; }
}
