/* ═══════════════════════════════════════════════════════════════════════
   Thoughtform — map your mind, compare minds, discover people.
   Mobile-first, fully responsive. Breakpoints: 400 / 640 / 900 / 1280.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #efe8dc;
  --ink: #160f0c;
  --mut: rgba(22, 15, 12, .78);
  --fai: rgba(22, 15, 12, .6);
  --hair: rgba(22, 15, 12, .18);
  --amb: #a83a08;
  --ros: #a80f5c;
  --rosT: #fdf6f2;
  --card: rgba(252, 248, 241, .94);
  --sel: rgba(168, 58, 8, .14);
  --selR: rgba(168, 15, 92, .12);

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* Horizontal gutter grows with the viewport. */
  --gut: clamp(16px, 4.5vw, 40px);
  /* Reading width for sheet content. */
  --sheet-w: min(660px, 100vw);
}

[data-tf="dark"] {
  --bg: #050307;
  --ink: #f7f2ea;
  --mut: rgba(247, 242, 234, .78);
  --fai: rgba(247, 242, 234, .55);
  --hair: rgba(247, 242, 234, .22);
  --amb: #ffbe80;
  --ros: #ff8fc4;
  --rosT: #1a0410;
  --card: rgba(9, 6, 11, .92);
  --sel: rgba(255, 150, 70, .16);
  --selR: rgba(255, 143, 196, .16);
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  /* 16px minimum on inputs stops iOS Safari zooming on focus. */
  font-size: 16px;
  line-height: 1.5;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

a { color: var(--amb); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

::selection { background: var(--sel); }

button, input, textarea, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}
input, textarea { caret-color: var(--amb); }
input::placeholder, textarea::placeholder { color: var(--fai); }
input:focus, button:focus, textarea:focus { outline: none; }
:focus-visible { outline: 2px solid var(--amb); outline-offset: 2px; border-radius: 2px; }

img, canvas { display: block; max-width: 100%; }

.tf-mono {
  font-family: var(--mono);
  font-weight: 700;
}

/* Scrollable regions keep their own momentum and never chain to the page. */
.tf-scroll,
.tf-sheet,
.tf-screen--landing,
.tf-screen--intent {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── App shell ──────────────────────────────────────────────────────── */
.tf-app {
  position: fixed;
  inset: 0;
  /* dvh keeps the layout honest while mobile browser chrome slides away. */
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  transition: background-color .75s ease, color .75s ease;
}

.tf-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Persistent chrome ──────────────────────────────────────────────── */
.tf-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + var(--safe-t)) calc(var(--gut) - 4px) 10px;
  pointer-events: none;
}

.tf-brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.tf-brand__mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(9.5px, 2.6vw, 11px);
  letter-spacing: .3em;
  color: var(--ink);
}

.tf-brand__sub {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(8px, 2.2vw, 9.5px);
  letter-spacing: .18em;
  color: var(--fai);
  white-space: nowrap;
}

.tf-count {
  pointer-events: auto;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 17px;
  font-family: var(--mono);
  font-size: clamp(8.5px, 2.3vw, 9.5px);
  font-weight: 700;
  letter-spacing: .14em;
  white-space: nowrap;
  transition: border-color .2s;
}
.tf-count:hover { border-color: var(--ink); }

.tf-count__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ros);
  animation: tfPulse 2s ease-in-out infinite;
}

.tf-back {
  position: absolute;
  top: calc(46px + var(--safe-t));
  left: calc(var(--gut) - 8px);
  z-index: 12;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 3px;
  color: var(--mut);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  transition: border-color .2s, color .2s;
}
.tf-back:hover { border-color: var(--ink); color: var(--ink); }

/* ── Screens ────────────────────────────────────────────────────────── */
.tf-screen { position: absolute; z-index: 6; }

/* Landing ------------------------------------------------------------- */
.tf-screen--landing {
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: calc(58px + var(--safe-t)) var(--gut) calc(4.5vh + var(--safe-b));
  text-align: center;
}

