/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --fill: #f5f5f7;
  --fill-2: #ebebf0;
  --card: #ffffff;
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #a1a1a6;
  --sep: rgba(60, 60, 67, 0.14);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --indigo: #5856d6;
  --purple: #af52de;
  --teal: #30b0c7;
  --pink: #ff2d55;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--label);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--label); }
svg { display: block; }

/* ---------- Layout ---------- */
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(110px + var(--safe-b));
  min-height: 100vh;
}
.view.enter { animation: fadeUp .28s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.topbar .back { color: var(--blue); display: flex; align-items: center; gap: 2px; font-size: 17px; margin-left: -6px; }
.topbar .back svg { width: 24px; height: 24px; stroke: var(--blue); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.topbar .action { color: var(--blue); font-size: 17px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin: 4px 0 18px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 4px 10px; }
.section-title h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.section-title button { color: var(--blue); font-size: 15px; }
.muted { color: var(--label-2); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Cards & lists ---------- */
.card { background: var(--fill); border-radius: var(--radius); padding: 16px; }
.card.white { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--sep); }
.hero {
  border-radius: 24px; padding: 20px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #5e5ce6 0%, #007aff 55%, #34aadc 100%);
  box-shadow: 0 12px 30px rgba(0, 122, 255, .25);
  position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero .label { font-size: 15px; opacity: .85; font-weight: 500; }
.hero .big { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 14px; opacity: .85; }
.hero-row { display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.hero-chip { flex: 1; background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(10px); }
.hero-chip b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.hero-chip span { font-size: 12px; opacity: .85; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--fill); border-radius: var(--radius); padding: 14px; }
.stat .k { font-size: 13px; color: var(--label-2); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v.green { color: var(--green); } .stat .v.red { color: var(--red); } .stat .v.blue { color: var(--blue); }

.list { background: var(--fill); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left;
  position: relative; min-height: 56px;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 64px; height: 1px; background: var(--sep); }
.list.plain .row + .row::before { left: 14px; }
.row:active { background: var(--fill-2); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .subtitle { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row .trail { text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.row .trail .amt { font-weight: 600; font-size: 16px; }
.row .trail .meta { font-size: 12px; color: var(--label-2); }
.chev { width: 8px; height: 14px; stroke: var(--label-3); fill: none; stroke-width: 2; flex-shrink: 0; }
.in { color: var(--green); } .out { color: var(--blue); } .neg { color: var(--red); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .02em;
}
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.icon-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; background: #fff; }

/* ---------- Pills, chips, segmented ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--fill-2); color: var(--label-2); }
.pill.green { background: rgba(52,199,89,.14); color: #1f8f3f; }
.pill.red { background: rgba(255,59,48,.12); color: #c9271e; }
.pill.blue { background: rgba(0,122,255,.12); color: #0062cc; }
.pill.orange { background: rgba(255,149,0,.14); color: #b86a00; }
.pill.indigo { background: rgba(88,86,214,.13); color: #4341b8; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 500; padding: 7px 11px; border-radius: 999px; background: var(--fill-2); color: var(--label); border: 1px solid transparent; transition: all .15s; }
.chip.on.pos { background: rgba(52,199,89,.14); color: #1f8f3f; border-color: rgba(52,199,89,.35); }
.chip.on.neg { background: rgba(255,59,48,.10); color: #c9271e; border-color: rgba(255,59,48,.3); }
.chip.on.neu { background: rgba(0,122,255,.10); color: #0062cc; border-color: rgba(0,122,255,.3); }

.segmented { display: flex; background: var(--fill-2); border-radius: 10px; padding: 2px; }
.segmented button { flex: 1; padding: 7px 6px; font-size: 13px; font-weight: 500; border-radius: 8px; transition: all .2s; white-space: nowrap; }
.segmented button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 600; background: var(--blue); color: #fff; width: 100%; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); opacity: .9; }
.btn.secondary { background: var(--fill); color: var(--blue); }
.btn.danger { background: rgba(255,59,48,.1); color: var(--red); }
.btn.sm { height: 36px; font-size: 15px; padding: 0 14px; border-radius: 10px; width: auto; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.link { color: var(--blue); font-weight: 500; }

/* ---------- Search / inputs ---------- */
.search { display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 12px; padding: 0 10px; height: 38px; margin-bottom: 14px; }
.search svg { width: 17px; height: 17px; stroke: var(--label-3); fill: none; stroke-width: 2.2; }
.search input { border: 0; background: none; outline: none; flex: 1; height: 100%; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--label-2); margin: 0 4px 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid transparent; background: var(--fill); border-radius: 12px; padding: 12px 14px; outline: none; transition: border .15s, background .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(0,122,255,.5); background: #fff; }
.textarea { resize: none; min-height: 110px; line-height: 1.4; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238e8e93' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }

/* Settings-style grouped form rows */
.form-list { background: var(--fill); border-radius: var(--radius); overflow: hidden; }
.form-row { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 50px; position: relative; }
.form-row + .form-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: 1px; background: var(--sep); }
.form-row label { flex-shrink: 0; font-size: 16px; }
.form-row input, .form-row select { flex: 1; min-width: 0; border: 0; background: none; outline: none; text-align: right; height: 48px; color: var(--label-2); }
.form-row select { appearance: none; -webkit-appearance: none; direction: rtl; }
.form-row button.row-btn { width: 100%; text-align: left; height: 50px; color: var(--blue); }
.form-row button.row-btn.red { color: var(--red); }
.footnote { font-size: 13px; color: var(--label-2); margin: 8px 16px 0; line-height: 1.4; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: flex-start;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--label-3); font-size: 10px; font-weight: 500; padding-top: 2px; max-width: 90px; }
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--blue); }
.tab.on svg { stroke-width: 2.2; }
.tab-add { padding-top: 0; }
.add-circle {
  width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; margin-top: -4px;
  background: linear-gradient(145deg, #3a8bff, #5856d6); box-shadow: 0 6px 16px rgba(0,122,255,.35);
  transition: transform .15s;
}
.add-circle svg { width: 24px; height: 24px; stroke: #fff; stroke-width: 2.6; }
.tab-add:active .add-circle { transform: scale(.92); }

/* ---------- Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 40; opacity: 0; transition: opacity .3s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; margin: 0 auto; max-width: 640px;
  background: #fff; border-radius: 22px 22px 0 0; max-height: 92vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .38s cubic-bezier(.2,.9,.25,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,.12);
}
.sheet.show { transform: none; }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 8px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 6px; flex-shrink: 0; }
.sheet-head h3 { font-size: 17px; font-weight: 600; margin: 0; }
.sheet-head button { color: var(--blue); font-size: 17px; min-width: 60px; }
.sheet-head button.primary { font-weight: 600; text-align: right; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(24px + var(--safe-b)); -webkit-overflow-scrolling: touch; }

/* ---------- Composer (log sheet) ---------- */
.mic-wrap { display: flex; flex-direction: column; align-items: center; padding: 10px 0 6px; }
.mic {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: linear-gradient(145deg, #ff5e57, #ff2d55); box-shadow: 0 10px 26px rgba(255,45,85,.35); transition: transform .15s;
}
.mic svg { width: 34px; height: 34px; fill: #fff; }
.mic:active { transform: scale(.94); }
.mic.rec::before, .mic.rec::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,45,85,.5); animation: ring 1.6s ease-out infinite; }
.mic.rec::after { animation-delay: .8s; }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.mic.busy { background: linear-gradient(145deg, #8e8e93, #636366); box-shadow: none; }
.mic-label { font-size: 13px; color: var(--label-2); margin-top: 10px; font-variant-numeric: tabular-nums; min-height: 18px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--label-3); font-size: 12px; margin: 10px 0; text-transform: uppercase; letter-spacing: .06em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
.examples { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 4px; padding: 0 16px 4px; scrollbar-width: none; }
.examples::-webkit-scrollbar { display: none; }
.example { flex-shrink: 0; max-width: 240px; font-size: 13px; text-align: left; background: var(--fill); border-radius: 12px; padding: 9px 11px; color: var(--label-2); line-height: 1.35; }

.draft { background: var(--fill); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; position: relative; }
.draft-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.draft-head input { flex: 1; font-weight: 600; font-size: 17px; background: none; border: 0; outline: none; padding: 4px 0; min-width: 0; }
.draft-remove { width: 30px; height: 30px; border-radius: 50%; background: var(--fill-2); display: grid; place-items: center; flex-shrink: 0; }
.draft-remove svg { width: 12px; height: 12px; stroke: var(--label-2); stroke-width: 2.6; }
.draft .input, .draft .select, .draft .textarea { background: #fff; }
.new-badge { font-size: 11px; }

/* ---------- Person detail ---------- */
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 4px 0 18px; }
.profile h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 4px; }
.score-card { display: flex; align-items: center; gap: 16px; }
.score-card .ring-wrap { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.score-card .ring-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.score-card .ring-num b { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; display: block; line-height: 1; }
.score-card .ring-num span { font-size: 11px; color: var(--label-2); font-weight: 500; }
.meter { margin: 10px 0; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter-top b { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-bar { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

.trait { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 15px; }
.trait + .trait { border-top: 1px solid var(--sep); }
.idea { background: #fff; border-radius: 14px; padding: 12px 14px; margin-top: 8px; border: 1px solid var(--sep); }
.idea b { display: block; font-size: 15px; }
.idea span { font-size: 13px; color: var(--label-2); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--label-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rank-no { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--fill-2); color: var(--label-2); font-variant-numeric: tabular-nums; }
.rank-no.top { background: linear-gradient(145deg, #3a8bff, #5856d6); color: #fff; }
.rank-track, .kind-track { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; margin-top: 7px; }
.rank-track i, .kind-track i { display: block; height: 100%; border-radius: 3px; }
.kind-track i { background: linear-gradient(90deg, #ff2d55, #ff9500); }
.rank-score { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.rank-row .trail { min-width: 44px; }
.give-head { display: flex; align-items: center; gap: 12px; margin: 0 4px 16px; }
.give-head b { font-size: 17px; }
.topbar-icons { display: flex; gap: 6px; }
.avatar.md { width: 62px; height: 62px; font-size: 22px; }
.rank-by { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.rank-by::-webkit-scrollbar { display: none; }
.rank-by .chip { white-space: nowrap; flex-shrink: 0; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 8px 0 14px; }
.podium-spot { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.podium-spot b { font-size: 15px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-medal { font-size: 24px; line-height: 1; }
.podium-score { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.podium-block { display: block; width: 100%; border-radius: 14px 14px 6px 6px; margin-top: 6px; background: linear-gradient(180deg, rgba(0,122,255,.16), rgba(0,122,255,.04)); }
.podium-spot.p1 .podium-block { height: 64px; background: linear-gradient(180deg, rgba(255,204,0,.35), rgba(255,204,0,.06)); }
.podium-spot.p2 .podium-block { height: 42px; background: linear-gradient(180deg, rgba(142,142,147,.3), rgba(142,142,147,.05)); }
.podium-spot.p3 .podium-block { height: 28px; background: linear-gradient(180deg, rgba(255,149,0,.28), rgba(255,149,0,.05)); }
.rank-summary { margin-bottom: 4px; }
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-card { background: var(--fill); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 16px; }
.rank-card.open { background: var(--card); border: 1px solid var(--sep); box-shadow: var(--shadow); }
.rank-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; }
.rank-head .body { flex: 1; min-width: 0; }
.rank-head .title { font-size: 16px; font-weight: 600; }
.rank-head .subtitle { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-head .trail { text-align: right; min-width: 44px; }
.rank-head .meta { font-size: 12px; color: var(--label-2); }
.rank-chev svg { width: 8px; height: 14px; stroke: var(--label-3); fill: none; stroke-width: 2; transition: transform .2s; }
.rank-card.open .rank-chev svg { transform: rotate(90deg); }
.rank-detail { padding: 0 14px 14px; }
.rank-detail .avail { margin-top: 0; }
.rank-detail .card { background: var(--fill); }
.rank-acts { margin-top: 14px; }
.card.tappable { cursor: pointer; transition: background .15s, box-shadow .15s; }
.card.tappable:hover { box-shadow: 0 0 0 2px rgba(0,122,255,.18); }
.card.tappable:active { background: var(--fill-2); }
.tap-hint { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--blue); text-align: right; }
.detail .tag-group { margin-top: 18px; }
.detail .list .row .title { white-space: normal; }
.detail-bits { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--label-2); }
.zone-head { display: flex; gap: 12px; align-items: flex-start; margin: 18px 4px 8px; padding-left: 10px; border-left: 4px solid var(--c); }
.zone-head > span { font-size: 26px; line-height: 1.1; }
.zone-head b { font-size: 16px; }
.heatmap.big th { vertical-align: bottom; }
.heatmap.big th small { display: block; font-size: 10.5px; color: var(--label-2); font-weight: 500; margin-top: 2px; white-space: nowrap; }
.heatmap.big .hm-all { font-size: 11px; color: var(--label-2); font-weight: 600; }
.heatmap.big .hm-cell { min-width: 38px; padding: 8px 0; font-size: 13px; }
.hm-name button { font: inherit; font-weight: 600; color: var(--blue); text-align: left; }
.dim-row { padding: 10px 0; }
.dim-row + .dim-row { border-top: 1px solid var(--sep); }
.dim-row-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 15px; }
.dim-row-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.month-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.month-table th { font-size: 12px; font-weight: 600; color: var(--label-2); text-align: right; padding: 10px 12px 8px; }
.month-table td { text-align: right; padding: 9px 12px; border-top: 1px solid var(--sep); white-space: nowrap; }
.month-table th:first-child, .month-table td:first-child { text-align: left; }
.month-table tr.muted td { color: var(--label-3); }
.month-table tfoot td { font-weight: 700; }
.month-table .green { color: var(--green); } .month-table .blue { color: var(--blue); }
.detail .card.flush { overflow-x: auto; }
@media (max-width: 480px) {
  .month-table { font-size: 13px; }
  .month-table th, .month-table td { padding: 8px 6px; }
  .month-table th:first-child, .month-table td:first-child { padding-left: 12px; }
}
.stance-card { background: linear-gradient(135deg, rgba(88,86,214,.08), rgba(0,122,255,.06)); border: 1px solid rgba(88,86,214,.18); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
.stance-card .pill { margin-top: 8px; }
.stance-card p { margin: 8px 0 0; font-size: 15px; line-height: 1.45; }
.stance-top { display: flex; justify-content: space-between; align-items: center; }
.axes .axis { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; position: relative; }
.axes .axis + .axis::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; height: 1px; background: var(--sep); }
.axes .axis:active { background: var(--fill-2); }
.axis-val { display: inline-flex; align-items: baseline; gap: 6px; }
.axis-word { font-size: 12px; color: var(--label-2); font-weight: 500; }
.axis-src { font-size: 11px; letter-spacing: 1px; }
.axis-access { font-size: 13px; color: #4341b8; }
.axis-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.axis-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--fill-2); }
.axis-dots i.on { background: #5856d6; }
.access-opt.on { background: rgba(88,86,214,.08); }
.access-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); font-weight: 700; flex-shrink: 0; }
.access-opt.on .access-no { background: #5856d6; color: #fff; }
.access-opt .tick { color: #5856d6; }
.matrix th button { display: flex; flex-direction: column; align-items: center; width: 100%; font-size: 16px; padding: 2px 0 4px; border-radius: 8px; }
.matrix th button.on { background: rgba(0,122,255,.1); }
.matrix th button.on small { color: var(--blue); }
.hm-cell.empty { background: transparent !important; color: var(--label-3); }
.home-rank-by { margin-bottom: 6px; }
.op-card { padding: 12px 14px; }
.op-card .op-head { display: flex; align-items: center; gap: 10px; }
.op-card .op-head b { flex: 1; font-size: 15px; }
.op-icon { width: 32px; height: 32px; border-radius: 10px; background: rgba(0,122,255,.1); display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.op-lines { margin: 8px 0 0 42px; font-size: 14px; color: var(--label-2); line-height: 1.45; }
.op-card.danger { border-color: rgba(255,59,48,.35); background: rgba(255,59,48,.04); }
.op-card.danger .op-icon { background: rgba(255,59,48,.12); }
.op-card.off { opacity: .55; }
.op-why { margin: 8px 0 0 42px; font-size: 13px; color: #b86a00; }
.answer-q { font-weight: 600; margin-bottom: 6px; }
.answer-a { font-size: 15px; line-height: 1.45; }
.answer-a + .answer-q { margin-top: 14px; }
.principles { background: linear-gradient(135deg, rgba(52,199,89,.08), rgba(0,122,255,.06)); border: 1px solid rgba(52,199,89,.2); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 6px; }
.principles ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.principles li { font-size: 15px; font-weight: 500; padding-left: 20px; position: relative; }
.principles li::before { content: "◆"; position: absolute; left: 2px; font-size: 9px; top: 5px; color: var(--green); }
@media (min-width: 900px) { .principles ul { grid-template-columns: 1fr 1fr; } }
.signin-hero { text-align: center; margin: 6px 0 18px; }
.signin-lock { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 10px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(145deg, #3a8bff, #5856d6); box-shadow: 0 10px 24px rgba(0,122,255,.3); }
.signin-hero h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; }
.ledger-item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--sep); text-align: left; font-size: 14px; }
.ledger-item b.green { color: var(--green); } .ledger-item b.blue { color: var(--blue); }
.hbar { display: grid; grid-template-columns: 104px 1fr 36px; align-items: center; gap: 10px; margin: 9px 0; font-size: 14px; }
.hbar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.hbar .track { height: 12px; border-radius: 6px; background: var(--fill-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 6px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.dbar { display: grid; grid-template-columns: 1fr 80px 1fr; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
.dbar .l, .dbar .r { height: 12px; display: flex; }
.dbar .l { justify-content: flex-end; }
.dbar .l i, .dbar .r i { display: block; height: 100%; border-radius: 6px; min-width: 2px; }
.dbar .name { text-align: center; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 36px 20px; }
.empty .emoji { font-size: 48px; }
.empty h3 { font-size: 20px; margin: 10px 0 6px; }
.empty p { color: var(--label-2); font-size: 15px; margin: 0 0 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 60;
  background: rgba(29,29,31,.92); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .3s cubic-bezier(.2,.8,.2,1); max-width: calc(100% - 32px); text-align: center;
  backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Spinner ---------- */
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,.12); border-top-color: var(--label-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 100; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.lock[hidden] { display: none; }
.lock h2 { font-size: 20px; font-weight: 600; margin: 14px 0 22px; }
.dots { display: flex; gap: 18px; margin-bottom: 36px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--label); transition: background .15s; }
.dots i.on { background: var(--label); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; }
.key { width: 76px; height: 76px; border-radius: 50%; background: var(--fill); font-size: 30px; font-weight: 400; display: grid; place-items: center; }
.key:active { background: var(--fill-2); }
.key.ghost { background: none; font-size: 16px; color: var(--blue); }

@media (min-width: 700px) {
  .view { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Relationship profile ---------- */
.avail {
  border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--c) 10%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.avail-head { display: flex; align-items: center; gap: 12px; }
.avail-head b { font-size: 19px; letter-spacing: -0.01em; display: block; margin-top: 1px; }
.avail-emoji { font-size: 34px; line-height: 1; }
.avail p { margin: 10px 0 0; font-size: 15px; line-height: 1.45; color: var(--label); }
.tips { margin: 10px 0 0; padding: 0; list-style: none; }
.tips li { position: relative; padding: 6px 0 6px 22px; font-size: 14px; line-height: 1.4; border-top: 1px solid var(--sep); }
.tips li::before { content: "→"; position: absolute; left: 2px; color: var(--label-2); }
.tag-group { font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .03em; margin: 14px 2px 8px; }
.tag-group:first-child { margin-top: 2px; }
.item-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.item-row + .item-row { border-top: 1px solid var(--sep); }
.item-row .txt { flex: 1; font-size: 15px; line-height: 1.35; }
.item-row .pill { flex-shrink: 0; min-width: 62px; justify-content: center; }
.rm { width: 24px; height: 24px; border-radius: 50%; background: var(--fill-2); display: grid; place-items: center; flex-shrink: 0; }
.rm svg { width: 9px; height: 9px; stroke: var(--label-2); stroke-width: 2.6; }
.chip.like { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,45,85,.08); color: #c41e45; padding-right: 5px; }
.chip.like .rm { width: 18px; height: 18px; background: rgba(255,45,85,.12); }
.chip.like .rm svg { width: 7px; height: 7px; stroke: #c41e45; }
.chip.add { background: none; border: 1px dashed var(--label-3); color: var(--blue); }
.segmented.sev button.on.sev1 { color: var(--label); }
.segmented.sev button.on.sev2 { color: #b86a00; }
.segmented.sev button.on.sev3 { color: #c9271e; }
.section-title > span { font-size: 13px; }

/* ---------- Quick actions (like iOS Contacts) ---------- */
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; margin-top: 16px; }
.quick { background: var(--fill); border-radius: 14px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--blue); }
.quick span { font-size: 20px; line-height: 1.1; }
.quick:active { background: var(--fill-2); }
.mixed { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sep); font-size: 14px; line-height: 1.4; }
.love-dot { font-size: 14px; flex-shrink: 0; }
.forgive { width: 28px; height: 28px; border-radius: 50%; background: var(--fill-2); font-size: 14px; display: grid; place-items: center; flex-shrink: 0; }
.chip.forgiven { background: rgba(0,122,255,.07); color: var(--label-2); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

/* ---------- Ask ---------- */
.ask-entry {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 13px 14px;
  background: var(--fill); border-radius: 14px; color: var(--label-2); font-size: 15px; text-align: left;
}
.ask-entry span:nth-child(2) { flex: 1; }
.ask-entry .spark { font-size: 18px; }
.ask-intro { font-size: 15px; color: var(--label-2); margin: 4px 2px 12px; line-height: 1.4; }
.ask-suggest { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ask-suggest .example { max-width: 100%; font-size: 14px; color: var(--blue); background: rgba(0,122,255,.07); }
.bubble { max-width: 88%; padding: 10px 13px; border-radius: 18px; margin: 8px 0; font-size: 15px; line-height: 1.42; }
.bubble.me { margin-left: auto; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble.ai { background: var(--fill); border-bottom-left-radius: 6px; }
.bubble.ai p { margin: 0 0 6px; } .bubble.ai p:last-child { margin: 0; }
.bubble.ai ul { margin: 4px 0; padding-left: 18px; } .bubble.ai li { margin: 3px 0; }
.bubble.thinking { display: inline-flex; padding: 12px 16px; }
.ask-bar { position: sticky; bottom: calc(-24px - var(--safe-b)); display: flex; align-items: flex-end; gap: 8px; background: #fff; padding: 10px 0 calc(10px + var(--safe-b)); margin-top: 10px; }
.ask-bar .textarea { min-height: 44px; max-height: 120px; padding: 11px 14px; border-radius: 22px; }
.ask-mic, .ask-send { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.ask-mic { background: var(--fill); }
.ask-mic svg { width: 22px; height: 22px; fill: var(--label-2); }
.ask-mic svg path { stroke: var(--label-2); }
.ask-mic.rec { background: #ff2d55; }
.ask-mic.rec svg { fill: #fff; }
.ask-send { background: var(--blue); }
.ask-send svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sheet.tall { height: 90vh; }
.sheet.tall .sheet-body { flex: 1; display: flex; flex-direction: column; padding-bottom: 0; }
.sheet.tall #askLog { flex: 1; }
.sheet.tall .ask-bar { bottom: 0; }

/* =================================================================== v2 */
.lead { font-size: 15px; color: var(--label-2); margin: -8px 4px 16px; line-height: 1.45; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--label-2); stroke-width: 1.8; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: relative; z-index: 1; }
.hero-grid .big { font-size: 30px; }
.hero-grid .sub { font-size: 12px; }
.hero-chip { color: #fff; text-align: left; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card.warn { background: rgba(255,149,0,.08); border: 1px solid rgba(255,149,0,.25); }
.nudge { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--fill); }
.nudge > span { font-size: 22px; }
.nudge > div { flex: 1; }
.nudge b { font-size: 15px; }

/* Dimensions */
.dims .dim { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; position: relative; }
.dims .dim + .dim::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; height: 1px; background: var(--sep); }
.dims button.dim:active { background: var(--fill-2); }
.dim-emoji { font-size: 22px; width: 26px; text-align: center; flex-shrink: 0; }
.dim-body { flex: 1; min-width: 0; }
.dim-top { display: flex; justify-content: space-between; font-size: 15px; font-weight: 500; margin-bottom: 5px; }
.dim-top b { font-variant-numeric: tabular-nums; }
.dim-meta { font-size: 12px; color: var(--label-2); margin-top: 4px; }
.meter-bar { position: relative; }
.meter-bar u { position: absolute; top: -3px; width: 3px; height: 14px; border-radius: 2px; background: var(--label); transform: translateX(-1px); }
.dim-hero { display: flex; align-items: center; gap: 14px; margin: 4px 0; }
.dim-hero > span { font-size: 40px; }
.dim-hero b { font-size: 34px; letter-spacing: -.02em; }
.impact { width: 44px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.impact.pos { background: rgba(52,199,89,.14); color: #1f8f3f; }
.impact.neg { background: rgba(255,59,48,.12); color: #c9271e; }
.rating-row { display: flex; align-items: center; gap: 12px; }
.rating-row input[type=range] { flex: 1; accent-color: var(--blue); }
.rating-val { min-width: 34px; text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }

/* Promises and Mirror rows */
.promise { padding: 12px 14px; position: relative; }
.promise + .promise::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: 1px; background: var(--sep); }
.promise-main { display: block; width: 100%; text-align: left; }
.promise-main .title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.promise-main .subtitle { font-size: 13px; color: var(--label-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.promise-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.promise-acts button { font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--sep); color: var(--blue); }
.promise-acts button:active { background: var(--fill-2); }
.sev-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.sev-dot.s2 { background: var(--orange); }
.sev-dot.s3 { background: var(--red); }
.review-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(88,86,214,.10), rgba(0,122,255,.08)); }
.review-step { background: var(--fill); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.review-step > b { display: block; margin-bottom: 8px; font-size: 15px; }
.review-step .textarea, .review-step .input { background: #fff; }
.review-step .textarea { min-height: 70px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 15px; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex-shrink: 0; }

/* Heatmap */
.hm-wrap { overflow-x: auto; margin: 0 -4px; }
.heatmap { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: 13px; }
.heatmap th { font-size: 16px; font-weight: 400; }
.heatmap td { text-align: center; }
.hm-name { text-align: left !important; font-weight: 500; white-space: nowrap; max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
.hm-cell { display: block; min-width: 30px; padding: 6px 0; border-radius: 8px; color: #fff; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.hbar { width: 100%; text-align: left; }

/* Composer */
.textarea.big { min-height: 150px; }
.compose-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.compose-tools .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.manual-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.review-h { font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .03em; margin: 18px 4px 8px; }
.review-h span { background: var(--fill-2); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.card-kind { font-size: 11px; font-weight: 600; color: var(--label-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.card-kind .pill { text-transform: none; letter-spacing: 0; }
.draft.self { background: linear-gradient(135deg, rgba(88,86,214,.07), rgba(0,122,255,.05)); }
.draft .segmented { background: rgba(0,0,0,.06); }
details.raw { margin-top: 14px; font-size: 14px; color: var(--label-2); }
details.raw summary { cursor: pointer; color: var(--blue); }
details.raw p { white-space: pre-wrap; background: var(--fill); padding: 10px 12px; border-radius: 12px; }

/* Profile and photos */
.details { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin-top: 6px; color: var(--label-2); }
.details span { color: var(--label-3); }
.avatar-btn { border-radius: 50%; }
.photo-pick { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.photo-btn { width: 72px; height: 72px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.photo-btn.sm { width: 40px; height: 40px; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; }
.photo-btn svg { width: 26px; height: 26px; fill: none; stroke: var(--label-3); stroke-width: 1.7; }
.photo-btn.sm svg { width: 20px; height: 20px; }
.link.red { color: var(--red); }
.me-row { gap: 12px; }

/* Sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 900px) {
  .tabbar, .mobile-only { display: none !important; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 248px; padding: 22px 14px;
    border-right: 1px solid var(--sep); background: rgba(250,250,252,.92); backdrop-filter: blur(20px); z-index: 20;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.01em; padding: 0 8px 18px; }
  .brand img { width: 32px; height: 32px; border-radius: 8px; }
  .side-log { height: 42px; font-size: 15px; border-radius: 12px; }
  .side-ask { margin: 10px 0 16px; padding: 10px 12px; border-radius: 12px; background: var(--fill); color: var(--label-2); text-align: left; font-size: 14px; }
  .side-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 10px; font-size: 15px; font-weight: 500; color: var(--label); }
  .side-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .side-item:hover { background: var(--fill); }
  .side-item.on { background: rgba(0,122,255,.1); color: var(--blue); }
  .side-foot { margin-top: auto; font-size: 12px; color: var(--label-3); padding: 0 10px; }
  .view { margin-left: 248px; max-width: 1080px; padding: 34px 40px 60px; }
  .grid4 { grid-template-columns: repeat(4, 1fr); }
  .person-layout, .insight-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .people-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .rank-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .podium { max-width: 560px; margin-left: auto; margin-right: auto; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .people-grid .row + .row::before { display: none; }
  .people-grid .row { border-bottom: 1px solid var(--sep); }
  .toast { bottom: 32px; left: calc(50% + 124px); }
  /* Sheets become centered dialogs */
  .sheet { top: 50%; bottom: auto; left: 50%; right: auto; width: 600px; max-width: calc(100vw - 48px); max-height: 86vh;
    border-radius: 20px; transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .28s cubic-bezier(.2,.9,.25,1), opacity .2s; }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.tall { height: 86vh; }
  .sheet .grabber { display: none; }
}
@media (min-width: 1280px) {
  .view { max-width: 1180px; }
}

/* =====================================================================
   Apple-style polish and motion layer
   Springy easing, content rising in per screen, sections revealing on
   scroll, growing bars, a living hero, glassy bars and press feedback.
   (Reduced-motion users get none of the movement: see the rule above.)
   ===================================================================== */
:root {
  --ease: cubic-bezier(.16, 1, .3, 1);       /* Apple-like "expo out" */
  --spring: cubic-bezier(.32, .72, 0, 1);    /* iOS sheet spring */
  --shadow-lift: 0 2px 6px rgba(0,0,0,.04), 0 16px 40px rgba(0,0,0,.10);
}
html { scroll-behavior: smooth; }
::selection { background: rgba(0,122,255,.18); }
:focus-visible { outline: 3px solid rgba(0,122,255,.45); outline-offset: 2px; border-radius: 10px; }
.large-title, .profile h1, .section-title h2, .hero .big { font-family: "SF Pro Display", var(--font); }
.large-title { letter-spacing: -0.035em; }

/* New screen: each block rises in, one after another */
.view.enter { animation: none; }
.view.enter > * { animation: rise .7s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.995); } to { opacity: 1; transform: none; } }

/* Below the fold: reveal when scrolled into view */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* Bars and meters grow from the left */
.view.enter .meter-bar i, .view.enter .rank-track i, .view.enter .kind-track i, .view.enter .hbar .track i, .rv.in .meter-bar i, .rv.in .rank-track i, .rv.in .kind-track i {
  transform-origin: left center; animation: growX 1.1s var(--ease) both; animation-delay: calc(var(--d, 0ms) + 180ms);
}
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.view.enter .hm-cell { animation: pop .6s var(--ease) both; animation-delay: calc(var(--d, 0ms) + 120ms); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

/* The hero: a slowly drifting gradient with a soft sheen */
.hero { background-size: 160% 160%; animation: heroDrift 16s ease-in-out infinite alternate; }
.view.enter .hero { animation: rise .7s var(--ease) both, heroDrift 16s ease-in-out .7s infinite alternate; }
@keyframes heroDrift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
.hero::before { content: ""; position: absolute; inset: -60% -20%; background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.16) 50%, transparent 60%); transform: translateX(-60%); animation: sheen 7s ease-in-out 1.2s infinite; pointer-events: none; }
@keyframes sheen { 0%, 70% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
.hero-chip { transition: transform .35s var(--ease), background .25s; }
.hero-chip:hover { background: rgba(255,255,255,.24); }

/* Press and hover feedback */
.btn, .chip, .quick, .hero-chip, .podium-spot, .nudge, .ask-entry, .card.tappable, .stat, .rank-card, .icon-btn, .side-log { transition: transform .35s var(--ease), box-shadow .35s var(--ease), background-color .25s, opacity .2s; }
.btn:active, .chip:active, .quick:active, .hero-chip:active, .podium-spot:active, .nudge:active, .ask-entry:active, .card.tappable:active, .icon-btn:active { transform: scale(.97); }
.row, .rank-head, .axis, .dims .dim, .ledger-item, .side-item { transition: background-color .2s; }
@media (hover: hover) and (pointer: fine) {
  .list .row:hover, .rank-head:hover, .axes .axis:hover, .dims button.dim:hover, .promise-main:hover { background-color: rgba(0,0,0,.028); }
  .card.tappable:hover, .nudge:hover, .ask-entry:hover, .stat:hover, .rank-card:not(.open):hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
  .podium-spot:hover { transform: translateY(-4px); }
  .btn:hover { filter: brightness(1.06); }
  .chip:hover { background-color: var(--fill); }
}

/* Compact title bar that appears once the large title scrolls away */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25; height: calc(46px + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid transparent; opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .4s var(--ease), border-color .3s;
}
body.scrolled .navbar { opacity: 1; transform: none; border-bottom-color: var(--sep); }
.navbar span { max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Glass bars, springy sheets, softer toast */
.tabbar { background: rgba(255,255,255,.72); }
.tab { transition: color .25s; }
.tab.on svg { animation: tabPop .45s var(--ease); }
@keyframes tabPop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.sheet { transition: transform .55s var(--spring), opacity .35s; }
.backdrop { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); transition: opacity .4s var(--ease); }
.toast { transition: opacity .35s var(--ease), transform .5s var(--spring); }
.sheet-body > * { animation: rise .55s var(--ease) both; }
.sheet-body > *:nth-child(2) { animation-delay: 40ms; } .sheet-body > *:nth-child(3) { animation-delay: 80ms; } .sheet-body > *:nth-child(n+4) { animation-delay: 120ms; }
.draft, .op-card { animation: rise .5s var(--ease) both; }

/* Cards: a touch more depth when open or white */
.rank-card.open, .card.white { box-shadow: var(--shadow-lift); }
.avatar { transition: transform .4s var(--ease); }
.profile .avatar-btn:hover .avatar { transform: scale(1.04); }

/* Desktop: bigger, Apple-website type and a slim scrollbar */
@media (min-width: 900px) {
  .navbar { left: 248px; }
  .large-title { font-size: 44px; margin: 6px 0 22px; }
  .section-title h2 { font-size: 24px; }
  .hero { padding: 26px 28px; border-radius: 28px; }
  .hero .big { font-size: 52px; }
  .sheet { transition: transform .45s var(--spring), opacity .3s var(--ease); }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,.26); }
}
