/* ============================================================
   REFINED ROSE  —  premium minimal, romantic pink + gold
   Offline & private: system serif/sans only, no web fonts.
   ============================================================ */
:root {
  color-scheme: light;
  /* Surfaces — soft blush ivory */
  --bg: #fbf4f7;
  --bg-2: #f1e2e9;
  --surface: #ffffff;
  --surface-2: #fbf5f8;
  --panel: #ffffff;
  --panel-2: #fbf3f6;
  --border: #efdae3;
  --border-strong: #e3c4d1;
  /* Ink — deep wine for dark fills / outlines */
  --ink: #47222f;
  --text: #3a1c28;
  --text-soft: #785763;
  --muted: #a98a95;
  /* Brand — romantic rose + elegant gold */
  --accent: #db2777;
  --accent-strong: #be1e63;
  --accent-soft: #fbe3ee;
  --accent-grad: #db2777;
  --acid: #f7e6ee;          /* soft blush highlight / hover (light in both modes) */
  --on-acid: #47222f;       /* text on blush / pastel (constant) */
  --gold: #a97b2f;          /* elegant gold accent (hairlines, emblem) */
  --gold-soft: #f3e7d0;
  /* Status — muted, semantic */
  --green: #2f8f57;
  --green-soft: #dcf1e4;
  --yellow: #b3841f;
  --yellow-soft: #f7eccf;
  --red: #d7413f;
  --red-soft: #fbdcdb;
  --red-ink: #a72d2c;
  /* Secondary role (S) — muted plum */
  --role-s: #9c4f86;
  --role-recv: #b83272;
  --role-give: #9a6b36;
  --role-both: #7563a8;
  --rating-1: #d8ccd2;
  --rating-2: #efd58e;
  --rating-3: #a9c8df;
  --rating-4: #9fcdb2;
  --rating-5: #e7ad8e;
  --rating-6: #df8298;
  --progress: linear-gradient(90deg, var(--gold), var(--accent));
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --content-max: 1120px;
  /* Radii — softly rounded */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  /* Elevation — soft, diffuse */
  --shadow-sm: 0 1px 2px rgba(58, 28, 40, .05);
  --shadow: 0 12px 34px rgba(58, 28, 40, .09);
  --shadow-lg: 0 32px 64px rgba(58, 28, 40, .16);
  --ring: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent);
  /* Motion — slow, elegant */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: .18s;
  --t: .32s;
  /* Type — elegant serif display + clean sans (system fallbacks, no network) */
  --display: "Cormorant Garamond", Cormorant, "Songti SC", "STSong", Georgia, "Times New Roman", "PingFang SC", serif;
  --serif: "Cormorant Garamond", Cormorant, "Songti SC", "STSong", Georgia, "Times New Roman", "PingFang SC", serif;
  --sans: "Montserrat", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", "Roboto Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Surfaces — deep wine night */
    --bg: #1a1015;
    --bg-2: #241820;
    --surface: #221820;
    --surface-2: #2c2029;
    --panel: #221820;
    --panel-2: #2c2029;
    --border: #47303b;
    --border-strong: #5d3e4c;
    --ink: #f3e5ec;
    --text: #f3e5ec;
    --text-soft: #d2b8c4;
    --muted: #a98a97;
    --accent: #ec5b95;
    --accent-strong: #f584b0;
    --accent-soft: #3f1726;
    --accent-grad: #ec5b95;
    --acid: #f7e6ee;
    --on-acid: #47222f;
    --gold: #d3a458;
    --gold-soft: #3a2f1c;
    --green: #57cc82;
    --green-soft: #12331f;
    --yellow: #e6b84e;
    --yellow-soft: #382b10;
    --red: #f0605f;
    --red-soft: #3c1514;
    --red-ink: #ff9a99;
    --role-s: #d08fbf;
    --role-recv: #ec6da7;
    --role-give: #d3a458;
    --role-both: #a899db;
    --rating-1: #62525b;
    --rating-2: #806d3c;
    --rating-3: #486b84;
    --rating-4: #417258;
    --rating-5: #854f3c;
    --rating-6: #8d4055;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 12px 34px rgba(0, 0, 0, .5);
    --shadow-lg: 0 32px 64px rgba(0, 0, 0, .62);
    --ring: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--acid); color: var(--on-acid); }

