/* ============================================================
   AIS-LVO 风险预测器 - 样式表
   设计风格：医学专业、克制、易读
============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1e40af;          /* 深蓝 - 医学主色 */
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --border-focus: #3b82f6;

  --low: #10b981;
  --medium: #f59e0b;
  --high: #ef4444;
  --critical: #7c2d12;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Noto Sans CJK SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ============== 头部 ============== */
.header {
  position: relative;
  text-align: center;
  margin-bottom: 24px;
  padding: 28px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.language-switch {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
}
.language-option {
  min-width: 64px;
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.86);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.language-option.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.language-option:focus-visible {
  outline: 2px solid #fcd34d;
  outline-offset: 2px;
}
.title {
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.title-highlight {
  color: #fcd34d;
  border-bottom: 2px solid #fcd34d;
  padding-bottom: 2px;
}
.subtitle {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 400;
  letter-spacing: 0.3px;
}

/* ============== 免责声明 ============== */
.disclaimer {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ============== 主网格 ============== */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .header {
    padding-top: 60px;
  }
  .language-switch {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* ============== 卡片 ============== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ============== 表单 ============== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}
.form-group .unit {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 12px;
}
.form-group input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  transition: all 0.2s;
  font-family: inherit;
}
.form-group input[type="number"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-group input[type="number"]:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}
.hint {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

/* 二分类组 */
.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 24px 0 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.optional-tag {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-secondary);
}
.binary-group label:first-child {
  margin-bottom: 8px;
}
.radio-row {
  display: flex;
  gap: 8px;
}
.radio-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  background: #fff;
  margin-bottom: 0 !important;
}
.radio-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.radio-btn:hover {
  border-color: var(--primary-light);
}
.radio-btn:has(input:checked) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 表单按钮 */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.btn {
  flex: 1;
  padding: 11px 18px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}
.btn-secondary:hover {
  background: #e5e7eb;
}

/* 加载动画 */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== 结果区 ============== */
.result-card {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: 300px;
}
.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.placeholder-icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: 16px;
}
.placeholder-text {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 概率显示 */
.probability-display {
  text-align: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 8px;
  margin-bottom: 20px;
}
.prob-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.prob-value {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--primary);
  line-height: 1.1;
}
.prob-baseline {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* 进度条 */
.prob-bar-wrap {
  margin-bottom: 20px;
}
.prob-bar {
  height: 12px;
  background: linear-gradient(to right,
    var(--low)      0%, var(--low)      10%,
    var(--medium)  10%, var(--medium)  30%,
    var(--high)    30%, var(--high)    50%,
    var(--critical) 50%, var(--critical) 100%);
  border-radius: 6px;
  position: relative;
  margin-bottom: 4px;
}
.prob-bar::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 4px;
  height: 18px;
  background: #1f2937;
  border-radius: 2px;
  left: var(--prob-pos, 0%);
  transition: left 0.5s ease-out;
  box-shadow: 0 0 0 2px #fff;
}
.prob-bar-marks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 2px;
}

/* 风险标签 */
.risk-badge {
  background: var(--risk-color, #6b7280);
  color: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.risk-label {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* 建议盒子 */
.advice-box {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.advice-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.advice-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

/* 风险图例 */
.risk-legend {
  font-size: 13px;
  background: #f9fafb;
  padding: 12px 16px;
  border-radius: 6px;
}
.risk-legend summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.risk-legend ul {
  list-style: none;
  margin-top: 12px;
}
.risk-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
}

/* ============== 错误提示 ============== */
.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 1000;
  max-width: 90%;
}

/* ============== 页脚 ============== */
.footer {
  text-align: center;
  padding: 24px 16px;
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}
.footer a {
  color: var(--primary);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }
.footer-about {
  margin-bottom: 8px;
}
.beian-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  color: var(--text-secondary);
}
.gongan-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.beian-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
}
.footer-cite {
  margin-top: 6px;
  font-size: 12px;
  font-style: italic;
}

/* ============== 关于弹窗 ============== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 16px;
}
.modal[hidden] {
  display: none;
}
.modal-content {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-content h2 { margin-bottom: 16px; color: var(--primary-dark); }
.modal-content h3 { font-size: 15px; margin: 16px 0 8px; color: var(--text); }
.modal-content p { font-size: 14px; line-height: 1.7; }
.modal-content ul { padding-left: 20px; font-size: 14px; }
.modal-content li { margin-bottom: 4px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.modal-close:hover { background: #e5e7eb; }