.tf-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 760px;
}

.tf-eyebrow {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(8px, 2.4vw, 9.5px);
  letter-spacing: .22em;
  color: var(--fai);
  /* Long on small phones — allow it to break rather than overflow. */
  text-wrap: balance;
}

.tf-display {
  margin-top: 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, min(10.2vw, 8vh), 76px);
  line-height: 1.04;
  max-width: 720px;
  text-wrap: balance;
}
.tf-display em { font-style: italic; color: var(--ros); }
.tf-display--sm { font-size: clamp(28px, 7.4vw, 46px); line-height: 1.1; max-width: 620px; }
.tf-display--sm em { color: var(--amb); }

.tf-lede {
  margin-top: 14px;
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.65;
  color: var(--mut);
  max-width: 440px;
  text-wrap: pretty;
}

.tf-fineprint {
  margin-top: 24px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(8.5px, 2.4vw, 9.5px);
  letter-spacing: .1em;
  line-height: 1.9;
  color: var(--fai);
  max-width: 460px;
  text-wrap: balance;
}

/* Question ------------------------------------------------------------ */
.tf-screen--question {
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 12px var(--gut) calc(2.8vh + 10px + var(--safe-b));
}

.tf-q {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  width: 100%;
  max-width: 640px;
}

.tf-q__meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
}
.tf-q__step { font-size: 10px; letter-spacing: .22em; color: var(--accent, var(--amb)); }
.tf-q__tag { font-size: 10px; letter-spacing: .18em; color: var(--mut); }
.tf-q__sep { width: 3px; height: 3px; border-radius: 50%; background: var(--hair); }

.tf-segs { display: flex; gap: 5px; width: min(340px, 78vw); }
.tf-segs span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  transition: background .3s, opacity .3s;
}

.tf-q__text {
  margin: 4px 0 2px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(23px, 6vw, 34px);
  line-height: 1.22;
  text-align: center;
  max-width: 600px;
  text-wrap: pretty;
}

