/* ============================================
   打工病 · dagongbing · iOS-Native UI
   主题: 医院白纸 + 红十字 + 处方笺
   ============================================ */

:root {
  --paper: #f6f3ec;
  --paper-2: #ede8d9;
  --ink: #1a1a1a;
  --ink-2: #3a3a3a;
  --ink-3: #6b6b6b;
  --brand: #c1272d;
  --brand-soft: rgba(193, 39, 45, 0.1);
  --brand-dim: rgba(193, 39, 45, 0.3);
  --accent: #2e7d32;
  --accent-soft: rgba(46, 125, 50, 0.1);
  --stroke: rgba(26, 26, 26, 0.12);
  --stroke-strong: rgba(26, 26, 26, 0.3);
  --card-bg: #ffffff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body { margin: 0; padding: 0; overflow-x: hidden; overscroll-behavior-y: none; background: var(--paper); }

body {
  min-height: 100vh; min-height: 100dvh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'STSong', 'SimSun', serif;
  -webkit-font-smoothing: antialiased;
  background: var(--paper);
}

input, select, textarea, button { font-family: inherit; -webkit-appearance: none; appearance: none; }

/* 纸张纹理 */
.paper-texture {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(193, 39, 45, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 90%, rgba(46, 125, 50, 0.04) 0%, transparent 40%),
    repeating-linear-gradient(45deg, transparent 0 2px, rgba(0,0,0,0.01) 2px 4px);
}

.app-container {
  position: relative; z-index: 1;
  max-width: 440px; margin: 0 auto;
  padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 40px);
}
.hidden { display: none !important; }

/* ===== Hero ===== */
.hero { padding: 8px 0 24px; animation: fadeUp 0.6s var(--ease-out); }
.hospital-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; border: 1px solid var(--brand);
  border-radius: 4px; background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  margin-bottom: 18px;
}
.hospital-seal {
  position: relative; flex-shrink: 0; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.seal-inner {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--brand);
}
.seal-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px dashed var(--brand);
  animation: spin 30s linear infinite;
}
.seal-cross { font-family: -apple-system, sans-serif; }
.hospital-titles { flex: 1; min-width: 0; }
.title {
  font-size: 22px; font-weight: 700;
  letter-spacing: 0.2em; color: var(--ink);
  margin: 0; line-height: 1.2;
  font-family: 'STSong', 'SimSun', serif;
}
.subtitle {
  font-size: 12px; color: var(--ink-3); margin: 4px 0 0; letter-spacing: 0.2em;
}
.eyebrow {
  font-size: 9px; color: var(--brand);
  margin: 4px 0 0; letter-spacing: 0.4em; font-weight: 600;
}
.tagline {
  font-size: 13px; line-height: 1.8;
  color: var(--ink-2); margin: 0; text-align: center;
  letter-spacing: 0.05em;
}

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

/* ===== Divider ===== */
.divider-mark {
  text-align: center; font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.4em;
  padding: 20px 0 12px;
  position: relative;
}
.divider-mark::before, .divider-mark::after {
  content: ''; position: absolute; top: 50%; width: 60px; height: 1px; background: var(--stroke);
}
.divider-mark::before { left: 0; }
.divider-mark::after { right: 0; }

/* ===== Fields ===== */
.card-group { animation: fadeUp 0.6s var(--ease-out) 0.1s both; }
.field { margin-bottom: 14px; }
.field-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-2); font-weight: 600;
  margin-bottom: 8px; padding-left: 2px;
}
.field-optional {
  font-size: 10px; color: var(--ink-3); padding: 2px 8px;
  border: 1px solid var(--stroke); border-radius: 999px;
  font-weight: 400;
}

.select-wrap { position: relative; }
.ios-select, .ios-input {
  width: 100%; padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--ink); font-size: 16px;
  outline: none;
  transition: all 0.2s var(--ease-out);
}
.ios-select { padding-right: 40px; background-image: none !important; }
.ios-select:focus, .ios-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.select-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}

/* 问卷单题 - chips */
.q-block {
  margin-bottom: 14px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}
