/* Three independent looks: green on off-white for men, soft pink with white for women
   (near-white text on the pink, pink text on the pale surfaces), and a plain one for the screens before anyone has signed in.
   Each sets its own colours and its own corner sizes; nothing below names a colour. */
#app[data-theme="male"] {
  --bg: #F2F4EE; --surface: #FFFFFF; --ink: #14201C; --muted: #586760; --line: #DDE3DA;
  --fill: #0E7C66; --on-fill: #FFFFFF; --accent: #0E7C66;
  --soft: #DCEFE8; --on-soft: #0A5C4C;
  --bar: #F2F4EE; --on-bar: #14201C; --brand: #0E7C66; --bar-brand: #0E7C66;
  --hero: #0B4F43; --on-hero: #FFFFFF; --hero-dim: #A9D6CA; --hero-line: #2B6B5F;
  --weak: #B4480C; --weak-soft: #FBE6D8; --on-weak-soft: #5A2305;
  --danger: #B3261E;
  --placeholder: #C9D6D2;
  --tint-0: #FFFFFF; --tint-1: #DCEFE8; --tint-2: #E9EDE2; --tint-3: #FFFFFF;
  --r-card: 14px; --r-ctl: 12px; --r-btn: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 28, 0.06), 0 4px 14px rgba(20, 32, 28, 0.05);
}
#app[data-theme="female"] {
  --bg: #FFF6FA; --surface: #FFFBFD; --ink: #E888BA; --muted: #A26C88; --line: #FFE1EE;
  --fill: #FFBDDE; --on-fill: #FFF4F9; --accent: #E888BA;
  --soft: #FFE5F1; --on-soft: #E888BA;
  --bar: #FFBDDE; --on-bar: #FFF4F9; --brand: #E888BA; --bar-brand: #FFF4F9;
  --hero: #FFBDDE; --on-hero: #FFF4F9; --hero-dim: #FFF4F9; --hero-line: #FFD3E9;
  --weak: #8A1F55; --weak-soft: #FFE5F1; --on-weak-soft: #E888BA;
  --danger: #A3123B;
  --placeholder: #F5CADD;
  --tint-0: #FFFBFD; --tint-1: #FFE5F1; --tint-2: #FFD0E6; --tint-3: #FFF1F7;
  --r-card: 22px; --r-ctl: 16px; --r-btn: 28px;
  --shadow: 0 1px 2px rgba(74, 29, 54, 0.05), 0 6px 18px rgba(176, 38, 107, 0.07);
}
#app[data-theme="plain"] {
  --bg: #F7F6F3; --surface: #FFFFFF; --ink: #1D1C21; --muted: #62606A; --line: #E2E0DB;
  --fill: #1D1C21; --on-fill: #FFFFFF; --accent: #1D1C21;
  --soft: #ECEAE5; --on-soft: #1D1C21;
  --bar: #F7F6F3; --on-bar: #1D1C21; --brand: #1D1C21; --bar-brand: #1D1C21;
  --hero: #1D1C21; --on-hero: #FFFFFF; --hero-dim: #BDBAC4; --hero-line: #45434C;
  --weak: #B4480C; --weak-soft: #FBE6D8; --on-weak-soft: #5A2305;
  --danger: #B3261E;
  --placeholder: #D9D7D2;
  --tint-0: #FFFFFF; --tint-1: #ECEAE5; --tint-2: #E2E0DB; --tint-3: #FFFFFF;
  --r-card: 18px; --r-ctl: 14px; --r-btn: 20px;
  --shadow: 0 1px 2px rgba(29, 28, 33, 0.06), 0 4px 14px rgba(29, 28, 33, 0.05);
}

