/* Lifecharts — styles. Colors are tokens; the app sets them from the chosen theme. */

:root {
  --bg: #F8F2EA;
  --surface: #FFFCF7;
  --ink: #2A221D;
  --ink2: #5F534A;
  --muted: #8C7F75;
  --hairline: #ECE2D6;
  --line: #A3482B;
  --rise: #C98316;
  --fall: #3E6AB0;
  --accent: #A3482B;
  --on-accent: #FFFFFF;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(60, 35, 15, 0.06);
  --shadow: 0 1px 2px rgba(60, 35, 15, 0.05), 0 10px 34px rgba(60, 35, 15, 0.08);
  --shadow-lg: 0 2px 6px rgba(40, 22, 8, 0.08), 0 24px 60px rgba(40, 22, 8, 0.18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --bg: #1A1520;
    --surface: #231C2B;
    --ink: #F4ECE4;
    --ink2: #CBBEC6;
    --muted: #978B97;
    --hairline: #382E42;
    --line: #F0AE86;
    --rise: #C4862C;
    --fall: #6A8BDB;
    --accent: #F0AE86;
    --on-accent: #1B1410;
    color-scheme: dark;
  }
}

:root[data-mode="dark"] {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 36px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.35), 0 28px 70px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.ready { transition: background-color 0.3s ease; }

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon.big { width: 26px; height: 26px; }
#i-play path, use[href="#i-play"] { fill: currentColor; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 550; letter-spacing: 0.005em; white-space: nowrap;
  background: none; text-decoration: none; color: var(--ink);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: var(--hairline); background: var(--surface); }
.btn.ghost:hover { border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.btn.small { height: 34px; padding: 0 13px; font-size: 14px; gap: 6px; }
.btn.small .icon { width: 16px; height: 16px; }
.btn.danger { color: #B23B3B; }
:root[data-mode="dark"] .btn.danger { color: #F09A9A; }
.btn:disabled { opacity: 0.45; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid transparent; background: none; color: var(--ink2);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small .icon { width: 16px; height: 16px; }
.icon-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }

.link-btn {
  background: none; border: none; padding: 0; color: var(--ink2);
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink2) 40%, transparent);
  text-underline-offset: 3px; font-size: 14px;
}
.link-btn:hover { color: var(--ink); }

.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1240px; margin: 0 auto; padding: 18px 24px 6px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: var(--accent); color: var(--on-accent);
}
.brand-mark .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--hairline); background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--ink2); font-size: 13px; font-weight: 550;
}
.badge .icon { width: 15px; height: 15px; }
.badge:hover { color: var(--ink); }

/* ---------- banners ---------- */

.banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  max-width: 1192px; margin: 12px auto 0; padding: 12px 14px 12px 18px;
  border-radius: 16px; background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink); font-size: 14.5px;
}
.banner p { margin: 0; flex: 1 1 280px; }
.banner > .icon { color: var(--accent); }

/* ---------- hero ---------- */

main { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.hero { padding: 26px 0 16px; }
.hero input.title-input {
  display: block; width: 100%;
  font-family: var(--serif); font-size: clamp(32px, 5vw, 52px); font-weight: 600; line-height: 1.12;
  letter-spacing: -0.01em; color: var(--ink);
  background: none; border: none; padding: 4px 0; margin: 0;
  border-bottom: 1.5px dashed transparent; border-radius: 0;
  transition: border-color 0.2s ease;
}
.hero input.title-input::placeholder { color: var(--muted); opacity: 0.7; }
.hero input.title-input:not([readonly]):hover { border-bottom-color: var(--hairline); }
.hero input.title-input:focus { outline: none; box-shadow: none; border-bottom-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.meaning {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px;
  margin: 10px 0 0; color: var(--ink2); font-size: 15.5px;
}
.meaning strong { color: var(--ink); font-weight: 600; }
.meaning-item { display: inline-flex; align-items: center; gap: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- chart card ---------- */

.chart-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent);
}
.chart-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 2px 4px 8px; }
.spacer { flex: 1 1 auto; }
.tool-group {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; background: var(--bg);
}
.tool-group .btn.ghost { border-color: transparent; background: none; height: 34px; }
.tool-group .btn.ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
#replayBtn .icon { fill: currentColor; stroke-width: 1.2; width: 16px; height: 16px; }

.chart-wrap {
  position: relative;
  height: clamp(340px, 58vh, 620px);
  border-radius: 14px;
  overflow: hidden;
  cursor: grab;
}
.chart-wrap.over-point { cursor: pointer; }
.chart-wrap.grabbing { cursor: grabbing; }
.chart { display: block; width: 100%; height: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart:focus { outline: none; }
.chart:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 14px; }
.chart-wrap.is-empty .chart { opacity: 0.55; }

.overview-wrap { padding: 6px 0 0; }
.overview { display: block; width: 100%; height: 54px; touch-action: none; user-select: none; -webkit-user-select: none; }
.overview.dragging { cursor: grabbing !important; }