.tf-scale { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.tf-scale__row { display: flex; gap: clamp(8px, 2.6vw, 14px); margin-top: 2px; }

.tf-scale__btn {
  cursor: pointer;
  width: clamp(52px, 14vw, 60px);
  height: clamp(52px, 14vw, 60px);
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
  transition: background .2s, border-color .2s;
}
.tf-scale__btn:hover { border-color: var(--amb); }
.tf-scale__btn[data-on="1"] { background: var(--sel); border-color: var(--accent, var(--amb)); }

.tf-scale__ends {
  display: flex;
  justify-content: space-between;
  width: min(350px, 86vw);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9.5px;
  letter-spacing: .14em;
  color: var(--mut);
}

.tf-choices {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  max-width: 520px;
}

.tf-choice {
  cursor: pointer;
  display: block;
  text-align: left;
  width: 100%;
  padding: 14px 17px;
  min-height: 56px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 4px;
  transition: background .2s, border-color .2s;
}
.tf-choice:hover { border-color: var(--amb); }
.tf-choice[data-on="1"] { background: var(--sel); border-color: var(--accent, var(--amb)); }
.tf-choice__t { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.tf-choice__s { margin-top: 3px; font-size: 11.5px; color: var(--mut); }

/* Feedback flash ------------------------------------------------------ */
.tf-fb {
  position: absolute;
  left: 0;
  right: 0;
  top: 37%;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0 var(--gut);
  text-align: center;
  pointer-events: none;
  animation: tfPop 1.8s ease both;
}
.tf-fb__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(25px, 6.4vw, 38px);
  line-height: 1.05;
}
.tf-fb__sub { font-size: 10px; letter-spacing: .18em; color: var(--accent, var(--amb)); }

/* Ceremony ------------------------------------------------------------ */
.tf-screen--ceremony { inset: 0; z-index: 7; }

.tf-cer {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  bottom: calc(2.5vh + 74px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 var(--gut);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.tf-cer[data-shown="1"] { opacity: 1; transition: opacity .8s ease; }

.tf-cer__kicker { font-size: 10px; letter-spacing: .3em; color: var(--amb); }
.tf-cer__verdict {
  font-family: var(--serif);
  font-size: clamp(32px, 8.5vw, 60px);
  line-height: 1.08;
  max-width: 640px;
}
.tf-cer__sub {
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--mut);
  max-width: 440px;
  line-height: 1.9;
}
.tf-cer__next {
  position: absolute;
  bottom: calc(2.5vh + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  letter-spacing: .2em;
}

/* Invited friend ------------------------------------------------------ */
.tf-screen--friend {
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 12px var(--gut) calc(5vh + var(--safe-b));
  text-align: center;
}
.tf-friend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 640px;
}
.tf-friend .tf-display--sm, .tf-friend .tf-lede { margin-top: 0; }
.tf-friend .tf-fineprint { margin-top: 0; }

/* Discovery intent ---------------------------------------------------- */
/* Top padding clears both the back button (ends ~90px) and the small canvas
   scene above it, for the case where the content is tall enough to scroll. */
.tf-screen--intent {
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(108px + var(--safe-t)) var(--gut) calc(3vh + var(--safe-b));
}
.tf-intent {
  margin: auto 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
}
.tf-intent__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 6.2vw, 36px);
  line-height: 1.16;
  text-align: center;
  text-wrap: pretty;
}
.tf-intent__grid {
  display: grid;
  /* Collapses to one column on narrow phones without a breakpoint. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 9px;
  width: 100%;
  margin-top: 4px;
}
.tf-intent__opt {
  cursor: pointer;
  text-align: left;
  padding: 12px 14px;
  min-height: 60px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 4px;
  transition: background .2s, border-color .2s;
}
.tf-intent__opt:hover { border-color: var(--ros); }
.tf-intent__opt[data-on="1"] { background: var(--selR); border-color: var(--ros); }
.tf-intent__opt b { display: block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.tf-intent__opt span { display: block; margin-top: 2px; font-size: 11px; color: var(--mut); }
.tf-intent__next { width: 100%; margin-top: 10px; }

.tf-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tf-chip {
  cursor: pointer;
  padding: 11px 15px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  transition: background .2s, border-color .2s;
}
.tf-chip:hover { border-color: var(--ink); }
.tf-chip[data-on="1"] { background: var(--sel); border-color: var(--amb); }

/* ── Sheets ─────────────────────────────────────────────────────────── */
.tf-sheetwrap {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.tf-sheet {
  pointer-events: auto;
  width: var(--sheet-w);
  max-height: 80vh;
  max-height: 80dvh;
  padding: 22px var(--gut) calc(20px + var(--safe-b));
  background: var(--card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--hair);
  border-radius: 14px 14px 0 0;
  animation: tfUp .5s ease both;
}

.tf-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.tf-sheet__head--wrap { flex-wrap: wrap; }

.tf-sheet__title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 7.6vw, 44px);
  line-height: 1.08;
  text-wrap: pretty;
}
.tf-sheet__title--sm { font-size: clamp(26px, 6.8vw, 38px); line-height: 1.12; }

.tf-sheet__body {
  margin-top: 9px;
  font-size: clamp(13px, 3.4vw, 14px);
  line-height: 1.6;
  color: var(--mut);
  text-wrap: pretty;
}
.tf-sheet__rare { margin-top: 9px; font-size: 9.5px; letter-spacing: .16em; color: var(--amb); }
.tf-sheet__counts { margin-top: 10px; font-size: 10px; letter-spacing: .16em; color: var(--ros); }

.tf-kicker { font-size: 10px; letter-spacing: .26em; color: var(--amb); }
.tf-kicker--ros { color: var(--ros); }
.tf-meta { font-size: 9px; font-weight: 400; letter-spacing: .14em; color: var(--fai); }
.tf-meta--ros { font-weight: 700; color: var(--ros); }

