/* =====================================================================
   pennio — editorial night garden
   Brand colours only: ink #1e1d1e and cream #e6dfd3.
   Upright serif display (Instrument Serif / Noto Serif SC), quiet sans
   (Inter / Noto Sans SC), plain mono for numbers. Square corners, hairlines.
   ===================================================================== */

:root {
  --ink: #1e1d1e;
  --ink-2: #242223;
  --ink-3: #2c2a2b;
  --cream: #e6dfd3;
  --cream-2: rgba(230, 223, 211, 0.82);
  --muted: rgba(230, 223, 211, 0.6);
  --faint: rgba(230, 223, 211, 0.38);
  --line: rgba(230, 223, 211, 0.14);
  --line-2: rgba(230, 223, 211, 0.28);
  --serif: 'Instrument Serif', 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --sans: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'Noto Sans SC', ui-monospace, monospace;
  --header-h: 60px;
  --ease: cubic-bezier(0.5, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--cream); color: var(--ink); }
:focus-visible { outline: 1px solid var(--cream); outline-offset: 3px; }

h1, h2, h3, .h2, .h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-synthesis: none;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.45em;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5.2rem); line-height: 1.05; letter-spacing: -0.02em; }
h2, .h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
h3, .h3 { font-size: 1.3rem; }
h1 em, h2 em { font-style: italic; }
p { margin: 0 0 1em; line-break: strict; }
.lead { font-size: clamp(1.05rem, 1.5vw, 1.22rem); color: var(--cream-2); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.up { color: var(--cream); }
.down, .flat { color: var(--muted); }
small { font-size: 0.75em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1220px, 100% - 40px); margin-inline: auto; }
.noscript { padding: 12px 20px; background: var(--cream); color: var(--ink); text-align: center; }
.kbd { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 0.85em; }

.link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 2px;
  transition: border-color 0.2s;
}
.link:hover { border-color: var(--cream); }
p a, li a, dd a, td a:not(.co) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--faint); }
p a:hover, li a:hover { text-decoration-color: currentColor; }

/* ---------------------------------------------------------------- buttons: square */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.85em 1.4em;
  border: 1px solid var(--cream);
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: transparent; color: var(--cream); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--cream); background: transparent; }
.btn-text { background: none; border-color: transparent; color: var(--muted); padding-inline: 0.4em; }
.btn-text:hover { color: var(--cream); }
.btn-sm { padding: 0.6em 1em; font-size: 0.82rem; }
.btn.danger.confirm { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------------------------------------------------------------- panels */
.patch, .panel {
  background: var(--ink-2);
  border: 1px solid var(--line);
  padding: clamp(18px, 2.4vw, 28px);
}
.patch-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.patch-head h2, .patch-head h3 { margin: 0; }

/* ---------------------------------------------------------------- forms */
.input {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line-2);
  padding: 0.7em 0.85em;
  color: var(--cream);
  transition: border-color 0.2s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--cream); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--cream) 50%), linear-gradient(135deg, var(--cream) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2em; }
.input-sm { padding: 0.4em 2em 0.4em 0.7em; width: auto; font-size: 0.9rem; }
.label { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.hint { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-2); font-size: 0.66rem; text-decoration: none; color: var(--muted); }
.hint:hover { color: var(--cream); border-color: var(--cream); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-2); }
.seg button { border: 0; border-right: 1px solid var(--line); background: none; padding: 0.5em 0.85em; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--cream); }
.seg button.on { background: var(--cream); color: var(--ink); }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--cream) 0 var(--p, 50%), var(--line-2) var(--p, 50%)); }
input[type='range']::-moz-range-track { height: 2px; background: var(--line-2); }
input[type='range']::-moz-range-progress { height: 2px; background: var(--cream); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; background: var(--cream); border: 0; }
input[type='range']::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 0; background: var(--cream); }
input[type='range']:focus-visible { outline: none; }
input[type='range']:focus-visible::-webkit-slider-thumb { outline: 1px solid var(--cream); outline-offset: 3px; }