.gentle-note {
  margin: 10px 6px 2px; color: var(--muted); font-size: 13.5px; font-style: italic; font-family: var(--serif);
}

.zoom-hint {
  position: absolute; left: 50%; bottom: 60px; transform: translate(-50%, 6px);
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--surface);
  font-size: 13px; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
  white-space: nowrap;
}
.zoom-hint.show { opacity: 0.92; transform: translate(-50%, 0); }
.zoom-hint kbd { font-family: inherit; font-weight: 700; }

/* ---------- tooltip ---------- */

.tooltip {
  position: absolute; left: 0; top: 0; z-index: 5;
  display: flex; gap: 12px; align-items: flex-start;
  width: max-content; max-width: min(300px, calc(100% - 16px));
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg); border: 1px solid var(--hairline);
  pointer-events: none;
}
.tip-photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.tip-body p { margin: 0; }
.tip-date { font-size: 12px; font-weight: 600; color: var(--ink2); letter-spacing: 0.02em; }
.tip-title { font-family: var(--serif); font-size: 17px; line-height: 1.3; font-weight: 600; margin-top: 2px !important; }
.tip-impact { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink2); margin-top: 6px !important; }
.tip-note { font-size: 13px; color: var(--ink2); margin-top: 6px !important; line-height: 1.45; }
.tip-hint { font-size: 11.5px; color: var(--muted); margin-top: 8px !important; }
@media (hover: none) { .tip-hint { display: none; } }
.unnamed { font-style: italic; color: var(--ink2); }

/* ---------- empty state ---------- */

.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--surface) 92%, transparent) 30%, color-mix(in srgb, var(--surface) 40%, transparent) 75%);
}
.empty h2 { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 34px); font-weight: 600; margin: 0 0 10px; }
.empty p { max-width: 460px; margin: 0 0 22px; color: var(--ink2); }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- moments list ---------- */

.moments { padding: 40px 0 24px; }
.moments-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.moments-head h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0; }
.moments-count { color: var(--muted); font-size: 14px; }
.list-empty { color: var(--muted); font-style: italic; font-family: var(--serif); margin: 8px 0; }

.year-group { display: grid; grid-template-columns: 84px 1fr; gap: 0 12px; padding: 14px 0; border-top: 1px solid var(--hairline); }
.year-label { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink2); margin: 8px 0 0; }
.year-items { list-style: none; margin: 0; padding: 0; }
.moment-item { display: flex; align-items: flex-start; gap: 4px; border-radius: 14px; }
.moment-item:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.moment-main {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: 96px 24px 1fr auto; align-items: start; gap: 4px 10px;
  padding: 12px 10px; border: none; background: none; text-align: left; border-radius: 14px;
}
.moment-main[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hairline); }
.moment-date { font-size: 13.5px; color: var(--ink2); padding-top: 3px; font-variant-numeric: tabular-nums; }
.moment-dot-wrap { display: grid; place-items: center; height: 26px; }
.moment-dot { border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }
.moment-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.moment-title { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.moment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.moment-note-flag .icon { width: 14px; height: 14px; }
.moment-note { font-size: 14px; color: var(--ink2); margin-top: 2px; overflow-wrap: anywhere; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: color-mix(in srgb, var(--line) 14%, transparent); color: var(--ink2);
}
.moment-thumbs { display: flex; gap: 4px; padding-top: 2px; }
.moment-thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.moment-actions { display: flex; gap: 0; padding-top: 10px; opacity: 0.55; transition: opacity 0.15s; }
.moment-item:hover .moment-actions, .moment-actions:focus-within { opacity: 1; }

.site-footer { max-width: 1240px; margin: 0 auto; padding: 8px 24px 48px; color: var(--muted); font-size: 13.5px; }
.site-footer p { display: flex; align-items: center; gap: 8px; margin: 0; padding-top: 18px; border-top: 1px solid var(--hairline); }
.site-footer p .icon { flex: none; }
.site-footer .icon { width: 15px; height: 15px; }

/* ---------- detail drawer ---------- */

.detail {
  position: absolute; z-index: 6; top: 10px; right: 10px;
  width: min(360px, 52%); max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain;
  padding: 16px 18px 16px; border-radius: 18px; cursor: auto;
  background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--hairline);
  transform: translateX(calc(100% + 30px)); visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.32s;
}
.detail.open { transform: none; visibility: visible; transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.detail-date { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: 0.02em; }
.detail-title { font-family: var(--serif); font-size: 26px; line-height: 1.22; font-weight: 600; margin: 6px 0 10px; overflow-wrap: anywhere; }
.detail-impact { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; color: var(--ink2); font-size: 14.5px; }
.detail-impact .dot { margin-right: 4px; transform: translateY(0px); }
.detail-impact strong { color: var(--ink); }
.detail-note {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--serif); font-size: 17px; line-height: 1.6;
  color: var(--ink); margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--bg);
}
.detail-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.photo-btn { padding: 0; border: none; background: none; border-radius: 10px; overflow: hidden; aspect-ratio: 1; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.photo-btn:hover img { transform: scale(1.04); }
.detail-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.detail-nav { display: flex; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--hairline); }