.tf-label { margin-top: 18px; font-size: 9px; letter-spacing: .22em; color: var(--fai); }
.tf-label--xs { margin-top: 0; font-size: 8.5px; }
.tf-label--center { margin-top: 8px; text-align: center; }

.tf-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--fai);
  border: 1px solid var(--hair);
  border-radius: 3px;
}

.tf-signals { margin-top: 10px; display: flex; flex-direction: column; gap: 12px; }
.tf-insights { margin-top: 18px; display: flex; flex-direction: column; gap: 15px; }
.tf-insight { margin-top: 16px; display: flex; flex-direction: column; gap: 3px; }
.tf-insight__label { font-size: 9px; letter-spacing: .2em; color: var(--amb); }
.tf-insight__label--ros { color: var(--ros); }
.tf-insight__label--mut { color: var(--mut); }
.tf-insight__text {
  font-size: clamp(12.5px, 3.4vw, 13.5px);
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}

.tf-panel { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--hair); border-radius: 6px; }
.tf-quote {
  margin-top: 7px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(15px, 4.2vw, 17px);
  line-height: 1.4;
}
.tf-note { margin-top: 6px; font-size: 10.5px; line-height: 1.5; color: var(--fai); }
.tf-note--mono { font-family: var(--mono); font-weight: 400; font-size: 9px; letter-spacing: .16em; }

.tf-disclaimer { margin-top: 16px; font-size: 10.5px; line-height: 1.8; color: var(--fai); text-wrap: pretty; }

.tf-stack { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.tf-row { display: flex; gap: 9px; }
.tf-row--wrap { flex-wrap: wrap; }
.tf-row--center { justify-content: center; flex-wrap: wrap; }
.tf-row > .tf-btn { flex: 1 1 160px; }

.tf-cardrow { display: flex; gap: 14px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.tf-safety { margin-top: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.tf-qr { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: tfIn .3s ease both; }
.tf-qr canvas {
  width: 126px;
  height: 126px;
  border: 1px solid var(--hair);
  border-radius: 4px;
  background: #f6f0e4;
}

.tf-links { margin-top: 16px; border: 1px solid var(--hair); border-radius: 6px; overflow: hidden; }
.tf-links__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--hair);
}
.tf-links__who { flex: none; font-size: 9px; letter-spacing: .18em; color: var(--mut); }
.tf-links__val {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--amb);
  text-align: right;
  overflow-wrap: anywhere;
}
.tf-links__start { padding: 13px 15px; }

/* ── Form fields ────────────────────────────────────────────────────── */
.tf-fields { margin-top: 16px; display: flex; flex-direction: column; gap: 15px; }
.tf-field { display: flex; flex-direction: column; gap: 4px; }
.tf-field__label { font-size: 9px; letter-spacing: .2em; color: var(--mut); }
.tf-field .tf-note { margin-top: 0; }

.tf-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  padding: 9px 2px;
  /* 16px stops iOS zoom-on-focus; visually it reads as 15px in context. */
  font-size: 16px;
  transition: border-color .2s;
}
.tf-input:focus { border-bottom-color: var(--amb); }
.tf-input--big {
  width: min(300px, 80vw);
  padding: 11px 4px;
  font-family: var(--serif);
  font-size: clamp(22px, 6vw, 26px);
  text-align: center;
}

.tf-textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 4px;
  resize: vertical;
  min-height: 64px;
}

.tf-rec {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: left;
  transition: border-color .2s;
}
.tf-rec:hover { border-color: var(--ink); }
.tf-rec--on { background: var(--selR); border-color: var(--ros); gap: 12px; }
.tf-rec__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ros); }
.tf-rec__done { display: flex; flex-direction: column; gap: 8px; animation: tfIn .3s ease both; }
.tf-rec__tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tf-bars { display: flex; align-items: center; gap: 3px; height: 18px; flex: none; }
.tf-bars i { width: 3px; height: 16px; background: var(--ros); animation: tfBar .9s ease-in-out infinite; }
.tf-bars i:nth-child(2) { animation-delay: -.15s; }
.tf-bars i:nth-child(3) { animation-delay: -.3s; }
.tf-bars i:nth-child(4) { animation-delay: -.45s; }
.tf-bars i:nth-child(5) { animation-delay: -.6s; }

