/* MateMap styles. Colours come from the brand kit (tokens.css).
   Blush = you, seafoam = them, navy = structure. Action pink only on the one main button per screen. */

@font-face { font-family: 'Inter'; src: url('fonts/Inter-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --mm-navy: #123A5A;
  --mm-blush: #F28C9A;
  --mm-seafoam: #7FD1C7;
  --mm-bg: #F5FAFB;
  --mm-surface: #FFFFFF;
  --mm-ink: #0F2233;
  --mm-ink-soft: #4A5A6B;
  --mm-action: #E0245E;
  --mm-action-hover: #C21A50;
  --mm-success: #1F8A70;
  --mm-error: #C62828;
  --blush-tint: #FDE3E7;
  --sea-tint: #DDF3EF;
  --line: #DCE6EA;
  --field: #B8C9D1;
  --radius: 16px;
  --nav-h: 62px;
  --shadow: 0 1px 2px rgba(15, 34, 51, .05), 0 6px 16px -10px rgba(15, 34, 51, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--mm-ink);
  background: var(--mm-bg);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
body.locked { overflow: hidden; }
img { max-width: 100%; }
a { color: var(--mm-navy); text-underline-offset: 2px; }
a.ext::after { content: ' ↗'; font-size: .85em; }
:focus-visible { outline: 3px solid var(--mm-navy); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: #fff; color: var(--mm-navy); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.skip:focus { left: 12px; }
.noscript { padding: 16px; }

/* ---------- Header and navigation ---------- */
header.top { background: var(--mm-navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 12px; }
.top-inner { max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; }
.wordmark { height: 32px; width: auto; display: block; }
.tagline { margin: 0; font-size: .8125rem; color: #D4E3EC; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-h); padding: 6px 4px 8px;
  color: var(--mm-ink-soft); text-decoration: none; font-size: .75rem; font-weight: 500;
  border-top: 3px solid transparent;
}
.tabs .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--mm-navy); font-weight: 700; border-top-color: var(--mm-blush); }
.tabs a[aria-current="page"] .ico { stroke-width: 2.3; }

/* ---------- Layout ---------- */
main { max-width: 680px; margin: 0 auto; padding: 12px 16px; outline: none; }
.screen-title { font-size: 1.625rem; line-height: 1.2; margin: 10px 0 4px; font-weight: 700; letter-spacing: -.01em; outline: none; }
.lede { color: var(--mm-ink-soft); margin: 0 0 14px; }
h2 { font-size: 1.1875rem; line-height: 1.3; margin: 24px 0 8px; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.35; margin: 0; font-weight: 600; }
p { margin: 8px 0; }
.card { background: var(--mm-surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 12px 0; }
.hint { font-size: .8125rem; color: var(--mm-ink-soft); margin: 6px 0; }
.center { text-align: center; }
.meta { font-size: .8125rem; color: var(--mm-ink-soft); }
.label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font: inherit; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  border: 2px solid transparent; cursor: pointer;
}
.btn-action { background: var(--mm-action); color: #fff; }
.btn-action:hover, .btn-action:active { background: var(--mm-action-hover); }
.btn-action:disabled { background: #8796A0; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--mm-navy); border-color: var(--mm-navy); }
.btn-secondary:hover { background: #EEF4F7; }
.btn-danger { background: var(--mm-error); color: #fff; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: .875rem; background: #fff; color: var(--mm-navy); border: 1.5px solid var(--mm-navy); }
.btn-quiet { border-color: var(--field); color: var(--mm-ink-soft); }
.btn-text { background: none; border: none; color: var(--mm-navy); text-decoration: underline; text-underline-offset: 2px; font: inherit; font-weight: 500; padding: 10px 2px; min-height: 44px; cursor: pointer; }
.btn-text.danger { color: var(--mm-error); font-weight: 600; }
.btn-text.clear { font-size: .875rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cta-wrap { text-align: center; margin: 26px 0 10px; }
.cta-wrap .btn { width: 100%; max-width: 380px; }

/* ---------- Consent ---------- */
.consent { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--mm-bg); padding: calc(20px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
.consent[hidden] { display: none; }
.consent-inner { max-width: 560px; margin: 0 auto; }
.consent h1 { font-size: 1.625rem; margin: 6px 0 2px; outline: none; }
.consent .btn-action { width: 100%; margin-top: 10px; }
.lockup { width: 100%; max-width: 300px; height: auto; display: block; margin: 6px auto 14px; }
.ticks { list-style: none; padding: 0; margin: 10px 0; }
.ticks li { padding: 3px 0; }
.ticks li::before { content: '✓'; color: var(--mm-success); font-weight: 700; margin-right: 10px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--mm-navy); flex: none; }
.legal h3 { margin-top: 16px; }
.legal p { font-size: .9375rem; }

/* ---------- About me ---------- */
.rule-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.rule-card {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  padding: 10px 6px 12px; min-height: 44px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  color: var(--mm-ink); text-decoration: none; text-align: center; font-size: .8125rem; font-weight: 600; line-height: 1.25;
}
.rule-card:hover { border-color: var(--mm-navy); }
.rule-card .art { width: 58px; height: 40px; }

.you-card { display: flex; gap: 14px; align-items: flex-start; }
.you-fields { flex: 1; min-width: 0; }
.avatar {
  width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #EEF4F7; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--mm-blush);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar img[src$="logo-mark.svg"] { width: 68%; height: 68%; object-fit: contain; }
.avatar.big { width: 84px; height: 84px; }

input[type="text"], textarea, .select {
  width: 100%; font: inherit; color: var(--mm-ink); background: #fff;
  border: 1.5px solid var(--field); border-radius: 12px; padding: 11px 12px; min-height: 48px;
}
textarea { resize: vertical; min-height: 104px; line-height: 1.45; }
input[type="text"]:focus, textarea:focus, .select:focus { border-color: var(--mm-navy); outline: 3px solid rgba(18, 58, 90, .25); outline-offset: 0; }
.select { margin-top: 10px; appearance: auto; }

.progress { position: sticky; top: 0; z-index: 5; background: var(--mm-bg); padding: 10px 0 8px; }
.progress-bar { height: 10px; background: #E3ECEF; border-radius: 999px; overflow: hidden; }
.progress-bar .fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mm-blush), var(--mm-seafoam)); transition: width .3s ease; }
.progress-label { font-size: .8125rem; color: var(--mm-ink-soft); margin: 6px 0 0; }

details.section { margin: 16px 0; }
details.section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 14px;
  background: var(--mm-navy); color: #fff; font-weight: 700; font-size: 1.0625rem;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: '▾'; margin-left: 8px; font-size: 1rem; }
details.section:not([open]) > summary::after { content: '▸'; }
details.section > summary .sec-title { flex: 1; }
details.section > summary .tag { color: #D4E3EC; }
.sec-intro { color: var(--mm-ink-soft); font-size: .9375rem; margin: 10px 2px 4px; }
.tag { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mm-ink-soft); white-space: nowrap; }

fieldset.item { display: block; min-width: 0; margin: 12px 0; }
fieldset.item > legend { float: left; width: 100%; padding: 0; margin: 0; }
fieldset.item > legend + * { clear: both; }
.item-title { display: block; font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.item-meaning { color: var(--mm-ink-soft); font-size: .9375rem; margin: 4px 0 8px; }
.item-question { font-weight: 600; margin: 10px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.b-strong { background: #DDF3EF; color: #0F4D45; }
.b-some { background: #DFE8F1; color: #123A5A; }
.b-early { background: #FBEBCD; color: #6B4A12; }
.b-theory { background: #FCE4E7; color: #7A2433; }
.rule { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid #9DB1BD; color: var(--mm-ink-soft); }
.lock { margin-left: 6px; font-size: .875rem; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.choices.stack { flex-direction: column; }
.pill { position: relative; cursor: pointer; display: block; }
.pill-face {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 44px; padding: 8px 14px; border-radius: 12px;
  background: #fff; border: 1.5px solid var(--field);
}
.pill-label { font-weight: 500; }
.pill-sub { font-size: .8125rem; color: var(--mm-ink-soft); }
.pill:hover .pill-face { border-color: var(--mm-navy); }
.pill input:checked + .pill-face { background: var(--blush-tint); border-color: var(--mm-navy); box-shadow: inset 0 0 0 1px var(--mm-navy); }
.pill input:checked + .pill-face .pill-label::before { content: '✓ '; font-weight: 700; }
.pill input:focus-visible + .pill-face { outline: 3px solid var(--mm-navy); outline-offset: 2px; }
.part { margin-top: 10px; }
.part-label { font-weight: 600; margin: 8px 0 0; }
.current { font-size: .875rem; margin: 8px 0 0; }
details.more { margin-top: 6px; }
details.more > summary { cursor: pointer; color: var(--mm-navy); font-weight: 600; font-size: .875rem; min-height: 44px; display: flex; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸'; margin-right: 8px; font-size: .875em; }
details.more[open] > summary::before { content: '▾'; }
.band-list { padding-left: 18px; font-size: .875rem; margin: 4px 0; }
.band-list li { margin: 4px 0; }
.note { font-size: .84375rem; color: var(--mm-ink-soft); background: var(--mm-bg); border-radius: 10px; padding: 8px 11px; margin: 8px 0 0; }
.note.safety { background: #FBEBCD; color: #5C3F0F; }
.test-list { padding-left: 18px; margin: 4px 0; }
.test-list li { margin: 8px 0; }
.op { display: block; font-size: .78125rem; color: var(--mm-ink-soft); }
.more-link { margin: 8px 0 0; font-size: .875rem; font-weight: 600; }
.own h2 { margin-bottom: 2px; }
.note-card .item-title { margin-bottom: 2px; }
.count { display: block; text-align: right; font-size: .75rem; color: var(--mm-ink-soft); margin-top: 4px; }
.danger-zone { text-align: center; margin: 8px 0 20px; }

/* ---------- My profile ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; }
.kicker { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mm-ink-soft); }
.nick { margin: 2px 0 0; font-size: 1.375rem; font-weight: 700; word-break: break-word; }
.psec h2 { margin-top: 22px; }
.plist { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; box-shadow: var(--shadow); }
.prow { padding: 12px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.prow-label { font-weight: 600; margin: 0; }
.you-chip { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 2px; padding: 4px 12px; border-radius: 999px; background: var(--blush-tint); font-weight: 600; font-size: .9375rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.you { background: var(--mm-blush); }
.meaning { font-size: .875rem; color: var(--mm-ink-soft); margin: 4px 0 0; }
.note-text { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; }
.empty { text-align: center; }
.empty .btn { margin-top: 6px; }

/* ---------- Partner fit ---------- */
.disclaimer { background: #fff; border-left: 5px solid var(--mm-seafoam); }
.disclaimer p { font-size: .9375rem; }
.grp { margin: 22px 0; }
.gh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--mm-navy); padding-bottom: 6px; margin-bottom: 6px; }
.gh h2 { margin: 0; }
.row { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; box-shadow: var(--shadow); }
.row-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pair { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { display: inline-flex; flex-direction: column; padding: 6px 12px 7px; border-radius: 12px; font-weight: 600; font-size: .9375rem; line-height: 1.3; max-width: 100%; }
.chip .k { font-size: .6875rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--mm-ink-soft); }
.chip.you { background: var(--blush-tint); border-left: 4px solid var(--mm-blush); }
.chip.them { background: var(--sea-tint); border-left: 4px solid var(--mm-seafoam); }
.chip.both { background: linear-gradient(90deg, var(--blush-tint), var(--sea-tint)); border-left: 4px solid var(--mm-navy); }
.chip.theory { background: #fff; border: 2px dashed var(--mm-seafoam); }
.line { font-weight: 600; margin: 8px 0 2px; }
.why { font-size: .875rem; color: var(--mm-ink-soft); margin: 4px 0; }
.tip { background: var(--mm-bg); border-radius: 10px; padding: 9px 12px; margin: 8px 0 0; font-size: .9375rem; }
.tip.muted { color: var(--mm-ink-soft); }
.starter { font-size: .9375rem; margin: 8px 0 0; }
.missing { font-size: .875rem; color: var(--mm-ink-soft); margin: 8px 2px; }
.flags { border-left: 5px solid var(--mm-error); }
.flags h2 { margin-top: 0; }
.flags ul { padding-left: 20px; }
.flags li { margin: 6px 0; }
.flags-close { font-weight: 700; }
.dark-explained > summary { font-size: 1rem; }
.dark .trait { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.dark .trait p { font-size: .9375rem; }

/* ---------- Learn ---------- */
.learn-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 10px; }
.learn-card { display: block; padding: 14px 16px; min-height: 44px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--mm-ink); text-decoration: none; box-shadow: var(--shadow); }
.learn-card:hover { border-color: var(--mm-navy); }
.lc-title { display: block; font-weight: 700; }
.lc-desc { display: block; margin-top: 2px; font-size: .875rem; color: var(--mm-ink-soft); }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
.learn-page h2 { scroll-margin-top: 16px; }
.badge-list { list-style: none; padding: 0; }
.badge-list li { margin: 8px 0; }
.sci-item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.sci-item .chips { margin: 6px 0; }
.table-wrap { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--line); }
thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mm-ink-soft); }
tbody th { font-weight: 600; min-width: 8em; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
.glossary dt { font-weight: 700; margin-top: 12px; }
.glossary dd { margin: 2px 0 0; color: var(--mm-ink-soft); }
.sources { padding-left: 22px; }
.sources li { margin: 8px 0; font-size: .875rem; }
.flash { animation: flash 1.8s ease; border-radius: 8px; }
@keyframes flash { from { background: #FCE4E7; } to { background: transparent; } }

/* ---------- Dialogs, toast, install tip ---------- */
dialog.dlg { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 520px); max-height: 88vh; color: var(--mm-ink); box-shadow: 0 24px 60px -20px rgba(15, 34, 51, .55); }
dialog.dlg::backdrop { background: rgba(15, 34, 51, .55); }
.dlg-body { padding: 20px; }
.dlg-body h2 { margin-top: 0; }
.check-list { max-height: 42vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 2px 12px; margin-top: 10px; }
.check-list .check-row { border-bottom: 1px solid var(--line); }
.check-list .check-row:last-child { border-bottom: 0; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: min(90vw, 480px); padding: 11px 16px; border-radius: 12px;
  background: var(--mm-ink); color: #fff; font-size: .9375rem; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.install-tip {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: 656px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--mm-navy); color: #fff; box-shadow: var(--shadow);
}
.install-tip span { flex: 1; font-size: .9375rem; }
.install-tip .install-yes { background: #fff; color: var(--mm-navy); border: 0; border-radius: 999px; min-height: 40px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.install-tip .install-close { background: none; border: 0; color: #fff; font-size: 1.125rem; min-width: 44px; min-height: 44px; cursor: pointer; }

@media (max-width: 360px) {
  main { padding: 10px 12px; }
  .rule-card { font-size: .75rem; }
  .tabs a { font-size: .6875rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .tabs, .install-tip, .toast, header.top { display: none !important; }
  body { padding: 0; background: #fff; }
}
