:root {
  --bg: #F2F6F1;
  --bg-2: #E8F0E9;
  --surface: #FFFFFF;
  --ink: #17261E;
  --muted: #5B6C62;
  --line: #DDE6DE;
  --green: #2E7D5B;
  --green-2: #3F9A71;
  --green-soft: #DAEEE1;
  --plum: #7A4FA6;
  --plum-2: #9166BF;
  --plum-soft: #EEE4F7;
  --warm: #D9774B;
  --shadow: 0 1px 2px rgba(23,38,30,.06), 0 8px 24px rgba(23,38,30,.06);
  --radius: 22px;
  --serif: "Fraunces", ui-serif, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --on-accent: #FFFFFF;
  --tabbar: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1511; --bg-2: #121D17; --surface: #16221B; --ink: #E8F1EB; --muted: #9AAEA2; --line: #253329;
    --green: #5BBE8C; --green-2: #74D1A1; --green-soft: #1C3528; --plum: #B592DD; --plum-2: #C7A8EA; --plum-soft: #2B2238;
    --warm: #EE9B72; --on-accent: #0D1511; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1511; --bg-2: #121D17; --surface: #16221B; --ink: #E8F1EB; --muted: #9AAEA2; --line: #253329;
  --green: #5BBE8C; --green-2: #74D1A1; --green-soft: #1C3528; --plum: #B592DD; --plum-2: #C7A8EA; --plum-soft: #2B2238;
  --warm: #EE9B72; --on-accent: #0D1511; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.hidden { display: none !important; }

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 10px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 26px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 8px 0 0 var(--plum); margin-right: 10px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.icon-btn svg { width: 20px; height: 20px; }

main { padding: 4px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px); }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 8px 2px 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.sub { color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 14px; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--green); }
.tab.active svg { transform: translateY(-1px); }

/* Person rows on home */
.pair { display: grid; gap: 12px; }
.person { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: var(--green-soft);
}
.person.partner .avatar { background: var(--plum-soft); }
.person-name { font-weight: 700; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.person-name .when { font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

.gauge { margin-top: 8px; }
.gauge-track { position: relative; height: 12px; border-radius: 99px; background: linear-gradient(90deg, #6B3E97, #A889C9 30%, #C9D3CB 50%, #86C9A5 70%, #2E7D5B); }
.gauge-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--surface); opacity: .8; }
.gauge-pin {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: left .5s cubic-bezier(.2,.8,.2,1);
}
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fact { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--bg-2); color: var(--ink); }
.fact.green { background: var(--green-soft); }
.fact.plum { background: var(--plum-soft); }
.note { margin-top: 10px; font-size: 14px; color: var(--ink); background: var(--bg-2); padding: 10px 12px; border-radius: 14px; font-style: italic; }
.empty { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* Heart */
.heart-card { text-align: center; padding: 22px 18px 18px; background: linear-gradient(160deg, var(--green-soft), var(--plum-soft)); }
.heart-btn {
  width: 132px; height: 132px; border-radius: 50%; margin: 4px auto 12px; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--plum-2), var(--plum) 60%);
  color: #fff; box-shadow: 0 12px 30px color-mix(in srgb, var(--plum) 45%, transparent);
  transition: transform .15s ease;
  position: relative;
}
.heart-btn:active { transform: scale(.94); }
.heart-btn svg { width: 58px; height: 58px; }
.heart-btn .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--plum); opacity: 0; }
.heart-btn.pulse .ring { animation: ring 1s ease-out; }
@keyframes ring { from { transform: scale(1); opacity: .7; } to { transform: scale(1.6); opacity: 0; } }
.heart-title { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

.chip {
  padding: 9px 14px; border-radius: 99px; background: var(--surface); font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--line); transition: all .15s ease; user-select: none;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.chip.plum.on { background: var(--plum); border-color: var(--plum); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 15px 18px; border-radius: 16px; font-weight: 700; font-size: 16px;
  background: var(--green); color: var(--on-accent); transition: transform .1s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--bg-2); color: var(--ink); }
.btn.plum { background: var(--plum); }
.btn.small { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

/* Thermometer */
.thermo-wrap { display: grid; grid-template-columns: 1fr 86px 1fr; align-items: center; gap: 8px; padding: 6px 0; }
.thermo { position: relative; width: 86px; height: 280px; margin: 0 auto; touch-action: none; }
.thermo-tube {
  position: absolute; left: 50%; top: 0; width: 34px; height: 236px; transform: translateX(-50%);
  border-radius: 20px 20px 0 0; background: var(--bg-2); overflow: hidden; border: 3px solid var(--line); border-bottom: 0;
}
.thermo-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%;
  background: var(--thermo-color, var(--green)); transition: height .2s ease, background .2s ease;
}
.thermo-bulb {
  position: absolute; left: 50%; bottom: 0; width: 64px; height: 64px; transform: translateX(-50%);
  border-radius: 50%; background: var(--thermo-color, var(--green)); border: 3px solid var(--line);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; transition: background .2s ease;
}
.thermo-ticks { position: absolute; left: calc(50% + 24px); top: 6px; height: 224px; display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--muted); }
.thermo-side { text-align: center; }
.thermo-side .big { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1; }
.thermo-side .word { margin-top: 6px; font-weight: 600; color: var(--muted); font-size: 14px; }
.round { width: 54px; height: 54px; border-radius: 50%; background: var(--bg-2); font-size: 28px; font-weight: 700; display: grid; place-items: center; margin: 0 auto; }
.round:active { transform: scale(.94); }