.tf-check {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border: none;
  padding: 6px 0;
  min-height: 44px;
  text-align: left;
}
.tf-check__box {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--hair);
  border-radius: 3px;
  background: transparent;
  transition: background .2s, border-color .2s;
}
.tf-check[aria-pressed="true"] .tf-check__box { background: var(--ros); border-color: var(--ros); }
.tf-check__text { font-size: 10.5px; letter-spacing: .1em; color: var(--ink); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.tf-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .14em;
  text-decoration: none;
  transition: opacity .2s, border-color .2s, color .2s, background .2s;
}
.tf-btn--block { width: 100%; }

.tf-btn--primary {
  background: var(--ros);
  color: var(--rosT);
  min-height: 56px;
  padding: 17px 20px;
  font-size: clamp(11.5px, 3.1vw, 12.5px);
  letter-spacing: .16em;
}
.tf-btn--primary:hover { opacity: .9; }

.tf-btn--solid-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
  min-height: 54px;
  padding: 16px 18px;
  font-size: clamp(10.5px, 2.9vw, 12px);
}
.tf-btn--solid-outline:hover { opacity: .82; }

.tf-btn--outline {
  background: transparent;
  color: var(--mut);
  border-color: var(--hair);
  min-height: 52px;
  padding: 15px 18px;
  font-size: clamp(10.5px, 2.9vw, 11.5px);
}
.tf-btn--outline:hover { border-color: var(--ink); color: var(--ink); }

.tf-btn--quiet {
  margin-top: 13px;
  background: transparent;
  color: var(--mut);
  border: none;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  min-height: 46px;
  padding: 11px 18px;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .12em;
}
.tf-btn--quiet:hover { color: var(--ink); border-bottom-color: var(--ink); }

.tf-btn--dark {
  background: transparent;
  color: #f7f2ea;
  border-color: rgba(255, 255, 255, .35);
  min-height: 46px;
  padding: 12px 18px;
  font-size: 10.5px;
}
.tf-btn--dark:hover { border-color: #fff; }
.tf-btn--dark[data-on="1"] { background: rgba(255, 255, 255, .16); }

.tf-btn--light {
  background: #f7f2ea;
  color: #160f0c;
  min-height: 48px;
  padding: 14px 22px;
  font-size: 11px;
  letter-spacing: .16em;
}
.tf-btn--light:hover { opacity: .9; }

/* The landing CTA is wide but never edge-to-edge on a tablet. */
.tf-screen--landing .tf-btn--primary { margin-top: 28px; width: min(400px, 100%); min-height: 60px; }
.tf-screen--friend .tf-btn--primary { margin-top: 4px; width: min(400px, 100%); min-height: 58px; }

.tf-link {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 10px 0;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--mut);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .2s;
}
.tf-link:hover { color: var(--ink); }
.tf-link--faint { font-size: 9px; letter-spacing: .16em; color: var(--fai); }

/* ── Modal / overlays ───────────────────────────────────────────────── */
.tf-modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gut);
}
.tf-modal__card {
  width: min(420px, 100%);
  padding: 26px 24px;
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hair);
  border-radius: 10px;
  text-align: center;
  animation: tfUp .4s ease both;
}
.tf-modal__title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 6.6vw, 36px);
  line-height: 1.12;
}
.tf-modal__body { margin-top: 9px; font-size: 13px; line-height: 1.65; color: var(--mut); text-wrap: pretty; }

.tf-dots { margin-top: 16px; display: flex; gap: 7px; justify-content: center; }
.tf-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--ros); animation: tfPulse 1.2s ease-in-out infinite; }
.tf-dots span:nth-child(2) { animation-delay: -.4s; }
.tf-dots span:nth-child(3) { animation-delay: -.8s; }

