/* ==========================================================
   鍵盤醫生 (Keyboard Doctor) — 專業醫療清爽白底設計系統
   配色與 LOGO 一致：純白卡片・微藍醫療畫布・專業深海軍藍・晴空藍
   ========================================================== */

:root {
  --bg-page: #f6f9fc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f6fb;
  --bg-muted: #eaf1f8;

  --text-primary: #0f2942;
  --text-secondary: #425a70;
  --text-muted: #6b8096;

  --border-light: #e2ebf3;
  --border-medium: #c8d7e6;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-deep: #0c4a6e;
  --primary-soft: #eef7ff;
  --primary-border: #bae0fd;

  --teal-accent: #0d9488;
  --teal-soft: #eefbf9;

  --amber-bg: #fffbeb;
  --amber-border: #f7df94;
  --amber-accent: #d97706;
  --amber-text: #854d0e;

  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #b91c1c;
  --danger-strong: #dc2626;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 10px rgba(15, 41, 66, 0.04), 0 1px 2px rgba(15, 41, 66, 0.03);
  --shadow-float: 0 -6px 24px rgba(15, 41, 66, 0.08);
  --shadow-btn: 0 4px 12px rgba(2, 132, 199, 0.28);
  --shadow-modal: 0 18px 42px rgba(15, 41, 66, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f3f8fd 0%, #f8fafc 240px, #f6f9fc 100%);
  color: var(--text-primary);
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button,
input {
  font-family: inherit;
}

.app-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- Header & Stepper ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 4px rgba(15, 41, 66, 0.03);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 11px;
  padding-bottom: 11px;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15, 41, 66, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.14);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-primary);
}

.brand-en {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* 2-Step Progress Strip */
.stepper-bar {
  border-top: 1px solid #edf3f9;
  background: #fafdff;
}

.stepper-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.stepper-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.18s ease;
}

.stepper-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.stepper-item.active {
  color: var(--primary-deep);
}

.stepper-item.active .stepper-dot {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.stepper-item.completed {
  color: var(--teal-accent);
}

.stepper-item.completed .stepper-dot {
  background: var(--teal-accent);
  color: #ffffff;
}

.stepper-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--border-light);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.btn-primary:disabled {
  background: #cbd5e1;
  color: #ffffff;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #9fb8d1;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.81rem;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

/* ---------- Main Page Wrapper ---------- */
.main-page {
  padding-top: 16px;
  padding-bottom: 154px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-page[hidden] {
  display: none;
}

.result-page {
  padding-bottom: 44px;
}

/* ---------- Search ---------- */
.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  width: 18px;
  height: 18px;
  color: var(--primary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 13px 42px 13px 44px;
  font-size: 0.94rem;
  color: var(--text-primary);
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

.search-input::placeholder {
  color: #8ea3b8;
}

.search-clear {
  position: absolute;
  right: 11px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.76rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--border-medium);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.card-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.meta-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary-hover);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* ---------- Category Tabs (with clean SVG icons + scroll fade) ---------- */
.category-tabs-wrap {
  position: relative;
  margin-bottom: 14px;
}

.category-tabs-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 6px;
  width: 28px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #ffffff 90%);
  pointer-events: none;
}

.category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 24px 6px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: #fafdff;
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-tab:hover {
  border-color: #9ec8eb;
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.cat-tab.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 41, 66, 0.18);
}

.cat-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.cat-tab.active .cat-svg {
  opacity: 1;
}

.cat-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cat-tab.active .cat-tab-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.category-meta {
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--primary-hover);
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  margin-bottom: 12px;
}

/* ---------- Symptom List ---------- */
.symptom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

@media (min-width: 560px) {
  .symptom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.symptom-group-heading {
  grid-column: 1 / -1;
  margin: 12px 0 2px;
  padding: 2px 0 6px;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid #edf3f9;
  display: flex;
  align-items: center;
  gap: 7px;
}

.symptom-group-heading:first-child {
  margin-top: 0;
}

.group-accent-bar {
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: var(--primary);
  display: inline-block;
}

.group-icon {
  width: 15px;
  height: 15px;
  color: var(--primary);
  flex-shrink: 0;
}

.symptom-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 41, 66, 0.025);
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.symptom-btn:hover {
  border-color: #93c5fd;
  background: #fafdff;
}

.symptom-btn:active {
  transform: scale(0.99);
}

.symptom-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.symptom-btn.is-red-flag.selected {
  border-color: var(--danger-strong);
  background: var(--danger-bg);
  color: #7f1d1d;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
}

.symptom-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.symptom-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-medium);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.symptom-btn.selected .symptom-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.symptom-btn.is-red-flag.selected .symptom-check {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
}

.symptom-label {
  line-height: 1.38;
}

.red-flag-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.red-flag-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger-strong);
}

.empty-search {
  text-align: center;
  padding: 28px 12px;
}

.empty-search-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-search-sub {
  margin: 0 0 14px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ---------- Duration Selector ---------- */
.duration-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

@media (min-width: 560px) {
  .duration-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.duration-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 10px 10px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: #ffffff;
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.duration-btn:hover {
  border-color: #93c5fd;
  background: #fafdff;
}

.duration-btn-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.duration-btn-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.duration-btn:last-child {
  grid-column: 1 / -1;
}

@media (min-width: 560px) {
  .duration-btn:last-child {
    grid-column: span 2;
  }
}

.duration-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.24);
}

