:root {
  color-scheme: dark;
  --bg: #070b13;
  --panel: #0d1422;
  --panel-soft: #111b2c;
  --panel-strong: #07101f;
  --text: #e7eefc;
  --muted: #8ea0bb;
  --line: #22324b;
  --line-strong: #314563;
  --primary: #2f80ff;
  --primary-strong: #67a5ff;
  --primary-soft: #0f2a52;
  --accent: #58d5ff;
  --danger: #ff6b6b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(47, 128, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #09111f 0%, var(--bg) 42%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  margin-bottom: 14px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--primary), #57d4ff);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-pill,
.status-pill,
.nav-link {
  height: 34px;
  min-width: 86px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.nav-link {
  padding: 0 14px;
  text-decoration: none;
}

.nav-link:hover {
  border-color: rgba(88, 181, 255, 0.5);
  color: var(--text);
  background: #17243a;
}

.model-pill {
  color: #cfe2ff;
  background: var(--primary-soft);
  border-color: rgba(47, 128, 255, 0.38);
}

.mode-picker { margin: 0; min-width: 118px; }
.mode-picker select { height: 34px; background: var(--primary-soft); border-color: rgba(47,128,255,.38); color: #cfe2ff; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.message-copy { width: auto; height: 26px; padding: 0 9px; border: 1px solid var(--line); background: #17243a; font-size: 12px; }
.pricing-notes { display: none; }
.login-dialog { width: min(460px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); }
.login-dialog::backdrop { background: rgba(2, 7, 16, .76); backdrop-filter: blur(4px); }
.login-card { padding: 22px; }
.login-tabs, .code-row { display: flex; gap: 10px; margin-bottom: 16px; }
.login-tabs button { flex: 1; }
.code-row input { flex: 1; }
.code-row button { white-space: nowrap; }
.login-card section > button { width: 100%; }
.login-qr-placeholder { display: grid; place-items: center; min-height: 220px; padding: 24px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); text-align: center; }
.login-status { margin-top: 14px; color: var(--muted); font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 320px minmax(360px, 0.92fr) minmax(460px, 1.25fr);
  gap: 14px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head,
.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2,
.answer-head h2 {
  font-size: 17px;
  line-height: 1.25;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 118px;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: #6f829e;
}

.file-import,
.voice-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.file-import {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.file-import input[type="file"] {
  display: none;
}

.file-import button {
  width: 100%;
}

.file-import span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.voice-box {
  margin-top: 12px;
  padding: 12px;
}

.voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
}

.voice-head span {
  color: var(--muted);
  font-size: 13px;
}

.transcript {
  min-height: 58px;
  max-height: 120px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
}

.inline-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.actions.compact {
  margin-top: 10px;
}

button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--primary-strong);
  color: #06101f;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button.secondary,
.icon-button {
  background: #17243a;
  color: var(--text);
  border: 1px solid var(--line);
}

button.secondary:hover,
.icon-button:hover {
  background: #223552;
  color: var(--text);
}

.answer-panel {
  display: flex;
  height: calc(100vh - 96px);
  min-height: 620px;
  max-height: 760px;
  flex-direction: column;
}

.chat-log {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 14px;
  height: 640px;
  min-height: 640px;
  max-height: 640px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #091222 0%, var(--panel-strong) 100%);
  scrollbar-color: #375780 #0b1526;
  scrollbar-width: thin;
}

.empty-chat {
  margin: auto;
  color: var(--muted);
  font-size: 14px;
}

.chat-message {
  display: grid;
  gap: 6px;
  max-width: 88%;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-meta {
  font-size: 12px;
  color: var(--muted);
}

.chat-message.user .chat-meta {
  text-align: right;
}

.chat-bubble {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101a2b;
  color: var(--text);
  line-height: 1.65;
  word-break: break-word;
}

.chat-message.user .chat-bubble {
  background: #113c74;
  border-color: rgba(88, 181, 255, 0.45);
}

.chat-message.assistant .chat-bubble {
  background: #101a2b;
  border-color: #2a3d58;
}

.pricing-shell {
  max-width: 1220px;
}

.pricing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.pricing-hero > div,
.price-card,
.note-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pricing-hero > div:first-child {
  padding: 28px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 10px;
}

.pricing-hero h2 {
  max-width: 760px;
  font-size: 34px;
  line-height: 1.18;
}

.hero-copy {
  max-width: 820px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.75;
}

.price-summary {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  background:
    radial-gradient(circle at 85% 20%, rgba(88, 213, 255, 0.18), transparent 36%),
    var(--primary-soft);
}

.price-summary span,
.price-summary p {
  color: #b8c9e4;
}

.price-summary strong {
  color: #fff;
  font-size: 38px;
  line-height: 1.1;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 390px;
  padding: 20px;
}

.price-card.featured {
  border-color: rgba(88, 181, 255, 0.72);
  box-shadow: 0 20px 52px rgba(47, 128, 255, 0.18);
}

.badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
}

.plan-head {
  display: grid;
  gap: 6px;
  padding-right: 54px;
}

.plan-head h3 {
  font-size: 20px;
}

.plan-head span,
.quota,
.price-card li,
.note-card p {
  color: var(--muted);
}

.price {
  margin: 24px 0 4px;
  color: #fff;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

.price small {
  margin-right: 4px;
  color: var(--primary-strong);
  font-size: 22px;
}

.quota {
  margin-bottom: 18px;
}

.price-card ul {
  display: grid;
  gap: 10px;
  margin: 0 0 22px;
  padding-left: 18px;
  line-height: 1.55;
}

.buy-button {
  display: grid;
  place-items: center;
  height: 42px;
  width: 100%;
  margin-top: auto;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

.buy-button:hover {
  background: var(--primary-strong);
  color: #06101f;
}

.secondary-buy {
  background: #17243a;
  border: 1px solid var(--line);
  color: var(--text);
}

.secondary-buy:hover {
  background: #223552;
  color: var(--text);
}

.buy-button.selected {
  outline: 3px solid rgba(88, 213, 255, 0.26);
  border: 1px solid rgba(88, 213, 255, 0.78);
}

.pricing-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.payment-panel,
.checkout-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.payment-panel h3,
.checkout-panel h2 {
  margin-bottom: 8px;
}

.payment-panel p,
.checkout-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.pay-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.pay-actions button {
  min-width: 120px;
}

.checkout-panel {
  display: grid;
  align-items: start;
}

.qr-placeholder {
  display: grid;
  gap: 10px;
}

.qr-placeholder textarea {
  min-height: 96px;
  resize: none;
}

.note-card {
  padding: 18px;
}

.note-card h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.note-card p {
  line-height: 1.7;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .answer-panel {
    grid-column: 1 / -1;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .chat-log {
    height: 560px;
    min-height: 560px;
    max-height: 560px;
  }

  .pricing-hero,
  .pricing-notes,
  .payment-panel {
    grid-template-columns: 1fr;
  }

  .payment-panel {
    display: grid;
  }

  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(760px, calc(100vw - 20px));
    padding: 12px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .model-pill,
  .status-pill,
  .nav-link {
    flex: 1;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .chat-log {
    height: 460px;
    min-height: 460px;
    max-height: 460px;
  }

  .chat-message {
    max-width: 96%;
  }

  .pricing-hero h2 {
    font-size: 26px;
  }

  .pricing-hero > div:first-child,
  .price-summary,
  .price-card,
  .note-card {
    padding: 16px;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .price-card {
    min-height: 0;
  }

  .pay-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