/* Brutalist label helper */
.eyebrow, .lock-label, .brand-sub, .legend-item, .role-badge,
.an-chip, .cmp-head, .stat-label, .role-pill {
  font-family: var(--mono);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Motion primitives ---------- */
@keyframes lock-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; transform: translate3d(-12px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise-stagger { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Landing / Lock — premium minimal, single view ---------- */
.lock-screen { position: fixed; inset: 0; z-index: 100; }
.lock-screen.landing {
  display: grid; place-items: center; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 32px 24px;
  background:
    radial-gradient(1100px 620px at 50% -10%, var(--surface), transparent 60%),
    radial-gradient(760px 620px at 106% 112%, var(--accent-soft), transparent 62%),
    var(--bg);
}

.lock-view {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  animation: lock-in .8s var(--ease) both;
}

.lock-emblem {
  width: 60px; height: 60px; display: grid; place-items: center; margin-bottom: 26px;
  color: var(--accent); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 50%;
  box-shadow: var(--shadow-sm); position: relative;
}
.lock-emblem::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
}
.lock-emblem svg { width: 26px; height: 26px; }

.lock-title { font-family: var(--serif); font-weight: 600; font-size: clamp(36px, 9vw, 48px); letter-spacing: .08em; line-height: 1.1; margin: 0; color: var(--text); }
.lock-rule { width: 42px; height: 1px; background: var(--gold); margin: 18px 0 16px; opacity: .85; }
.lock-sub { font-size: 13.5px; color: var(--text-soft); margin: 0 0 32px; line-height: 1.75; letter-spacing: .01em; max-width: 30ch; }

/* Unlock form */
.lock-card { width: 100%; background: transparent; border: none; box-shadow: none; padding: 0; margin: 0; display: block; text-align: left; }
.auth-switch { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 22px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.auth-tab { min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--text-soft); font: 600 13px var(--sans); cursor: pointer; transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-tab:focus-visible { outline: none; box-shadow: var(--ring); }
.lock-password-label { margin-top: 16px; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 18px; border-radius: 999px; }
.auth-note { margin: 12px 12px 0; color: var(--muted); font-size: 11.5px; line-height: 1.65; text-align: center; }
.lock-label { display: block; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin: 0 0 9px 4px; font-weight: 500; }
.lock-field {
  display: flex; align-items: center; gap: 0; width: 100%;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 5px 4px 18px;
  box-shadow: var(--shadow); transition: box-shadow var(--t), border-color var(--t);
}
.lock-field:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow); }
.lock-field-ico { color: var(--muted); display: grid; place-items: center; flex: none; margin-right: 10px; }
.lock-field-ico svg { width: 18px; height: 18px; }
.lock-field input { flex: 1; min-width: 0; border: none; background: transparent; padding: 13px 4px; font-size: 15px; letter-spacing: 1px; font-family: var(--sans); }
.lock-field input:focus { box-shadow: none; }
.lock-field .btn-primary { flex: none; border-radius: 999px; padding: 13px 28px; align-self: stretch; border: none; font-family: var(--sans); text-transform: none; letter-spacing: .04em; font-weight: 600; }
.lock-error { color: var(--red); font-size: 12.5px; margin-top: 14px; text-align: center; }
.lock-setup { color: var(--yellow); font-size: 12.5px; line-height: 1.6; margin-top: 14px; text-align: center; }

.lock-meta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 28px; }
.lock-meta span { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; }
.lock-meta span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--gold); margin: 0 10px 0 2px; }

.lock-foot { position: fixed; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 11px; letter-spacing: .03em; padding: 0 20px; pointer-events: none; }
.app[hidden] { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  font-family: var(--display); font-weight: 900; font-size: 20px; color: var(--bg);
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 72%, var(--border)); border-radius: var(--radius-sm);
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-title { font-family: var(--display); font-weight: 900; font-size: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--text); line-height: 1; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.tabs { display: flex; gap: 3px; flex-wrap: wrap; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.tab {
  background: var(--bg); color: var(--text); border: none;
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono);
  transition: color var(--t-fast), background var(--t-fast);
}
.tab + .tab { border-left: 0; }
.tab:hover { background: var(--acid); color: var(--on-acid); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); position: relative; z-index: 2; }
.tab.active { color: var(--surface); background: var(--ink); box-shadow: var(--shadow-sm); }
.account-bar { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-soft); }
.sync-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--green); white-space: nowrap; }
.sync-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sync-status.syncing { color: var(--yellow); }
.sync-status.error, .sync-status.offline { color: var(--red); }
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; }
  .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
  .account-bar { order: 2; }
}

/* ---------- Layout ---------- */
.container { max-width: var(--content-max); margin: 0 auto; padding: 26px 22px 10px; }
.view { display: none; animation: fade .35s var(--ease); }
.view.active { display: block; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px 22px; box-shadow: var(--shadow);
}
.toolbar { margin-bottom: 22px; position: sticky; top: 72px; z-index: 20; }
.toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-row + .toolbar-row { margin-top: 14px; }
.toolbar-top { justify-content: space-between; }
.hint { display: flex; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }

.profile-switch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-switch > label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text); font-weight: 700; }
.profile-field { display: inline-flex; align-items: center; gap: 8px; }
.profile-field select { min-width: 160px; }

/* search with leading icon */
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink); display: grid; place-items: center; pointer-events: none; }
.search-box .search-ico svg { width: 17px; height: 17px; }
.search-box input { width: 100%; padding-left: 38px; }
.search-box:focus-within .search-ico { color: var(--accent); }

/* progress */
.progress-row { margin-top: 16px; }
.progress-track { height: 10px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: var(--radius-sm); background: var(--progress); transition: width .6s var(--ease); }
.progress-row .hint { margin-top: 9px; }

select, input[type="search"], input[type="text"], input[type="password"] {
  background: var(--surface); color: var(--text); border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; outline: none; font-family: var(--sans);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
select { cursor: pointer; }
input::placeholder { color: var(--muted); }
select:focus, input:focus, select:focus-visible, input:focus-visible { border-color: var(--accent); box-shadow: var(--ring); }
.lock-field input[type="text"], .lock-field input[type="password"] {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.lock-field input[type="text"]:focus, .lock-field input[type="password"]:focus {
  border: 0;
  box-shadow: none;
}
.search-box { flex: 1; min-width: 180px; }
.search-box input { width: 100%; }
.search-box.wide { width: 100%; }

.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  background: var(--surface); color: var(--text); border: 2px solid var(--border-strong);
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono);
  transition: box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn:hover { background: var(--acid); color: var(--on-acid); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.btn:active { box-shadow: none; opacity: .82; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--accent); border: 2px solid var(--border-strong); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); color: var(--bg); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; text-decoration: none; display: inline-block; }
.btn-warn:hover { background: var(--red); color: var(--bg); }
.btn-soft { background: var(--acid); border-color: var(--border-strong); color: var(--on-acid); }
.btn-soft:hover { background: var(--ink); color: var(--bg); }
.btn-lock { background: transparent; }
.btn-lock:hover { background: var(--red); color: var(--bg); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; background: var(--surface); color: var(--muted); }

/* ---------- Profiles & roles ---------- */
.profile-actions { display: flex; gap: 6px; }
.role-badge {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 8px;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; color: var(--bg); letter-spacing: 1px; border: 2px solid var(--border-strong);
}
.role-badge.role-M, .pair-name.role-M { background: var(--accent); }
.role-badge.role-S, .pair-name.role-S { background: var(--role-s); }
.profile-empty { padding: 48px 24px; }
.profile-empty .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; display: grid; place-items: center;
  color: var(--bg); background: var(--accent); border: 3px solid var(--border-strong); border-radius: var(--radius-sm);
}
.profile-empty .empty-icon svg { width: 30px; height: 30px; display: block; }
.profile-empty h3 { margin: 0 0 6px; color: var(--text); font-family: var(--display); text-transform: uppercase; }
.profile-empty p { max-width: 440px; margin: 0 auto 16px; }

