/* =========================================
   傷口管理平台 — App CSS v3
   Dr. Wound × 達特傷口學院
   陽光活力主題 — 生命的堅持
   ========================================= */

:root {
  --brand:        #0CBF7A;
  --brand-dk:     #09A068;
  --brand-lt:     #34D399;
  --brand-glow:   rgba(12,191,122,0.15);
  --brand-pale:   #E8FBF3;

  --w1:           #16A34A;
  --w1-bg:        #DCFCE7;
  --w2:           #D97706;
  --w2-bg:        #FEF3C7;
  --w3:           #EA580C;
  --w3-bg:        #FFEDD5;
  --w4:           #DC2626;
  --w4-bg:        #FEE2E2;

  --danger:       #EF4444;
  --danger-bg:    #FFF1F1;
  --success:      #22C55E;
  --warning:      #F59E0B;

  --teal-50:      #F0FDFA;
  --teal-100:     #CCFBF1;
  --teal-600:     #0D9488;
  --teal-700:     #0F766E;
  --coral-50:     #FFF1F2;
  --coral-600:    #E11D48;
  --coral-700:    #BE123C;
  --purple-50:    #F5F3FF;
  --purple-600:   #7C3AED;
  --amber-50:     #FFFBEB;
  --amber-600:    #D97706;
  --blue-50:      #EFF6FF;
  --blue-600:     #2563EB;
  --gray-100:     #F3F4F6;
  --gray-500:     #6B7280;

  --text-primary:   #1A2E22;
  --text-secondary: #4B6358;
  --text-hint:      #9DB8AD;

  --bg-white:     #FFFFFF;
  --bg-page:      #F2FBF7;
  --bg-card:      #FFFFFF;

  --border:       rgba(12,191,122,0.14);
  --border-md:    rgba(12,191,122,0.25);

  --radius-sm:    10px;
  --radius-md:    14px;
  --radius-lg:    20px;

  --shadow-sm:    0 2px 8px rgba(12,191,122,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:    0 6px 20px rgba(12,191,122,0.12), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-brand: 0 4px 16px rgba(12,191,122,0.28);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 480px; margin: 0 auto; }
.screen { padding: 1.25rem 1rem; animation: fadeIn .22s cubic-bezier(.25,.46,.45,.94); }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }

h1 { font-size: 22px; font-weight: 700; line-height: 1.3; letter-spacing: -.3px; }
h2 { font-size: 18px; font-weight: 700; line-height: 1.4; letter-spacing: -.2px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: .5rem; }
p  { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

.card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: .875rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-md); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: .75rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border-md);
  background: #FFFFFF; color: var(--text-primary);
  transition: all .18s; white-space: nowrap;
}
.btn:hover { background: var(--brand-pale); border-color: var(--brand); color: var(--brand-dk); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(12,191,122,0.15); }
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, #0CBF7A 0%, #09A068 100%); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: linear-gradient(135deg, #34D399 0%, #0CBF7A 100%); color: #fff; box-shadow: 0 6px 22px rgba(12,191,122,0.38); transform: translateY(-2px); }
.btn-primary:active { transform: scale(.96) translateY(0); }
.btn-danger { background: linear-gradient(135deg, #FECACA 0%, #FCA5A5 100%); color: #991B1B; border-color: transparent; box-shadow: 0 3px 10px rgba(239,68,68,0.15); }
.btn-danger:hover { background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%); color: #DC2626; }
.btn-sm   { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-row  { display: flex; gap: 8px; flex-wrap: wrap; margin-top: .875rem; }

.form-group { margin-bottom: .875rem; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 600; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid #D1FAE5; border-radius: var(--radius-sm);
  background: #FAFFFE; color: var(--text-primary);
  font-size: 14px; font-family: inherit; transition: all .18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-error  { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.check-row input[type=checkbox] { width: 17px; height: 17px; margin-top: 1px; flex-shrink: 0; accent-color: var(--brand); }

.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge-teal   { background: var(--teal-50);   color: var(--teal-600);   border: 1px solid var(--teal-100); }
.badge-coral  { background: var(--coral-50);  color: var(--coral-600); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-600); }
.badge-purple { background: var(--purple-50); color: var(--purple-600); }
.badge-blue   { background: var(--blue-50);   color: var(--blue-600); }
.badge-green  { background: var(--w1-bg);     color: var(--w1); }

.progress-row { display: flex; gap: 7px; align-items: center; margin-bottom: 1.25rem; }
.p-dot { width: 9px; height: 9px; border-radius: 50%; background: #D1FAE5; transition: all .3s cubic-bezier(.34,1.56,.64,1); }
.p-dot.done   { background: var(--brand-lt); }
.p-dot.active { background: var(--brand); transform: scale(1.35); box-shadow: 0 0 0 3px var(--brand-glow); }
.p-label { font-size: 12px; color: var(--text-hint); margin-left: 4px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,0.92);
  border-top: 1.5px solid var(--border);
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 20px rgba(12,191,122,0.08);
}
.bottom-nav.hidden { display: none; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 500; color: var(--text-hint); background: none; border: none; cursor: pointer; padding: 4px 14px; border-radius: var(--radius-sm); transition: all .18s; }
.nav-item.active { color: var(--brand-dk); font-weight: 700; }
.nav-item.active .nav-icon { filter: drop-shadow(0 2px 6px rgba(12,191,122,0.3)); }
.nav-icon { font-size: 20px; transition: transform .2s; }
.nav-item:active .nav-icon { transform: scale(.88); }

.body-map-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding: .5rem 0; }
.body-map-wrap svg { display: block; touch-action: manipulation; }
.body-flip-btn { position: absolute; top: 0; right: 0; font-size: 12px; padding: 5px 10px; }
.zone-label { font-size: 11px; text-anchor: middle; fill: var(--text-hint); pointer-events: none; }
.wound-marker { cursor: default; }

.wound-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1.5px solid var(--border); transition: background .15s; }
.wound-item:last-child { border-bottom: none; }
.wound-num { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.wound-info { flex: 1; }
.wound-info-title { font-size: 14px; font-weight: 600; }
.wound-info-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.photo-upload-box {
  border: 2px dashed #A7F3D0; border-radius: var(--radius-md);
  padding: 1.5rem 1rem; text-align: center;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; transition: all .2s; background: #F0FDF9;
}
.photo-upload-box:hover { border-color: var(--brand); background: var(--brand-pale); color: var(--brand-dk); }
.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: .5rem 0; }
.photo-thumb { width: 68px; height: 68px; border-radius: var(--radius-sm); background: #F0FDF9; border: 1.5px solid #D1FAE5; display: flex; align-items: center; justify-content: center; font-size: 24px; position: relative; overflow: hidden; }
.photo-thumb .del { position: absolute; top: -5px; right: -5px; width: 20px; height: 20px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: transform .15s; }
.photo-thumb .del:hover { transform: scale(1.15); }

.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: .5rem 0; }
.rec-chip { background: #F0FDF9; border: 1.5px solid #A7F3D0; border-radius: var(--radius-sm); padding: 5px 11px; font-size: 12px; color: var(--text-secondary); transition: all .15s; }
.rec-chip:hover { border-color: var(--brand); color: var(--brand-dk); background: var(--brand-pale); }

.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 1rem; }
.tab { padding: 9px 16px; font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2.5px solid transparent; color: var(--text-hint); background: none; border-left: none; border-right: none; border-top: none; font-family: inherit; transition: all .18s; }
.tab.active { color: var(--brand-dk); border-bottom-color: var(--brand); font-weight: 700; }

.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1.5px solid var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 3px; line-height: 1.55; }

.grad-wrap { text-align: center; padding: 2rem .5rem; }
.grad-icon { font-size: 60px; margin-bottom: .75rem; animation: bounce .65s ease infinite alternate; filter: drop-shadow(0 4px 12px rgba(12,191,122,0.25)); }
@keyframes bounce { to { transform: translateY(-10px); } }
.grad-title { font-size: 22px; font-weight: 700; margin-bottom: .5rem; }
.grad-sub   { font-size: 14px; color: var(--text-secondary); margin-bottom: 1.25rem; line-height: 1.65; }
.stat-row   { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-box { background: linear-gradient(135deg, #F0FDF9 0%, #E8FBF3 100%); border-radius: var(--radius-md); padding: 12px 18px; text-align: center; min-width: 85px; border: 1.5px solid #A7F3D0; }
.stat-num   { font-size: 24px; font-weight: 700; color: var(--brand-dk); }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }

.app-header { display: flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; }
.app-logo { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #34D399 0%, #0CBF7A 100%); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(12,191,122,0.3); }
.app-logo-title { font-size: 17px; font-weight: 700; }
.app-logo-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }
.menu-card {
  background: linear-gradient(145deg, #FFFFFF 0%, #F7FFFE 100%);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 1.1rem; cursor: pointer;
  transition: all .2s cubic-bezier(.25,.46,.45,.94);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.menu-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--brand-lt), var(--brand)); opacity: 0; transition: opacity .2s; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.menu-card:hover { border-color: var(--brand-lt); box-shadow: 0 6px 20px rgba(12,191,122,0.15); transform: translateY(-3px); }
.menu-card:hover::after { opacity: 1; }
.menu-card:active { transform: scale(.97) translateY(0); }
.menu-icon  { font-size: 28px; margin-bottom: 8px; }
.menu-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.menu-desc  { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

.splash { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; text-align: center; background: linear-gradient(160deg, #F0FDF9 0%, #ECFDF5 50%, #F7FFFE 100%); }
.splash-icon  { font-size: 60px; margin-bottom: 1rem; }
.splash-title { font-size: 22px; font-weight: 700; margin-bottom: .25rem; }
.splash-sub   { font-size: 14px; color: var(--text-secondary); }
.spinner { width: 38px; height: 38px; border: 3px solid #A7F3D0; border-top-color: var(--brand); border-radius: 50%; animation: spin .65s linear infinite; margin: 1.5rem auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden       { display: none !important; }
.mt-sm        { margin-top: .5rem; }
.mt-md        { margin-top: 1rem; }
.text-sm      { font-size: 12px; }
.text-hint    { color: var(--text-hint); }
.text-success { color: var(--brand-dk); }
.text-danger  { color: var(--danger); }
.divider      { border: none; border-top: 1.5px solid var(--border); margin: .875rem 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-pale); color: var(--brand-dk); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid #A7F3D0; }

/* ── 人體圖正反面標題對比強化 ── */
.body-face-label {
  font-size: 13px; font-weight: 700;
  color: var(--brand-dk);
  letter-spacing: .5px;
}

/* ── 全域對比強化 ── */
.card { border-color: rgba(12,191,122,0.2); }
.text-primary { color: #1A2E22 !important; }

/* ── 首頁人體圖背景強化 ── */
.body-map-card {
  background: linear-gradient(145deg, #F0FDF9, #E8FBF3);
  border: 1.5px solid rgba(12,191,122,0.25);
}