/* ---------- dialogs ---------- */

dialog {
  border: none; padding: 0; margin: auto;
  width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  border-radius: 24px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; animation: dlg-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog::backdrop { background: rgba(24, 14, 6, 0.38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } }

dialog > form, dialog > .dlg-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px 24px; }
.dlg-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0; }
.dlg-body { padding: 8px 24px 20px; overflow: auto; min-height: 0; }
.dlg-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 24px 18px;
  border-top: 1px solid var(--hairline); background: var(--surface);
}
.dlg-section { padding: 16px 0 6px; border-top: 1px solid var(--hairline); }
.dlg-section:first-child { border-top: none; padding-top: 4px; }
.dlg-section h3 { font-size: 15px; font-weight: 650; margin: 0 0 6px; letter-spacing: 0.005em; }

.small-dialog { width: min(440px, calc(100vw - 32px)); }
.small-dialog .dlg-body { padding-top: 24px; }
.small-dialog h2 { font-family: var(--serif); font-size: 23px; margin: 0 0 8px; }
.small-dialog p { margin: 0; color: var(--ink2); }

.field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 18px; padding: 0; border: none; min-width: 0; }
.field-label { font-size: 14px; font-weight: 650; color: var(--ink); padding: 0; }
.field-label em { font-style: normal; font-weight: 450; color: var(--muted); margin-left: 4px; }
.field-error { color: #B23B3B; font-size: 13px; }
:root[data-mode="dark"] .field-error { color: #F09A9A; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.hint.warn { color: var(--ink2); }
.hint code { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 5px; }

input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border-radius: 12px; border: 1px solid var(--hairline); background: var(--bg); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
#fTitle { font-family: var(--serif); font-size: 19px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--bg); align-self: flex-start; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 14px; color: var(--ink2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.date-row { display: flex; gap: 8px; }
.date-row > * { flex: 1; }
#fYear { max-width: 140px; }

.impact-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.impact-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 8px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--bg);
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}
.impact-opt:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.impact-opt:has(input:checked) {
  background: var(--surface); border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink), var(--shadow-sm);
}
.impact-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.impact-glyph { width: 28px; height: 60px; }
.glyph-mid { stroke: var(--muted); stroke-opacity: 0.5; stroke-width: 1; }
.glyph-rise { fill: var(--rise); }
.glyph-fall { fill: var(--fall); }
.glyph-steady { fill: var(--muted); }
.impact-word { font-size: 11.5px; line-height: 1.2; text-align: center; color: var(--ink2); min-height: 2.4em; display: flex; align-items: center; }
.impact-caption { margin: 2px 0 0; font-size: 14px; color: var(--muted); min-height: 1.5em; }
.impact-caption.chosen { color: var(--ink2); }
.impact-caption strong { color: var(--ink); }

.photo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-row:empty { display: none; }
.draft-photo { position: relative; width: 76px; height: 76px; }
.draft-photo-img { padding: 0; border: none; width: 100%; height: 100%; border-radius: 12px; overflow: hidden; background: none; }
.draft-photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.draft-photo.first .draft-photo-img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.draft-badge {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 10.5px; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.draft-remove {
  position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  border: 2px solid var(--surface); background: var(--ink); color: var(--surface);
}
.draft-remove .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.field .file-btn { align-self: flex-start; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col .field { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--bg);
  font-size: 13px; color: var(--ink2);
}
.chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }

.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.choice-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px;
  border-radius: 16px; border: 1px solid var(--hairline); background: var(--bg); cursor: pointer;
}
.choice-card input { position: absolute; opacity: 0; }
.choice-card:has(input:checked) { background: var(--surface); border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-title { font-weight: 650; font-size: 14.5px; }
.choice-desc { font-size: 13px; color: var(--ink2); line-height: 1.45; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.switch-title { font-weight: 600; font-size: 14.5px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 44px; height: 26px; border-radius: 999px; background: var(--hairline); position: relative; cursor: pointer;
  transition: background-color 0.18s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 8px 0 14px; }
.swatch {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 6px 8px;
  border-radius: 14px; border: 1px solid var(--hairline); background: none; text-align: center;
}
.swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.swatch-preview { position: relative; height: 44px; border-radius: 9px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.swatch-preview.auto { background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); }
.swatch-dots { display: flex; gap: 4px; }
.swatch-dots span { width: 12px; height: 12px; border-radius: 50%; }
.swatch-name { font-size: 12px; color: var(--ink2); line-height: 1.2; }

.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.color-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink2); cursor: pointer; }
.color-field input[type="color"] {
  width: 34px; height: 34px; padding: 0; border: 1px solid var(--hairline); border-radius: 50%;
  background: none; cursor: pointer; overflow: hidden;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-field input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

.privacy-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 16px; margin: 4px 0 8px;
  border-radius: 16px; background: color-mix(in srgb, var(--accent) 10%, var(--bg));
}
.privacy-card .icon { color: var(--accent); margin-top: 2px; }
.privacy-card p { margin: 0; font-size: 14px; color: var(--ink2); }
.privacy-card .privacy-title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.check-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 6px; }
.check-list label { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check-list input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }
.link-out { display: flex; gap: 8px; margin: 8px 0 4px; }
.link-out input { font-size: 13px; min-height: 36px; padding: 6px 10px; }

