/* ⌚ 웨어러블 건강 데이터 */
.wear { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.wear .sim-head { margin-bottom: 0; }
.wear-live { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wear-live .live { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .82rem; color: var(--ok); background: var(--ok-bg); padding: 5px 11px; border-radius: 99px; }
.wear-live .live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: blink 1.4s steps(1) infinite; }
.wear-live .dev { font-size: .78rem; background: var(--surface-2); padding: 5px 10px; border-radius: 99px; }
@keyframes blink { 50% { opacity: .2; } }

/* 상태 색 */
.lv { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.lv-ok { background: var(--ok-bg); color: var(--ok); }
.lv-warn { background: var(--warn-bg); color: var(--warn); }
.lv-bad { background: var(--danger-bg); color: var(--danger); }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--danger); }
.wear-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.wear-legend .lv { font-weight: 700; }

/* 항목 카드 */
.wgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.wcard {
  text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .3s;
  border-left-width: 6px;
}
.wcard:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(30, 60, 30, .12); }
.wcard.lv-ok { border-color: #b8e2c4; border-left-color: var(--ok); background: var(--surface); color: inherit; }
.wcard.lv-warn { border-color: #ffd8a8; border-left-color: #f59f00; background: linear-gradient(180deg, var(--warn-bg), var(--surface) 60%); color: inherit; }
.wcard.lv-bad { border-color: #ffa8bd; border-left-color: var(--danger); background: linear-gradient(180deg, var(--danger-bg), var(--surface) 60%); color: inherit; animation: cardPulse 1.6s ease-in-out infinite; }
@keyframes cardPulse { 50% { box-shadow: 0 0 0 4px rgba(214, 51, 108, .18); } }
.wcard.wide { grid-column: span 2; }
.wc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.wc-name { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-val { display: flex; align-items: baseline; gap: 6px; }
.wc-val b { font-size: 2.2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.wcard.big .wc-val b { font-size: 2.6rem; }
.wc-val em, .wc-bp em { font-style: normal; color: var(--muted); font-size: .82rem; }
.wc-bp { display: flex; align-items: flex-end; gap: 8px; }
.wc-bp > div { display: flex; flex-direction: column; }
.wc-bp small { font-size: .72rem; color: var(--muted); font-weight: 700; }
.wc-bp b { font-size: 2.3rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.wc-bp > span { font-size: 1.6rem; color: var(--muted); padding-bottom: 4px; }
.lvt-warn b { color: var(--warn); } .lvt-bad b { color: var(--danger); }
.wc-sub { font-size: .82rem; color: var(--muted); }
.wc-sub b { color: var(--text); }
.wc-range { font-size: .76rem; color: var(--muted); background: var(--surface-2); padding: 4px 8px; border-radius: 8px; }
.wc-foot { display: flex; justify-content: space-between; gap: 6px; font-size: .74rem; margin-top: auto; }
.wc-foot .why { color: var(--muted); }
.wc-foot .more { color: var(--brand); font-weight: 800; white-space: nowrap; }
.wspark { width: 100%; height: 38px; display: block; }
.wspark .band, .wd-svg .band { fill: rgba(47, 143, 78, .12); }

/* 심전도 파형 */
.ecg { height: 46px; background: #0e1a14; border-radius: 10px; overflow: hidden; background-image: linear-gradient(rgba(60, 200, 120, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 200, 120, .12) 1px, transparent 1px); background-size: 10px 10px; }
.ecg.big { height: 90px; }
.ecg svg { width: 100%; height: 100%; display: block; }
.ecg g { animation: ecgScroll linear infinite; }
.ecg path { fill: none; stroke: #3dff8c; stroke-width: 2; vector-effect: non-scaling-stroke; }
@keyframes ecgScroll { from { transform: translateX(0); } to { transform: translateX(-400px); } }

/* 상황 버튼 */
.wear-scen { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 16px; padding: 10px 14px; }
.wear-scen > b { font-size: .9rem; }
.scen-btns { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.scen-btns button { background: var(--surface); border: 1px solid var(--line); font-size: .82rem; padding: 6px 11px; border-radius: 99px; }
.scen-btns button.on { border-color: var(--brand); background: var(--brand-2); color: var(--brand); font-weight: 800; }
#wAuto.running { background: var(--danger); color: #fff; }

/* 추천 */
.reco-head { border-radius: 18px; padding: 14px 16px; background: var(--ok-bg); }
.reco-head b { font-size: 1.05rem; color: var(--ok); }
.reco-head p { margin: 4px 0 0; font-size: .86rem; }
.reco-head.warn { background: var(--warn-bg); } .reco-head.warn b { color: var(--warn); }
.reco-head.danger { background: var(--danger-bg); } .reco-head.danger b { color: var(--danger); }
.reco-sub { font-size: .82rem; color: var(--muted); margin: 10px 2px 8px; }
.reco-sub .new { background: var(--accent); color: #fff; font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; margin-left: 4px; }
.reco-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.reco-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.reco-card:hover { box-shadow: var(--shadow); }
.reco-card .rk { position: absolute; top: 10px; right: 12px; font-weight: 900; color: var(--muted); font-size: .85rem; }
.reco-card:first-child .rk { color: var(--accent); }
.reco-card .em { font-size: 2rem; }
.reco-card small { color: var(--muted); font-size: .76rem; }
.reco-card .whys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reco-card .whys i { font-style: normal; font-size: .7rem; font-weight: 700; background: var(--brand-2); color: var(--brand); padding: 2px 7px; border-radius: 99px; }
.sim-log li.warn { border-left: 3px solid #f59f00; }
.sim-log li span { font-size: .82rem; }
.wear-note { font-size: .76rem; color: var(--muted); margin: 0; }

/* 상세 화면 */
dialog.wd { width: min(980px, calc(100vw - 32px)); }
.wd-head { display: flex; align-items: center; gap: 14px; padding-right: 44px; margin-bottom: 14px; flex-wrap: wrap; }
.wd-icon { font-size: 2.4rem; width: 64px; height: 64px; border-radius: 18px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.wd-head h2 { font-size: 1.35rem; }
.wd-head h2 small { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: 4px; }
.wd-head p { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.wd-now { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wd-now b { font-size: 2rem; line-height: 1; }
.wd-now b em { font-style: normal; font-size: .85rem; color: var(--muted); margin-left: 4px; }
.wd-now small { font-size: .76rem; color: var(--muted); }
.wd-chart { position: relative; background: var(--surface-2); border-radius: 16px; padding: 8px; }
.wd-svg { width: 100%; height: auto; display: block; touch-action: none; }
.wd-svg .grid { stroke: var(--line); stroke-width: 1; }
.wd-svg .grid.v { stroke-dasharray: 2 4; }
.wd-svg .ax { font-size: 11px; fill: var(--muted); }
.wd-svg .band.b1 { fill: rgba(28, 126, 214, .1); }
.wd-svg .danger { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 6 4; }
.wd-svg .goal { stroke: var(--ok); stroke-width: 2; stroke-dasharray: 6 4; }
.wd-svg .lbl { font-size: 10.5px; font-weight: 700; }
.wd-svg .lbl.ok { fill: var(--ok); } .wd-svg .lbl.bad { fill: var(--danger); }
.wd-svg .pt.warn { fill: #f59f00; } .wd-svg .pt.bad { fill: var(--danger); }
.wd-svg .now { stroke: #fff; stroke-width: 2; }
.wd-svg .nowlbl text { fill: #fff; font-size: 12px; font-weight: 800; }
.wd-svg .hover-line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.wd-tip { position: absolute; top: 14px; pointer-events: none; background: rgba(20, 28, 22, .92); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: .78rem; display: flex; flex-direction: column; gap: 2px; min-width: 150px; z-index: 2; }
.wd-tip span { display: flex; align-items: center; gap: 5px; }
.wd-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.wd-tip em { font-style: normal; font-weight: 800; margin-left: auto; }
.wd-tip .t-ok { color: #8ce99a; } .wd-tip .t-warn { color: #ffd43b; } .wd-tip .t-bad { color: #ff8fab; }
.wd-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.wd-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.wd-stats small { font-size: .72rem; color: var(--muted); }
.wd-stats b { font-size: 1.05rem; }
.wd-stats .tir .bar { height: 6px; margin-top: 4px; display: block; }
.wd-stats .tir .bar-fill { display: block; height: 100%; }
.wd-extra .ecg-box { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ecg-meta { display: flex; align-items: center; gap: 10px; }
.ecg-tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ecg-tbl th, .ecg-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.ecg-tbl th { color: var(--muted); font-weight: 700; font-size: .78rem; }
.wd-form { background: var(--surface-2); border-radius: 16px; padding: 16px; }
.wd-form h3 { margin: 0 0 12px; }
.wd-form h3 small { color: var(--muted); font-weight: 500; font-size: .78rem; }
.wd-row { display: grid; grid-template-columns: 110px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end; margin-bottom: 10px; }
.wd-row > span { font-weight: 800; font-size: .9rem; padding-bottom: 9px; }
.wd-row label { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; font-weight: 700; }
.wd-row label.ok { color: var(--ok); } .wd-row label.bad { color: var(--danger); }
.wd-row input { font-weight: 700; }
.wd-hint { font-size: .8rem; color: var(--muted); margin: 6px 0 12px; }
.wd-btns { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1100px) { .wgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .wear { padding: 18px 14px; border-radius: 18px; }
  .wgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .wcard { padding: 11px; }
  .wcard.wide { grid-column: 1 / -1; }
  .wc-val b, .wcard.big .wc-val b, .wc-bp b { font-size: 1.7rem; }
  .wc-foot .why { display: none; }
  .reco-cards { grid-template-columns: 1fr; }
  .wear-scen { flex-direction: column; align-items: stretch; }
  .scen-btns { flex: none; }
  .wc-bp em { display: none; }
  .wc-top { flex-wrap: wrap; }
  .wd-row { grid-template-columns: 1fr 1fr; }
  .wd-row > span { grid-column: 1 / -1; padding: 0; }
  .wd-stats { grid-template-columns: 1fr 1fr; }
  .wd-now { margin-left: 0; align-items: flex-start; }
}

/* 📡 건강 데이터 수집 */
.collect-btn { padding: 10px 16px; border-radius: 99px; box-shadow: 0 4px 14px rgba(47, 143, 78, .3); }
.collect-btn:disabled { opacity: .7; cursor: wait; }
.lv-none { background: var(--surface-2); color: var(--muted); }
.wcard.empty { cursor: default; border-color: var(--line); border-left-color: var(--line); background: var(--surface); opacity: .75; }
.wcard.empty:hover { transform: none; box-shadow: none; }
.wcard.empty .wc-val b { color: var(--muted); }
.scen-btns button:disabled { opacity: .5; cursor: not-allowed; }
.collect-hint { display: flex; align-items: center; gap: 14px; background: var(--brand-2); border: 2px dashed var(--brand); border-radius: 18px; padding: 16px 18px; }
.collect-hint > span { font-size: 2.2rem; }
.collect-hint p { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }
.collect-hint button { margin-left: auto; white-space: nowrap; }
.wgrid.fresh .wcard { animation: cardIn .6s cubic-bezier(.2, .8, .2, 1) both; }
.wgrid.fresh .wcard:nth-child(2) { animation-delay: .05s; } .wgrid.fresh .wcard:nth-child(3) { animation-delay: .1s; }
.wgrid.fresh .wcard:nth-child(4) { animation-delay: .15s; } .wgrid.fresh .wcard:nth-child(5) { animation-delay: .2s; }
.wgrid.fresh .wcard:nth-child(6) { animation-delay: .25s; } .wgrid.fresh .wcard:nth-child(7) { animation-delay: .3s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.measuring { position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 25, 15, .55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; }
.measuring.show { opacity: 1; }
.m-card { width: min(380px, 100%); background: var(--surface); border-radius: 24px; padding: 26px 24px; text-align: center; box-shadow: 0 30px 70px rgba(0, 0, 0, .35); transform: scale(.94); transition: transform .3s; }
.measuring.show .m-card { transform: none; }
.m-ring { width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; background: var(--brand-2); }
.m-ring::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 4px solid transparent; border-top-color: var(--brand); border-right-color: var(--brand); animation: spin .8s linear infinite; }
.m-ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: mPulse 1.2s ease-out infinite; }
@keyframes mPulse { 0% { box-shadow: 0 0 0 0 rgba(47, 143, 78, .45); } 100% { box-shadow: 0 0 0 22px rgba(47, 143, 78, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.m-card > b { font-size: 1.2rem; display: block; }
.m-card ul { list-style: none; margin: 14px 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.m-card li { font-size: .86rem; display: flex; align-items: center; gap: 8px; opacity: .35; animation: stepOn .3s ease forwards; animation-delay: var(--d); }
.m-card li i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; animation: stepDot .3s ease forwards; animation-delay: calc(var(--d) + .25s); }
@keyframes stepOn { to { opacity: 1; } }
@keyframes stepDot { to { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); } }
.m-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.m-bar span { display: block; height: 100%; width: 0; background: var(--brand); animation: mFill 1.65s linear forwards; }
@keyframes mFill { to { width: 100%; } }
@media (max-width: 700px) { .collect-hint { flex-direction: column; text-align: center; } .collect-hint button { margin: 0; width: 100%; } .wear-live .collect-btn { width: 100%; } }
