
/* Layout: blood-bank specimen labels. Left column takes input, right column shows the printed label. */
:root {
  --bg: #F4F0F2;
  --surface: #FFFFFF;
  --ink: #1D1722;
  --muted: #6A6070;
  --line: #DCD3D8;
  --accent: #B3142C;
  --accent-ink: #FFFFFF;
  --soft: #EEE7EB;
  --good: #1F7A4D;
  --warn: #A5600B;
  --bt-a: #F2C94C;
  --bt-b: #F29BB8;
  --bt-o: #6FA8F0;
  --bt-ab: #B697F0;
  --bt-ink: #1D1722;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15101A; --surface: #201A27; --ink: #F3EEF2; --muted: #A89DB0; --line: #3A3142;
    --accent: #E5586C; --accent-ink: #1B0A10; --soft: #2A2231; --good: #5BC58E; --warn: #E3A04F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15101A; --surface: #201A27; --ink: #F3EEF2; --muted: #A89DB0; --line: #3A3142;
  --accent: #E5586C; --accent-ink: #1B0A10; --soft: #2A2231; --good: #5BC58E; --warn: #E3A04F;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 40px;
}
html[lang="ko"] body { word-break: keep-all; }
.wrap { max-width: 1040px; margin: 0 auto; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; font-size: 11px; font-weight: 500; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand svg { width: 22px; height: 26px; flex: none; }
.brand span { min-width: 0; }
.brand small { font-family: var(--f-mono); font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.lang a, .lang button { white-space: nowrap; border: 0; background: none; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lang a[aria-current="page"], .lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* intro */
.intro { padding: 10px 0 22px; }
.intro h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(30px, 6.4vw, 48px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 10px; text-wrap: balance; }
.intro h1 em { font-style: normal; color: var(--accent); }
.intro p { margin: 0; color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); padding: 9px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* grid */
.grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }

@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* controls */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 16px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin: 0; font-size: 12px; }
.panel h2 span { color: var(--accent); }
.field { display: grid; gap: 8px; }
.field > label, .field > .lbl { font-size: 12px; color: var(--muted); font-weight: 700; }
.axis { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.axis button { border: 0; background: var(--surface); padding: 8px 6px; font-size: 13px; text-align: center; min-width: 0; }
.axis button + button { border-left: 1px solid var(--line); }
.axis button b { font-family: var(--f-display); font-size: 17px; margin-right: 4px; }
.axis button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.axis.three { grid-template-columns: repeat(3, 1fr); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.gnote { color: var(--muted); font-size: 14px; display: block; margin-top: 4px; }
.gnote .mono { color: var(--accent); margin-right: 4px; }
.axes { display: grid; gap: 8px; }
.code-now { font-family: var(--f-display); font-weight: 800; font-size: 32px; letter-spacing: .04em; line-height: 1; }
.bloods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bloods button { border: 2px solid transparent; border-radius: 12px; padding: 10px 0; font-family: var(--f-display); font-weight: 800; font-size: 20px; color: var(--bt-ink); }
.bloods button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.bt-A { background: var(--bt-a); } .bt-B { background: var(--bt-b); } .bt-O { background: var(--bt-o); } .bt-AB { background: var(--bt-ab); }

/* result: specimen label */
.result { display: grid; gap: 16px; min-width: 0; }
.spec { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 0; }
.spec-head { background: var(--accent); color: var(--accent-ink); display: flex; justify-content: space-between; gap: 8px; padding: 9px 16px; }
.spec-body { padding: 20px 20px 8px; display: grid; gap: 18px; }
.codeline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.code { font-family: var(--f-display); font-weight: 800; font-size: clamp(54px, 13vw, 92px); line-height: .95; letter-spacing: .01em; }
.chip { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font-family: var(--f-display); font-weight: 800; font-size: 24px; color: var(--bt-ink); flex: none; }
.chip.sm { width: 38px; height: 38px; font-size: 17px; }
.mname { color: var(--muted); font-size: 13px; font-weight: 500; margin: 0; }
.title { font-family: var(--f-display); font-weight: 800; font-size: clamp(24px, 4.6vw, 34px); line-height: 1.15; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.lead { margin: 0; font-size: 16px; }
.sec { display: grid; gap: 4px; border-top: 1px dashed var(--line); padding-top: 14px; }
.sec h3 { margin: 0; font-size: 12px; color: var(--muted); }
.sec p { margin: 0; }
.meters { display: grid; gap: 10px; border-top: 1px dashed var(--line); padding-top: 14px; }
.meter { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 10px; font-size: 13px; }
.meter .bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter b { font-variant-numeric: tabular-nums; text-align: right; font-family: var(--f-mono); font-size: 12px; font-weight: 500; }
.barcode { display: block; width: 100%; height: 46px; color: var(--ink); }
.spec-foot { padding: 6px 20px 16px; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }

/* pair */
.pair-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; }
.who { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.who .code { font-size: clamp(30px, 7vw, 46px); }
.who .t { font-weight: 700; font-size: 13px; line-height: 1.3; }
.who.r { justify-items: end; text-align: right; }
.who .row { display: flex; align-items: center; gap: 8px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .n { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .n b { font-family: var(--f-display); font-weight: 800; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .n span { font-size: 11px; color: var(--muted); }
.grade { text-align: center; font-family: var(--f-display); font-weight: 800; font-size: clamp(24px, 5vw, 32px); margin: 0; text-wrap: balance; }
@media (max-width: 520px) {
  .pair-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ring { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .two { grid-template-columns: minmax(0, 1fr); } }
.note { border-radius: 10px; padding: 12px 14px; background: var(--soft); display: grid; gap: 2px; align-content: start; }
.note h3 { margin: 0; font-size: 12px; }
.note.good h3 { color: var(--good); } .note.warn h3 { color: var(--warn); }
.note p { margin: 0; font-size: 14px; }

/* actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 13px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:hover { border-color: var(--ink); }
.share-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-right: 2px; }

footer { margin-top: 36px; color: var(--muted); font-size: 12px; max-width: 70ch; border-top: 1px solid var(--line); padding-top: 14px; }
footer p { margin: 0 0 6px; }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(10,6,14,.72); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal-box { background: var(--surface); border-radius: 14px; padding: 14px; max-width: 460px; width: 100%; max-height: 100%; overflow: auto; display: grid; gap: 12px; }
.modal-box img { width: 100%; height: auto; border-radius: 8px; display: block; }
.modal-box p { margin: 0; font-size: 12px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .meter .bar i { transition: width .5s ease; }
  .ring circle.val { transition: stroke-dashoffset .6s ease; }
}

/* ---- per-language type ---- */
html[lang="ko"] { --f-body: "Noto Sans KR", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "Noto Sans KR", sans-serif; }
html[lang="ja"] { --f-body: "Noto Sans JP", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "Noto Sans JP", sans-serif; }
html[lang="en"] { --f-body: "Noto Sans", system-ui, sans-serif; --f-display: "Bricolage Grotesque", "Noto Sans", sans-serif; }
html[lang="ja"] body { line-break: strict; }
.lang a { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }
.top-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav .links { display: flex; gap: 14px; font-size: 13px; }
.top-nav .links a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top-nav .links a:hover { color: var(--ink); text-decoration: underline; }
a.brand { color: inherit; text-decoration: none; }
@media (max-width: 560px) { .top { flex-wrap: nowrap; } .top-nav .links { display: none; } }

/* ---- content sections ---- */
.section { margin-top: 44px; display: grid; gap: 14px; min-width: 0; }
.section h2 { font-family: var(--f-display); font-weight: 800; font-size: clamp(22px, 4vw, 28px); line-height: 1.2; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.section p { margin: 0; }
.section .sub { color: var(--muted); }
.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin-top: 8px; }
.type-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tcard { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; display: grid; gap: 8px; min-width: 0; }
.tcard h3 { margin: 0; font-size: 15px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tcard h3 a { color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.tcard h3 a:hover { color: var(--accent); }
.tcard h3 span { color: var(--muted); font-size: 12px; font-weight: 500; }
.bt-links { display: flex; gap: 6px; flex-wrap: wrap; }
.bt-links a { display: inline-grid; place-items: center; min-width: 44px; height: 36px; padding: 0 10px; border-radius: 18px; font-family: var(--f-display); font-weight: 800; color: var(--bt-ink); text-decoration: none; border: 2px solid transparent; }
.bt-links a:hover { border-color: var(--ink); }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.page-h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 5.4vw, 42px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -.02em; text-wrap: balance; }
.article { max-width: 760px; margin: 0 auto; display: grid; gap: 22px; min-width: 0; }
.article.wide { max-width: 1040px; }
.prose { display: grid; gap: 12px; }
.prose h2 { font-family: var(--f-display); font-weight: 800; font-size: 20px; margin: 18px 0 0; }
.prose p { margin: 0; }
.prose a { color: var(--accent); }
.mini-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mini-list li a { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; color: var(--ink); text-decoration: none; }
.mini-list li a:hover { border-color: var(--ink); }
.mini-list .chip { width: 30px; height: 30px; font-size: 14px; }
.mini-list .pair { font-family: var(--f-display); font-weight: 800; letter-spacing: .02em; }
.mini-list .sc { margin-left: auto; font-family: var(--f-mono); font-size: 13px; color: var(--accent); font-weight: 500; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-row a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; }
.chips-row a:hover { border-color: var(--ink); }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.site-foot { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 10px; color: var(--muted); font-size: 12px; max-width: 76ch; }
.site-foot p { margin: 0; }
.site-foot .flinks { display: flex; gap: 16px; flex-wrap: wrap; }
.site-foot a, .site-foot button.linklike { color: var(--muted); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.desc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.gnotes { display: grid; gap: 6px; }

/* ---- ads and consent ---- */
.ad-slot { display: none; margin: 22px 0; text-align: center; min-width: 0; overflow: hidden; }
.ad-slot.on { display: block; }
.ad-slot::before { content: attr(data-label); display: block; font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0,0,0,.12);
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.consent-in { max-width: 1040px; margin: 0 auto; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.consent p { margin: 0; font-size: 13px; max-width: 68ch; }
.consent a { color: var(--accent); }
.consent .actions { flex: none; }
html[lang="ja"] .meter { grid-template-columns: 132px minmax(0, 1fr) 34px; }
.btn .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.share-row { gap: 8px; }
.modal-box h3 { margin: 0; font-size: 12px; }
.modal-box img.qr { image-rendering: pixelated; width: min(280px, 100%); margin: 0 auto; background: #fff; padding: 10px; }

/* ---- text wrapping: fill the width, never leave a lone word on the last line ---- */
html[lang="ko"], html[lang="ja"] { --measure: 46em; }
html[lang="en"] { --measure: 66ch; }
p, li, summary, .lead, .sec p, .note p, .tcard p, .desc-card p, .who .t, .mname { text-wrap: pretty; overflow-wrap: break-word; }
h1, h2, h3, .title, .grade, .page-h1 { text-wrap: balance; overflow-wrap: break-word; }
html[lang="ja"] body { word-break: auto-phrase; line-break: strict; }
.intro p { max-width: min(100%, 60em); }
.section p, .lead, .sec p, .prose p { max-width: var(--measure); }
.faq p { max-width: var(--measure); }
/* short descriptive blocks: balance every line so the last one is never a stray word */
.intro p, .section p, .lead, .sec p, .faq p, .site-foot p, .prose p { text-wrap: balance; }

/* =====================================================================================
   v2 tool: mobile-first. One 560px column, even on desktop. Scoped to body.home.
   ===================================================================================== */
body.home { padding-block: 14px 120px; }
body.home .wrap { max-width: 560px; }
body.home .top { padding-bottom: 8px; flex-wrap: nowrap; }
body.home .top-nav .links { display: none; }

body.home .intro { padding: 8px 0 18px; }
body.home .intro h1 { font-size: clamp(25px, 7.4vw, 36px); line-height: 1.16; margin-bottom: 8px; }
body.home .intro p { font-size: 14px; }
body[data-view="result"] .intro, body[data-view="test"] .intro { display: none; }
body[data-view="result"] .section, body[data-view="test"] .section { display: none; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--soft); border-radius: 14px; margin-bottom: 14px; }
.seg button { border: 0; background: none; min-height: 44px; border-radius: 11px; font-weight: 800; font-size: 15px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(30,10,20,.12); }

.pairbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.who-btn { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; min-height: 58px; display: grid; gap: 2px; align-content: center; min-width: 0; }
.who-btn b { font-size: 14px; }
.who-btn .mini { font-size: 12px; color: var(--ink); overflow-wrap: anywhere; line-height: 1.3; }
.who-btn .mini.dim { color: var(--muted); }
.who-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.relbtn { width: 100%; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; min-height: 48px; padding: 0 14px; margin-bottom: 8px; }
.relbtn .lbl { color: var(--muted); font-size: 12px; font-weight: 700; }
.relbtn b { font-size: 15px; margin-left: auto; }
.relbtn .chev { color: var(--muted); }
.editing { margin: 0 0 10px; font-size: 12px; color: var(--accent); font-weight: 700; }

.card2 { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 12px; display: grid; gap: 12px; min-width: 0; }
.card2 h2 { margin: 0; font-size: 16px; font-family: var(--f-display); font-weight: 800; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card2 h2 .opt { font-size: 11px; font-weight: 500; color: var(--muted); font-family: var(--f-body); }
.card2 .axes { display: grid; gap: 8px; }
.card2 .axis button { min-height: 44px; }
.card2 .axis button span { font-size: 12px; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card2 .code-now { font-size: 26px; letter-spacing: .12em; }
.dk { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.dk span { flex: 1 1 auto; min-width: 0; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; min-height: 36px; font-size: 13px; }
.btn.small { padding: 8px 12px; min-height: 40px; }
.bloods button { min-height: 52px; }

.grid-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pick { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); padding: 8px 2px 7px; display: grid; justify-items: center; align-content: start; gap: 3px; min-width: 0; }
.pick .ico { width: 42px; height: 42px; display: block; }
.pick .ico svg, .ico svg { width: 100%; height: 100%; display: block; }
.pick b { font-size: 12px; font-weight: 800; line-height: 1.2; text-align: center; }
.pick small { font-size: 10px; color: var(--muted); line-height: 1.3; text-align: center; font-variant-numeric: tabular-nums; }
.pick[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: 0 0 0 1px var(--accent) inset; }
.pick[aria-pressed="true"] b { color: var(--accent); }

/* bottom bar */
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: linear-gradient(to top, var(--bg) 62%, transparent); pointer-events: none; }
.bottom-bar .in { max-width: 528px; margin: 0 auto; display: grid; gap: 6px; pointer-events: auto; }
.bar-hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; text-wrap: balance; }
.cta { width: 100%; min-height: 54px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 17px; box-shadow: 0 6px 18px rgba(179,20,44,.28); }
.cta:disabled { background: var(--soft); color: var(--muted); box-shadow: none; cursor: not-allowed; }

/* sheets */
.sheet-back { position: fixed; inset: 0; z-index: 25; background: rgba(10,6,14,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; max-height: 88vh; overflow: auto; }
.sheet h3 { margin: 0; font-family: var(--f-display); font-size: 18px; font-weight: 800; }
.opt-list { display: grid; gap: 8px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 16px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; font-weight: 700; font-size: 15px; text-align: left; }
.opt-row i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.opt-row[aria-pressed="true"] { border-color: var(--accent); }
.opt-row[aria-pressed="true"] i { border-color: var(--accent); background: radial-gradient(var(--accent) 0 42%, transparent 46%); }
.selrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.selrow select { min-height: 48px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; padding: 0 10px; min-width: 0; }
.preview { min-height: 64px; display: grid; align-content: center; gap: 6px; background: var(--soft); border-radius: 14px; padding: 12px; font-size: 13px; }
.preview .dim { color: var(--muted); }
.preview .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.warn-line { margin: 0; font-size: 12px; color: var(--warn); }

/* chips with icons */
.ico { display: inline-block; width: 28px; height: 28px; flex: none; }
.cchip { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border-radius: 999px; padding: 4px 12px 4px 5px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.cchip em { font-style: normal; }
.cchip .chip { margin: 0; }
.cchip.mono-chip { background: var(--ink); color: var(--bg); padding: 6px 14px; font-family: var(--f-display); font-weight: 800; letter-spacing: .06em; font-size: 15px; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }

/* result */
.res-top { margin-bottom: 10px; }
.back-btn { border: 0; background: none; font-weight: 800; font-size: 14px; color: var(--ink); padding: 8px 0; min-height: 40px; }
.res { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; margin-bottom: 14px; }
.res-head { background: var(--accent); color: var(--accent-ink); display: flex; justify-content: space-between; gap: 8px; padding: 10px 18px; }
.res-body { padding: 18px 18px 8px; display: grid; gap: 16px; }
.res-foot { padding: 6px 18px 16px; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.res .title { font-family: var(--f-display); font-weight: 800; font-size: clamp(24px, 6.4vw, 32px); line-height: 1.18; margin: 0; letter-spacing: -.01em; }
.radar-box { background: var(--soft); border-radius: 16px; padding: 8px 0 4px; }
.radar { display: block; width: 100%; height: auto; }
.radar .rl { font-size: 15px; fill: var(--ink); font-weight: 500; }
.radar .rv { fill: var(--accent); font-weight: 800; font-family: var(--f-mono); }
.feat { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.feat li { position: relative; padding-left: 20px; }
.feat li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.res .pair-top { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 10px; }
.res .pair-top .who { justify-items: center; width: 100%; }
.res .pair-top .who .codes { justify-content: center; }
.res .pair-top .ring { order: 0; }
.res .pair-top .who.r { order: 2; text-align: center; justify-items: center; }
.res .pair-top .who:not(.r) { order: -1; }
.note.tip { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.used { margin: 0; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }
.res .sec { gap: 6px; }

/* test */
.test { display: grid; gap: 14px; }
.test-top { display: flex; align-items: center; justify-content: space-between; }
.bar.big { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar.big i, .tbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.test-note { margin: 0; font-size: 12px; color: var(--muted); }
.qtext { font-family: var(--f-display); font-weight: 800; font-size: clamp(21px, 5.8vw, 26px); line-height: 1.3; margin: 8px 0 6px; min-height: 3.9em; }
.answers { display: grid; gap: 8px; }
.ans { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; font-weight: 700; font-size: 15px; text-align: left; }
.ans i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.ans[aria-pressed="true"] { border-color: var(--accent); }
.ans[aria-pressed="true"] i { background: var(--accent); border-color: var(--accent); }
.tres { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.tcode { font-family: var(--f-display); font-weight: 800; font-size: clamp(54px, 16vw, 80px); letter-spacing: .08em; line-height: 1; }
.tname { margin: 0; color: var(--muted); font-weight: 700; }
.tbar { display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; gap: 10px; align-items: center; width: 100%; font-weight: 800; font-size: 13px; }
.tbar .bar { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.tres .actions { justify-content: center; }

/* wrapping per language: break only between words, keep phrases together */
html[lang="ko"] body, html[lang="ko"] .card2, html[lang="ko"] .sheet { word-break: keep-all; overflow-wrap: break-word; }
html[lang="en"] body { word-break: normal; overflow-wrap: break-word; hyphens: manual; }
html.ja-phrase body { word-break: keep-all; line-break: strict; overflow-wrap: break-word; }
html.ja-native body { word-break: auto-phrase; line-break: strict; }
.pick b, .cchip, .relbtn b, .opt-row span, .ans span { text-wrap: balance; }
.hint, .dk span, .bar-hint, .warn-line, .test-note, .used { text-wrap: pretty; }
.res .lead, .res .sec p, .res .note p, .res .feat li, .qtext, .intro p { text-wrap: pretty; }
.res .title, .res .grade, .intro h1 { text-wrap: balance; }
@media (prefers-reduced-motion: no-preference) { .bar.big i { transition: width .25s ease; } }
.res .lead, .res .sec p, .res .note p, .res .feat li { text-wrap: balance; }

/* ---------- v3: score-band colors (no red), fortune, best match ---------- */
.res { --sc: #4C5BD4; }
.res.sc-1, .fortune-sheet.sc-1 { --sc: #0E8A63; } .res.sc-2, .fortune-sheet.sc-2 { --sc: #1F6FD1; }
.res.sc-3, .fortune-sheet.sc-3 { --sc: #7650CF; } .res.sc-4, .fortune-sheet.sc-4 { --sc: #B57A12; } .res.sc-5, .fortune-sheet.sc-5 { --sc: #5F6B7A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .res { --sc: #8F9BF5; }
  :root:not([data-theme="light"]) .res.sc-1, :root:not([data-theme="light"]) .fortune-sheet.sc-1 { --sc: #4CCB9B; }
  :root:not([data-theme="light"]) .res.sc-2, :root:not([data-theme="light"]) .fortune-sheet.sc-2 { --sc: #6AA7F2; }
  :root:not([data-theme="light"]) .res.sc-3, :root:not([data-theme="light"]) .fortune-sheet.sc-3 { --sc: #A98BF0; }
  :root:not([data-theme="light"]) .res.sc-4, :root:not([data-theme="light"]) .fortune-sheet.sc-4 { --sc: #E5B24F; }
  :root:not([data-theme="light"]) .res.sc-5, :root:not([data-theme="light"]) .fortune-sheet.sc-5 { --sc: #A3AEBD; }
}
:root[data-theme="dark"] .res { --sc: #8F9BF5; }
:root[data-theme="dark"] .res.sc-1, :root[data-theme="dark"] .fortune-sheet.sc-1 { --sc: #4CCB9B; }
:root[data-theme="dark"] .res.sc-2, :root[data-theme="dark"] .fortune-sheet.sc-2 { --sc: #6AA7F2; }
:root[data-theme="dark"] .res.sc-3, :root[data-theme="dark"] .fortune-sheet.sc-3 { --sc: #A98BF0; }
:root[data-theme="dark"] .res.sc-4, :root[data-theme="dark"] .fortune-sheet.sc-4 { --sc: #E5B24F; }
:root[data-theme="dark"] .res.sc-5, :root[data-theme="dark"] .fortune-sheet.sc-5 { --sc: #A3AEBD; }
.radar .rv { fill: var(--sc); }
.feat li::before { background: var(--sc); }
.note.tip { background: color-mix(in srgb, var(--sc, var(--accent)) 8%, var(--surface)); }
.relbtn:disabled { opacity: .45; cursor: not-allowed; }
.relbtn:disabled .chev { visibility: hidden; }
.fortune-row { margin: 12px 0 4px; }
.btn.fortune { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; border-color: var(--ink); }
.bm { display: grid; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.bm h4 { margin: 0; font-size: 13px; font-weight: 800; }
.bm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bm-item { display: grid; gap: 4px; background: var(--soft); border-radius: 12px; padding: 8px 10px; align-content: start; min-width: 0; }
.bm-item .mono { color: var(--muted); font-size: 10px; }
.bm-note { margin: 0; font-size: 11px; color: var(--muted); }
.fortune-sheet { gap: 12px; }
.fx-date { margin: -8px 0 0; color: var(--muted); }
.fx-top { display: flex; gap: 14px; align-items: center; background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.fx-top p { margin: 0; text-wrap: balance; }
.fx-score { display: grid; justify-items: center; flex: none; color: var(--sc); }
.fx-score b { font-family: var(--f-display); font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.fx-score span { font-size: 11px; color: var(--muted); }
.fx-row p { margin: 4px 0 0; font-size: 14px; text-wrap: pretty; }
.fx-h { display: flex; justify-content: space-between; align-items: baseline; }
.fx-h .mono { color: var(--sc); font-weight: 700; }
.fx-bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.fx-bar i { display: block; height: 100%; background: var(--sc); border-radius: 99px; }
.fx-lucky { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fx-lucky div { background: var(--soft); border-radius: 12px; padding: 8px 10px; display: grid; gap: 2px; }
.fx-lucky .mono { font-size: 10px; color: var(--muted); } .fx-lucky b { font-size: 15px; }
.fx-note { margin: 0; font-size: 11px; color: var(--muted); }
.bm-item .cchip { justify-self: start; }
.res .res-head { background: var(--sc); }

.logo { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-display); font-weight: 800; text-transform: none; letter-spacing: -.01em; font-size: 13px; }
.logo svg { width: 11px; height: 13px; flex: none; fill: currentColor; } .logo i { font-style: normal; font-weight: 500; opacity: .8; } .logo b { font-weight: 800; }
.res-foot .logo { color: var(--ink); } .res-foot .logo svg { fill: var(--accent); }
.cta.need { background: var(--soft); color: var(--ink); border: 1.5px dashed var(--muted); font-size: 15px; line-height: 1.3; padding: 8px 14px; text-wrap: balance; }

.logo { gap: 7px; line-height: 1; }
.logo svg { fill: var(--accent); display: block; } .logo i, .logo b { display: block; line-height: 1; }
.res-head .logo { color: var(--accent-ink); } .res-head .logo svg { fill: var(--accent); }
.brand { gap: 8px; } .brand .x { font-style: normal; font-weight: 500; opacity: .85; line-height: 1; }

.res-head .logo svg { fill: #fff; }
.share-row { align-items: center; }
.share-row .share-label { flex: 0 0 100%; font-family: var(--f-display); font-size: 17px; font-weight: 800; color: var(--ink); margin: 10px 0 2px; padding-top: 14px; border-top: 1px solid var(--line); }

/* v4: text-only wordmark (no drop), red × */
.wm { display: inline-flex; align-items: baseline; gap: .12em; font-family: var(--f-display); font-weight: 800; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.wm i { color: var(--accent); font-style: normal; font-weight: 500; }
.brand .wm { font-size: 22px; }
.brand small { margin-left: 10px; }
.res-head .wm { color: var(--accent-ink); font-size: 15px; }
.res-head .wm i { color: var(--accent-ink); opacity: .85; }
.res-foot .wm { color: var(--ink); font-size: 14px; }
.spec-foot .wm { color: var(--ink); font-size: 14px; }

.intro .eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .01em; text-wrap: balance; }
.intro .descr { margin: 8px 0 6px; font-family: var(--f-display); font-weight: 700; font-size: 16px; color: var(--ink); text-wrap: balance; }

/* slogan beside the logo; stacks under it on narrow screens */
.brand small { font-family: var(--f-body, inherit); font-weight: 600; font-size: 12px; letter-spacing: 0; color: var(--muted); line-height: 1.3; text-wrap: balance; }
@media (max-width: 640px) { .brand { flex-direction: column; align-items: flex-start; gap: 2px; } .brand small { margin-left: 0; font-size: 11.5px; max-width: 190px; text-wrap: wrap; word-break: keep-all; } }

/* spec card radar + types link */
.spec { --sc: #4C5BD4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .spec { --sc: #8F9BF5; } }
:root[data-theme="dark"] .spec { --sc: #8F9BF5; }
.spec .meters { border-top: 1px dashed var(--line); }
.browse-link h2 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.goto { font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; border-bottom: 1.5px solid currentColor; }
.goto:hover { opacity: .8; }
.spec-head { align-items: center; padding: 10px 18px; }
.spec-head .wm { color: var(--accent-ink); font-size: 15px; }
.spec-head .wm i { color: var(--accent-ink); opacity: .85; }

/* back link on sub pages (same look as the result screen's back button) */
a.back-btn { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.article > .back-btn { margin: -6px 0 2px; }

/* richer solo result */
.res .nick { margin: 6px 0 0; font-weight: 700; font-size: 16px; }
.res .nick .mono { margin-right: 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.res .mix-tag { display: inline-block; margin-bottom: 2px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); }
.res .mix-tag.up { color: var(--good); }
.res .mix-tag.down { color: var(--warn); }
.res .mix-tag.clash { color: var(--accent); }
.res .sec p + p { margin-top: 10px; }
.res .more-hint { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.res .mix-tag.comp { color: var(--sc, var(--accent)); }
.res .mix-tag.comp { color: var(--sc, var(--accent)); }