.photo-dialog { width: auto; max-width: calc(100vw - 32px); background: #111; padding: 0; border-radius: 16px; }
.photo-dialog img { display: block; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); object-fit: contain; }
.photo-dialog .icon-btn { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, 0.5); color: #fff; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 11px 12px 11px 18px; border-radius: 999px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14.5px;
  transform: translate(-50%, 16px); opacity: 0; transition: transform 0.22s ease, opacity 0.22s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast button {
  border: none; background: color-mix(in srgb, var(--surface) 18%, transparent); color: var(--surface);
  padding: 5px 13px; border-radius: 999px; font-weight: 650; font-size: 14px;
}

/* ---------- read-only (shared) and discreet modes ---------- */

body.readonly .edit-only { display: none !important; }
body.discreet .private-text { filter: blur(6px); user-select: none; transition: filter 0.2s; }
body.discreet .private-media { filter: blur(8px); }
body.discreet .moment-item:focus-within .private-text { filter: blur(6px); }

/* ---------- price mode & candles ---------- */

html:not(.mode-price) .price-only { display: none !important; }
html.mode-price .scale-only { display: none !important; }

.quote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 12px 0 0; }
.ticker {
  align-self: center; padding: 3px 9px; border-radius: 7px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--ink); color: var(--surface); font-variant-numeric: tabular-nums;
}
.quote-price { font-size: clamp(28px, 4vw, 38px); font-weight: 650; letter-spacing: -0.01em; line-height: 1.1; }
.quote-change { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.arrow { display: inline-block; flex: none; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; }
.arrow.up { border-bottom: 9px solid var(--rise); }
.arrow.down { border-top: 9px solid var(--fall); }
.arrow.flat { width: 10px; height: 3px; border: none; background: var(--muted); border-radius: 2px; }
.quote-meta { font-size: 14px; color: var(--ink2); }

.range-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 4px 0; }
.seg-buttons { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--bg); }
.seg-buttons button {
  display: inline-flex; align-items: center; gap: 6px; border: none; background: none; color: var(--ink2);
  padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.seg-buttons button .icon { width: 15px; height: 15px; }
.seg-buttons button:hover { color: var(--ink); }
.seg-buttons button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.price-input { display: flex; align-items: center; border-radius: 12px; border: 1px solid var(--hairline); background: var(--bg); padding-left: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.price-input:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.price-currency { font-size: 22px; font-weight: 600; color: var(--ink2); }
.price-input input[type="number"] {
  border: none; background: none; box-shadow: none !important; font-size: 26px; font-weight: 650; min-height: 54px; padding: 8px 12px 8px 6px;
  font-variant-numeric: tabular-nums;
}
.price-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.price-quick:empty { display: none; }
.price-quick button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums;
}
.price-quick button:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.price-delta { margin: 0; font-size: 14px; color: var(--ink2); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 1.5em; }
.price-delta strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.choice-cards.three { grid-template-columns: repeat(3, 1fr); }
.sub-label { margin: 6px 0 6px; }

.tip-price { font-size: 20px; font-weight: 650; margin-top: 4px !important; font-variant-numeric: tabular-nums; }
.tip-ohlc { display: grid; grid-template-columns: auto auto; gap: 1px 14px; font-size: 12.5px; margin-top: 6px !important; font-variant-numeric: tabular-nums; }
.tip-ohlc span:nth-child(odd) { color: var(--muted); }
.tip-list { margin: 8px 0 0 !important; padding: 0; list-style: none; font-size: 13px; }
.tip-list li { display: flex; gap: 6px; align-items: baseline; margin-top: 3px; }
.tip-list .dot { width: 7px; height: 7px; transform: translateY(-1px); }
.detail-price { font-size: 30px; font-weight: 650; margin: 0 0 2px; font-variant-numeric: tabular-nums; }

.chip-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 2px; vertical-align: -1px; }
.color-chip { display: inline-flex; align-items: center; gap: 3px; }
.color-chip .chip-swatch:nth-of-type(2) { margin-right: 6px; }
.list-price { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.list-price strong { color: var(--ink); font-weight: 650; }
html.mode-price .detail-impact { flex-direction: column; align-items: flex-start; gap: 2px; }
.detail-move { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 15px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums; }
.tip-impact .arrow, .detail-move .arrow, .price-delta .arrow, .list-price .arrow { flex: none; }

/* ---------- ticker, privacy tiers and watchlist ---------- */

.listing-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 0; padding: 12px 14px;
  border-radius: 16px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}
