@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --ink: #18181b;
  --ink-2: #52525b;
  --muted: #71717a;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --accent: #d9482b;
  --accent-hover: #c23d22;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee9;
  --accent-text: #b8391f;
  --hope: #0f7b5f;
  --hope-soft: #e3f4ee;
  --warn-soft: #fef6e4;
  --danger-soft: #fdecec;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e7e5e4;
  --axis: #c7c4bf;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px -12px rgba(24, 24, 27, .10);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0c0c0d; --surface: #161618; --surface-2: #1f1f22; --ink: #f4f4f5; --ink-2: #c4c4c9; --muted: #8e8e96;
    --line: #27272a; --line-strong: #3a3a3f; --accent: #f06a4c; --accent-hover: #f48066; --accent-ink: #160b08;
    --accent-soft: #34201a; --accent-text: #f58b72; --hope: #3cc495; --hope-soft: #12302a; --warn-soft: #33291a;
    --danger-soft: #3a1c1c; --series-1: #3987e5; --series-2: #d95926; --grid: #27272a; --axis: #3a3a3f;
    --shadow-sm: none; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c0c0d; --surface: #161618; --surface-2: #1f1f22; --ink: #f4f4f5; --ink-2: #c4c4c9; --muted: #8e8e96;
  --line: #27272a; --line-strong: #3a3a3f; --accent: #f06a4c; --accent-hover: #f48066; --accent-ink: #160b08;
  --accent-soft: #34201a; --accent-text: #f58b72; --hope: #3cc495; --hope-soft: #12302a; --warn-soft: #33291a;
  --danger-soft: #3a1c1c; --series-1: #3987e5; --series-2: #d95926; --grid: #27272a; --axis: #3a3a3f;
  --shadow-sm: none; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15.5px/1.6 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-text); }
img, svg { max-width: 100%; }
.icon { flex: none; vertical-align: -3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.022em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); letter-spacing: -.03em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.04rem; letter-spacing: -.012em; font-weight: 650; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; width: 100%; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 85%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; text-decoration: none; font-size: 1.02rem; letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.brand-tld { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 2px; align-items: center; }
.nav a { text-decoration: none; padding: 7px 11px; border-radius: 8px; color: var(--ink-2); font-size: .92rem; font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--surface-2); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; list-style: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn::-webkit-details-marker { display: none; }
.menu-btn { display: none; }
.account-menu { position: relative; }
.account-menu summary { border: 1px solid var(--line); }
.menu-pop { position: absolute; right: 0; top: 46px; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; z-index: 30; }
.menu-pop a { padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: .92rem; }
.menu-pop a:hover { background: var(--surface-2); color: var(--ink); }
.menu-note { padding: 6px 10px 8px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
@media (max-width: 1040px) {
  .menu-btn { display: inline-grid; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
}
@media (max-width: 560px) { .share-cta { display: none; } .site-header .wrap { gap: 12px; } }

main { flex: 1; padding: 32px 0 72px; }
.site-footer { border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); font-size: .84rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 32px; align-items: start; }
.aside { position: sticky; top: 84px; }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } .aside { position: static; } }
@media (max-width: 560px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } }
.section { margin-top: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .9rem; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.section-head a:hover { color: var(--accent-text); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin: 0; max-width: 46em; }
.crumb { margin-bottom: 18px; font-size: .9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.push-right { float: right; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tint { background: var(--surface-2); box-shadow: none; border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 14px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.25; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn.big { padding: 12px 22px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .76rem; font-weight: 550; white-space: nowrap; border: 1px solid transparent; }
.chip.ai { background: var(--accent-soft); color: var(--accent-text); }
.chip.hope { background: var(--hope-soft); color: var(--hope); }
.chip.sample { background: var(--warn-soft); color: var(--ink-2); border: 1px dashed var(--line-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.notice { display: block; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); font-size: .9rem; margin-bottom: 16px; }
.notice .icon { margin-right: 4px; }
.notice.hope { background: var(--hope-soft); }
.notice.danger { background: var(--danger-soft); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.kbd { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 2px 7px; border-radius: 6px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--accent-text); margin-bottom: 10px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=number], input[type=month], input[type=search], input[type=email], input[type=url], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: .94rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--series-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 20%, transparent); }
.btn:focus-visible, a:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.field { margin-bottom: 16px; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 6px; margin: 0 0 20px; background: var(--surface); }
legend { font-weight: 700; padding: 0 6px; font-size: .95rem; }
.form-error { color: var(--accent-text); font-weight: 600; margin: 10px 0; font-size: .9rem; }
.hp { position: absolute; left: -9999px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 14px; font: inherit; font-weight: 600; font-size: .86rem; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--page); }

/* ---------- sign-in ---------- */
.signin-card { display: flex; gap: 16px; align-items: flex-start; }
.signin-card h3 { margin-bottom: 4px; }
.signin-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--hope-soft); color: var(--hope); display: grid; place-items: center; flex: none; }
.signin-icon.big { width: 56px; height: 56px; margin: 0 auto 16px; }
.signin-page { max-width: 460px; margin: 24px auto; text-align: center; padding: 36px 32px; }
.signin-page h1 { font-size: 1.6rem; }
.signin-page .btn { width: 100%; margin-bottom: 10px; padding: 11px 16px; }
.google-btn { background: var(--surface); font-weight: 600; }