/* Share overlay ------------------------------------------------------- */
.tf-share {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gut);
  background: rgba(8, 4, 7, .86);
}
.tf-share__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-height: 100%;
  animation: tfUp .4s ease both;
}
.tf-share img {
  max-width: min(340px, 82vw);
  max-height: 54vh;
  max-height: 54dvh;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7);
}

/* Minds map ----------------------------------------------------------- */
.tf-map { position: fixed; inset: 0; z-index: 30; background: var(--bg); }
.tf-map__top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + var(--safe-t)) var(--gut) 10px;
}
.tf-map__close {
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  transition: border-color .2s;
}
.tf-map__close:hover { border-color: var(--ink); }

.tf-map__head {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(66px + var(--safe-t));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0 var(--gut);
  text-align: center;
  pointer-events: none;
}
.tf-map__count { font-family: var(--serif); font-size: clamp(30px, 7.6vw, 48px); line-height: 1.08; }
.tf-map__note { font-size: 12.5px; line-height: 1.6; color: var(--mut); max-width: 400px; text-wrap: pretty; }
.tf-map__you { font-size: 9.5px; letter-spacing: .16em; color: var(--amb); }

.tf-map__foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gut);
}
.tf-legend { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; max-width: 560px; }
.tf-legend span.tf-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--hair);
  border-radius: 15px;
  background: var(--card);
}
.tf-legend i { width: 7px; height: 7px; border-radius: 50%; }
.tf-legend b { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .12em; color: var(--ink); }
.tf-legend em { font-family: var(--mono); font-style: normal; font-size: 8.5px; color: var(--mut); }

/* Toast --------------------------------------------------------------- */
/* Centred with auto margins, not translateX — the tfUp keyframes animate
   `transform`, which would otherwise overwrite a centring translate. */