.listing-field { display: inline-flex; align-items: center; gap: 2px; padding: 0 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--hairline); }
.listing-field:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.listing-dollar { font-size: 22px; font-weight: 700; color: var(--ink2); }
.listing-field input[type="text"] {
  border: none; background: none; box-shadow: none !important; min-height: 44px; width: 11ch; padding: 6px 2px;
  font-size: 20px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.listing-card .hint { flex-basis: 100%; margin: 0; }
.ticker-input { display: flex; align-items: center; gap: 2px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--bg); padding-left: 12px; }
.ticker-input span { font-weight: 700; color: var(--ink2); }
.ticker-input input[type="text"] { border: none; background: none; box-shadow: none !important; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; }
.ticker.small { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; }

.tier-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 8px; }
.tier-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tier-label { display: flex; flex-direction: column; }
.tier-title { font-weight: 600; font-size: 14.5px; }
.tier-label .hint { margin: 0; }
.tier-seg span { padding: 5px 11px; font-size: 13px; }
.link-kind { align-self: center; font-size: 12px; font-weight: 700; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.05em; }
.tip-noise { margin-top: 8px !important; font-size: 12.5px; color: var(--muted); font-style: italic; }

.watchlist { padding: 36px 0 0; }
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }
.watch-item { position: relative; display: flex; }
.watch-card {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 178px;
  padding: 14px 14px 12px; border-radius: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.15s;
}
.watch-card:hover { border-color: color-mix(in srgb, var(--ink) 22%, transparent); transform: translateY(-1px); }
.watch-top { display: flex; align-items: center; gap: 8px; width: 100%; padding-right: 26px; }
.watch-audience { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.watch-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.watch-price { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.watch-change { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums; }
.watch-spark { width: 100%; height: 38px; margin-top: auto; }
.watch-meta { font-size: 12px; color: var(--muted); }
.watch-remove { position: absolute; top: 8px; right: 8px; opacity: 0.6; }
.watch-item:hover .watch-remove, .watch-remove:focus-visible { opacity: 1; }
.watch-card.add {
  align-items: center; justify-content: center; gap: 6px; text-align: center; box-shadow: none;
  background: none; border: 1.5px dashed var(--hairline);
}
.watch-card.add:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.watch-requests {
  display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding: 12px 14px;
  border-radius: 18px; background: color-mix(in srgb, var(--surface) 60%, transparent); border: 1px solid var(--hairline);
}
.req-head { display: flex; align-items: center; gap: 8px; }
.req-title { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.req-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.req-empty { margin: 0; font-size: 14px; color: var(--ink2); }
.req-empty strong { color: var(--ink); }
.watch-req {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--hairline);
}
.watch-req.incoming { border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline)); }
.watch-req .req-text { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink2); }
.watch-req .req-text strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.watch-live { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--rise); }
.watch-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.watch-private { font-size: 13px; color: var(--muted); }
.friend-me { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.friend-me strong { color: var(--ink); }
.fm-list { display: flex; flex-direction: column; gap: 4px; margin: 0 -8px; }
.fm-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 10px; border-radius: 12px; text-align: left;
  color: var(--ink); font-size: 15.5px; font-weight: 600;
}
.fm-item:hover { background: var(--bg); }
.fm-item .icon { width: 20px; height: 20px; margin-top: 1px; flex: none; color: var(--ink2); }
.fm-item > span { display: flex; flex-direction: column; gap: 2px; }
.fm-item .hint { margin: 0; font-weight: 450; }
.fm-item.danger, .fm-item.danger .icon { color: #B23B3B; }
:root[data-mode="dark"] .fm-item.danger, :root[data-mode="dark"] .fm-item.danger .icon { color: #F09A9A; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; color: var(--ink); }
.radio-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.fm-actions { display: flex; align-items: center; gap: 8px; }
.watch-add-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
.watch-add-title { font-weight: 650; font-size: 15px; }

/* ---------- quick moves & catalysts ---------- */

.move-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.move-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--hairline); background: var(--bg);
  font-size: 14px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums;
  transition: border-color 0.12s, background-color 0.12s, transform 0.08s;
}
.move-chip:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.move-chip:active { transform: scale(0.96); }
.move-chip.up[aria-pressed="true"] { background: color-mix(in srgb, var(--rise) 18%, var(--surface)); border-color: var(--rise); }
.move-chip.down[aria-pressed="true"] { background: color-mix(in srgb, var(--fall) 18%, var(--surface)); border-color: var(--fall); }
.move-chip-gap { width: 6px; }
.price-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.price-row-label { font-size: 13.5px; color: var(--muted); }
.price-row .price-input { flex: 1 1 200px; }
.price-row .price-input input[type="number"] { font-size: 22px; min-height: 48px; }
.pct-row { margin: 12px 0 10px; }
.pct-control { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; }
.sign-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--bg); border: 1px solid var(--hairline); flex: none; }
.sign-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 999px;
  font-size: 14px; font-weight: 650; color: var(--ink2);
}
.sign-btn[aria-pressed="true"] { color: var(--ink); box-shadow: var(--shadow-sm); }
.sign-btn.up[aria-pressed="true"] { background: color-mix(in srgb, var(--rise) 18%, var(--surface)); }
.sign-btn.down[aria-pressed="true"] { background: color-mix(in srgb, var(--fall) 18%, var(--surface)); }
.sign-btn .arrow { transform: scale(0.85); }
.pct-input { position: relative; flex: 1 1 auto; min-width: 84px; }
.pct-input input[type="number"] { font-size: 19px; font-variant-numeric: tabular-nums; padding-right: 34px; min-height: 46px; }
.pct-suffix { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 17px; font-weight: 600; pointer-events: none; }