/* fonts:start (served from this site, so no visitor is sent to a font service; both are
   under the SIL Open Font License, see fonts/README.md) */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 600 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-weight: 400 700; font-display: swap; src: url(fonts/figtree-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-weight: 400 700; font-display: swap; src: url(fonts/figtree-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* fonts:end */

/* page:start (the document around the app) */
html, body { height: 100%; margin: 0; }
body { background: #E7E6E2; -webkit-text-size-adjust: 100%; }
/* page:end */

/* The app is a phone-width column; on a wide screen it sits centred. */
#app {
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 var(--body);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background-color 0.25s;
}
:where(#app) *, :where(#app) *::before, :where(#app) *::after { box-sizing: border-box; }
:where(#app) button, :where(#app) input, :where(#app) textarea { font: inherit; color: inherit; }
:where(#app) button { cursor: pointer; }
:where(#app) h1, :where(#app) h2, :where(#app) p { margin: 0; }
:where(#app) h2 { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }

.mockbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px;
  background: #2B2D33; color: #FFFFFF;
  font-size: 13px;
}
.mockbar button {
  min-height: 32px; padding: 0 12px;
  border: 1px solid #8A8E99; border-radius: 16px;
  background: none; color: #FFFFFF;
}
.mockbar button[aria-pressed="true"] { background: #FFFFFF; color: #2B2D33; border-color: #FFFFFF; font-weight: 600; }

.topbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 4px;
  min-height: 60px; padding: 0 16px;
  background: var(--bar); color: var(--on-bar);
}
.topbar.has-back { padding-left: 4px; }
.topbar h1 { flex: 1; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; color: var(--bar-brand); }
.iconbtn {
  width: 48px; height: 48px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; color: inherit; border-radius: 24px;
}
.textbtn { min-height: 44px; padding: 0 12px; border: none; background: none; color: var(--accent); font-weight: 700; border-radius: var(--r-ctl); }
.topbar .textbtn { color: var(--on-bar); }
.textbtn.danger { color: var(--danger); }

main { flex: 1; overflow-y: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
main.flush { padding: 0; gap: 0; }

.tabs { flex-shrink: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px env(safe-area-inset-bottom); }
.tabs button {
  flex: 1; min-width: 0; min-height: 60px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.tabs .pill { display: flex; align-items: center; justify-content: center; width: 60px; height: 32px; border-radius: 16px; transition: background-color 0.2s; }
.tabs button[aria-current="page"] { color: var(--on-soft); font-weight: 700; }
.tabs button[aria-current="page"] .pill { background: var(--soft); }
#app[data-theme="female"] .tabs button[aria-current="page"] .pill { background: var(--fill); color: var(--on-fill); }

.banner { flex-shrink: 0; display: flex; align-items: center; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; border-radius: var(--r-ctl); background: var(--soft); color: var(--on-soft); font-size: 14px; }
.banner p { flex: 1; }
.banner + .banner { margin-top: 6px; }
.banner[data-staging] { padding-top: 10px; padding-bottom: 10px; }

.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
button.card, a.card { display: block; width: 100%; text-align: left; border: none; padding: 0; color: inherit; text-decoration: none; }
.card.line { padding: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); flex-shrink: 0; display: flex; }
.lead { font-size: 14px; color: var(--muted); max-width: 60ch; }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 2px 0; }
.sectionhead .strong { font-family: var(--display); font-size: 18px; }

.avatar {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--soft); color: var(--on-soft);
  font-family: var(--display); font-size: 21px; font-weight: 700;
}
.avatar.large { width: 64px; height: 64px; font-size: 28px; background: var(--fill); color: var(--on-fill); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.btn {
  min-height: 52px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-btn);
  background: var(--fill); color: var(--on-fill);
  font-weight: 700;
}
.btn.quiet { background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); }
.btn.soft { background: var(--soft); color: var(--on-soft); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btnrow { display: flex; gap: 10px; }
.btnrow > * { flex: 1; }

/* Feed: two columns of mixed photo and text tiles. */
.feed { display: flex; gap: 10px; align-items: flex-start; }
.feed-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tile { overflow: hidden; position: relative; }
.tile .name { padding: 8px 14px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tile .quote { padding: 16px 14px 0; font-family: var(--display); font-size: 17px; font-weight: 600; line-height: 1.28; letter-spacing: -0.005em; }
/* A text tile stops at about one and a half photos' height, with the rest behind "…";
   the whole text is there once opened. */
.text-tile .quote { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 14; line-clamp: 14; overflow: hidden; }
.tile.photo-tile .name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 14px 11px;
  color: #FFFFFF; font-size: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}
.tile.t1 { background: var(--tint-1); }
.tile.t2 { background: var(--tint-2); }
.tile.t3 { background: var(--tint-3); }
.photo { display: block; width: 100%; background: var(--placeholder); object-fit: cover; }
.tile .photo { aspect-ratio: 4 / 5; }
.block { overflow: hidden; }
.block .photo { aspect-ratio: 1; }
.thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--r-ctl); object-fit: cover; background: var(--placeholder); }
.thumb.text { display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--on-soft); font-family: var(--display); font-weight: 700; font-size: 20px; }
.block .quote { padding: 20px 18px; font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.28; }
.block .caption { padding: 12px 16px; color: var(--muted); }

/* Voice clips: a tile in the feed, a player wherever a clip appears, and recording. */
.voice-tile .quote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voice-mark { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: var(--fill); color: var(--on-fill); flex-shrink: 0; }
.voice { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--on-soft); }
.voice audio { flex: 1; min-width: 0; height: 40px; max-width: 260px; }
.bubble .voice { color: inherit; }
.bubble.mine .voice .muted { color: inherit; opacity: 0.8; }
.voice-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; color: var(--on-soft); text-align: center; }
.voice-stage .quote { padding: 0; font-size: 24px; }
.voice-stage .voice audio { max-width: none; width: min(320px, 70vw); }
.rec { display: flex; align-items: center; gap: 10px; min-height: 44px; font-variant-numeric: tabular-nums; font-weight: 700; }
.rec audio { flex: 1; min-width: 0; height: 40px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.rec-dot.on { background: var(--danger); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .rec-dot.on { animation: none; } }

/* One item full screen. */
.opened { flex: 1; display: flex; flex-direction: column; background: var(--soft); color: var(--ink); min-height: 0; }
.opened .tools { display: flex; justify-content: space-between; padding: 6px 8px; }
.opened .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 14px 14px; overflow-y: auto; }
/* A long text scrolls in the stage instead of being cut off; a short one stays centred. */
.opened .stage .quote { margin: auto; }
.opened .stage .quote.long { font-size: 22px; line-height: 1.3; letter-spacing: 0; text-wrap: initial; }
.opened .stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-card); box-shadow: var(--shadow); }
.opened .stage .quote { padding: 12px 14px; font-family: var(--display); font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; color: var(--on-soft); text-wrap: balance; }
.sheet { background: var(--surface); color: var(--ink); border-radius: 26px 26px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06); }
.sheet h2 { font-size: 26px; }

