:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --ink-mute: #9ca3af;
  --line: #eef1f6;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --warn: #f97316;
  --ok: #22c55e;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.03);
  --shadow-md: 0 8px 24px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 1160px; margin: 0 auto; padding: 24px 24px 40px; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #ffd27a, #ff9a5a); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.brand-name { font-size: 20px; font-weight: 700; }
.brand-tagline { color: var(--ink-soft); font-size: 14px; padding-left: 14px; border-left: 1px solid var(--line); margin-left: 4px; }
.search { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-input { height: 44px; width: 320px; max-width: 44vw; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 16px; font: inherit; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.search-input:focus { border-color: #c7d2fe; box-shadow: 0 0 0 4px rgba(99,102,241,.12); }
.icon-btn, .search-btn { height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); transition: transform .06s ease, background .15s, color .15s; }
.icon-btn { width: 44px; }
.icon-btn:hover { color: var(--brand); }
.search-btn { width: 52px; background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(37,99,235,.28); }
.search-btn:hover { background: var(--brand-strong); }
.search-btn:active { transform: translateY(1px); }

/* Hero */
.hero { position: relative; border-radius: 20px; padding: 28px 32px; background: linear-gradient(115deg, #ffe9c2 0%, #ffd8c0 40%, #ffe1e4 100%); box-shadow: var(--shadow-md); overflow: hidden; display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: center; min-height: 240px; }
.hero.mood-low  { background: linear-gradient(115deg, #e6f7ea 0%, #e2f2ff 60%, #eef2ff 100%); }
.hero.mood-mid  { background: linear-gradient(115deg, #ffe9c2 0%, #ffd8c0 40%, #ffe1e4 100%); }
.hero.mood-high { background: linear-gradient(115deg, #ffd6b8 0%, #ffbaba 60%, #ffd0e0 100%); }
.hero-sun { position: absolute; right: 28px; top: 22px; width: 56px; height: 56px; opacity: .95; }
.hero-meta { color: #8a5a2b; font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.hero.mood-low .hero-meta { color: #37628a; }
.hero-headline { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.hero-emoji { font-size: 30px; }
.hero-sub { color: #7a5230; font-size: 14px; margin-bottom: 18px; max-width: 34em; }
.hero.mood-low .hero-sub { color: #385a7a; }
.score-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); padding: 10px 14px; border-radius: 999px; font-size: 14px; color: #7a4a1e; backdrop-filter: blur(4px); }
.score-pill .num { font-weight: 800; font-size: 22px; color: var(--warn); margin: 0 2px 0 8px; }
.score-pill .of { color: var(--ink-mute); }
.score-pill .tag { color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 999px; margin-left: 6px; background: var(--warn); }
.hero-note { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 12px; color: #9a6a3a; }
.hero.mood-low .hero-note { color: #517695; }

/* Gauge */
.gauge { position: relative; width: 320px; height: 190px; justify-self: end; }
.gauge svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gauge .track { fill: none; stroke: #e5e7eb; stroke-linecap: round; }
.gauge .value { fill: none; stroke: url(#gaugeGrad); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.22,.61,.36,1); }
.gauge-labels { position: absolute; inset: 0; color: var(--ink-mute); font-size: 12px; pointer-events: none; }
.gauge-labels .lo { position: absolute; left: 8px; bottom: 8px; }
.gauge-labels .hi { position: absolute; right: 8px; bottom: 8px; }
.gauge-labels .mid { position: absolute; left: 50%; top: -4px; transform: translateX(-50%); }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; }
.gauge-center .g-num { font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.gauge-center .g-tag { font-size: 13px; margin-top: -4px; }

/* Sections */
.section-title { font-size: 16px; font-weight: 700; margin: 28px 0 14px; }
.metric-panel { background: var(--surface); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.metric { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.metric-head { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.metric-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 30px; }
.metric-ic.uv    { background: #efe7ff; color: #7c3aed; }
.metric-ic.feel  { background: #ffe6d1; color: #ea580c; }
.metric-ic.hum   { background: #dcefff; color: #2563eb; }
.metric-ic.wind  { background: #d8f5e3; color: #059669; }
.metric-ic.cloud { background: #e7ecf2; color: #64748b; }
.metric-value { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.metric-value .num  { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; color: var(--ink); }
.metric-value .unit { color: var(--ink-soft); font-size: 13px; }
.metric-value .badge { margin-left: auto; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #f3f4f6; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.badge.b-green  { background: #dcfce7; color: #15803d; }
.badge.b-lime   { background: #ecfccb; color: #65a30d; }
.badge.b-amber  { background: #fef3c7; color: #b45309; }
.badge.b-orange { background: #ffe4d6; color: #ea580c; }
.badge.b-red    { background: #fee2e2; color: #dc2626; }
.badge.b-blue   { background: #dbeafe; color: #2563eb; }
.badge.b-slate  { background: #e5e7eb; color: #475569; }

.metric-scale { position: relative; height: 6px; border-radius: 999px; }
.metric-scale.uv    { background: linear-gradient(90deg,#22c55e,#eab308 35%, #f97316 60%, #dc2626 82%, #7c3aed); }
.metric-scale.feel  { background: linear-gradient(90deg,#a5f3fc,#fde68a 45%,#f97316 75%,#dc2626); }
.metric-scale.hum   { background: linear-gradient(90deg,#fde68a,#93c5fd 55%,#1d4ed8); }
.metric-scale.wind  { background: linear-gradient(90deg,#bbf7d0,#facc15 55%,#dc2626); }
.metric-scale.cloud { background: linear-gradient(90deg,#fef9c3,#cbd5e1); }
.metric-scale .knob { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #cbd5e1; transform: translate(-50%,-50%); box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: left .5s ease; }
.metric-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-mute); margin-top: -2px; }

/* Reasons */
.reasons { display: flex; flex-direction: column; gap: 10px; }
.reason { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 16px 20px; display: grid; grid-template-columns: 44px 1fr 220px; gap: 16px; align-items: center; }
.reason-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.reason-ic.uv    { background: #efe7ff; color: #7c3aed; }
.reason-ic.feel  { background: #ffe6d1; color: #ea580c; }
.reason-ic.hum   { background: #dcefff; color: #2563eb; }
.reason-ic.wind  { background: #d8f5e3; color: #059669; }
.reason-ic.cloud { background: #e7ecf2; color: #64748b; }
.reason-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.reason-desc { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.reason-impact { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.reason-impact .label { font-size: 12px; color: var(--ink-soft); }
.reason-impact .label b { color: var(--warn); font-weight: 700; margin-left: 4px; }
.reason-bar { width: 180px; height: 6px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.reason-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#facc15,#f97316); transition: width .6s ease; }
.reason.impact-low  .reason-bar span { background: linear-gradient(90deg,#a7f3d0,#22c55e); }
.reason.impact-mid  .reason-bar span { background: linear-gradient(90deg,#facc15,#f97316); }
.reason.impact-high .reason-bar span { background: linear-gradient(90deg,#f97316,#dc2626); }

/* Footer */
.footer { margin-top: 22px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-soft); flex-wrap: wrap; }
.footer-left { display: flex; align-items: center; gap: 8px; }
.footer a { color: var(--brand); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: transform .2s ease, opacity .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Loading */
.is-loading .hero { opacity: .7; }

/* ----- 肤质选择器 ----- */
.skin-panel {
  background: #fff;
  border-radius: 16px;
  padding: 18px 22px 22px;
  box-shadow: 0 6px 24px rgba(20,30,60,.04);
  border: 1px solid #eef0f5;
  margin-bottom: 22px;
}
.skin-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap;
}
.skin-sub, .curve-sub {
  color: #6b7180; font-size: 13px; margin-top: 4px;
}
.burn-callout {
  background: linear-gradient(135deg,#fff5ec,#ffe1cf);
  border: 1px solid #fdd0b3;
  border-radius: 14px; padding: 10px 16px; min-width: 200px; text-align: right;
}
.burn-callout.safe { background: linear-gradient(135deg,#eafbe8,#d3f0ce); border-color:#b6e0ac; }
.burn-callout.danger { background: linear-gradient(135deg,#ffe5e5,#ffc9c9); border-color:#f2a5a5; }
.burn-label { font-size: 12px; color: #7a5f4a; letter-spacing: .5px; }
.burn-callout.safe .burn-label { color: #457b3d; }
.burn-callout.danger .burn-label { color: #a12626; }
.burn-value { font-size: 34px; font-weight: 800; color: #dd5a1a; letter-spacing: -1px; line-height:1.1; }
.burn-callout.safe .burn-value { color:#22a538; }
.burn-callout.danger .burn-value { color:#d43a3a; }
.burn-unit { font-size: 14px; font-weight: 600; margin-left: 4px; color: #b8672a; }
.burn-callout.safe .burn-unit { color:#3f8b39; }
.burn-callout.danger .burn-unit { color:#c14a4a; }
.burn-hint { font-size: 12px; color: #7a5f4a; margin-top: 2px; }
.burn-callout.safe .burn-hint { color:#4d7a48; }
.burn-callout.danger .burn-hint { color:#a53737; }

.skin-swatches {
  display: grid; grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 10px; margin-top: 16px;
}
.skin-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 8px 8px;
  text-align: center;
  background: #fafbfc;
  transition: all .18s ease;
}
.skin-item:hover { background:#f2f4f8; }
.skin-item.active {
  border-color: #2563eb;
  background: #eef4ff;
  box-shadow: 0 4px 14px rgba(37,99,235,.14);
}
.skin-dot {
  width: 34px; height: 34px; border-radius: 50%;
  margin: 0 auto 6px;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.15), 0 2px 4px rgba(0,0,0,.08);
}
.skin-name { font-size: 13px; font-weight: 600; color: #23273d; }
.skin-desc { font-size: 11px; color: #767c8f; margin-top: 2px; }

/* ----- UV 曲线 ----- */
.curve-panel {
  background:#fff; border-radius:16px; padding:18px 22px 20px;
  box-shadow: 0 6px 24px rgba(20,30,60,.04); border:1px solid #eef0f5;
  margin-bottom: 22px;
}
.curve-head { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; }
.curve-legend { display:flex; gap:14px; font-size:12px; color:#5c6474; align-items:center; }
.curve-legend .dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:6px; vertical-align:middle; }
.dot-danger { background:#ef4444; }
.dot-safe   { background:#22c55e; }
.dot-now    { background:#2563eb; }
.curve-wrap { margin-top: 14px; width:100%; }
#uvCurve { width:100%; height:220px; display:block; }
.curve-windows {
  display:flex; flex-wrap:wrap; gap:10px; margin-top:14px;
}
.win-chip {
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 12px; border-radius: 999px; font-size:13px;
  background:#f4f6fa; border:1px solid #e6e9ef;
}
.win-chip.danger { background:#ffefef; border-color:#f5c9c9; color:#9a2626; }
.win-chip.safe   { background:#ecfbee; border-color:#bfe6c7; color:#256b30; }
.win-chip b { font-weight: 700; }

/* Responsive */
@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr; }
  .gauge { justify-self: center; width: 280px; }
  .reason { grid-template-columns: 40px 1fr; }
  .reason-impact { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .reason-bar { width: 140px; }
  .hero-headline { font-size: 26px; }
  .skin-swatches { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .burn-callout { text-align: left; }
}
@media (max-width: 560px) {
  .brand-tagline { display: none; }
  .search-input { width: 200px; }
  .metric-grid { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
  .hero-headline { font-size: 22px; }
  .app { padding: 16px; }
  .skin-swatches { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .curve-panel { padding: 16px; }
  .burn-value { font-size: 28px; }
}