.catalysts { margin-top: 20px; padding: 18px 22px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent); }
.catalysts h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.cat-item::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rise); flex: none; }
.cat-item .cat-text { flex: 1; min-width: 0; font-family: var(--serif); font-size: 17px; overflow-wrap: anywhere; }
.cat-item .icon-btn { opacity: 0; }
.cat-item:hover .icon-btn, .cat-item .icon-btn:focus-visible { opacity: 0.6; }
@media (hover: none) { .cat-item .icon-btn { opacity: 0.5; } }
.cat-add input[type="text"] { border: none; background: none; box-shadow: none !important; padding: 10px 0 6px 16px; min-height: 40px; font-family: var(--serif); font-size: 17px; }
.cat-add input[type="text"]::placeholder { font-style: italic; }

/* ---------- story card ---------- */

.quote-story { margin-left: auto; align-self: center; }
.story-dialog { width: min(460px, calc(100vw - 32px)); }
.story-body { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.story-frame {
  width: min(100%, calc((100dvh - 260px) * 9 / 16)); aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden;
  background: var(--bg); box-shadow: var(--shadow); border: 1px solid var(--hairline);
}
.story-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-body .hint { text-align: center; }
.story-option { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.story-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* ---------- ticker claiming ---------- */

.ticker-claim { display: flex; gap: 8px; align-items: center; }
.ticker-claim .ticker-input { flex: 1; }
.ticker-status { margin: 0; min-height: 1.4em; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink2); }
.ticker-status:empty { display: none; }
.ticker-status .icon { width: 16px; height: 16px; stroke-width: 2.4; color: var(--rise); }
.ticker-status[data-kind="ok"] { color: var(--ink); font-weight: 600; }
.ticker-chip { font-weight: 700; letter-spacing: 0.03em; padding: 3px 10px; }
.listing-card .ticker-status { flex-basis: 100%; }

/* ---------- journaling ---------- */

.memory-card {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 16px; padding: 12px 12px 12px 18px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
  animation: memory-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes memory-in { from { opacity: 0; transform: translateY(-6px); } }
.memory-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--surface) 100%, transparent), 0 0 0 5px var(--hairline); }
.memory-text { flex: 1; min-width: 0; }
.memory-text p { margin: 0; }
.memory-when { font-size: 12.5px; font-weight: 600; color: var(--ink2); letter-spacing: 0.02em; }
.memory-title { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.prompt-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; text-decoration: none; color: var(--ink2); }
.prompt-btn:hover { color: var(--ink); }
.prompt-btn .icon { width: 15px; height: 15px; color: var(--accent); }
.prompt {
  margin: 0; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
  font-family: var(--serif); font-style: italic; font-size: 16.5px; line-height: 1.45; color: var(--ink);
}

/* ---------- install ---------- */

.install-hero { display: flex; gap: 16px; align-items: center; margin: 4px 0 14px; }
.install-hero img { border-radius: 15px; box-shadow: var(--shadow-sm); flex: none; }
.install-hero p { margin: 0; color: var(--ink2); font-size: 14.5px; }
.install-steps { font-size: 14.5px; color: var(--ink); }
.install-steps ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.install-steps p { margin: 0; }
.install-steps strong { font-weight: 650; }
.small-dialog .install-steps p { color: var(--ink); }
#installNote { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); }

