:root {
  --bg: #14110f; --panel: #1d1916; --panel-2: #26211d; --line: #3a322c;
  --text: #f6efe8; --muted: #b3a79c; --accent: #ff7a59; --accent-2: #ffc857;
  --ok: #7bd389; --danger: #ff6b6b; --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; }
a { color: var(--accent-2); }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

header.top { position: sticky; top: 0; z-index: 20; background: rgba(20,17,15,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; color: var(--text); margin-right: auto; }
.disc { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle, var(--accent-2) 0 18%, var(--bg) 19% 30%, #2b2420 31% 100%); box-shadow: inset 0 0 0 2px var(--accent); }
.nav-btn { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.nav-btn:hover { border-color: var(--muted); }
select.lang { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 14px; }
.bmc-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-2); color: #1a1410; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.bmc-btn:hover { filter: brightness(1.05); }

.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(32px, 6vw, 54px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 16px; max-width: 14ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 18px; max-width: 56ch; margin: 0 0 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; color: var(--muted); }
.chips li::before { content: "✓ "; color: var(--ok); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 18px 0; }
.card h2 { font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.card h2 .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #1a1410; font-size: 14px; }
.card .hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } header.top .bmc-btn span.lbl { display: none; } }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
label .opt { opacity: .7; font-weight: 400; }
input, select.field { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
input:focus, select.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,89,.18); }
input.bad, select.bad { border-color: var(--danger); }

.primary { width: 100%; background: var(--accent); color: #1a1410; border: 0; border-radius: 12px; padding: 15px; font-weight: 700; font-size: 17px; cursor: pointer; }
.primary:disabled { opacity: .6; cursor: progress; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.ghost:hover { border-color: var(--muted); }
.danger-link { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 0; text-decoration: underline; font-size: 14px; }
.error { color: var(--danger); font-size: 14px; min-height: 1.5em; margin: 10px 0 0; }

.magic { display: flex; gap: 8px; margin-top: 10px; }
.magic button { white-space: nowrap; flex: none; }
.magic input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(120deg, rgba(255,200,87,.14), rgba(255,122,89,.10)); border: 1px solid rgba(255,200,87,.35); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; }
.banner p { margin: 0; max-width: 52ch; }

.match { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 12px; }
@media (max-width: 560px) { .match { grid-template-columns: auto 1fr; } .match .actions { grid-column: 1 / -1; } }
.score { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.score::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--panel-2); }
.score span { position: relative; }
.match .who { font-weight: 600; }
.match .meta { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 2px 9px; margin-left: 6px; vertical-align: 2px; border: 1px solid var(--line); color: var(--muted); }
.badge.mutual { border-color: var(--accent-2); color: var(--accent-2); }
.waiting { color: var(--muted); font-size: 14px; }
.revealed { color: var(--ok); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .disc { width: 54px; height: 54px; margin: 0 auto 12px; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .empty .disc { animation: none; } }

dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); padding: 28px; max-width: 420px; width: calc(100% - 40px); text-align: center; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { font-size: 24px; margin: 6px 0 8px; }
dialog .handle { font-size: 20px; font-weight: 700; background: var(--panel-2); border-radius: 10px; padding: 12px; margin: 14px 0; word-break: break-all; }
dialog .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 26px 0 40px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; }
.hidden { display: none !important; }

/* --- utility classes (replace inline style attributes, so the CSP needs no 'unsafe-inline') --- */
.hero.compact { padding-bottom: 8px; }
.hero.compact h1 { max-width: none; }
.hint.flush { margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.actions-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.modal-emoji { font-size: 42px; }
.modal-bmc { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.modal-bmc p { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 15px; margin: 18px 0 6px; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.check.bad { color: var(--danger); }
.privacy-note { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
#tsBox { min-height: 70px; margin: 8px 0 14px; }
.signals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.signal { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: rgba(123,211,137,.12); color: var(--ok); }
.badge.strong { border-color: var(--accent-2); color: var(--accent-2); }
.report-link { background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; margin-top: 6px; }
.actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 560px) { .actions { align-items: flex-start; } }
.about-you { color: var(--muted); font-size: 13px; margin-top: 4px; }
.notice { color: var(--ok); font-size: 14px; min-height: 1.5em; margin: 10px 0 0; }
.doc { max-width: 680px; padding: 40px 0; }
.doc h1 { font-size: 34px; letter-spacing: -.02em; margin: 0 0 6px; }
.doc h2 { font-size: 19px; margin: 28px 0 6px; }
.doc p, .doc li { color: var(--muted); }
.doc .draft { border: 1px dashed var(--accent-2); color: var(--accent-2); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card h2 .opt { color: var(--muted); font-weight: 400; font-size: 14px; }
.lib-check { margin-top: 8px; font-size: 13px; color: var(--text); background: rgba(255,200,87,.08); border: 1px solid rgba(255,200,87,.25); border-radius: 10px; padding: 8px 10px; }
.lib-check b { color: var(--accent-2); font-weight: 600; }
.listen-other { margin-top: 8px; }
.score.full { background: var(--ok); color: #10200f; }
.score.full::before { display: none; }

/* Screenshot reading (on-device) */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.scan-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: var(--accent); color: #111; font-weight: 700; cursor: pointer; }
.scan-btn:focus-within, #scanFiles:focus-visible + .scan-btn { outline: 2px solid var(--accent); outline-offset: 3px; }
.scan-progress { margin-top: 14px; }
.scan-progress .bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.scan-progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.scan-progress p { font-size: 14px; margin: 8px 0 0; opacity: .8; }
.auto { box-shadow: 0 0 0 2px var(--accent) inset; }
.scan-missing { color: var(--danger); }
.email-alert { margin-top: 14px; }
.email-alert .hint { margin-top: 6px; }