/* ---------- Compare pickers ---------- */
.compare-pickers { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 16px; background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); }
.compare-pickers .picker { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
.compare-pickers .picker label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.compare-pickers .picker select { width: 100%; }
.compare-pickers .vs {
  font-family: var(--display); font-size: 13px; font-weight: 900; color: var(--bg); margin-bottom: 4px;
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; align-self: center;
  background: var(--ink); border-radius: var(--radius-sm); border: 2px solid var(--border-strong);
}
.report-pair { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.pair-name { color: var(--bg); padding: 4px 11px; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; font-weight: 700; border: 2px solid var(--border-strong); text-transform: uppercase; letter-spacing: .5px; }
.pair-x { color: var(--muted); font-size: 14px; font-weight: 700; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 55%, transparent); backdrop-filter: none;
  padding: 20px; animation: fade .18s var(--ease);
}
.modal-card {
  background: var(--surface); border: 3px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 26px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease);
}
.modal-card h3 { margin: 0 0 16px; color: var(--text); font-family: var(--display); text-transform: uppercase; letter-spacing: -.5px; }
.modal-card label, .modal-role-label { display: block; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 7px; font-weight: 700; }
.modal-card input[type="text"] { width: 100%; }
.modal-card input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.modal-role-label { margin-top: 16px; }
.role-toggle { display: flex; gap: 0; border: 2px solid var(--border-strong); }
.role-opt {
  flex: 1; padding: 12px 8px; border-radius: var(--radius-sm); border: none;
  background: var(--surface); color: var(--text); cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  transition: background var(--t-fast), color var(--t-fast);
}
.role-opt + .role-opt { border-left: 2px solid var(--border-strong); }
.role-opt:hover { background: var(--acid); color: var(--on-acid); }
.role-opt:focus-visible { outline: none; box-shadow: var(--ring); position: relative; z-index: 2; }
.role-opt.active { background: var(--ink); color: var(--bg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Legend ---------- */
.legend { gap: 6px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 5px 10px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.legend-dot { width: 16px; height: 16px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 10px; color: var(--on-acid); font-weight: 700; border: 1px solid var(--border-strong); }

/* ---------- Category nav ---------- */
.category-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 12px; scrollbar-width: thin; }
.category-nav button {
  white-space: nowrap; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.category-nav button:hover { color: var(--on-acid); background: var(--acid); transform: translate(-1px, -1px); box-shadow: var(--shadow-sm); }
.category-nav button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- Category & items ---------- */
.category { margin-bottom: 34px; }
.category-head {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  padding-bottom: 12px; border-bottom: 3px solid var(--border-strong);
}
.category-head .ico {
  font-size: 18px; width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  background: var(--acid); border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
}
.category-head h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 900; letter-spacing: -.5px; text-transform: uppercase; color: var(--text); }
.category-head .count { font-family: var(--mono); color: var(--bg); font-size: 11px; font-weight: 700; margin-left: auto; background: var(--ink); padding: 4px 11px; border-radius: var(--radius-sm); }
.category-intro { color: var(--text-soft); font-size: 13.5px; margin: 0 0 16px; }

.item {
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 16px 18px; margin-bottom: 12px;
  transition: box-shadow var(--t), transform var(--t);
  animation: rise-stagger .4s var(--ease) both;
}
.item:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.item.is-rated { border-left: 8px solid var(--accent); }
.item-head { display: flex; align-items: flex-start; gap: 12px; }
.item-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.item-name { font-weight: 700; font-size: 16px; color: var(--text); }
.item-en { color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
.risk-badge { flex: none; font-family: var(--mono); font-size: 10px; padding: 4px 10px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); margin-left: auto; white-space: nowrap; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.risk-low { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.risk-medium { color: var(--yellow); background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.risk-high { color: var(--red-ink); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.item-desc { color: var(--text-soft); font-size: 13.5px; margin: 10px 0 0; line-height: 1.65; }
.item-safety {
  font-size: 12.5px; margin-top: 12px; padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--red-soft); border: 2px solid var(--red); color: var(--red-ink);
}
.item-safety::before { content: "安全 · "; font-weight: 700; }

/* rating control */
.item-rate { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--border-strong); }
.ratings { display: flex; gap: 7px; flex-wrap: wrap; }
.rate-btn {
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 7px 13px 7px 8px; cursor: pointer; font-family: var(--mono); font-size: 12px; min-height: 38px; font-weight: 700;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);
  display: inline-flex; align-items: center; gap: 7px;
}
.rate-btn .sym {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--text); font-size: 11px; font-weight: 700; flex: none; border: 1px solid var(--border-strong);
}
.rate-btn:hover { background: var(--acid); color: var(--on-acid); box-shadow: var(--shadow-sm); }
.rate-btn:active { opacity: .82; box-shadow: none; }
.rate-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.rate-btn.sel { color: var(--on-acid); font-weight: 700; border-color: var(--ink); box-shadow: var(--shadow-sm); }
.rate-btn.sel .sym { background: color-mix(in srgb, var(--ink) 18%, transparent); color: var(--text); }

/* meta footer: role + note */
.item-meta { margin-top: 12px; display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 12px; align-items: end; }
@media (max-width: 600px) { .item-meta { grid-template-columns: 1fr; } }
.role-select { display: flex; flex-direction: column; gap: 5px; }
.role-select label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.role-select select { width: 100%; font-size: 13px; }
.note-input { display: flex; flex-direction: column; gap: 5px; }
.note-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.note-input input { width: 100%; font-size: 13px; }

/* rating value colors */
.v1 { background: var(--rating-1) !important; }
.v2 { background: var(--rating-2) !important; }
.v3 { background: var(--rating-3) !important; }
.v4 { background: var(--rating-4) !important; }
.v5 { background: var(--rating-5) !important; }
.v6 { background: var(--rating-6) !important; }

/* ---------- Encyclopedia ---------- */
.enc-cat { margin-bottom: 30px; }
.enc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .enc-grid { grid-template-columns: 1fr; } }
.enc-card {
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 15px 17px; box-shadow: none;
  transition: box-shadow var(--t), transform var(--t);
}
.enc-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.enc-card h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--text); }