/* installed app: respect notches and home indicators */
.topbar { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
main { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
.site-footer { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
html.standalone .site-footer, html.native .site-footer { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
html.standalone .topbar, html.native .topbar { padding-top: max(14px, env(safe-area-inset-top)); }

/* ---------- inside the iPhone / iPad app ---------- */

.native-only { display: none; }
html.native .native-only { display: block; }
html.native .web-only { display: none !important; }
html.native { -webkit-tap-highlight-color: transparent; }
html.native button, html.native .btn, html.native .chart, html.native .overview { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.time-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 10px; font-size: 14.5px; color: var(--ink2); }
.time-row input[type="time"] { width: auto; min-height: 38px; padding: 6px 10px; }
.footer-links { display: flex; gap: 18px; padding-top: 10px; }
.footer-links a { color: var(--ink2); text-decoration: none; }
.footer-maker { margin: 0; padding-top: 10px; font-size: 13px; color: var(--muted); }
.footer-maker a { color: var(--ink2); }
.site-footer .footer-maker { border-top: none; display: block; padding-top: 8px; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- privacy & support pages ---------- */

.doc { max-width: 720px; margin: 0 auto; padding: 28px 24px 48px; }
.doc-kicker { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink2); }
.doc h1 { font-family: var(--serif); font-size: clamp(32px, 5vw, 46px); line-height: 1.12; font-weight: 600; margin: 8px 0 10px; letter-spacing: -0.01em; }
.doc-date { margin: 0; color: var(--muted); font-size: 14px; }
.doc-summary {
  margin: 26px 0 10px; padding: 18px 20px; border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.doc-summary p { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.5; }
.doc h2 { font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 40px 0 8px; line-height: 1.25; }
.doc h3 { font-size: 16.5px; font-weight: 650; margin: 22px 0 4px; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.65; color: var(--ink); }
.doc p { margin: 10px 0; }
.doc ul { padding-left: 22px; margin: 8px 0; }
.doc li { margin: 6px 0; }
.doc a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: 3px; }
.doc strong { font-weight: 650; }
.doc .muted { color: var(--ink2); }
.doc-footer { max-width: 720px; }
.doc-footer .footer-links { border-top: 1px solid var(--hairline); padding-top: 18px; }
.todo { background: #FFE58A; color: #3A2A00; padding: 0 5px; border-radius: 5px; font-weight: 600; }
.doc-back { white-space: nowrap; }
.faq { margin-top: 8px; }
.faq details { border-top: 1px solid var(--hairline); padding: 4px 0; }
.faq details:last-child { border-bottom: 1px solid var(--hairline); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0;
  font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.35; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); font-weight: 400; font-size: 24px; color: var(--ink2); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details > :not(summary) { margin-top: 0; }
.faq details p:last-child, .faq details ul:last-child { margin-bottom: 16px; }
.help-card {
  margin: 28px 0 8px; padding: 18px 20px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--hairline); box-shadow: var(--shadow-sm);
}
.help-card h2 { margin-top: 0; font-size: 21px; }
.help-card ul { list-style: none; padding: 0; }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .topbar { padding: 14px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left)); }
  main { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .memory-card { padding: 10px 8px 10px 14px; gap: 10px; }
  .memory-title { font-size: 16.5px; }
  .banner { margin: 10px 16px 0; }
  .btn-text { display: none; }
  .topbar .btn { width: 40px; padding: 0; }
  .badge span { display: none; }
  .badge { width: 34px; padding: 0; justify-content: center; }
  .hero { padding: 18px 0 12px; }
  .chart-card { padding: 10px 8px 10px; border-radius: 18px; margin: 0 -6px; }
  .chart-toolbar { gap: 8px; }
  .chart-toolbar { padding: 2px 0 8px; }
  .chart-toolbar #addBtn, .chart-toolbar #todayBtn { flex: 1 1 0; order: -1; padding: 0 10px; gap: 6px; }
  .chart-toolbar .tool-group:first-of-type { margin-right: auto; }
  .chart-toolbar .spacer { display: none; }
  .chart-toolbar .tool-group:last-child { margin-left: auto; }
  .chart-wrap { height: clamp(320px, 54vh, 460px); }
  .tool-group .btn.small { padding: 0 10px; }

  .year-group { grid-template-columns: 1fr; }
  .year-label { margin: 0 0 4px 10px; font-size: 20px; }
  .moment-main { grid-template-columns: 22px 1fr; padding: 10px; }
  .moment-date { grid-column: 2; grid-row: 1; padding: 0; font-size: 12.5px; }
  .moment-dot-wrap { grid-column: 1; grid-row: 2; }
  .moment-text { grid-column: 2; grid-row: 2; }
  .moment-thumbs { grid-column: 2; grid-row: 3; }
  .moment-actions { opacity: 1; flex-direction: column; padding-top: 6px; }

  .detail {
    position: fixed; z-index: 30;
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 62dvh; border-radius: 22px 22px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateY(105%);
  }

  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top) - 10px));
    border-radius: 24px 24px 0 0;
  }
  dialog[open] { animation: sheet-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0.4; } }
  .dlg-head { padding: 16px 12px 4px 18px; }
  .dlg-body { padding: 8px 18px 18px; }
  .dlg-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .small-dialog { width: 100%; }
  .photo-dialog { margin: auto; border-radius: 16px; width: auto; }

  .two-col, .choice-cards, .choice-cards.three { grid-template-columns: 1fr; }
  .range-row { padding: 8px 0 0; }
  .quote-story { margin-left: 0; }
  .story-dialog { margin: auto; border-radius: 24px; width: calc(100vw - 24px); max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px); }
  .catalysts { padding: 14px 16px 10px; margin-left: -6px; margin-right: -6px; }
  .move-chip { min-height: 36px; padding: 0 10px; font-size: 13.5px; }
  .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .watch-card { min-height: 168px; padding: 12px; }
  .tier-row { align-items: flex-start; }
  .seg-buttons button { padding: 6px 10px; }
  .doc { padding: 18px 16px 40px; }
  .topbar .doc-back { width: auto; padding: 0 13px; }
  .swatches { grid-template-columns: repeat(3, 1fr); }
  .impact-picker { gap: 4px; }
  .impact-opt { padding: 6px 0; border-radius: 12px; }
  .impact-word { font-size: 10.5px; }
}