/* ---------------------------------------------------------------- header */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; transition: background-color 0.3s; }
.site-header.scrolled, body:not([data-page='home']) .site-header { background: rgba(30, 29, 30, 0.96); border-bottom: 1px solid var(--line); }
body[data-page='home'] .site-header.scrolled { background: linear-gradient(rgba(30, 29, 30, 0.85), rgba(30, 29, 30, 0)); border-bottom-color: transparent; }
body[data-page='home'].past-scene .site-header.scrolled { background: rgba(30, 29, 30, 0.96); border-bottom-color: var(--line); }
.ca-bar { display: flex; justify-content: center; background: var(--cream); color: var(--ink); padding: 4px 12px; }
.ca-chip { display: inline-flex; align-items: center; gap: 0.9em; border: 0; background: transparent; color: var(--ink); padding: 3px 4px; font-family: var(--mono); font-size: 0.82rem; font-weight: 500; cursor: pointer; }
.ca-copy { font-family: var(--sans); font-size: 0.74rem; border-bottom: 1px solid currentColor; }
.ca-chip-lg { background: var(--cream); padding: 0.65em 1em; font-size: 0.95rem; }
.nav { display: flex; align-items: center; gap: 24px; height: 60px; width: min(1320px, 100% - 32px); margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 1.6rem; line-height: 1; letter-spacing: -0.01em; }
.brand img { width: 22px; height: auto; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 0.9rem; text-decoration: none; color: var(--cream-2); }
.nav-links a:hover, .nav-links a.active { color: var(--cream); }
.nav-links a.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 1px; background: var(--cream); }
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; background: var(--cream); color: var(--ink); font-family: var(--mono); font-size: 0.68rem; }
.nav-cta { margin-left: 6px; }
.nav-toggle { display: none; margin-left: auto; width: 40px; height: 40px; border: 1px solid var(--line-2); background: none; cursor: pointer; position: relative; }
.nav-toggle span { position: absolute; left: 11px; right: 11px; height: 1px; background: var(--cream); transition: transform 0.25s var(--ease); }
.nav-toggle span:first-child { top: 15px; }
.nav-toggle span:last-child { top: 23px; }
.menu-open .nav-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
.menu-open .nav-toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-cta { display: none; }
  .nav-links { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; padding: 4px 16px 16px; background: var(--ink); border-bottom: 1px solid var(--line); display: none; }
  .menu-open .nav-links { display: flex; }
  .menu-open { background: var(--ink); }
  .nav-links a { padding: 14px 2px; font-size: 1rem; border-bottom: 1px solid var(--line); }
  .nav-links a.active::after { display: none; }
}

/* ---------------------------------------------------------------- footer */
.site-footer { margin-top: 90px; border-top: 1px solid var(--line); padding: 44px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px 60px; }
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { max-width: 40ch; font-size: 0.92rem; }
.footer-links { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 32px; align-content: start; }
.footer-links a { font-size: 0.92rem; text-decoration: none; color: var(--cream-2); }
.footer-links a:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { grid-column: 1 / -1; margin: 18px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--faint); }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } .footer-links { grid-template-columns: repeat(2, auto); } }

/* ---------------------------------------------------------------- loader + transitions (the flower window) */
.veil { position: fixed; inset: 0; z-index: 400; pointer-events: none; }
.veil svg { width: 100%; height: 100%; max-width: none; }

