:root {
  color-scheme: light;
  --ink: #202725;
  --muted: #66716e;
  --line: #d8dfdc;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --primary: #176b5b;
  --primary-dark: #0f5145;
  --blue: #2f6fa3;
  --blue-soft: #e8f1f8;
  --amber: #a86c08;
  --amber-soft: #fff4db;
  --danger: #a74232;
  --danger-soft: #faebe8;
  --success-soft: #e6f3ee;
  --shadow: 0 10px 30px rgba(28, 44, 39, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.65;
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 111, 163, 0.28);
  outline-offset: 2px;
}

.research-header {
  color: #fff;
  background: #24312d;
  border-bottom: 5px solid var(--primary);
}

.research-header__inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 42px;
}

.research-badge,
.study-number,
.section-kicker,
.group-code,
.preview-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.research-badge {
  color: #dff5ed;
  background: rgba(65, 175, 139, 0.18);
  border: 1px solid rgba(135, 222, 191, 0.4);
}

.research-header h1 {
  margin: 14px 0 8px;
  max-width: 820px;
  font-size: 36px;
  line-height: 1.22;
}

.research-header p {
  margin: 0;
  color: #d3ded9;
  font-size: 16px;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 28px;
  color: #d9e3df;
}

.summary-row span {
  padding-right: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-row span:last-child {
  border-right: 0;
}

.summary-row strong {
  color: #fff;
  font-size: 22px;
}

.research-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.protocol-band {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.7fr) auto;
  gap: 24px;
  align-items: center;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.section-kicker {
  padding: 0;
  color: var(--primary);
}

.protocol-band h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.protocol-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
}

.protocol-flow svg {
  width: 16px;
}

.study-section {
  padding: 42px 0 46px;
  border-bottom: 1px solid var(--line);
}

.study-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.study-number {
  color: var(--primary-dark);
  background: var(--success-soft);
}

.study-heading h2 {
  margin: 10px 0 0;
  font-size: 24px;
  line-height: 1.35;
}

.study-heading > p {
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.condition-set-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 14px;
}

.condition-set-heading--new {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.condition-set-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.condition-set-tag {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.condition-set-tag--new {
  color: var(--primary-dark);
  background: var(--success-soft);
  border-color: rgba(36, 111, 88, 0.24);
}

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

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

.condition-card {
  display: flex;
  min-height: 285px;
  flex-direction: column;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(28, 44, 39, 0.05);
}

.condition-card--new {
  border-top: 4px solid var(--primary);
}

.group-code {
  width: fit-content;
  color: #fff;
  background: var(--blue);
}

.condition-card h3 {
  margin: 16px 0 5px;
  font-size: 17px;
  line-height: 1.45;
}

.condition-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.condition-card .english-name {
  min-height: 42px;
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 20px;
}

.primary-button,
.secondary-button,
.action-button,
.handover-button,
.solution-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-button,
.action-button,
.handover-button,
.solution-button {
  color: #fff;
  background: var(--primary);
}

.primary-button:hover,
.action-button:hover,
.handover-button:hover,
.solution-button:hover {
  background: var(--primary-dark);
}

.primary-button:active,
.secondary-button:active,
.action-button:active,
.handover-button:active,
.solution-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: #aebbb6;
}

.primary-button svg,
.secondary-button svg,
.action-button svg,
.handover-button svg,
.solution-button svg {
  width: 18px;
  height: 18px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--primary);
  border-color: #aebbb6;
}

.icon-button svg {
  width: 19px;
}

.toast {
  position: fixed;
  z-index: 50;
  bottom: 22px;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  color: #fff;
  background: #26322f;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Participant demo */
.demo-body {
  min-height: 100vh;
  background: #edf1ef;
}

.demo-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.preview-bar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 14px;
  color: #5c3b04;
  background: var(--amber-soft);
  border-bottom: 1px solid #e6c881;
  font-size: 12px;
  font-weight: 700;
}

.preview-bar svg {
  width: 15px;
}

.app-header {
  color: #fff;
  background: #24312d;
}

.app-header__inner {
  display: flex;
  width: min(760px, 100%);
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  padding: 0 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
}

.brand-mark svg {
  width: 20px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d7e0dc;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #57c59f;
  border-radius: 50%;
}

.demo-main {
  width: min(760px, 100%);
  flex: 1;
  margin: 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.progress-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 12px 20px;
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
}

.progress-segment {
  height: 4px;
  background: #dce3e0;
  border-radius: 2px;
}

.progress-segment--active,
.progress-segment--done {
  background: var(--primary);
}

.view {
  animation: view-in 220ms ease both;
}

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

.scenario-visual {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  background: #dce4e1;
}

.scenario-visual img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
  object-position: center 55%;
}

.scenario-time {
  position: absolute;
  top: 16px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: #fff;
  background: rgba(32, 39, 37, 0.84);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.scenario-time svg {
  width: 15px;
}

.content-panel {
  padding: 26px 24px 32px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.content-panel h1,
.completion-panel h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.38;
}

.lead {
  margin: 13px 0 0;
  color: #4f5b57;
  font-size: 15px;
}

.order-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.order-fact {
  min-width: 0;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
}

.order-fact:first-child {
  padding-left: 0;
}

.order-fact:last-child {
  padding-right: 0;
  border-right: 0;
}

.order-fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.order-fact strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.issue-notice {
  display: flex;
  gap: 11px;
  margin-top: 20px;
  padding: 13px 14px;
  color: #6e2e23;
  background: var(--danger-soft);
  border-left: 4px solid var(--danger);
  border-radius: 4px;
  font-size: 14px;
}

.issue-notice svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  margin-top: 2px;
}