@media (max-width: 420px) {
  .brand-name { display: none; }
  .topbar-actions { gap: 4px; }
}

@media (max-width: 380px) {
  .impact-word { display: none; }
}

/* ---------- first-run tour ---------- */

.tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour[hidden] { display: none; }
.tour.peek { visibility: hidden; }
.tour-shade { position: fixed; background: rgba(24, 14, 6, 0.5); pointer-events: auto; transition: opacity 0.2s; }
:root[data-mode="dark"] .tour-shade { background: rgba(0, 0, 0, 0.6); }
.tour-ring {
  position: fixed; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: opacity 0.2s;
}
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 24px)); padding: 16px 16px 12px; border-radius: 20px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: dlg-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tour-card.center { width: min(420px, calc(100vw - 24px)); padding: 22px 20px 14px; text-align: center; }
.tour-count { margin: 0 0 4px; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tour-card h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; }
.tour-card.center h2 { font-size: 26px; }
.tour-card p { margin: 0; color: var(--ink2); font-size: 15px; line-height: 1.45; }
.tour-extra:empty { display: none; }
.tour-extra { margin-top: 12px; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-card.center .tour-actions { flex-direction: column-reverse; align-items: stretch; }
.tour-card.center .tour-actions .spacer { display: none; }
.tour-card.center .tour-actions .btn { height: 44px; font-size: 15px; justify-content: center; }
.tour-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.tour-theme {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 5px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--bg); color: var(--ink); font-size: 13.5px; font-weight: 600;
}
.tour-theme .dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.08); }
.tour-theme[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- guided setup ---------- */

.setup-dialog { width: min(560px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 48px)); }
.setup-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 4px 24px; }
.setup-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.setup-progress span { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.setup-count { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.setup-body { flex: 1; padding-top: 14px; }
.setup-preview { margin: 0 0 18px; padding: 10px 12px 8px; border-radius: 16px; background: var(--bg); }
.setup-preview svg { display: block; width: 100%; height: 96px; overflow: visible; }
.setup-preview .sp-line { fill: none; stroke: var(--line); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.setup-preview .sp-area { fill: color-mix(in srgb, var(--line) 12%, transparent); stroke: none; }
.setup-preview .sp-base { stroke: var(--hairline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.setup-preview .sp-ath { stroke: var(--rise); stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.setup-caption { margin: 6px 0 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink2); font-variant-numeric: tabular-nums; min-height: 20px; }
.setup-caption strong { color: var(--ink); }
.setup-spark-wrap { position: relative; }
.setup-spark-wrap .sp-pt {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
}
.setup-spark-wrap .sp-pt.now { width: 14px; height: 14px; margin: -7px 0 0 -7px; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.setup-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
#setupTitle { margin: 0 0 6px; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.15; }
.setup-sub { margin: 0 0 20px; color: var(--ink2); font-size: 15.5px; line-height: 1.45; }
.setup-fields .field { margin-bottom: 20px; }
.setup-fields input.serif { font-family: var(--serif); font-size: 19px; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-chip {
  min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--bg); color: var(--ink); font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: border-color 0.12s, background-color 0.12s, transform 0.08s;
}
.pick-chip:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.pick-chip:active { transform: scale(0.96); }
.pick-chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: var(--accent); }
.size-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.size-chip {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 14px;
  border: 1px solid var(--hairline); background: var(--bg); color: var(--ink); text-align: left;
  transition: border-color 0.12s, background-color 0.12s, transform 0.08s;
}
.size-chip:active { transform: scale(0.98); }
.size-chip .size-word { font-weight: 650; font-size: 15px; }
.size-chip .size-pct { margin-left: auto; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.size-chip .size-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.size-chip .size-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.size-chip.up[aria-pressed="true"] { background: color-mix(in srgb, var(--rise) 16%, var(--surface)); border-color: var(--rise); }
.size-chip.down[aria-pressed="true"] { background: color-mix(in srgb, var(--fall) 16%, var(--surface)); border-color: var(--fall); }
.now-chips { display: flex; flex-direction: column; gap: 8px; }
.now-chips .size-chip { min-height: 52px; }
.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-row.three { grid-template-columns: 1.4fr 0.8fr 1fr; }
.setup-row select { min-width: 0; }
#setupTitle:focus { outline: none; }
.tour.light .tour-shade { background: rgba(24, 14, 6, 0.14); }
:root[data-mode="dark"] .tour.light .tour-shade { background: rgba(0, 0, 0, 0.22); }
.setup-note { margin: -8px 0 18px; font-size: 13px; color: var(--muted); }
.setup-note strong { color: var(--ink2); }

@media (max-width: 760px) {
  .setup-dialog { width: 100%; height: calc(100dvh - env(safe-area-inset-top) - 10px); max-height: none; }
  #setupTitle { font-size: 25px; }
  .size-chips { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .topbar-actions, .chart-toolbar, .overview-wrap, .detail, .moment-actions, .banner, .site-footer { display: none !important; }
  .chart-card { box-shadow: none; }
}
