:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #f7f7f8;
  --ink: #111111;
  --muted: #5f6368;
  --line: #d8dadd;
  --line-strong: #111111;
  --accent: #e4002b;
  --blue: #002fa7;
  --cyan: #00a7b5;
  --shadow: 0 24px 80px rgba(17, 17, 17, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.06) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(0deg, rgba(17, 17, 17, 0.04) 1px, transparent 1px) 0 0 / 80px 80px,
    var(--bg);
  font-family: Helvetica Neue, Arial, PingFang SC, Microsoft YaHei, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.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;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: min(1180px, 100%);
  height: 72px;
  margin: 0 auto;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 20px;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 800;
  line-height: 1;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
}

.brand-symbol svg {
  width: 22px;
  height: 22px;
}

.header-actions {
  display: flex;
  border-left: 1px solid var(--line);
}

.text-button {
  min-width: 112px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.text-button:hover,
.text-button:focus-visible {
  background: var(--paper);
  outline: none;
}

.page-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 112px 20px 188px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(260px, 0.55fr);
  gap: 32px;
  align-items: end;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line-strong);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

#heroTitle {
  grid-column: 1 / 2;
  margin: 0;
  font-size: clamp(42px, 6vw, 88px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-intro {
  grid-column: 2 / 3;
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.starter-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
}

.prompt-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  font-size: 16px;
  font-weight: 800;
}

.prompt-chip:last-child {
  border-right: 0;
}

.prompt-chip:nth-child(2) .chip-icon {
  color: var(--blue);
}

.prompt-chip:nth-child(3) .chip-icon {
  color: var(--cyan);
}

.prompt-chip:hover,
.prompt-chip:focus-visible {
  background: var(--paper);
  outline: none;
}

.chip-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--accent);
}

.chat-panel {
  min-height: 340px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 340px;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-number {
  color: var(--line);
  font-size: clamp(82px, 13vw, 160px);
  font-weight: 900;
  line-height: 0.9;
}

.empty-state p {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.chat-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 390px);
  min-height: 340px;
  padding: 28px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.chat-message {
  display: flex;
  gap: 12px;
  width: 100%;
  animation: rise-in 220ms ease both;
}

.chat-message.user {
  justify-content: flex-end;
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.chat-message.user .message-avatar {
  order: 2;
  background: var(--ink);
  color: #ffffff;
}

.message-bubble {
  max-width: min(76%, 720px);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  line-height: 1.7;
  box-shadow: 10px 10px 0 var(--paper);
}

.chat-message.user .message-bubble {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
  box-shadow: 10px 10px 0 rgba(228, 0, 43, 0.12);
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.composer-wrap {
  position: fixed;
  right: 20px;
  bottom: 18px;
  left: 20px;
  z-index: 25;
  width: min(860px, calc(100% - 40px));
  margin: 0 auto;
}

.chat-form {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.chat-form.is-focused {
  outline: 3px solid rgba(228, 0, 43, 0.16);
}

#messageInput {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

#messageInput::placeholder {
  color: #8a8f98;
}

.icon-button,
.send-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}

.icon-button svg,
.send-button svg {
  width: 22px;
  height: 22px;
}

.icon-button.ghost {
  border-color: transparent;
}

.send-button {
  width: 48px;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.icon-button:hover,
.send-button:hover,
.icon-button:focus-visible,
.send-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.connection-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.08) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(0deg, rgba(17, 17, 17, 0.06) 1px, transparent 1px) 0 0 / 64px 64px,
    rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.login-copy {
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.7;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  font-weight: 800;
}

.login-card input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.login-card input:focus {
  outline: 3px solid rgba(228, 0, 43, 0.16);
}

.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 14px;
  line-height: 1.5;
}

.embed-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 24px;
  background: rgba(17, 17, 17, 0.42);
}

.embed-shell {
  display: flex;
  flex-direction: column;
  width: min(1060px, 100%);
  height: min(760px, calc(100vh - 48px));
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-strong);
}

.embed-header h2,
.embed-header p {
  margin: 0;
}

.empty-embed {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  flex: 1;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-embed h3 {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.2;
}

.empty-embed p {
  max-width: 480px;
  margin: 0;
  line-height: 1.7;
}

#yuanqiFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .header-inner {
    height: auto;
    min-height: 64px;
    align-items: center;
  }

  .brand-mark {
    padding: 12px 14px;
    font-size: 18px;
  }

  .brand-symbol {
    width: 32px;
    height: 32px;
  }

  .header-actions {
    align-self: stretch;
  }

  .text-button {
    min-width: auto;
    padding: 0 12px;
    font-size: 13px;
  }

  .page-shell {
    padding: 92px 14px 174px;
  }

  .hero-section {
    display: block;
    padding-bottom: 26px;
  }

  #heroTitle {
    font-size: clamp(38px, 13vw, 58px);
  }

  .hero-intro {
    margin-top: 18px;
    font-size: 16px;
  }

  .starter-section {
    grid-template-columns: 1fr;
  }

  .prompt-chip {
    min-height: 64px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .prompt-chip:last-child {
    border-bottom: 0;
  }

  .chat-container {
    max-height: calc(100vh - 420px);
  }

  .message-bubble {
    max-width: calc(100vw - 106px);
  }

  .composer-wrap {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }

  .chat-form {
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    gap: 6px;
    padding: 8px;
  }

  .icon-button,
  .send-button {
    width: 40px;
    height: 40px;
  }

  #messageInput {
    height: 40px;
    font-size: 15px;
  }

  .embed-overlay {
    padding: 12px;
  }

  .embed-shell {
    height: calc(100vh - 24px);
  }
}

@media (max-width: 420px) {
  .brand-mark span:last-child {
    max-width: 8.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .text-button {
    padding: 0 8px;
  }
}