/* ---------- Compare ---------- */
.cmp-section-title { margin: 18px 0 10px; font-family: var(--display); font-size: 17px; text-transform: uppercase; letter-spacing: -.5px; display: flex; align-items: center; gap: 8px; }
.cmp-row {
  display: grid; grid-template-columns: 1fr 128px 128px; gap: 10px; align-items: center;
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); padding: 11px 15px; margin-bottom: 8px;
}
.cmp-name { font-size: 14px; font-weight: 700; }
.cmp-name small { color: var(--muted); display: block; font-family: var(--mono); font-size: 10px; margin-top: 2px; text-transform: uppercase; }
.cmp-val { font-family: var(--mono); font-size: 12px; text-align: center; padding: 6px 8px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); color: var(--text); }
.cmp-head { display: grid; grid-template-columns: 1fr 128px 128px; gap: 10px; padding: 0 15px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
@media (max-width: 620px) {
  .cmp-head { display: none; }
  .cmp-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cmp-name { grid-column: 1 / -1; }
  .cmp-val { text-align: left; }
  .cmp-val::before { content: attr(data-person) " · "; color: var(--muted); font-size: 9px; text-transform: uppercase; }
}
.empty-state {
  text-align: center; color: var(--muted); padding: 40px 24px; font-size: 14px; line-height: 1.7;
  background: var(--surface-2); border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.empty-state.profile-empty { background: var(--surface); border-style: solid; }

/* ---------- Analysis report ---------- */
.report { margin-bottom: 24px; border-radius: var(--radius-sm); }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-title { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 900; text-transform: uppercase; letter-spacing: -1px; }
.report-time { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.report-print-btn { white-space: nowrap; }
.report-sub { margin: 26px 0 10px; font-family: var(--display); font-size: 15px; text-transform: uppercase; letter-spacing: 0; color: var(--text); font-weight: 900; border-left: 8px solid var(--accent); padding-left: 12px; }
.report-hint { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin: 0 0 10px; }
.report-summary { background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; line-height: 1.8; color: var(--text-soft); }

.report-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; border: 2px solid var(--border-strong); }
@media (max-width: 680px) { .report-stats { grid-template-columns: repeat(2, 1fr); } }
.score-breakdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  overflow: hidden; border: 2px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--border-strong);
}
.score-breakdown .stat-card { min-height: 104px; border-radius: 0; }
@media (max-width: 680px) { .score-breakdown { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.report-stats .stat-card { border-right: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); }
.stat-card.danger { background: var(--red-soft); }
.stat-num { font-family: var(--display); font-size: 30px; font-weight: 900; letter-spacing: -1px; }
.stat-card.danger .stat-num { color: var(--red); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

.gauge-card { gap: 9px; }
.gauge { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); }
.gauge-inner { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; border: 2px solid var(--border-strong); }
.gauge-num { font-family: var(--display); font-size: 19px; font-weight: 900; }

.cat-bars { display: flex; flex-direction: column; gap: 7px; }
.cat-bar-row { display: grid; grid-template-columns: 154px 1fr 78px; gap: 10px; align-items: center; }
@media (max-width: 560px) { .cat-bar-row { grid-template-columns: 112px 1fr 58px; } }
.cat-bar-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); }
.cat-bar-track { height: 14px; background: var(--bg-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.cat-bar-track.empty { opacity: .6; }
.cat-bar-fill { height: 100%; border-radius: var(--radius-sm); background: var(--accent); transition: width .6s var(--ease); }
.cat-bar-val { font-family: var(--mono); font-size: 11px; text-align: right; color: var(--muted); }

.rec-box { display: flex; flex-direction: column; gap: 10px; }
.rec-item { border-radius: var(--radius-sm); padding: 12px 15px; font-size: 13.5px; line-height: 1.7; border: 2px solid var(--border-strong); border-left-width: 8px; background: var(--surface-2); color: var(--text-soft); }
.rec-lead { font-weight: 700; margin-bottom: 4px; color: var(--text); }
.rec-names { color: var(--text-soft); font-size: 13px; }
.rec-item.good { border-left-color: var(--green); background: var(--green-soft); }
.rec-item.warn { border-left-color: var(--yellow); background: var(--yellow-soft); }
.rec-item.danger { border-left-color: var(--red); background: var(--red-soft); }
.rec-item.danger .rec-lead { color: var(--red-ink); }
.rec-item.info { border-left-color: var(--accent); background: var(--accent-soft); }
.rec-item.safety { border-style: dashed; }

/* grouped lists */
.cmp-group { margin-bottom: 24px; }
.cmp-group-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding-bottom: 8px; border-bottom: 3px solid var(--border-strong); }
.cmp-group-ico { font-size: 17px; }
.cmp-group-title { font-family: var(--display); font-weight: 900; font-size: 15px; text-transform: uppercase; }
.cmp-group-desc { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.cmp-group-head.bucket-bothWant { border-color: var(--green); }
.cmp-group-head.bucket-conflictHard { border-color: var(--red); }
.cmp-group-head.bucket-conflictStrong, .cmp-group-head.bucket-negotiate { border-color: var(--yellow); }
.cmp-group-head.bucket-hardAligned, .cmp-group-head.bucket-boundaryNote { border-color: var(--text-soft); }
.cmp-row.bothWant { border-color: var(--green); border-left-width: 8px; }
.cmp-row.conflictHard { border-color: var(--red); border-left-width: 8px; }
.cmp-row.hardAligned, .cmp-row.boundaryNote { border-color: var(--text-soft); border-left-width: 8px; }
.cmp-row.conflictStrong, .cmp-row.negotiate { border-color: var(--yellow); border-left-width: 8px; }

/* ---------- Single-profile analysis ---------- */
.pair-name.ref { opacity: .9; filter: grayscale(.3); }
.report-empty { background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 15px; font-size: 13px; margin: 0; }

.an-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 2px; }
.an-legend-item { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); }
.an-swatch { width: 24px; height: 12px; border-radius: var(--radius-sm); display: inline-block; border: 1px solid var(--border-strong); }
.an-swatch.main { background: var(--accent); }
.an-swatch.ref { height: 8px; background: var(--role-s); }