.q-num {
  display: inline-block; min-width: 24px;
  font-size: 11px; color: var(--brand); font-weight: 700;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.q-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin: 0 0 10px;
}
.q-options {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.q-chip {
  padding: 8px 14px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.q-chip:active { transform: scale(0.96); }
.q-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(193, 39, 45, 0.3);
}

/* ===== Primary Button ===== */
.primary-btn {
  position: relative; width: 100%;
  padding: 16px 20px; margin-top: 22px;
  background: var(--brand);
  border: none; border-radius: 12px;
  color: #fff; font-size: 15px; font-weight: 700;
  letter-spacing: 0.2em; cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(193, 39, 45, 0.5);
  transition: transform 0.2s var(--ease-out);
}
.primary-btn:active { transform: scale(0.97); }

.disclaimer {
  text-align: center; font-size: 11px; line-height: 1.8;
  color: var(--ink-3); margin: 18px 0 0; letter-spacing: 0.05em;
}
.legal-links {
  text-align: center; font-size: 11px; letter-spacing: 0.1em;
  margin: 8px 0 0; color: var(--ink-3); opacity: 0.9;
}
.legal-links a {
  color: var(--stamp-red, #c23030);
  text-decoration: none;
  border-bottom: 0.5px solid rgba(194, 48, 48, 0.4);
  padding-bottom: 1px;
}
.legal-links a:active { opacity: 0.6; }
.legal-links .sep { margin: 0 8px; opacity: 0.5; }

/* ===== Loading ===== */
.loading-wrap { text-align: center; padding: 80px 0; animation: fadeUp 0.5s var(--ease-out); }
.loading-cross {
  display: inline-block; padding: 22px;
  background: #fff; border: 1px solid var(--brand);
  border-radius: 50%; animation: pulse-hospital 1.2s ease-in-out infinite;
}
@keyframes pulse-hospital {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(193, 39, 45, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(193, 39, 45, 0); }
}
.loading-text { margin-top: 24px; font-size: 14px; letter-spacing: 0.3em; color: var(--ink-2); }
.loading-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.loading-dots span {
  width: 6px; height: 6px; background: var(--brand);
  border-radius: 50%; animation: dot-pulse 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
  30% { transform: scale(1.3); opacity: 1; }
}

/* ===== Report Poster ===== */
.result-wrap { animation: fadeUp 0.6s var(--ease-out); }
.poster-card {
  background: #fff;
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 2px;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.04);
  position: relative;
}
.poster-inner {
  padding: 22px 20px;
  border: 1px double var(--stroke);
  border-radius: 4px;
  position: relative;
}
/* 已诊红章 */
.report-stamp {
  position: absolute; top: 24px; right: 24px;
  width: 72px; height: 72px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  color: var(--brand); font-weight: 700;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-12deg);
  opacity: 0.85;
  letter-spacing: 0.1em;
  font-family: 'STSong', 'SimSun', serif;
  background: rgba(193, 39, 45, 0.03);
}

.report-header { text-align: center; margin-bottom: 18px; }
.report-brand-line {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.15em;
}
.report-hospital { font-weight: 600; color: var(--brand); letter-spacing: 0.1em; }
.report-dot { color: var(--ink-3); }
.report-en { font-size: 9px; letter-spacing: 0.4em; color: var(--ink-3); }
.report-title {
  font-size: 26px; font-weight: 700;
  letter-spacing: 0.5em;
  color: var(--ink); margin: 10px 0 4px;
  font-family: 'STSong', 'SimSun', serif;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 8px 0;
  display: inline-block;
  padding-left: 0.5em;
}
.report-eyebrow { font-size: 9px; color: var(--ink-3); margin: 6px 0 0; letter-spacing: 0.3em; }

.report-meta {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  margin-bottom: 14px;
}
.meta-row { display: flex; gap: 14px; }
.meta-cell { flex: 1; display: flex; gap: 8px; align-items: baseline; }
.meta-label { font-size: 11px; color: var(--ink-3); flex-shrink: 0; }
.meta-value { font-size: 13px; color: var(--ink); font-weight: 600; }

.report-section {
  padding: 10px 0;
  border-bottom: 1px dashed var(--stroke);
}
.report-section:last-of-type { border-bottom: none; }
.section-label {
  font-size: 12px; color: var(--brand);
  font-weight: 700; letter-spacing: 0.25em;
  margin-bottom: 6px;
  display: inline-block;
  padding-left: 8px;
  border-left: 3px solid var(--brand);
}
.section-body {
  font-size: 14px; line-height: 1.7;
  color: var(--ink); padding-left: 11px;
}
.rx-body {
  font-family: 'Courier', 'Courier New', monospace;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 4px 4px 0;
  color: var(--ink-2);
  font-size: 13px;
}