/* ---------------------------------------------------------------- toasts + dialog */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(460px, 100% - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: var(--cream); color: var(--ink); font-size: 0.9rem; opacity: 0; transform: translateY(8px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.toast img { filter: invert(1) brightness(0.25); flex: none; }
.toast.in { opacity: 1; transform: none; }
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 14, 15, 0.82); }
.modal-card { position: relative; width: min(520px, 100%); background: var(--ink-2); border: 1px solid var(--line-2); padding: 30px 26px 24px; }
.modal-card .input { margin: 6px 0 16px; font-family: var(--mono); font-size: 0.82rem; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 1px solid var(--line-2); background: none; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--cream); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- home: the film */
.film { position: relative; height: 760vh; }
.film-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--ink); }
.film-canvas, .film-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.film-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chapters { position: absolute; inset: 0; pointer-events: none; }
.chapter {
  position: absolute;
  left: max(28px, 6vw);
  bottom: max(56px, 11vh);
  width: min(520px, 44vw);
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
  text-shadow: 0 2px 24px rgba(15, 14, 15, 0.9), 0 0 2px rgba(15, 14, 15, 0.6);
}
.chapter > * { pointer-events: auto; }
.chapter h2 { font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.12; }
.chapter p { font-size: clamp(1rem, 1.2vw, 1.1rem); color: var(--cream-2); max-width: 34em; }
.chapter b { font-family: var(--mono); font-weight: 500; color: var(--cream); white-space: nowrap; }
.chapter-intro { bottom: auto; top: 50%; margin-top: -9rem; }
.wordmark { font-family: var(--serif); font-weight: 400; font-size: clamp(5rem, 13vw, 11.5rem); line-height: 0.85; letter-spacing: -0.035em; margin: 0 0 14px -0.03em; }
.chapter-lead { font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 2rem) !important; line-height: 1.3; color: var(--cream) !important; margin-bottom: 22px; }
.hero-ca { margin-bottom: 22px; }
.chapter-hint { display: flex; align-items: center; gap: 12px; font-size: 0.85rem !important; color: var(--muted) !important; }
.chapter-hint::before { content: ''; width: 1px; height: 30px; background: var(--cream); animation: hint 1.8s var(--ease) infinite; transform-origin: top; }
@keyframes hint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); } }
.chapter-end .row-actions { margin-top: 8px; gap: 18px; }
.film-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); }
.film-progress i { display: block; height: 100%; background: var(--cream); transform: scaleX(0); transform-origin: left; }
@media (max-width: 899px) {
  .film { height: 720vh; }
  .chapter { left: 18px; right: 18px; width: auto; bottom: 34px; }
  .chapter h2 { font-size: 1.75rem; }
  .chapter p { font-size: 0.98rem; }
  .chapter-intro { top: auto; bottom: 40px; margin-top: 0; }
  .wordmark { font-size: clamp(4.4rem, 24vw, 7rem); }
}

.below { padding: 100px 0 10px; }
.below-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 6vw, 90px); align-items: start; }
.below-grid > *, .builder > *, .docs > * { min-width: 0; }
.below-block > .muted { max-width: 46ch; }
@media (max-width: 899px) { .below-grid { grid-template-columns: 1fr; } }

