:root {
  --ink: #0a0d0c;
  --surface: #111614;
  --surface-2: #161d1a;
  --line: rgba(233, 239, 233, 0.09);
  --line-strong: rgba(233, 239, 233, 0.18);
  --text: #eef2ee;
  --muted: #8a958f;
  --faint: #5c6660;
  --volt: #d7ff3c;
  --opp: #ff5a4e;
  --cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC";
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", var(--cjk), sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, var(--cjk), sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
:lang(ja) {
  --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans CJK JP";
}
:lang(ko) {
  --cjk: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR";
  word-break: keep-all;
}
/* Arabic: no condensed Latin face, no letter-spacing (it breaks letter joining), RTL-friendly line height */
:lang(ar) {
  --display: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
  --body: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
}
:lang(ar) * { letter-spacing: 0 !important; }
:lang(ar) .intro h1 { line-height: 1.3; font-size: clamp(40px, 6vw, 76px); }
:lang(ar) .result-hero h2 { line-height: 1.3; font-size: clamp(40px, 6vw, 80px); }
:lang(ar) .side .ask { line-height: 1.4; font-size: 32px; }
:lang(ar) .lede, :lang(ar) .verdict p, :lang(ar) .blurb { line-height: 1.9; }
/* CJK/Hangul have no condensed caps: give headings a little more air */
:lang(zh) .intro h1, :lang(ja) .intro h1 { line-height: 1.08; letter-spacing: 0.01em; }
:lang(ko) .intro h1 { line-height: 1.32; letter-spacing: 0; font-size: clamp(40px, 5.6vw, 72px); }
:lang(ja) .intro h1 { font-size: clamp(42px, 6vw, 80px); }
:lang(ko) .result-hero h2 { word-break: keep-all; }
/* numbers/counters stay left-to-right inside RTL layouts */
.progress-count, .clock, .big-stat b { direction: ltr; unicode-bidi: isolate; }
:lang(zh) .result-hero h2, :lang(ja) .result-hero h2, :lang(ko) .result-hero h2 { line-height: 1.05; font-size: clamp(48px, 7vw, 92px); }
:lang(zh) .side .ask, :lang(ja) .side .ask, :lang(ko) .side .ask { line-height: 1.15; }
/* long headlines keep the intro within one desktop screen */
:lang(tr) .intro h1, :lang(id) .intro h1, :lang(vi) .intro h1 { font-size: clamp(44px, 6.4vw, 80px); }

/* RTL: logical alignment */
.opt { text-align: start; }
.mix-row .pct { text-align: end; }
.legend .dir { margin-left: 0; margin-inline-start: auto; }
[dir="rtl"] .opt .p { align-items: flex-start; }

.top-right { display: flex; align-items: center; gap: 16px; }
.lang select {
  background: var(--ink); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 6px 10px; font: 600 13px var(--body); cursor: pointer;
}
.lang select:hover { border-color: var(--text); }
.lang select option { background: var(--surface); color: var(--text); }
/* long headlines (FR/PT/IT) keep the intro within one desktop screen */
:lang(fr) .intro h1, :lang(pt) .intro h1, :lang(it) .intro h1 { font-size: clamp(44px, 6.4vw, 78px); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { background: var(--ink); color: var(--text); font-family: var(--body); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.shell { max-width: 1080px; margin: 0 auto; padding: 18px 20px 40px; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.wordmark { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: 0.06em; }
.wordmark b { color: var(--volt); font-weight: 800; }
.progress { display: flex; align-items: center; gap: 12px; }
.progress-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.progress-track { display: flex; gap: 4px; }
.progress-track i { width: 18px; height: 3px; background: var(--line-strong); border-radius: 2px; }
.progress-track i.done { background: var(--text); }
.progress-track i.now { background: var(--volt); }

.screen { display: none; }
.screen.on { display: block; animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.eyebrow.volt { color: var(--volt); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 14px 26px; border-radius: 999px; transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-volt { background: var(--volt); color: var(--ink); }
.btn-volt:hover { background: #e3ff6e; }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }

/* ---------- intro ---------- */
.intro { display: grid; gap: 40px; padding: 24px 0 8px; }
@media (min-width: 860px) { .intro { grid-template-columns: 1.1fr 0.9fr; align-items: center; } }
.intro h1 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(48px, 8vw, 96px); line-height: 0.9; letter-spacing: -0.01em; margin: 14px 0 22px; overflow-wrap: break-word;
}
.intro h1 em { font-style: normal; color: var(--volt); }
.intro p.lede { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 460px; margin-bottom: 30px; }
.intro .meta { margin-top: 18px; font-size: 13px; color: var(--faint); }

.roster { border-top: 1px solid var(--line); }
.roster-row {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: baseline; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.roster-row .n { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.roster-row .who { font-family: var(--display); font-weight: 700; font-size: 24px; text-transform: uppercase; letter-spacing: 0.02em; }
.roster-row .type { font-size: 13px; color: var(--muted); }

/* ---------- question ---------- */
.play { display: grid; gap: 22px; }
@media (min-width: 860px) { .play { grid-template-columns: 1.08fr 0.92fr; align-items: start; } }

.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; }
#board { display: block; width: 100%; max-height: 72vh; aspect-ratio: 1; border-radius: 10px; }
.legend .dir { margin-left: auto; font-family: var(--display); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.legend { display: flex; gap: 16px; padding: 10px 6px 4px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-you { background: var(--volt); }
.lg-mate { background: #e9efe9; }
.lg-opp { border: 2px solid var(--opp); }

.side { display: flex; flex-direction: column; gap: 18px; }
.context { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.match { font-family: var(--display); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: 0.02em; }
.clock { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.ask { font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 0.95; text-transform: uppercase; }
.ask small { display: block; font-family: var(--body); font-weight: 400; font-size: 14px; text-transform: none; color: var(--muted); margin-top: 10px; line-height: 1.5; }

.options { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.opt {
  display: grid; grid-template-columns: 34px 1fr 92px; align-items: center; gap: 14px;
  padding: 16px 4px; border-bottom: 1px solid var(--line); text-align: left; transition: background 0.15s ease;
}
.opt:hover:not(:disabled), .opt.hot { background: var(--surface-2); }
.opt:disabled { cursor: default; }
.opt .k {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px;
}
.opt:hover:not(:disabled) .k, .opt.hot .k { border-color: var(--volt); color: var(--volt); }
.opt .d { font-size: 16px; font-weight: 500; }
.opt .tag { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.opt .p { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.opt .p b { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted); }
.opt .bar { width: 72px; height: 3px; background: var(--line-strong); border-radius: 2px; overflow: hidden; }
.opt .bar i { display: block; height: 100%; background: var(--muted); }

.opt.is-pick .k { background: var(--volt); border-color: var(--volt); color: var(--ink); }
.opt.is-pro .k { background: #fff; border-color: #fff; color: var(--ink); }
.opt.is-pick.is-pro .k { background: var(--volt); border-color: var(--volt); box-shadow: 0 0 0 3px rgba(255,255,255,0.9); }
.opt.dim { opacity: 0.42; }
.opt.revealed .tag { color: var(--text); }

.verdict { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); display: none; }
.verdict.on { display: block; animation: rise 0.3s ease both; }
.verdict h3 { font-family: var(--display); font-weight: 800; font-size: 28px; text-transform: uppercase; line-height: 1; }
.verdict h3.same { color: var(--volt); }
.verdict p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 10px 0 16px; }
.verdict p strong { color: var(--text); font-weight: 600; }
.verdict .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chip {
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text);
}

/* ---------- result ---------- */
.result { display: grid; gap: 28px; padding-top: 10px; }
@media (min-width: 1000px) { .result { grid-template-columns: 1.1fr 0.9fr; align-items: start; } }
.result-hero h2 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(60px, 10vw, 120px); line-height: 0.86; margin: 12px 0 14px; word-break: break-word;
}
.result-hero .archetype { font-family: var(--display); font-weight: 700; font-size: 24px; text-transform: uppercase; color: var(--volt); letter-spacing: 0.04em; }
.result-hero .blurb { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 14px 0 24px; max-width: 480px; }
.result-hero .alts { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.result-hero .alts b { color: var(--text); font-weight: 600; }
.result-hero .alts .n { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.panel + .panel { margin-top: 14px; }
.panel h4 { margin-bottom: 14px; }
.mix-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 12px; padding: 8px 0; }
.mix-row .lbl { font-family: var(--display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; }
.mix-row .tracks { display: flex; flex-direction: column; gap: 5px; }
.mix-row .track { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.mix-row .track i { display: block; height: 100%; border-radius: 3px; transition: width 0.8s cubic-bezier(.2,.9,.3,1); }
.mix-row .track.you i { background: var(--volt); }
.mix-row .track.star i { background: #fff; }
.mix-row .pct { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; line-height: 1.35; }
.mix-row .pct em { font-style: normal; color: var(--faint); }

.vs-grid { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
#resMap { width: 150px; height: 210px; display: block; border-radius: 6px; }
.vs-legend, .map-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.vs-legend { margin-bottom: 6px; }
.vs-legend b { font-weight: 500; color: var(--muted); }
.map-legend { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.vs-legend span, .map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.vs-legend i, .map-legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
i.you { background: var(--volt); }
i.star { background: #fff; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.big-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.big-stat b { font-family: var(--display); font-weight: 800; font-size: 52px; line-height: 1; }
.big-stat span { color: var(--muted); font-size: 14px; }
.calls { list-style: none; }
.calls li { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.calls li .m { color: var(--faint); }
.calls li.hit .m { color: var(--volt); }
.calls li .s { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.yt-line { color: var(--muted); font-size: 14px; line-height: 1.55; margin-bottom: 14px; }
.yt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-yt { background: #ff0033; color: #fff; text-decoration: none; }
.btn-yt:hover { background: #ff2a52; }
.yt-actions .btn-ghost { text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--ink); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; transition: all 0.25s ease; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateX(-50%); }

.foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

@media (max-width: 600px) {
  .shell { padding: 14px 14px 32px; }
  .ask { font-size: 32px; }
  .opt { grid-template-columns: 30px 1fr 64px; gap: 10px; }
  .opt .bar { width: 52px; }
  .progress-track i { width: 10px; }
  .progress-track { display: none; }
  .top-right { gap: 10px; }
  .mix-row { grid-template-columns: 80px 1fr 36px; }
  .vs-grid { grid-template-columns: 112px 1fr; gap: 14px; }
  #resMap { width: 112px; height: 160px; }
}