.dist-list { display: flex; flex-direction: column; gap: 9px; }
.dist-row { display: grid; grid-template-columns: 150px 1fr 86px; gap: 10px; align-items: center; }
@media (max-width: 560px) { .dist-row { grid-template-columns: 104px 1fr 64px; } }
.dist-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); }
.dist-stack { display: flex; flex-direction: column; gap: 3px; }
.dist-track { height: 14px; background: var(--bg-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.dist-track.ref { height: 9px; }
.dist-track.empty { opacity: .55; }
.dist-fill { height: 100%; border-radius: var(--radius-sm); transition: width .6s var(--ease); background: var(--accent); }
.dist-fill.ref { background: var(--role-s); }
.dist-val { font-family: var(--mono); font-size: 11px; text-align: right; color: var(--muted); }
.dist-val small { color: var(--muted); }

.an-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.an-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 5px 11px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.an-chip-sym { font-size: 11px; color: var(--accent); font-weight: 700; }
.an-chip small { color: var(--muted); }
.an-chip.more { background: transparent; border-style: dashed; color: var(--muted); }

.an-limits { display: flex; flex-direction: column; gap: 12px; }
.an-limit-block { border-radius: var(--radius-sm); padding: 12px 14px; border: 2px solid var(--border-strong); border-left-width: 8px; background: var(--surface-2); }
.an-limit-block.hard { border-left-color: var(--red); }
.an-limit-block.soft { border-left-color: var(--yellow); }
.an-limit-lead { font-weight: 700; font-size: 13px; margin-bottom: 9px; color: var(--text); }
.an-limit-block.hard .an-limit-lead { color: var(--red-ink); }

.match-group { margin-bottom: 14px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); overflow: hidden; }
.match-group.good { border-color: var(--border-strong); }
.match-head { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 13px; padding: 9px 14px; border-bottom: 2px solid var(--border-strong); }
.match-group.good .match-head { background: var(--green); color: var(--on-acid); }
.match-group.warn .match-head { background: var(--yellow); color: var(--on-acid); }
.match-group.info .match-head { background: var(--acid); color: var(--on-acid); }
.match-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; flex-wrap: wrap; }
.match-row + .match-row { border-top: 2px solid var(--border-strong); }
.match-name { font-size: 13.5px; font-weight: 700; }
.match-name small { display: block; color: var(--muted); font-family: var(--mono); font-size: 10px; margin-top: 2px; text-transform: uppercase; }
.match-roles { display: flex; align-items: center; gap: 8px; }
.match-x { color: var(--muted); font-size: 14px; font-weight: 700; }
.role-pill { font-size: 10px; padding: 4px 10px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); white-space: nowrap; text-transform: uppercase; letter-spacing: .5px; }
.role-pill.muted { color: var(--muted); }