.plain-table { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 0.95rem; }
.plain-table th { text-align: left; font-size: 0.78rem; font-weight: 500; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
.plain-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.num { text-align: right; white-space: nowrap; }
.co { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; min-width: 0; }
.co .tk { font-family: var(--mono); font-weight: 500; font-size: 0.92rem; }
.co .nm { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co:hover .tk { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 600px) { .plain-table .co { flex-direction: column; gap: 2px; } .plain-table .co .nm { max-width: 46vw; } }

.patterns { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line-2); }
.pattern { display: grid; grid-template-columns: 52px 1fr auto auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pattern .mini-flower { width: 52px; height: 52px; }
.pattern h3 { margin: 0 0 2px; font-size: 1.2rem; }
.pattern h3 .mono { font-family: var(--mono); font-size: 0.78rem; font-weight: 400; margin-left: 6px; }
.pattern p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.pattern > .mono { font-size: 0.95rem; }
@media (max-width: 560px) { .pattern { grid-template-columns: 44px 1fr auto; } .pattern .mini-flower { width: 44px; height: 44px; } .pattern .btn { grid-column: 2 / -1; justify-self: start; } }

/* ---------------------------------------------------------------- inner pages */
.page-head { padding: calc(var(--header-h) + 64px) 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.section-tight { padding: 28px 0 10px; display: grid; gap: 22px; }
.today-line { max-width: 72ch; color: var(--cream-2); margin-top: 12px; }
.today-line a { font-family: var(--mono); }

.market-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.search { position: relative; flex: 1 1 320px; max-width: 460px; }
.search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.6; }
.search input { width: 100%; padding: 0.75em 1em 0.75em 2.5em; background: var(--ink); border: 1px solid var(--line-2); }
.search input:focus { outline: none; border-color: var(--cream); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: none; padding: 0.42em 0.8em; font-size: 0.84rem; color: var(--cream-2); cursor: pointer; }
.chip small { color: var(--faint); margin-left: 4px; font-family: var(--mono); }
.chip:hover { border-color: var(--cream); color: var(--cream); }
.chip.on { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.chip.on small { color: rgba(30, 29, 30, 0.6); }
.table-wrap { padding: 4px 8px; overflow-x: auto; }
table.market { width: 100%; border-collapse: collapse; min-width: 640px; }
table.market th { text-align: left; padding: 10px; font-size: 0.78rem; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line-2); }
table.market th.num { text-align: right; }
table.market th button { border: 0; background: none; padding: 4px 0; font: inherit; color: inherit; cursor: pointer; }
table.market th button:hover, table.market th.sorted { color: var(--cream); }
table.market th.sorted[aria-sort='ascending'] button::after { content: ' ↑'; }
table.market th.sorted[aria-sort='descending'] button::after { content: ' ↓'; }
table.market td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.market tbody tr { cursor: pointer; transition: background-color 0.15s; }
table.market tbody tr:hover { background: rgba(230, 223, 211, 0.04); }
table.market tbody tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 0.2em 0.55em; border: 1px solid var(--line); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.spark { width: 96px; height: 28px; }
.add-btn { width: 32px; height: 32px; border: 1px solid var(--line-2); background: none; font-family: var(--mono); font-size: 1rem; line-height: 1; color: var(--cream); cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.add-btn:hover { border-color: var(--cream); }
.add-btn.on { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.empty-row { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .col-sector, .col-vol, .col-mcap, .col-1m, .col-spark { display: none; }
  table.market { min-width: 0; }
  .co { flex-direction: column; gap: 2px; }
  .co .nm { max-width: 40vw; font-size: 0.8rem; }
}

.crumbs { display: flex; gap: 10px; font-size: 0.86rem; color: var(--muted); margin-bottom: 24px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }
.stock-head h1 { font-size: clamp(2.2rem, 5.6vw, 4.4rem); }
.st-ticker { font-family: var(--mono); font-weight: 500; font-size: 0.7em; letter-spacing: 0; margin-right: 0.2em; vertical-align: 0.08em; }
.st-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 16px; margin: 4px 0 22px; }
.st-price .mono:first-child { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.st-price .chg { font-family: var(--mono); }
#st-in-indexes { margin-top: 14px; }
#st-period-ret { font-family: var(--mono); font-size: 0.85rem; font-weight: 400; margin-left: 10px; }
.chart-box { position: relative; height: 300px; }
.chart-box canvas { width: 100%; height: 100%; touch-action: pan-y; }
.chart-lg { height: 380px; }
@media (max-width: 600px) { .chart-box { height: 240px; } .chart-lg { height: 280px; } }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 30px; margin: 18px 0 0; }
.specs div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.specs dt { font-size: 0.82rem; color: var(--muted); }
.specs dd { margin: 0; font-family: var(--mono); font-size: 0.95rem; text-align: right; white-space: nowrap; }
.specs dd small { color: var(--muted); }
.peers { display: grid; }
.peer { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 16px; align-items: baseline; padding: 12px 4px; text-decoration: none; border-bottom: 1px solid var(--line); }
.peer:last-child { border-bottom: 0; }
.peer:hover { background: rgba(230, 223, 211, 0.04); }
.peer .tk { font-family: var(--mono); font-weight: 500; }
.peer .nm { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .peer { grid-template-columns: 60px 1fr auto; } .peer > :nth-child(3) { display: none; } }

/* builder */
.build-head { padding: calc(var(--header-h) + 52px) 0 24px; }
.build-head h1 { font-size: clamp(2.4rem, 5.4vw, 4.2rem); }
.editing-note { display: inline-block; font-size: 0.88rem; padding: 6px 12px; border: 1px solid var(--line-2); color: var(--cream-2); }
.builder { display: grid; grid-template-columns: minmax(330px, 410px) 1fr; gap: 22px; align-items: start; padding-bottom: 10px; }
.config { display: grid; gap: 20px; }
.field { display: grid; }
.field-row { display: flex; gap: 12px; }
.field.grow { flex: 1; }
.field.sym { width: 120px; }
.sym-wrap { position: relative; display: block; }
.sym-wrap > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--mono); }
.sym-wrap .input { padding-left: 1.6em; text-transform: uppercase; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.add-row { display: flex; gap: 8px; }
.add-row .input { flex: 1; min-width: 0; }
.items { list-style: none; margin: 12px 0 0; padding: 0; max-height: 400px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; border-top: 1px solid var(--line); }
.item { padding: 10px 2px 6px; border-bottom: 1px solid var(--line); }
.item.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { background-color: rgba(230, 223, 211, 0.1); } 100% { background-color: transparent; } }
.item-top { display: flex; align-items: center; gap: 10px; }
.item-name { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; text-decoration: none; }
.item-name b { font-family: var(--mono); font-weight: 500; font-size: 0.9rem; }
.item-name span { color: var(--muted); font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-name:hover b { text-decoration: underline; text-underline-offset: 3px; }
.item-ret { font-family: var(--mono); font-size: 0.8rem; }
.item-w { font-size: 0.88rem; min-width: 52px; text-align: right; }
.item-x { width: 26px; height: 26px; border: 1px solid transparent; background: none; color: var(--muted); font-size: 1.05rem; line-height: 1; cursor: pointer; }
.item-x:hover { border-color: var(--line-2); color: var(--cream); }
.items-empty { font-size: 0.92rem; margin: 12px 0 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--line-2); background: none; cursor: pointer; text-align: left; }
.preset:hover { border-color: var(--cream); }
.preset .mini-flower { width: 28px; height: 28px; }
.preset-name { font-size: 0.86rem; }
.preset-ret { font-family: var(--mono); font-size: 0.74rem; }
.preset-ret small { color: var(--faint); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.stage { display: grid; gap: 22px; min-width: 0; }
.bloom { position: relative; padding: 0; overflow: hidden; }
.bloom-head { position: absolute; z-index: 2; left: 22px; right: 22px; top: 18px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; pointer-events: none; }
.bloom-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bloom-symbol { font-size: 1rem; }
.bloom-level { font-size: 1.8rem; }
.bloom-ret { font-size: 0.9rem; }
.bloom-legend { max-width: 34ch; margin: 0; text-align: right; }
.bloom-canvas { position: relative; height: clamp(380px, 46vw, 520px); }
.bloom-canvas canvas { width: 100%; height: 100%; }
.bloom-svg { width: 70%; height: 80%; margin: 60px auto 0; }
.bloom-empty { position: absolute; left: 0; right: 0; bottom: 28px; text-align: center; color: var(--muted); margin: 0; }
.bloom-tip { position: absolute; top: 0; left: 0; z-index: 3; min-width: 150px; padding: 10px 12px; background: var(--cream); color: var(--ink); font-size: 0.82rem; line-height: 1.4; pointer-events: none; }
.bloom-tip b { display: block; font-family: var(--mono); font-size: 1rem; font-weight: 500; }
.bloom-tip span { display: block; color: rgba(30, 29, 30, 0.7); margin-bottom: 4px; }
.bloom-tip-row { display: flex; justify-content: space-between; gap: 12px; }
.bloom-tip em { font-style: normal; color: rgba(30, 29, 30, 0.6); }
.bloom-tip i { font-style: normal; font-family: var(--mono); }
.bloom-tip i.down { color: rgba(30, 29, 30, 0.6); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.86rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend b { color: var(--cream); font-family: var(--mono); font-weight: 500; }
.sw { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--cream); }
.sw-dash { border-top: 1px dashed var(--faint); }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } .stage { order: -1; } .bloom-legend { text-align: left; } }
@media (max-width: 520px) { .field-row { flex-direction: column; } .field.sym { width: 100%; } .bloom-level { font-size: 1.45rem; } .bloom-legend { display: none; } }

