:root {
  color-scheme: light dark;
  --teal: #00b8c4;
  --gold: #ffca36;
  --navy: #0b3a58;
  --bg: #edf7f7;
  --surface: #fff;
  --ink: #153f56;
  --muted: #516d7d;
  --border: #d8e9eb;
  --bubble: #edf7f8;
  --notice: #fff7df;
  --notice-ink: #684d13;
  --accent-text: #007781;
  --shadow: 0 18px 55px #0b3a5814;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1, h2, p { margin: 0; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
a { color: var(--accent-text); }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner {
  max-width: 1192px;
  padding: 14px 16px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.brand { display: flex; gap: 11px; align-items: center; }
.brand strong { display: block; font-size: 19px; font-weight: 900; letter-spacing: .12em; line-height: 1.15; }
.brand span, .header-tag { font-size: 12px; color: var(--muted); }
.header-tag { text-align: right; }
.header-tag span { color: var(--accent-text); padding-inline: 2px; }

.layout { max-width: 1192px; margin: auto; padding: 14px 12px max(16px, env(safe-area-inset-bottom)); }
.intro { display: none; }
.chat {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 104px);
  min-height: 510px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  color: #fff;
  background: var(--navy);
}
.chat-header img { width: 38px; height: auto; }
.chat-identity { flex: 1; }
.chat-header h2 { font-size: clamp(15px, 4.5vw, 20px); line-height: 1.35; }
.chat-header p { font-size: 12px; color: #cae6ee; margin-top: 3px; }
.mode {
  flex: none;
  border-radius: 40px;
  background: var(--gold);
  color: #342707;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 750;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  background: var(--notice);
  color: var(--notice-ink);
  font-size: 12px;
  line-height: 1.65;
}
.notice p:first-child { font-weight: 700; }
.notice-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
  line-height: 1;
}
.noscript { padding: 12px; }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 12px 8px;
}
.messages:focus-visible { outline-offset: -3px; }
.message { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.message.user { justify-content: flex-end; }
.message-content { min-width: 0; max-width: min(88%, 490px); }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 10px;
}
.avatar img { display: block; width: auto; height: 22px; }
.sender { font-size: 11px; font-weight: 750; color: var(--muted); margin: 0 0 5px 2px; }
.user .sender { text-align: right; margin-right: 2px; }
.bubble {
  background: var(--bubble);
  border-radius: 3px 15px 15px 15px;
  padding: 11px 13px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.user .bubble { background: var(--navy); color: #fff; border-radius: 15px 3px 15px 15px; }
.chat-status { padding: 0 14px; color: var(--muted); font-size: 12px; }
.chat-status:not(:empty) { padding-bottom: 8px; }

.composer { border-top: 1px solid var(--border); padding: 10px 12px 12px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 9px; }
.shortcuts button {
  background: var(--surface);
  color: var(--accent-text);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 5px 11px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 700;
}
.shortcuts button span { margin-right: 3px; }
.shortcuts button:not(:disabled):hover { background: var(--bubble); border-color: var(--accent-text); }
.shortcuts button:disabled { opacity: .65; }
form { display: flex; gap: 8px; }
input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 16px;
}
input::placeholder { color: var(--muted); }
.send {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  background: var(--teal);
  color: var(--navy);
  border: 0;
  border-radius: 11px;
}
.send:not(:disabled):hover { background: var(--gold); }
.send:disabled { opacity: .55; }
.send svg { width: 22px; height: 22px; }
.composer-note { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.composer-note a { font-weight: 750; }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

.entry-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.entry-card { width: min(100%, 450px); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 22px; padding: 28px; }
.entry-card .eyebrow { margin: 16px 0 8px; color: var(--accent-text); }
.entry-card h1 { font-size: 27px; margin-bottom: 10px; }
.entry-card > p { line-height: 1.7; }
.primary-link { display: inline-flex; gap: 9px; align-items: center; background: var(--gold); color: var(--navy); font-weight: 800; padding: 12px 16px; margin-top: 22px; border-radius: 10px; text-decoration: none; }
.primary-link:hover { text-decoration: underline; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .17em; font-weight: 850; }
.eyebrow > span { background: var(--gold); width: 8px; height: 8px; border-radius: 50%; }

@media (min-width: 820px) {
  .header-inner { padding: 17px 28px; }
  .layout { padding: 36px 28px; display: grid; grid-template-columns: minmax(275px, .7fr) minmax(0, 1fr); gap: 22px; }
  .intro {
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-radius: 22px;
    padding: 34px 30px;
    color: #fff;
    background: linear-gradient(152deg, #0b3a58 24%, #0b3a58 52%, #075867 100%);
  }
  .intro .eyebrow { color: #8ce3e5; }
  .intro h1 { font-size: clamp(32px, 4vw, 52px); line-height: 1.24; margin: 22px 0 16px; }
  .intro h1 span { color: var(--gold); }
  .intro-copy { color: #d1ebf1; font-size: 15px; line-height: 1.8; }
  .pitch { width: calc(100% + 32px); max-height: 230px; color: #85dfe34f; position: absolute; left: -12px; bottom: 82px; z-index: -1; }
  .intro-footer { display: grid; gap: 5px; margin-top: auto; color: #90dfe2; font-size: 10px; font-weight: 850; letter-spacing: .16em; }
  .intro-footer span { color: #d1ebf1; font-size: 13px; font-weight: 500; letter-spacing: .05em; }
  .chat { height: clamp(550px, calc(100dvh - 148px), 760px); border-radius: 22px; }
  .chat-header { padding: 18px 22px; gap: 13px; }
  .chat-header img { width: 46px; }
  .mode { padding: 7px 11px; font-size: 12px; }
  .notice, .chat-status { padding-inline: 22px; }
  .notice { padding-block: 11px; font-size: 13px; }
  .messages { padding: 22px 22px 8px; }
  .composer { padding: 13px 22px 16px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #102634;
    --surface: #132f40;
    --ink: #e9f7f8;
    --muted: #b3cbd4;
    --border: #345466;
    --bubble: #203e4f;
    --notice: #45381d;
    --notice-ink: #ffdf9b;
    --accent-text: #85e5e7;
    --shadow: none;
  }
}

.trial-handoff {
  margin-block: 8px;
  font-size: .875rem;
}
.trial-handoff summary { cursor: pointer; font-weight: 650; }
.trial-handoff p { margin: 6px 0; }
.trial-handoff label { display: block; margin-block: 6px; }
.trial-handoff select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  font: inherit;
}
.trial-handoff a { display: inline-block; padding-block: 6px; }