/* persona: radar + role spectrum */
.persona-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: center; margin-top: 6px; }
@media (max-width: 680px) { .persona-grid { grid-template-columns: 1fr; } }
.persona-cap { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 6px; }
.persona-radar { min-width: 0; }
.radar { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.radar-grid { fill: none; stroke: var(--ink); stroke-width: 1.5; opacity: .35; }
.radar-axis { stroke: var(--ink); stroke-width: 1.5; opacity: .3; }
.radar-label { font-family: var(--mono); font-size: 10px; fill: var(--text-soft); text-transform: uppercase; }
.radar-area { stroke-width: 3; stroke-linejoin: round; }
.radar-area.main { fill: color-mix(in srgb, var(--accent) 28%, transparent); stroke: var(--accent); }
.radar-area.ref { fill: color-mix(in srgb, var(--role-s) 20%, transparent); stroke: var(--role-s); }
.radar-dot.main { fill: var(--accent); }
.radar-dot.ref { fill: var(--role-s); }

.persona-spectrum { min-width: 0; }
.spectrum { padding: 4px 2px 0; }
.spectrum-track {
  position: relative; height: 16px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong);
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 49%, var(--bg-2) 49%, var(--bg-2) 51%, var(--role-s) 51%, var(--role-s) 100%);
}
.spectrum-marker {
  position: absolute; top: 50%; width: 18px; height: 18px; border-radius: var(--radius-sm);
  background: var(--acid); border: 2px solid var(--border-strong); transform: translate(-50%, -50%);
  box-shadow: var(--shadow-sm);
}
.spectrum-labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 8px; }
.spectrum-labels .spectrum-mid { color: var(--text-soft); }
.spectrum-note { font-family: var(--mono); font-size: 11px; margin-top: 8px; text-align: center; text-transform: uppercase; letter-spacing: .5px; }