.duration-btn.active .duration-btn-sub {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- Page 1 Sticky Bottom Submit Bar ---------- */
.sticky-submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-light);
  box-shadow: var(--shadow-float);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sticky-submit-inner {
  padding-top: 10px;
  padding-bottom: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.selected-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-preview-row[hidden] {
  display: none;
}

.selected-chips-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.selected-chips-scroll::-webkit-scrollbar {
  display: none;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary-deep);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.selected-chip.chip-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.chip-remove {
  border: none;
  background: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 0.76rem;
  padding: 0 2px;
  line-height: 1;
}

.chip-remove:hover {
  opacity: 1;
}

.clear-inline-btn {
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.clear-inline-btn:hover {
  border-color: var(--danger-border);
  color: var(--danger-text);
  background: var(--danger-bg);
}

.submit-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.submit-status {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.submit-count-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.submit-count-text strong {
  color: var(--primary);
  font-size: 1rem;
}

.submit-duration-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.btn-submit {
  min-width: 158px;
  min-height: 46px;
  padding: 11px 22px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

/* ==================== Page 2: Clinical Report ==================== */
.result-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-pill-box {
  padding: 14px 16px;
  background: #ffffff;
}

.summary-pill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.summary-pill-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.duration-tag {
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.result-symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-sym-tag {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.result-sym-tag.is-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
  font-weight: 600;
}

/* ---------- Red Flag Alert ---------- */
.alert-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.alert-danger {
  background: var(--danger-bg);
  border: 1.5px solid #fca5a5;
  border-left: 5px solid var(--danger-strong);
  color: #7f1d1d;
}

.alert-header {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.alert-icon {
  width: 24px;
  height: 24px;
  color: var(--danger-strong);
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.alert-title {
  margin: 0 0 4px;
  font-size: 0.96rem;
  color: var(--danger-text);
}

.alert-lead {
  margin: 0;
  font-size: 0.83rem;
}

.alert-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.83rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ---------- Section Headings on Page 2 ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.section-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-icon svg {
  width: 20px;
  height: 20px;
}

.section-icon-blue {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.section-icon-navy {
  background: #ffffff;
  color: var(--primary-deep);
  border: 1px solid var(--primary-border);
}

.section-eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
}

.section-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ---------- ① Condition Percentage Results ---------- */
.results-note {
  margin: 0 0 14px;
  font-size: 0.81rem;
  color: var(--text-muted);
}

.condition-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.condition-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.condition-item.rank-1 {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #f5faff 0%, #ffffff 48%);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.07);
}

.condition-item.is-emergency {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 48%);
}

.condition-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.condition-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.condition-rank {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.rank-1 .condition-rank {
  background: var(--primary);
  color: #ffffff;
}

.condition-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.condition-pct {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.is-emergency .condition-pct {
  color: var(--danger-strong);
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.condition-item:not(.rank-1) .progress-fill {
  background: linear-gradient(90deg, #7dd3fc 0%, #38bdf8 100%);
}

.condition-item.is-emergency .progress-fill {
  background: linear-gradient(90deg, #f87171 0%, #dc2626 100%);
}

.condition-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 0.79rem;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 600;
}

.mini-dept-pill {
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  font-weight: 600;
}

.matched-symptom-pill {
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.condition-summary {
  margin: 10px 0 9px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.condition-tips {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  font-size: 0.82rem;
  color: var(--text-primary);
}

.condition-tips strong {
  color: var(--primary-deep);
}

/* ---------- ② Recommended Departments ---------- */
.dept-card {
  background: linear-gradient(180deg, #f2f8ff 0%, #ffffff 100%);
  border-color: var(--primary-border);
}

.dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 11px;
}

.dept-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: var(--primary-deep);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 41, 66, 0.05);
}

.dept-badge.dept-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.25);
}

.dept-badge.dept-emergency {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.25);
}

.dept-guidance {
  margin: 0 0 13px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.inline-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.duration-advice-inline {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.duration-advice-inline.level-caution {
  background: var(--amber-bg);
  border-color: var(--amber-border);
}

.duration-advice-inline.level-warning {
  background: #fff7ed;
  border-color: #fed7aa;
}

.duration-advice-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.duration-advice-body {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- ③ Disclaimer Box (Bottom of Page 2) ---------- */
.disclaimer-box {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber-accent);
  border-radius: var(--radius-lg);
  padding: 18px;
  color: var(--amber-text);
  font-size: 0.82rem;
}

.disclaimer-box-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #78350f;
  margin-bottom: 8px;
}

.disclaimer-box-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
}

.disclaimer-box p {
  margin: 0 0 8px;
}

.hotlines-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.hotline-pill {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--amber-border);
  font-size: 0.78rem;
  color: var(--amber-text);
  font-weight: 600;
}

.hotline-pill strong {
  margin-right: 4px;
}

/* ---------- Bottom Result Actions ---------- */
.result-bottom-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 41, 66, 0.48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-light);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  margin: 0;
  font-size: 1.02rem;
  color: var(--text-primary);
}

.modal-close {
  border: none;
  background: var(--bg-muted);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
}

.modal-body {
  padding: 20px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.modal-body h3 {
  margin: 14px 0 6px;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.modal-body p {
  margin: 0 0 8px;
}

.modal-highlight {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary-deep);
  font-size: 0.84rem;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
}