.full-action {
  width: 100%;
  margin-top: 24px;
}

.prime-panel {
  min-height: calc(100vh - 118px);
  padding: 34px 24px;
}

.prime-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 8px;
}

.prime-icon svg {
  width: 25px;
}

.prime-panel h1 {
  margin: 18px 0 0;
  font-size: 24px;
}

.prime-copy {
  margin: 13px 0 0;
  color: #46514e;
  font-size: 16px;
}

.writing-field {
  display: block;
  margin-top: 26px;
}

.writing-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.writing-field textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aeb9b5;
  border-radius: 6px;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stage-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 28px;
  border-top: 2px solid var(--line);
}

.stage-node {
  position: relative;
  padding: 15px 5px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.stage-node::before {
  position: absolute;
  top: -7px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  content: "";
  background: #c6d0cc;
  border: 2px solid #fff;
  border-radius: 50%;
}

.stage-node--active {
  color: var(--primary-dark);
  font-weight: 700;
}

.stage-node--active::before {
  background: var(--primary);
}

.stage-node--done::before {
  background: var(--blue);
}

.chat-view {
  display: flex;
  min-height: calc(100vh - 118px);
  flex-direction: column;
  background: #f3f6f5;
}

.chat-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.chat-avatar,
.message-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}

.chat-avatar {
  width: 39px;
  height: 39px;
}

.chat-avatar svg {
  width: 21px;
}

.chat-header strong,
.chat-header span {
  display: block;
}

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

.secure-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.secure-label svg {
  width: 14px;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px 26px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

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

.message-avatar {
  width: 30px;
  height: 30px;
  background: #3f7870;
}

.message-avatar--agent {
  background: var(--blue);
}

.message-avatar svg {
  width: 16px;
}

.message-bubble {
  max-width: min(79%, 520px);
  padding: 11px 13px;
  background: #fff;
  border: 1px solid #d9e0dd;
  border-radius: 8px 8px 8px 2px;
  box-shadow: 0 2px 8px rgba(30, 46, 41, 0.04);
  font-size: 14px;
  white-space: pre-line;
}

.message-row--user .message-bubble {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 8px 8px 2px 8px;
}

.agent-tag {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.system-message {
  align-self: center;
  max-width: 88%;
  padding: 6px 10px;
  color: var(--muted);
  background: #e7ecea;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
}

.handover-zone {
  position: sticky;
  bottom: 0;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

.message-form {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.message-form input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #aeb9b5;
  border-radius: 6px;
}

.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.send-button svg {
  width: 19px;
}

.send-button:disabled,
.action-button:disabled {
  color: #89928f;
  background: #dce2e0;
  cursor: not-allowed;
}

.handover-button,
.solution-button {
  width: 100%;
}

.connection-status {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--primary-dark);
  background: var(--success-soft);
  border: 1px solid #b8d8cc;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid #9fc8b9;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.input-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.completion-panel {
  display: flex;
  min-height: calc(100vh - 118px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 24px;
  text-align: center;
}

.completion-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}

.completion-icon svg {
  width: 34px;
}

.completion-panel h1 {
  margin-top: 20px;
}

.completion-panel > p {
  max-width: 480px;
  margin: 10px 0 0;
  color: var(--muted);
}

.completion-summary {
  width: min(100%, 480px);
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.completion-summary div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0;
  font-size: 14px;
}

.completion-summary span {
  color: var(--muted);
}

.completion-code {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
}

.blocked-panel {
  width: min(620px, calc(100% - 32px));
  margin: 60px auto;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--danger);
  border-radius: 8px;
}

.blocked-panel h1 {
  margin: 0;
  font-size: 22px;
}

.blocked-panel p {
  color: var(--muted);
}

@media (max-width: 920px) {
  .condition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .protocol-band {
    grid-template-columns: 1fr;
  }

  .protocol-flow {
    justify-content: flex-start;
  }

  .protocol-band .secondary-button {
    width: fit-content;
  }
}

@media (max-width: 620px) {
  .research-header__inner,
  .research-main {
    width: min(100% - 28px, 1180px);
  }

  .research-header__inner {
    padding: 38px 0 32px;
  }

  .research-header h1 {
    font-size: 28px;
  }

  .summary-row {
    gap: 12px;
  }

  .summary-row span {
    padding-right: 12px;
  }

  .study-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .study-heading > p {
    text-align: left;
  }

  .condition-set-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .condition-set-heading p {
    text-align: left;
  }

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

  .condition-card {
    min-height: 250px;
  }

  .protocol-flow {
    flex-wrap: wrap;
  }

  .demo-main {
    border-right: 0;
    border-left: 0;
  }

  .app-header__inner {
    padding: 0 15px;
  }

  .scenario-visual,
  .scenario-visual img {
    height: 205px;
    min-height: 205px;
  }

  .content-panel,
  .prime-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .content-panel h1,
  .completion-panel h1,
  .prime-panel h1 {
    font-size: 22px;
  }

  .order-facts {
    grid-template-columns: 1fr;
  }

  .order-fact,
  .order-fact:first-child,
  .order-fact:last-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .order-fact:last-child {
    border-bottom: 0;
  }

  .order-fact strong {
    margin: 0;
    text-align: right;
  }

  .message-bubble {
    max-width: 84%;
  }

  .header-status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