.footer { flex-shrink: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.note { display: flex; align-items: center; gap: 10px; background: var(--soft); color: var(--on-soft); border-radius: var(--r-ctl); padding: 12px 14px; font-weight: 700; font-size: 14px; }
.locked { border: 1.5px dashed var(--muted); border-radius: var(--r-card); padding: 16px; color: var(--muted); display: flex; align-items: center; gap: 12px; }

/* His photos behind a text item: which one she is on. */
.count { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.dots { display: flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.sheet .btn.soft { width: 100%; }
.btn { white-space: nowrap; }
.btn svg, .note svg { flex-shrink: 0; }

/* Statistics. */
.hero { background: var(--hero); color: var(--on-hero); border-radius: var(--r-card); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.hero .label { font-size: 13px; font-weight: 700; color: var(--hero-dim); }
.hero .figures { border-top: 1px solid var(--hero-line); }
.hero .figures span { color: var(--hero-dim); }
.big { font-family: var(--display); font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.figures.bare { border-top: none; padding-top: 0; }
.figures b { display: block; font-family: var(--display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.figures span { font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.weak > i { background: var(--weak); }
.weaktext { color: var(--weak); }
.bar.ink > i { background: var(--ink); }
.weakbox { background: var(--weak-soft); color: var(--on-weak-soft); border-radius: var(--r-card); padding: 14px 16px; }
.measure { display: flex; flex-direction: column; gap: 5px; }
.measure .row { justify-content: space-between; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Chat. */
.bubbles { display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 20px 20px 20px 6px; background: var(--surface); box-shadow: var(--shadow); align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { background: var(--fill); color: var(--on-fill); box-shadow: none; border-radius: 20px 20px 6px 20px; align-self: flex-end; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 48px; max-height: 120px; resize: none; border-radius: 24px; background: var(--bg); border-color: transparent; }
.composer .iconbtn { background: var(--fill); color: var(--on-fill); }

#app input[type="text"], #app input[type="email"], #app input[type="password"], #app input[type="date"], #app textarea {
  width: 100%; min-height: 50px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface);
}
#app .composer textarea { border-radius: 24px; background: var(--bg); border-color: transparent; }
#app input:focus-visible, #app textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; color: var(--muted); }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Choosing woman or man when signing up, which also sets the look of the app. */
.choice { display: flex; gap: 10px; }
.choice label {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 16px;
  border-radius: var(--r-ctl);
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 700;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label:has(input:checked) { background: var(--fill); color: var(--on-fill); box-shadow: none; }
.choice label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.auth { padding: 36px 24px; gap: 14px; }
.auth .logo { font-family: var(--display); font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -0.045em; color: var(--brand); }
/* On her sign-up screen the name, heading and text buttons take the button pink. */
#app[data-theme="female"] .auth { --ink: var(--fill); --brand: var(--fill); --accent: var(--fill); color: var(--fill); }
.auth .tagline { color: var(--muted); margin-top: -6px; padding-bottom: 10px; }

/* Dialogs and the transient message. */
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 5; }
.dialog { width: 100%; background: var(--surface); border-radius: 24px; padding: 22px 20px 14px; display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-size: 21px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 4px; }
.toast { position: absolute; left: 16px; right: 16px; bottom: 92px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; z-index: 6; }

#app button:focus-visible, #app a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { #app, #app * { transition: none !important; } }