/* trait indicators */
.trait-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 2px solid var(--border-strong); }
@media (max-width: 680px) { .trait-grid { grid-template-columns: repeat(2, 1fr); } }
.trait-card { background: var(--surface); border-radius: var(--radius-sm); padding: 14px 12px; text-align: center; border-right: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); }
.trait-num { font-family: var(--display); font-size: 22px; font-weight: 900; color: var(--text); }
.trait-num small { font-size: 12px; font-weight: 700; color: var(--muted); }
.trait-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 3px 0 9px; }
.trait-track { height: 8px; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.trait-fill { height: 100%; border-radius: var(--radius-sm); background: var(--accent); transition: width .6s var(--ease); }

/* statistics table */
.an-table-wrap { overflow-x: auto; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); }
.an-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 460px; }
.an-table th, .an-table td { padding: 9px 12px; border-bottom: 2px solid var(--border-strong); text-align: center; white-space: nowrap; }
.an-table thead th { background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; position: sticky; top: 0; }
.an-table .th-cat, .an-table .td-cat { text-align: left; }
.an-table tbody tr:hover { background: var(--surface-2); }
.an-table .td-num { font-family: var(--mono); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.an-table .td-want { color: var(--green); font-weight: 700; }
.an-table .td-limit { color: var(--red); }
.an-table tfoot td { border-top: 3px solid var(--border-strong); border-bottom: none; font-weight: 700; background: var(--surface-2); }
.an-table .td-heat { min-width: 96px; }
.an-table .td-heat .dist-stack { display: flex; flex-direction: column; gap: 2px; }
.an-table .td-heat .dist-track { height: 10px; }
.an-table .td-heat .dist-track.ref { height: 7px; }
.an-table .td-heat-val { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ---------- Encrypted pairing ---------- */
.pairing-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 18px;
}
.pairing-head h1 { margin: 2px 0 4px; font-family: var(--display); font-size: clamp(28px, 5vw, 42px); line-height: 1.1; }
.pairing-head p { margin: 0; max-width: 680px; }
.pairing-head .eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; }
.pairing-global-status { min-height: 24px; color: var(--text-soft); font: 11px var(--mono); text-align: right; }
.pairing-global-status.error { color: var(--red); }
.pairing-warning {
  margin-bottom: 18px; padding: 14px 17px; border: 2px solid var(--yellow);
  border-left-width: 8px; border-radius: var(--radius-lg); background: var(--yellow-soft);
  color: var(--text); font-size: 13.5px; line-height: 1.7;
}
.pairing-setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pairing-setup-card { min-width: 0; }
.pairing-setup-card h2, .pairing-section h2 { margin: 0; font-family: var(--display); text-transform: uppercase; font-size: 18px; }
.pairing-setup-card > p { min-height: 44px; margin: 7px 0 15px; font-size: 13px; }
.pairing-join-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.pairing-join-form label { grid-column: 1 / -1; font: 700 10px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.pairing-join-form input { min-width: 0; width: 100%; font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.invite-code-box { margin-top: 15px; padding: 14px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); }
.invite-code-box > span { display: block; color: var(--muted); font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: 1px; }
.invite-code { display: block; margin: 7px 0 12px; color: var(--accent); font: 700 clamp(16px, 3vw, 23px) var(--mono); letter-spacing: 1.5px; overflow-wrap: anywhere; }
.invite-code-box p { margin: 10px 0 0; font-size: 11px; line-height: 1.6; }
.pairing-section { margin-top: 28px; }
.pairing-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; padding-bottom: 10px; border-bottom: 3px solid var(--border-strong); }
.pairing-count {
  min-width: 26px; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 700 11px var(--mono); text-align: center;
}
.pairing-list { display: grid; gap: 12px; }
.pair-card { padding: 18px; border: 2px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.pair-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pair-card-title { margin: 0; font-size: 16px; color: var(--text); }
.pair-card-sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.pair-status {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 4px 9px;
  border: 1px solid var(--border-strong); border-radius: 999px; color: var(--green); font: 10px var(--mono);
}
.pair-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pair-status.waiting { color: var(--yellow); }
.pair-status.error { color: var(--red); }
.safety-code-block { padding: 12px 14px; border: 2px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.safety-code-label { color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: 1px; }
.safety-code { display: block; margin: 3px 0; color: var(--text); font: 700 21px var(--mono); letter-spacing: 2px; }
.safety-code-hint { margin: 0; color: var(--muted); font-size: 11px; }
.pair-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.connection-fields { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(210px, 1.2fr); gap: 12px; }
.connection-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.connection-field label { color: var(--muted); font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: 1px; }
.connection-field input, .connection-field select { width: 100%; }
.pair-empty { padding: 24px; }

@media (max-width: 720px) {
  .pairing-head { display: block; }
  .pairing-global-status { margin-top: 9px; text-align: left; }
  .pairing-setup-grid { grid-template-columns: 1fr; }
  .pairing-setup-card > p { min-height: 0; }
  .connection-fields { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .pairing-join-form { grid-template-columns: 1fr; }
  .pairing-join-form label { grid-column: auto; }
  .pairing-join-form .btn { width: 100%; }
  .pair-card-head { display: block; }
  .pair-status { margin-top: 8px; }
  .pair-actions .btn { flex: 1; }
}

/* ---------- Safety / prose ---------- */
.prose { line-height: 1.8; }
.prose h2 { margin-top: 0; font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: -.5px; }
.prose h3 { margin-top: 22px; color: var(--text); font-family: var(--display); text-transform: uppercase; border-left: 8px solid var(--accent); padding-left: 12px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; color: var(--text-soft); }
.safety-card { margin-bottom: 16px; }
.safety-card h2 { font-family: var(--display); text-transform: uppercase; }
.safety-card h3 { color: var(--text); font-family: var(--display); text-transform: uppercase; border-left: 8px solid var(--accent); padding-left: 12px; font-size: 16px; }
.safety-card p { color: var(--text-soft); margin: 8px 0; }

.footer { text-align: center; padding: 28px max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 28px; }

::-webkit-scrollbar { height: 12px; width: 12px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--accent); border: 2px solid var(--bg-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-strong); }
* { scrollbar-color: var(--accent) var(--bg-2); }

/* ---------- Refined shapes ---------- */
.panel, .modal-card, .compare-pickers, .report-summary, .rec-item,
.an-limit-block, .an-table-wrap, .item, .enc-card { border-radius: var(--radius-lg); }
.report-stats, .trait-grid, .match-group { overflow: hidden; border-radius: var(--radius-lg); }
.btn, .btn-primary, .btn-soft, .btn-warn, .btn-lock, .rate-btn,
.category-nav button, .role-badge, .risk-badge, .legend-item,
.an-chip, .role-pill, .pair-name { border-radius: 999px; }
.progress-track, .progress-fill, .cat-bar-track, .cat-bar-fill,
.dist-track, .dist-fill, .trait-track, .trait-fill, .spectrum-track { border-radius: 999px; }
.brand-mark { border-radius: var(--radius); }

@media (max-width: 760px) {
  .toolbar { position: static; }
  .toolbar-top { align-items: stretch; }
  .profile-switch, .toolbar-actions { width: 100%; }
  .search-box { flex-basis: 100%; }
  .ratings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rate-btn { width: 100%; }
}
@media (max-height: 720px), (max-width: 520px) {
  .lock-screen.landing { align-items: start; padding-top: 28px; padding-bottom: 76px; }
  .lock-foot { position: absolute; }
  .lock-emblem { margin-bottom: 18px; }
  .lock-sub { margin-bottom: 22px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .footer, .category-nav, #lock-screen, .report-print-btn { display: none !important; }
  body.printing-report .view:not(#view-compare) { display: none !important; }
  body.printing-analysis .view:not(#view-analysis) { display: none !important; }
  .panel, .stat-card, .cmp-row, .rec-item, .report-summary, .cmp-group-head { box-shadow: none; }
  .report, .panel { border: 2px solid #000; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
