/* Repli. Soft gray ground, white cards, one action per screen. Words are the exception, not the layout. */
:root {
  --ground: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #aeaeb2;
  --line: rgb(0 0 0 / 0.08);
  --fill: rgb(0 0 0 / 0.05);
  --up: #248a3d;
  --down: #c93400;
  --series: #2a78d6;
  --series-warm: #eb6834;
  --glass: rgb(255 255 255 / 0.72);
  --lift: 0 1px 2px rgb(0 0 0 / 0.03), 0 8px 28px rgb(0 0 0 / 0.04);
  --ease: cubic-bezier(0.25, 0.9, 0.3, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #000000;
    --card: #1c1c1e;
    --ink: #f5f5f7;
    --ink-2: #98989d;
    --ink-3: #636366;
    --line: rgb(255 255 255 / 0.1);
    --fill: rgb(255 255 255 / 0.09);
    --up: #30d158;
    --down: #ff9f0a;
    --series: #3987e5;
    --series-warm: #d95926;
    --glass: rgb(44 44 46 / 0.72);
    --lift: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; color: var(--ink); font: 17px/1.4 var(--font); letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 620px; margin: 0 auto; padding: 18px 20px 0; min-height: 56px; }
.logo { width: 24px; height: 24px; flex: none; margin-right: 4px; }
.mark { display: inline-flex; align-items: center; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.demo-link { font-size: 14px; color: var(--ink-2); }
.demo-link b { color: var(--ink); font-weight: 500; }

.page { max-width: 620px; margin: 0 auto; padding: 16px 20px 132px; }
.page > * { animation: rise 0.22s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 20px; }
h2 { font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin: 32px 0 12px; }
.card { background: var(--card); border-radius: 24px; box-shadow: var(--lift); }

/* Tab bar */
.tabs { position: fixed; z-index: 10; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 2px; padding: 6px; border-radius: 30px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); box-shadow: 0 8px 32px rgb(0 0 0 / 0.12), inset 0 0 0 0.5px var(--line); }
.tabs button { width: clamp(58px, 21vw, 76px); padding: 7px 0 5px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); transition: background-color 0.12s, color 0.12s, transform 0.12s var(--ease); }
.tabs button:active { transform: scale(0.94); }
.tabs button[aria-current="page"] { color: var(--ink); background: var(--fill); }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.primary { display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 28px; border-radius: 27px; background: var(--ink); color: var(--ground); font-size: 17px; font-weight: 600; width: 100%; transition: transform 0.12s var(--ease), opacity 0.12s; }
.primary:hover { opacity: 0.88; }
.primary:active { transform: scale(0.98); }
.primary:disabled { opacity: 0.35; }
.round { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--lift); color: var(--ink); transition: transform 0.2s var(--ease); }
.round:active { transform: scale(0.92); }
.round svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quiet { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 20px; background: var(--fill); font-size: 15px; font-weight: 500; transition: transform 0.2s var(--ease); }
.quiet:active { transform: scale(0.96); }