.scale5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale5 button { padding: 10px 2px 8px; border-radius: 14px; background: var(--bg-2); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); border: 2px solid transparent; }
.scale5 button .e { font-size: 24px; }
.scale5 button.on { border-color: var(--green); background: var(--green-soft); color: var(--ink); }
.scale5.plum button.on { border-color: var(--plum); background: var(--plum-soft); }

.flames { display: flex; gap: 6px; justify-content: space-between; }
.flames button { flex: 1; height: 50px; border-radius: 14px; background: var(--bg-2); font-size: 22px; filter: grayscale(1); opacity: .5; transition: all .15s; }
.flames button.on { filter: none; opacity: 1; background: var(--plum-soft); }
.flame-label { text-align: center; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--plum); min-height: 20px; }

details.intim { border-radius: var(--radius); }
details.intim summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
details.intim summary::-webkit-details-marker { display: none; }
details.intim summary .chev { transition: transform .2s; color: var(--muted); }
details.intim[open] summary .chev { transform: rotate(180deg); }
details.intim .inner { margin-top: 14px; }

textarea, input[type=text], input[type=datetime-local] {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px 14px; outline: none; resize: none;
}
textarea:focus, input:focus { border-color: var(--green); }

/* Ideas */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg-2); padding: 4px; border-radius: 14px; margin-bottom: 14px; }
.seg button { padding: 9px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.idea { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.idea .em { width: 44px; height: 44px; border-radius: 14px; background: var(--bg-2); display: grid; place-items: center; font-size: 22px; }
.idea-title { font-weight: 700; }
.idea-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.votes { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.vote { padding: 7px 11px; border-radius: 10px; font-size: 13px; font-weight: 700; background: var(--bg-2); color: var(--muted); }
.vote.on.yes { background: var(--green); color: var(--on-accent); }
.vote.on.maybe { background: #C9A53C; color: #fff; }
.vote.on.no { background: #9A5B6A; color: #fff; }
.pvote { font-size: 12px; color: var(--muted); margin-left: auto; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.badge.match { background: var(--green); color: var(--on-accent); }
.badge.nogo { background: var(--bg-2); color: var(--muted); }
.idea.dim { opacity: .55; }
.idea-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.link { color: var(--green); font-weight: 700; font-size: 13px; }
.link.plum { color: var(--plum); }
.link.muted { color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggest .chip { font-weight: 500; font-size: 13px; padding: 7px 12px; }
.emoji-pick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; }
.emoji-pick button { font-size: 22px; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: var(--bg-2); }
.emoji-pick button.on { background: var(--green-soft); outline: 2px solid var(--green); }
.countdown { font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--green); }

/* Moments */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl li:last-child { border-bottom: 0; }
.tl .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: var(--bg-2); }
.tl .t { font-size: 14px; }
.tl .d { font-size: 12px; color: var(--muted); }

/* Sheets */
.scrim { position: fixed; inset: 0; background: rgba(10,20,14,.4); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-width: 520px; margin: 0 auto;
  background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); max-height: 88dvh; overflow-y: auto;
}
.sheet.open { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: 0 0 50px; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 30px; letter-spacing: .18em; font-weight: 700; text-align: center; padding: 14px; background: var(--bg-2); border-radius: 16px; margin: 10px 0; user-select: all; }
.steps { padding-left: 20px; margin: 6px 0; font-size: 14px; color: var(--muted); }
.steps li { margin: 4px 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); z-index: 80; transform: translate(-50%, -150%);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .3s cubic-bezier(.2,.8,.2,1); max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.love { background: #7A4FA6; color: #fff; }

.banner { font-size: 13px; background: var(--plum-soft); color: var(--ink); padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; }
.banner b { color: var(--plum); }

/* Onboarding */
.onb { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(env(safe-area-inset-top) + 24px) 22px calc(env(safe-area-inset-bottom) + 24px); max-width: 520px; margin: 0 auto; }
.onb-hero { text-align: center; margin-bottom: 26px; }
.onb-hero .logo { width: 108px; height: 108px; margin: 0 auto 18px; }
.onb-hero h1 { font-family: var(--serif); font-size: 40px; margin: 0; letter-spacing: -.02em; }
.onb-hero p { color: var(--muted); margin: 8px auto 0; max-width: 300px; }
.onb .stack { display: grid; gap: 10px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 2px 6px; display: block; }

.floating-plus { position: absolute; right: 0; top: 0; }
@media (min-width: 560px) { main { padding-left: 0; padding-right: 0; } }