/* my indexes */
.garden-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: 10px; }
.garden { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.idx-card { display: grid; gap: 14px; align-content: start; }
.idx-top { display: flex; gap: 14px; align-items: center; }
.idx-top .mini-flower { width: 60px; height: 60px; flex: none; }
.idx-top h3 { margin: 0 0 2px; }
.idx-top p { margin: 0; }
.idx-sym { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin: 0 0 2px; }
.idx-spark { width: 100%; height: 54px; }
.idx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; border-top: 1px solid var(--line); padding-top: 10px; }
.idx-stats dt { font-size: 0.76rem; color: var(--muted); }
.idx-stats dd { margin: 3px 0 0; font-family: var(--mono); font-size: 0.95rem; }
.idx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.idx-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.garden-empty { text-align: center; display: grid; justify-items: center; gap: 4px; padding: 50px 24px; }
.garden-empty img { margin-bottom: 10px; }
.import { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.import h2, .import p { margin: 0; }
.import .add-row { flex: 1 1 360px; max-width: 560px; }

/* docs */
.docs { display: grid; grid-template-columns: 230px 1fr; gap: clamp(28px, 5vw, 70px); padding: 30px 0 10px; align-items: start; }
.docs-side { position: sticky; top: calc(var(--header-h) + 24px); }
.docs-nav { display: grid; border-left: 1px solid var(--line); }
.docs-nav a { padding: 6px 0 6px 16px; margin-left: -1px; border-left: 1px solid transparent; font-size: 0.92rem; text-decoration: none; color: var(--muted); }
.docs-nav a:hover { color: var(--cream); }
.docs-nav a.active { color: var(--cream); border-left-color: var(--cream); }
.docs-picker-wrap { display: none; }
.docs-body { max-width: 720px; }
.docs-body section { padding-bottom: 44px; margin-bottom: 44px; border-bottom: 1px solid var(--line); }
.docs-body section:last-child { border-bottom: 0; }
.docs-body h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.docs-body ul, .docs-body ol { padding-left: 1.3em; margin: 0 0 1em; }
.docs-body li { margin-bottom: 0.5em; }
.docs-body li::marker { color: var(--faint); }
.callout { padding: 14px 18px; border-left: 2px solid var(--cream); background: var(--ink-2); font-size: 0.95rem; color: var(--cream-2); }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0 0; font-size: 0.95rem; }
.doc-table th { text-align: left; font-size: 0.8rem; font-weight: 500; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-2); }
.doc-table td { padding: 10px 10px 10px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-table td:first-child { white-space: nowrap; font-weight: 500; }
.doc-dl { margin: 0; }
.doc-dl dt { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin-top: 18px; }
.doc-dl dd { margin: 4px 0 0; color: var(--cream-2); }
details { padding: 14px 0; border-bottom: 1px solid var(--line); }
summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; font-weight: 500; font-size: 1.02rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-family: var(--mono); color: var(--muted); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin: 10px 0 0; color: var(--cream-2); }
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; }
  .docs-side { position: sticky; top: calc(var(--header-h) + 8px); z-index: 5; background: var(--ink); padding: 8px 0; }
  .docs-nav { display: none; }
  .docs-picker-wrap { display: block; }
}

.page-404 { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; border-bottom: 0; }
.page-404 .row-actions { margin-top: 18px; }

/* private CA page */
body.admin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.admin-main { width: min(540px, 100%); }
.admin-card { display: grid; gap: 10px; padding: 36px 32px 30px; }
.admin-card img { width: 36px; height: auto; margin-bottom: 4px; }
.admin-card form { display: grid; gap: 12px; margin-top: 6px; }
.admin-status { min-height: 1.4em; margin: 6px 0 0; font-size: 0.92rem; }
.admin-status.ok { color: var(--cream); }
.admin-status.err { color: var(--cream); padding: 10px 12px; border: 1px solid var(--line-2); border-left: 2px solid var(--cream); }
.admin-preview { display: grid; gap: 10px; justify-items: start; padding: 18px 0 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.admin-preview p { margin: 0; }
#admin-locked h1 { font-size: 2.6rem; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.mini-flower { width: 48px; height: 48px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
