@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; src: url("fonts/FiraSansCondensed-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  --purple: #7973FF;
  --purple-dark: #554FCC;
  --navy: #110D4A;
  --navy-2: #322E7A;
  --lilac: #A7A3F9;
  --lilac-2: #E1E4FF;
  --white-ish: #F5F6FF;
  --red: #D1283E;
  --red-dark: #9F0519;
  --amber: #E09A2B;
  --text: #110D4A;
  --muted: #5B587F;
  --bg: #FFFFFF;
  --line: #E1E4FF;
  --radius: 14px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
h1, h2, h3 {
  font-family: "Fira Sans Condensed", "Inter", sans-serif;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
}
h1 { font-size: 26px; }
h2 { font-size: 19px; letter-spacing: .01em; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
ul { margin: 0; padding-left: 20px; }
li { margin: 0 0 6px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Persistent pilot banner */
.pilot-banner {
  position: sticky; top: 0; z-index: 50;
  background: var(--red); color: #fff;
  font-size: 12.5px; line-height: 1.35;
  padding: 8px var(--gutter);
  padding-top: calc(8px + env(safe-area-inset-top));
  text-align: center;
}
.pilot-banner strong { letter-spacing: .06em; margin-right: 4px; }

/* Safety screen */
.safety { background: var(--white-ish); min-height: 100vh; }
.safety-inner { max-width: 560px; margin: 0 auto; padding: 20px var(--gutter) 40px; }
.safety .logo { height: 30px; width: auto; display: block; margin: 4px 0 18px; }
.safety h1 { margin-bottom: 10px; }
.lead { font-size: 15.5px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0;
}
.card h2 { margin: 2px 0 8px; }
.card ul + h2 { margin-top: 14px; }
.card.warn { border-color: var(--red); background: #FFF5F6; }
.card.warn h2 { color: var(--red-dark); }
.confirm { margin-top: 18px; }
.confirm label {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; cursor: pointer;
}
.confirm input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--purple); flex: none; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 999px;
  padding: 14px 18px; font-weight: 700; font-size: 16px; cursor: pointer;
}
.btn.primary { background: var(--purple); color: #fff; }
.btn.primary:disabled { background: var(--lilac); cursor: not-allowed; }

/* App shell */
#app { max-width: 640px; margin: 0 auto; }
.topbar {
  position: sticky; top: var(--banner-h, 35px); z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px var(--gutter);
}
.topbar h1 { font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--purple-dark); background: var(--lilac-2); border-radius: 999px; padding: 3px 8px;
}
.icon-btn { background: none; border: 0; padding: 4px; margin-left: -6px; cursor: pointer; color: var(--navy); display: flex; }
.view { padding: 14px var(--gutter) 40px; }

.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--lilac); border-radius: 12px; padding: 0 12px; color: var(--muted);
  background: #fff;
}
.search input { flex: 1; border: 0; outline: 0; font: inherit; padding: 12px 0; color: var(--text); background: transparent; min-width: 0; }
.search:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac-2); }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--white-ish); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 12px 0;
}
.segmented button { border: 0; background: none; border-radius: 9px; padding: 8px; font-weight: 600; cursor: pointer; color: var(--muted); }
.segmented button[aria-selected="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(17,13,74,.12); }

.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 6px; text-align: center; }
.bodymap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bodymap figure { margin: 0; text-align: center; }
.bodymap figcaption { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.bodymap svg { width: 100%; height: auto; display: block; }
.hotspot { cursor: pointer; outline: none; }
.hotspot:focus-visible circle.halo { opacity: .5; }
.hotspot circle.dot { fill: var(--purple); stroke: #fff; stroke-width: 1.5; }
.hotspot circle.halo { fill: var(--purple); opacity: .22; }
.hotspot.active circle.dot { fill: var(--red); }
.hotspot.active circle.halo { fill: var(--red); opacity: .3; }
.hotspot text { fill: #fff; font: 700 8px "Inter", sans-serif; pointer-events: none; }

.chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--lilac-2); color: var(--navy); border-radius: 999px;
  padding: 6px 6px 6px 14px; margin: 12px 0 4px; scroll-margin-top: 130px; font-weight: 600; font-size: 14px;
}
.chip button { border: 0; background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }

.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: "Inter", sans-serif; font-weight: 700; margin: 18px 0 6px; }
.muscle-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; cursor: pointer;
}
.muscle-item:active { background: var(--white-ish); }
.muscle-item .thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--white-ish); overflow: hidden; }
.muscle-item .thumb svg { width: 100%; height: 100%; display: block; }
.muscle-item .meta { flex: 1; min-width: 0; }
.muscle-item .name { font-weight: 600; display: block; }
.muscle-item .sub { font-size: 13px; color: var(--muted); }
.chev { color: var(--lilac); flex: none; }

.risk { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: 2px 8px; }
.risk.low { background: #E8F5EC; color: #1F6B3A; }
.risk.moderate { background: #FFF3DD; color: #8A5300; }
.risk.high, .risk.very-high { background: #FDE7EA; color: var(--red-dark); }

.empty { text-align: center; color: var(--muted); margin: 24px 0; }
.footnote { font-size: 12.5px; color: var(--muted); margin-top: 22px; }

/* Detail */
.detail-head { margin-bottom: 12px; }
.detail-head h2 { font-size: 26px; margin-bottom: 6px; }
.detail-head .sub { color: var(--muted); font-size: 14px; }
.figure-card { background: var(--white-ish); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.figure-views { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.figure-views figure { margin: 0; background: #fff; border-radius: 10px; padding: 6px; }
.figure-views svg { width: 100%; height: auto; max-height: 320px; display: block; }
.figure-views figcaption { font-size: 11.5px; color: var(--muted); text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.placeholder-note {
  font-size: 12.5px; color: var(--red-dark); background: #FFF5F6; border: 1px dashed var(--red);
  border-radius: 10px; padding: 8px 10px; margin-top: 10px;
}
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 10px; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
.danger-list { counter-reset: none; list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; }
.danger-list li { display: flex; gap: 8px; align-items: flex-start; }
.num { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }

.section { margin-top: 22px; }
.section > h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 8px; }
.kv div { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.kv dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kv dd { margin: 2px 0 0; }
.danger-card { background: #FFF5F6; border: 1px solid var(--red); border-radius: var(--radius); padding: 12px 14px; }
.danger-card h3 { color: var(--red-dark); }
.danger-card .dz { margin-bottom: 10px; }
.danger-card .dz:last-child { margin-bottom: 0; }
.danger-card .dz strong { display: block; }
.review-card { background: #FFF8EC; border: 1px solid var(--amber); border-radius: var(--radius); padding: 12px 14px; }
.review-card h3 { color: #8A5300; }
.refs { padding-left: 18px; font-size: 13.5px; }
.refs li { margin-bottom: 10px; }
.refs .supports { display: block; color: var(--muted); font-size: 12.5px; }
.depth-note { font-size: 13px; color: var(--muted); background: var(--white-ish); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