.tf-toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(24px + var(--safe-b));
  width: fit-content;
  margin-inline: auto;
  z-index: 50;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
  letter-spacing: .14em;
  border-radius: 4px;
  max-width: calc(100% - 2 * var(--gut));
  text-align: center;
  animation: tfUp .3s ease both;
}

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes tfUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tfIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes tfPop  { 0% { opacity: 0; transform: translateY(14px); } 12%, 82% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes tfBar  { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes tfPulse{ 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.tf-a1 { animation: tfUp .8s .25s ease both; }
.tf-a2 { animation: tfUp .8s .35s ease both; }
.tf-a3 { animation: tfUp .8s .50s ease both; }
.tf-a4 { animation: tfUp .8s .62s ease both; }
.tf-a5 { animation: tfUp .8s .72s ease both; }
.tf-a6 { animation: tfUp .8s .85s ease both; }
.tf-anim-q { animation: tfUp .5s ease both; }
.tf-anim-q-late { animation: tfUp .5s .08s ease both; }

/* ═══ Responsive ═══════════════════════════════════════════════════════
   The canvas geometry adapts in JS (see geo() in app.js); these rules
   handle the DOM layer.
   ══════════════════════════════════════════════════════════════════════ */

/* Very small phones (iPhone SE and narrower) --------------------------- */
@media (max-width: 400px) {
  .tf-brand__sub { font-size: 7.5px; letter-spacing: .14em; }
  .tf-count { padding: 8px 10px; gap: 5px; }
  .tf-screen--question { height: 66%; }
  .tf-scale__row { gap: 7px; }
  .tf-sheet { max-height: 84dvh; }
}

/* Tablet and up -------------------------------------------------------- */
@media (min-width: 640px) {
  .tf-screen--landing { justify-content: center; padding-bottom: calc(8vh + var(--safe-b)); }
  .tf-screen--question { height: 58%; }
  .tf-q { gap: 13px; }
  .tf-sheet { max-height: 78dvh; }
  .tf-toast { font-size: 11px; }
}

/* Desktop: sheets stop being phone bottom-sheets and become cards ------ */
@media (min-width: 900px) {
  :root { --sheet-w: min(680px, calc(100vw - 2 * var(--gut))); }

  .tf-sheetwrap { align-items: flex-end; padding-bottom: clamp(20px, 4vh, 48px); }

  .tf-sheet {
    max-height: min(76dvh, 820px);
    border: 1px solid var(--hair);
    border-radius: 14px;
    padding: 26px 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .16);
  }
  [data-tf="dark"] .tf-sheet { box-shadow: 0 30px 90px rgba(0, 0, 0, .55); }

  .tf-screen--question { height: 54%; }
  .tf-cer { top: 50%; }
  .tf-share img { max-width: 380px; max-height: 60dvh; }
  .tf-map__note { max-width: 460px; }
}

/* Large desktop: keep line lengths readable ---------------------------- */
@media (min-width: 1280px) {
  :root { --gut: 48px; }
  .tf-display { max-width: 860px; }
  .tf-lede { max-width: 520px; }
  .tf-q { max-width: 720px; }
  .tf-screen--question { height: 50%; }
}

/* Short viewports / landscape phones ----------------------------------- */
@media (max-height: 620px) and (orientation: landscape) {
  .tf-screen--landing {
    justify-content: flex-start;
    padding-top: calc(52px + var(--safe-t));
    padding-bottom: calc(16px + var(--safe-b));
  }
  .tf-display { font-size: clamp(26px, 5.4vw, 40px); margin-top: 8px; }
  .tf-lede { margin-top: 8px; font-size: 12.5px; }
  .tf-screen--landing .tf-btn--primary { margin-top: 14px; min-height: 50px; }
  .tf-btn--quiet { margin-top: 6px; }
  .tf-fineprint { margin-top: 12px; }

  /* The question panel gets the full height and scrolls internally. It stays
     bottom-anchored so the canvas scene above it is never covered. */
  .tf-screen--question {
    height: auto;
    top: calc(46px + var(--safe-t));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-top: 8px;
    justify-content: flex-end;
  }
  .tf-q { gap: 8px; }
  .tf-q__text { font-size: clamp(19px, 3.6vw, 26px); }
  .tf-scale__btn { width: clamp(46px, 7vw, 54px); height: clamp(46px, 7vw, 54px); }
  .tf-choice { min-height: 48px; padding: 10px 14px; }

  .tf-screen--friend { height: auto; top: calc(46px + var(--safe-t)); overflow-y: auto; justify-content: center; }
  .tf-cer { top: 42%; bottom: calc(12px + 60px + var(--safe-b)); }
  .tf-cer__verdict { font-size: clamp(26px, 5.6vw, 42px); }
  .tf-sheet { max-height: 88dvh; padding-top: 16px; }
  .tf-fb { top: 26%; }
  .tf-share img { max-height: 46dvh; }
  .tf-map__head { top: calc(56px + var(--safe-t)); }
  .tf-map__count { font-size: clamp(22px, 4.4vw, 32px); }
  .tf-map__note { font-size: 11px; }
}

/* Very short viewports of any orientation ------------------------------ */
@media (max-height: 480px) {
  .tf-top { padding-top: calc(8px + var(--safe-t)); }
  .tf-cer__next { bottom: calc(8px + var(--safe-b)); min-height: 44px; }
}

/* Pointer-coarse devices get no hover repaint -------------------------- */
@media (hover: none) {
  .tf-btn:hover, .tf-choice:hover, .tf-chip:hover, .tf-scale__btn:hover,
  .tf-intent__opt:hover, .tf-link:hover, .tf-count:hover, .tf-back:hover {
    opacity: 1;
    border-color: inherit;
  }
  .tf-choice:hover, .tf-scale__btn:hover, .tf-chip:hover, .tf-intent__opt:hover { border-color: var(--hair); }
  .tf-choice[data-on="1"]:hover, .tf-scale__btn[data-on="1"]:hover { border-color: var(--accent, var(--amb)); }
  .tf-chip[data-on="1"]:hover { border-color: var(--amb); }
  .tf-intent__opt[data-on="1"]:hover { border-color: var(--ros); }
}

/* Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