/* Today */
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 2px; background: var(--ink); transition: width 0.25s var(--ease); }
.thread { padding: 18px 18px 14px; }
.thread__row { display: flex; gap: 12px; }
.thread__row--mine { cursor: text; margin-top: 4px; }
.thread__side { flex: none; display: flex; flex-direction: column; align-items: center; width: 40px; }
.thread__line { flex: 1; width: 2px; min-height: 16px; margin: 6px 0; border-radius: 1px; background: var(--line); }
.thread__body { flex: 1; min-width: 0; padding-bottom: 14px; }
.thread__row--mine .thread__body { padding-bottom: 0; }
.face { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-size: 15px; font-weight: 600; object-fit: cover; }
.who { font-size: 15px; line-height: 1.3; }
.who b { font-weight: 600; }
.who span { color: var(--ink-2); font-size: 13px; }
.quote { margin: 3px 0 0; font-size: 16px; line-height: 1.36; color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.because { display: block; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.replying { display: block; margin: 2px 0 8px; font-size: 14px; font-weight: 500; color: var(--series); }
.composer-input { display: block; width: 100%; min-height: 58px; border: 0; border-radius: 12px; background: var(--fill); outline: none; resize: none; padding: 10px 12px; margin: 0; font-size: 18px; line-height: 1.36; overflow: hidden; caret-color: var(--series); transition: box-shadow 0.12s; }
.composer-input:focus { background: transparent; box-shadow: inset 0 0 0 1.5px var(--series); }
.swapped { animation: swapped 0.2s var(--ease); }
@keyframes swapped { from { opacity: 0.2; } }
.left { display: block; text-align: right; font-size: 13px; color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.left:empty { display: none; }
.left.over { color: var(--down); font-weight: 600; }
.check { display: block; margin-top: 8px; font-size: 13px; color: var(--down); }
.controls { display: grid; gap: 8px; margin-top: 14px; }
.controls__more { display: flex; justify-content: center; gap: 8px; }
.text { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 22px; font-size: 15px; font-weight: 500; color: var(--ink-2); transition: background-color 0.12s, color 0.12s; }
.text:hover { background: var(--fill); color: var(--ink); }
.text:active { background: var(--fill); }
.ask { margin: 2px 0 2px; font-weight: 600; text-align: center; }
.reason { min-height: 50px; border-radius: 25px; background: var(--card); box-shadow: var(--lift); font-weight: 500; transition: transform 0.12s var(--ease); }
.reason:active { transform: scale(0.98); }
.tick { color: var(--up); }
.tick svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.action-metric { font-size: 88px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.action-metric.up { color: var(--up); }
.action-metric.down { color: var(--down); }
.action-detail { margin: -8px 0 24px; color: var(--ink-2); font-size: 18px; line-height: 1.35; }
.demo-note { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
select.sub-field { appearance: auto; }

.result-note { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 12px; font-size: 15px; line-height: 1.25; }
.result-note .metric { flex: none; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.result-note .metric.up { color: var(--up); }
.result-note b { display: block; font-weight: 600; }
.result-note span:not(.metric) { font-size: 13px; color: var(--ink-2); }
.need { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 340px; min-height: 54px; padding: 0 18px; margin-bottom: 12px; font-weight: 500; }
.email-ask { width: 100%; max-width: 340px; padding: 14px 16px; margin-bottom: 12px; text-align: left; }
.email-ask b { display: block; font-weight: 600; font-size: 15px; }
.email-ask__row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.email-input { flex: 1; min-width: 0; border: 0; background: var(--fill); border-radius: 12px; padding: 10px 12px; font-size: 16px; outline: none; }
.email-input:focus { box-shadow: inset 0 0 0 1.5px var(--series); }

/* Getting ready and finishing */
.center { min-height: 62vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--ink); animation: spin 0.9s linear infinite; margin-bottom: 24px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center h1 { margin: 0 0 8px; font-size: 28px; }
.center p { margin: 0 0 24px; color: var(--ink-2); }
.done-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--ink); color: var(--ground); display: grid; place-items: center; margin-bottom: 24px; animation: pop 0.5s var(--ease) both; }
.done-mark svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 340px; margin-bottom: 24px; }
.tile { padding: 16px; text-align: left; }
.tile b { display: block; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--ink-2); }
.center .primary { max-width: 340px; }

/* Insights */
.hero { padding: 24px; position: relative; overflow: hidden; }
.hero small, .stat small { display: block; font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: -0.01em; }
.hero b { display: block; font-size: 72px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.delta { font-size: 15px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.spark { display: block; width: 100%; height: 56px; margin-top: 16px; overflow: visible; }
.spark path { fill: none; stroke: var(--series); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat { padding: 18px 20px; }
.stat b { display: block; font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }

.group { overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 18px; text-align: left; position: relative; transition: background-color 0.15s; }
button.row { cursor: pointer; }
button.row:hover, button.row:active { background: var(--fill); }
.row + .row::before, .row + .expand::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 0.5px; background: var(--line); }
.row .metric { flex: none; min-width: 56px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric.up { color: var(--up); }
.metric.down { color: var(--down); }
.row .label { flex: 1; font-weight: 500; min-width: 0; }
.row .value { color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.chev { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); transform: rotate(45deg); }
.row-danger .label { color: var(--down); }

.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 16px; color: var(--ink-2); }
.back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.segments { display: flex; padding: 3px; background: var(--fill); border-radius: 12px; margin-bottom: 16px; }
.segments button { flex: 1; padding: 7px 0; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background-color 0.2s, color 0.2s; }
.segments button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.panel { padding: 20px; margin-bottom: 12px; }
.panel h3 { font-size: 15px; font-weight: 500; color: var(--ink-2); margin: 0 0 14px; }
.bars { display: block; width: 100%; height: auto; }
.bars rect.mark-bar { fill: var(--series); }
.bars rect.hit { fill: transparent; }
.bars text { font: 10px var(--font); fill: var(--ink-2); }
.heat { display: grid; grid-template-columns: 32px repeat(4, 1fr); gap: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
.heat > div { display: grid; place-items: center; height: 34px; color: var(--ink-2); }
.heat .cell { border-radius: 8px; color: var(--ink); background: var(--fill); }
.heat .cell.empty { background: none; }
.top-post { padding: 12px 0; border-top: 0.5px solid var(--line); }
.top-post:first-of-type { border-top: 0; padding-top: 0; }
.top-post p { margin: 0 0 4px; font-size: 15px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.top-post small { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Create */
.composer { padding: 16px 16px 12px 20px; }
.composer textarea { display: block; width: 100%; border: 0; background: none; outline: none; resize: none; padding: 4px 0; min-height: 64px; font-size: 19px; line-height: 1.32; overflow: hidden; }
.composer textarea::placeholder { color: var(--ink-3); }
.composer__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 6px; }
.modes { display: flex; flex-wrap: wrap; gap: 6px; }
.mode { min-height: 34px; padding: 0 13px; border-radius: 17px; font-size: 14px; font-weight: 500; color: var(--ink-2); background: var(--fill); transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease); }
.mode[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.mode:active { transform: scale(0.95); }
.send { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--ground); transition: transform 0.2s var(--ease), opacity 0.2s; }
.send:disabled { opacity: 0.25; }
.send:active { transform: scale(0.92); }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.results { display: grid; gap: 10px; margin-top: 16px; }
.verdict { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin: 8px 0 0; }
.result { padding: 18px 20px; animation: rise 0.4s var(--ease) both; }
.result p { margin: 0 0 12px; font-size: 18px; line-height: 1.32; overflow-wrap: anywhere; }
.result__actions { display: flex; gap: 8px; }
.thinking { padding: 22px 20px; }
.thinking i { display: block; height: 12px; border-radius: 6px; background: var(--fill); margin-bottom: 10px; animation: glow 1.2s ease-in-out infinite; }
.thinking i:last-child { width: 60%; margin-bottom: 0; }
@keyframes glow { 50% { opacity: 0.4; } }

/* You */
.me { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.me img, .me .face { width: 64px; height: 64px; border-radius: 50%; font-size: 24px; }
.me b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.me span { color: var(--ink-2); }
.sub-field { display: block; width: 100%; border: 0; outline: none; resize: none; background: none; padding: 18px 20px; font-size: 17px; line-height: 1.35; }
.sub-field::placeholder { color: var(--ink-3); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.table td { padding: 8px 0; border-top: 0.5px solid var(--line); }
.table tr:first-child td { border-top: 0; }
.table .right { text-align: right; color: var(--ink-2); }

/* Offer */
.offer { padding: 28px 24px 24px; text-align: center; }
.offer b { display: block; font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 4px; }
.offer b small { font-size: 17px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.offer p { margin: 8px 0 20px; color: var(--ink-2); }
.offer em { display: block; font-style: normal; font-size: 13px; color: var(--ink-2); margin-top: 12px; }

/* Loading, tips, messages */
.skeleton { display: grid; gap: 12px; }
.skeleton i { display: block; height: 140px; border-radius: 24px; background: var(--card); animation: glow 1.4s ease-in-out infinite; }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--ground); padding: 6px 10px; border-radius: 9px; font-size: 12px; font-variant-numeric: tabular-nums; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 100px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 22px; background: var(--ink); color: var(--ground); font-size: 15px; animation: toast 0.3s var(--ease); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast button { font-weight: 600; color: inherit; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.12s; }
@media (prefers-reduced-motion: reduce) {
  .page > *, .result, .reasons, .done-mark, .toast { animation: none; }
  .ring, .thinking i, .skeleton i { animation-duration: 3s; }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