/* ---------- hero ---------- */
.hero { padding: 24px 0 8px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.08; }
.hero p.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 36em; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
@media (max-width: 820px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

/* ---------- stat tiles ---------- */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.hero-panel .tile { background: var(--surface-2); border-color: transparent; }
.tile .label { color: var(--ink-2); font-size: .82rem; font-weight: 550; }
.tile .value { font-size: 1.8rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: 4px; overflow-wrap: anywhere; }
.tile .sub { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* ---------- story cards ---------- */
.story-card { display: block; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.story-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: inherit; }
.story-card h3 { margin: 10px 0 6px; font-size: 1.06rem; }
.story-card .meta { color: var(--muted); font-size: .84rem; }
.story-card .excerpt { color: var(--ink-2); margin: 8px 0 14px; font-size: .92rem; }
.story-card .foot { display: flex; gap: 14px; color: var(--muted); font-size: .82rem; flex-wrap: wrap; align-items: center; }
.foot .alias { font-weight: 550; color: var(--ink-2); }
.foot .stat { display: inline-flex; align-items: center; gap: 4px; }
.list { display: grid; gap: 14px; }
.mine { display: grid; gap: 6px; justify-items: start; }
.mine > a { width: 100%; }
.story-title { margin-top: 14px; }
.story-body { font-size: 1.04rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.story-body a, .comment a { color: var(--series-1); }
.small-body { font-size: .95rem; }
.quote-card { margin: 18px 0 22px; }
.quote { font-size: 1.05rem; font-weight: 500; }
.advice { margin-top: 22px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: .9rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.react-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0; align-items: center; }
.comments { margin-top: 36px; }
.comment { border-top: 1px solid var(--line); padding: 14px 0; }
.comment .who { font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment .who .push-right { margin-left: auto; float: none; }
.comment p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.owner-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); margin: 8px 0 16px; }
.connect-card { border-color: color-mix(in srgb, var(--hope) 45%, var(--line)); }
.buddy { margin: 0 0 12px; font-size: .92rem; }
.success-card { margin: 0 auto; }

/* ---------- images ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 20px 0; }
.gallery-item { position: relative; display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 4 / 3; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .chip { position: absolute; left: 8px; bottom: 8px; }
.image-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.image-picker:empty { display: none; }
.image-tile { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.image-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-tile.failed { border-color: var(--accent); }
.image-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px; font-size: .75rem; font-weight: 600; background: color-mix(in srgb, var(--surface) 90%, transparent); display: flex; gap: 4px; align-items: center; }
.image-tile.failed .image-status { color: var(--accent-text); }
.image-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
fieldset label.btn { display: inline-flex; margin-bottom: 14px; }

/* ---------- admin ---------- */
.admin-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 28px; }
.admin-image img { width: 100%; border-radius: 8px; margin-bottom: 8px; background: var(--surface-2); min-height: 120px; }
.admin-item { margin-bottom: 12px; }
.admin-item h3 { margin-top: 10px; }

/* ---------- charts ---------- */
.chart-card h3 { margin-bottom: 2px; }
.chart-card .sub { color: var(--muted); font-size: .84rem; margin-bottom: 14px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; font-size: .86rem; }
.hbar .lbl { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 14px; position: relative; cursor: default; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.chart-svg text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--page); padding: 7px 10px; border-radius: 8px; font-size: .8rem; line-height: 1.4; max-width: 260px; opacity: 0; transition: opacity .1s; }
.tooltip.show { opacity: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 600; font-size: .8rem; cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
details.table-toggle summary { cursor: pointer; color: var(--muted); font-size: .82rem; margin-top: 12px; }

/* ---------- calculator ---------- */
.slider { margin-bottom: 14px; }
.slider .top { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; }
.slider .top b { font-variant-numeric: tabular-nums; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.result-big { font-size: 2.1rem; font-weight: 750; letter-spacing: -.03em; }
.eq { font-family: ui-serif, Georgia, serif; font-style: italic; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

.checklist label { font-weight: 500; display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.checklist input { margin-top: 4px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 600; font-size: .9rem; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.decoder { display: grid; gap: 10px; }
.decoder div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: .92rem; }
@media (max-width: 560px) { .decoder div { grid-template-columns: minmax(0, 1fr); } }
.prose { max-width: 740px; }
.prose li { margin-bottom: 6px; }
