:root {
  --ink: #17233b;
  --muted: #5a6b85;
  --brand: #1d4ed8;
  --brand-dark: #1e40af;
  --paper: #f6f8fc;
  --card: #ffffff;
  --line: #dbe4f0;
  --warn: #9b1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-header h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
}

.input-panel,
.result-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(23, 35, 59, 0.06);
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
}

textarea[data-role="primary-input"] {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

textarea[data-role="primary-input"]:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.voice-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 20px;
  font-size: 15px;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-primary:disabled {
  background: #93a8d8;
  cursor: wait;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.voice-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
}

.result-panel h2 {
  margin-top: 0;
}

.session-meta {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 6px 16px;
  margin: 0 0 16px;
}

.session-meta dt {
  color: var(--muted);
}

.session-meta dd {
  margin: 0;
  word-break: break-all;
}

.coverage-list {
  margin: 0 0 20px;
  padding-left: 20px;
}

.download-area .btn {
  margin-bottom: 12px;
}

.disclosure {
  color: var(--warn);
  font-size: 14px;
  margin: 0;
}

.page-footer {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 480px) {
  .page {
    padding: 20px 12px 48px;
  }

  .button-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

.access-gate {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.access-gate[hidden] {
  display: none;
}

.access-gate-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
}

.access-gate-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.access-gate-card p {
  color: var(--muted, #475569);
  font-size: 14px;
  line-height: 1.6;
}

.access-gate-card input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* ---------- 对话式界面 ---------- */

.chat-panel {
  margin-bottom: 16px;
}

.chat-thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  color: var(--muted, #64748b);
  font-size: 14px;
  text-align: center;
  padding: 24px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-ai {
  align-self: flex-start;
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}

.bubble-user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  background: #f1f5f9;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  color: #475569;
  font-size: 14px;
}

.thinking[hidden] {
  display: none;
}

.dots {
  display: inline-flex;
  gap: 4px;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: dot-blink 1.2s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-blink {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

.composer {
  position: sticky;
  bottom: 0;
  background: #ffffff;
  padding: 12px 0 8px;
  border-top: 1px solid #e2e8f0;
  z-index: 10;
}

.composer textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 72px;
  font-size: 16px;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  resize: vertical;
}

.composer .button-row {
  margin-top: 8px;
}

.coverage-panel {
  margin: 12px 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #f8fafc;
}

.coverage-panel summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 15px;
  color: #0f172a;
}

.coverage-list {
  margin: 8px 0 4px;
  padding-left: 20px;
  color: #475569;
  font-size: 14px;
  line-height: 1.8;
}

.session-meta[hidden] {
  display: none;
}

/* hidden 属性必须始终生效（覆盖 .btn 等 display 规则） */
[hidden] {
  display: none !important;
}