.diagnoses-list { padding-left: 11px; }
.diag-item {
  display: flex; align-items: flex-start;
  gap: 10px; padding: 8px 0;
}
.diag-item + .diag-item { border-top: 1px solid var(--stroke); }
.diag-bullet { color: var(--brand); font-weight: 700; flex-shrink: 0; }
.diag-content { flex: 1; }
.diag-name {
  font-size: 15px; font-weight: 700;
  color: var(--ink); letter-spacing: 0.05em;
}
.diag-severity {
  display: inline-block; margin-left: 8px;
  padding: 1px 8px;
  font-size: 10px; letter-spacing: 0.1em;
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: 4px;
  vertical-align: middle;
}
.diag-severity.晚期 { background: var(--brand); color: #fff; }
.diag-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.score-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.health-score {
  flex-shrink: 0; text-align: center; padding: 8px 16px;
  border: 2px solid var(--brand); border-radius: 8px;
  background: var(--brand-soft);
}
.score-num {
  font-size: 28px; font-weight: 900;
  color: var(--brand); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-label { font-size: 9px; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.1em; }

.report-footer {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--stroke-strong);
}
.doctor-sign {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin-bottom: 8px;
}
.doctor-line {
  width: 30px; height: 1px; background: var(--ink);
}
.doctor-name {
  font-size: 14px; color: var(--ink);
  font-family: 'STSong', serif; font-style: italic;
}
.doctor-note {
  font-size: 13px; color: var(--ink-2);
  padding: 10px; background: var(--paper);
  border-left: 3px solid var(--brand);
  border-radius: 0 4px 4px 0;
  margin: 0;
  line-height: 1.7;
}

.poster-footer {
  margin-top: 16px; text-align: center;
  font-size: 9px; color: var(--ink-3);
  letter-spacing: 0.2em;
}

/* ===== Action buttons ===== */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.secondary-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 10px;
  color: var(--brand);
  font-size: 14px; font-weight: 600;
  letter-spacing: 0.1em; cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.secondary-btn:active { transform: scale(0.96); background: var(--brand-soft); }
.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== chuanshu ===== */
.chuanshu-entry {
  position: relative; display: block;
  margin-top: 18px; padding: 20px 16px;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
  border: 1px dashed var(--brand);
  border-radius: 12px; text-align: center;
  text-decoration: none;
}
.chuanshu-entry:active { transform: scale(0.98); }
.chuanshu-glow { display: none; }
.chuanshu-eyebrow { font-size: 10px; letter-spacing: 0.3em; color: var(--ink-3); margin: 0 0 6px; }
.chuanshu-title {
  font-size: 16px; font-weight: 700; letter-spacing: 0.3em;
  color: var(--brand); margin: 0 0 4px;
  font-family: 'STSong', serif;
}
.chuanshu-sub { font-size: 11px; color: var(--ink-3); margin: 0; }

/* ===== Onboarding ===== */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px);
  animation: fadeIn 0.3s var(--ease-out);
}
.onboarding-card {
  width: 100%; max-width: 400px;
  background: #fff; border: 1px solid var(--stroke-strong);
  border-radius: 16px; padding: 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: onboardIn 0.5s var(--spring);
}
.onboarding-icon { display: flex; justify-content: center; margin-bottom: 12px; }
.hospital-mark {
  font-size: 38px; color: var(--brand); line-height: 1;
}
.onboarding-title {
  text-align: center; font-size: 20px; font-weight: 700;
  color: var(--ink); margin: 0 0 4px; letter-spacing: 0.05em;
}
.onboarding-subtitle {
  text-align: center; font-size: 12px;
  color: var(--ink-3); margin: 0 0 18px; letter-spacing: 0.2em;
}
.onboarding-rules {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; background: var(--paper);
  border: 1px solid var(--stroke); border-radius: 10px;
}
.rule-item { display: flex; gap: 12px; align-items: flex-start; }
.rule-icon { flex-shrink: 0; font-size: 18px; margin-top: 2px; }
.rule-en { font-size: 13px; font-weight: 600; color: var(--ink); }
.rule-zh { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ===== Animations ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes onboardIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

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

@media (min-width: 768px) {
  .app-container { max-width: 480px; padding-top: calc(var(--safe-top) + 40px); }
}

/* ============ 金句卡 · Punchline Card ============ */
.punchline-wrap {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.punchline-eyebrow {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.42em;
  color: var(--ink-3);
  margin: 0;
  text-indent: 0.42em;
}
.punchline-card {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 20% 8%, rgba(193,39,45,0.05) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 92%, rgba(46,125,50,0.04) 0%, transparent 50%),
    var(--card-bg);
  box-shadow:
    0 2px 4px rgba(26,26,26,0.06),
    0 16px 40px rgba(26,26,26,0.14);
  overflow: hidden;
  border: 1px solid var(--stroke);
}
.punchline-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px double var(--stroke-strong);
  border-radius: 8px;
  pointer-events: none;
}
.punchline-inner {
  position: relative;
  height: 100%;
  padding: 30px 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.punchline-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--brand);
  font-weight: 600;
  text-indent: 0.28em;
}
.punchline-cross {
  font-size: 20px;
  line-height: 1;
  color: var(--brand);
  font-weight: 700;
}
.punchline-headline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
  font-size: 34px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.02em;
  padding: 0 6px;
  word-break: break-word;
}
.punchline-quote-l,
.punchline-quote-r {
  color: var(--brand);
  font-size: 38px;
  opacity: 0.75;
  font-weight: 400;
}
.punchline-diag {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 88%;
  align-self: center;
  margin-top: -8px;
}
.punchline-score-block {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding: 12px 0 8px;
  border-top: 1px dashed var(--stroke-strong);
}
.punchline-score-label {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-3);
  text-indent: 0.3em;
  align-self: center;
}
.punchline-score {
  font-family: 'SF Pro Display', -apple-system, serif;
  font-size: 44px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  letter-spacing: -0.02em;
}
.punchline-score-unit {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}
.punchline-stamp {
  position: absolute;
  top: 26px;
  right: 22px;
  width: 54px;
  height: 54px;
  border: 2px solid var(--brand);
  color: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-indent: 0.15em;
  transform: rotate(-14deg);
  opacity: 0.88;
  box-shadow: inset 0 0 0 1px rgba(193,39,45,0.2);
}
.punchline-footer {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-3);
  text-indent: 0.32em;
  margin-top: 6px;
}
