/* Bazi Insight: the site's whole stylesheet, handwritten. Light theme only for now; every colour
   is a token below, so a dark theme only has to redefine them. Nothing here loads from outside. */

@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/spectral-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/spectral-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/spectral-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("vendor/fonts/spectral-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/spectral-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/spectral-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Only the Chinese characters the site uses: regenerate when new ones appear (vendor/README.md). */
@font-face { font-family: "Noto Serif SC"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("vendor/fonts/noto-serif-sc-500-subset.woff2") format("woff2"); }

:root {
  --ink: #1c1a17;
  --ink-soft: #6b6459;
  --ink-faint: #a0988a;
  --ground: #f7f4ee;
  --panel: #fffefb;
  --fill: #f1ece2;
  --fill-hover: #e9e3d6;
  --line: #e3ddd1;
  --accent: #8c3b2e;
  --accent-dark: #742f24;
  --accent-soft: #f4e9e4;
  --gold: #c9a227;
  --bad: #a33227;
  --radius: 10px;
  --radius-small: 7px;
  --font: "Spectral", "Noto Serif SC", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-han: "Noto Serif SC", "Songti SC", serif;
  --bar-height: 3.5rem;
  --side-width: 13.5rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--ground); color: var(--ink);
  font: 16px/1.6 var(--font);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-weight: 600; line-height: 1.2; margin: 0; }
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.han { font-family: var(--font-han); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Development strip --- */
.dev-bar { display: flex; align-items: center; gap: .6rem; padding: .25rem 1.25rem;
  background: var(--ink); color: var(--fill); font-size: .8rem; }
.dev-bar strong { color: var(--gold); letter-spacing: .06em; text-transform: uppercase; font-size: .72rem; }
.dev-bar a { color: var(--fill); padding: 0 .5rem; border-radius: 4px; }
.dev-bar a:hover { background: #3a362f; color: #fff; }
.dev-bar a[aria-current] { background: var(--gold); color: var(--ink); font-weight: 600; }

/* --- Top bar --- */
.bar { display: flex; align-items: center; gap: 2rem; min-height: var(--bar-height); padding: 0 1.25rem;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.wordmark { font-size: 1.2rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.wordmark:hover { color: var(--ink); }
.top-menu { display: flex; gap: 1.5rem; align-self: stretch; }
.top-menu a { display: flex; align-items: center; color: var(--ink-soft); border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.top-menu a:hover { color: var(--ink); }
.top-menu a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; color: var(--ink-soft); white-space: nowrap; }
.account a { color: var(--ink-soft); }
.account a:hover { color: var(--ink); }
.plan-tag { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 0 .45rem; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.burger { display: none; width: 2.5rem; height: 2.5rem; margin-left: -.5rem; padding: 0; border: 0; border-radius: var(--radius-small);
  background: none; cursor: pointer; align-items: center; justify-content: center; }
.burger:hover { background: var(--fill); }
.burger svg { display: block; }

/* --- Sidebar and page --- */
.layout { flex: 1; display: flex; width: 100%; max-width: 88rem; margin: 0 auto; }
.side { flex: 0 0 var(--side-width); padding: 2.25rem 0 2rem 1.25rem; }
.side-top { display: none; }
.side-title { margin: 0 0 .5rem .75rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list a { display: block; padding: .4rem .75rem; border-radius: var(--radius-small); color: var(--ink-soft); }
.side-list a:hover { background: var(--fill); color: var(--ink); }
.side-list a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.scrim { display: none; }
.content { flex: 1; min-width: 0; padding: 2rem 1.25rem 3rem 2.5rem; }

.page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.page-lead { margin: .5rem 0 0; color: var(--ink-soft); font-size: 1.05rem; }

.panel { margin-top: 1.5rem; padding: 1rem 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* --- Form controls --- */
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.25rem; }
.field-label { display: block; margin-bottom: .3rem; font-size: .85rem; color: var(--ink-soft); }
.input { height: 2.6rem; width: 9rem; padding: 0 .75rem; border: 1px solid transparent; border-radius: var(--radius-small);
  background: var(--fill); outline: none; font-variant-numeric: lining-nums tabular-nums; }
.input:hover { background: var(--fill-hover); }
.input:focus { background: var(--panel); border-color: var(--accent); }
.segmented { display: flex; gap: 2px; width: fit-content; height: 2.6rem; padding: 3px; border-radius: var(--radius-small); background: var(--fill); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; align-items: center; height: 100%; padding: 0 .9rem; border-radius: 5px; color: var(--ink-soft); }
.segmented label:hover span { color: var(--ink); }
.segmented input:checked + span { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(28 26 23 / .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.button { height: 2.6rem; padding: 0 1.4rem; border: 0; border-radius: var(--radius-small); background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.button:hover { background: var(--accent-dark); }

/* One line of controls: what is known as text, and each control opens only when needed */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; }
.person.editing { flex: 1 1 100%; }
.person-summary { display: inline-flex; align-items: center; gap: .55rem; min-height: 2.6rem; padding: 0 .75rem; margin-left: -.75rem;
  border: 0; border-radius: var(--radius-small); background: none; cursor: pointer; font-weight: 600; text-align: left; }
.person-summary svg { flex: none; color: var(--ink-faint); }
.person-summary:hover { background: var(--fill); }
.person-summary:hover svg { color: var(--accent); }
.text-button { height: 2.6rem; padding: 0 .4rem; border: 0; background: none; color: var(--ink-soft); cursor: pointer; }
.text-button:hover { color: var(--ink); }

.period { position: relative; }
.period-toggle { display: inline-flex; align-items: center; gap: .5rem; height: 2.6rem; padding: 0 .85rem; border: 0;
  border-radius: var(--radius-small); background: var(--fill); cursor: pointer; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.period-toggle:hover { background: var(--fill-hover); }
.period-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.popover { position: absolute; z-index: 20; top: calc(100% + .4rem); left: 0; width: max-content; padding: 1rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgb(28 26 23 / .16); }
.popover-dates { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin-top: .85rem; }
.limit { margin: .7rem 0 0; font-size: .9rem; color: var(--ink-faint); }
.at-time { display: flex; align-items: center; gap: .45rem; }
.at-word { color: var(--ink-soft); }

/* Locked by the plan: shown, faded, with a padlock; the line under the controls says how to see more */
.lock { flex: none; vertical-align: -1px; color: var(--ink-faint); }
.segmented label.locked { cursor: not-allowed; }
.segmented label.locked span, .segmented label.locked:hover span { gap: .35rem; color: var(--ink-faint); }
.period-toggle:disabled { cursor: default; background: var(--fill); color: var(--ink); }
.nav-arrow:disabled, .month-grid button:disabled, .nav-arrow:disabled:hover, .month-grid button:disabled:hover { opacity: .35; background: none; cursor: not-allowed; }
.window-note { margin: .9rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.window-note a { margin-left: .25rem; font-weight: 600; color: var(--accent); text-underline-offset: 3px; }
.blurred { filter: blur(12px); opacity: .55; user-select: none; pointer-events: none; }

.shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem 1.1rem; font-size: .95rem; }
.shortcuts button { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; }
.shortcuts button:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }

/* Typed date and time: parts in one filled box */
.input-name { width: 13rem; }
.parts { display: flex; align-items: center; width: fit-content; height: 2.6rem; padding: 0 .55rem; border: 1px solid transparent;
  border-radius: var(--radius-small); background: var(--fill); }
.parts:hover { background: var(--fill-hover); }
.parts:focus-within { background: var(--panel); border-color: var(--accent); }
.parts input { padding: 0; border: 0; outline: none; background: none; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.parts input::placeholder { color: var(--ink-faint); }
.parts input:disabled { color: var(--ink-faint); }
.seg-2 { width: 1.9rem; }
.seg-4 { width: 3rem; }
.sep { color: var(--ink-faint); }
.check { display: flex; align-items: center; gap: .45rem; height: 2.6rem; color: var(--ink-soft); cursor: pointer; }
.check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }

/* --- Cards, pillars --- */
.card { margin-top: 1.25rem; padding: 1.25rem 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.result > .card:first-child { margin-top: 0; }
.card-title { font-size: 1.1rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.card-note { margin: .75rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.natal { display: flex; gap: 1.25rem; margin-top: 1rem; }
.gua { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 6.5rem; padding: .75rem 1rem;
  border-radius: var(--radius-small); background: var(--fill); text-align: center; }
.gua p { margin: 0; }
.gua-number { margin-top: .5rem !important; font-size: 2.6rem; font-weight: 600; line-height: 1; }
.trigram { display: block; flex: none; width: 3.4rem; height: auto; margin-top: .6rem; fill: currentColor; }
.gua-name { margin-top: .5rem !important; font-size: 1.3rem; color: var(--ink-soft); }
.gua-word { margin-top: .4rem !important; font-size: .85rem; white-space: nowrap; }
.gua-trigram { margin-top: .5rem !important; font-size: .9rem; white-space: nowrap; }
/* Listed oldest first, shown from right to left */
.pillar-row { flex: 1; min-width: 0; display: grid; gap: .25rem; direction: rtl; }
.pillar-row > * { direction: ltr; }
.pillar-row-natal { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pillar-row-four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: .85rem; }
.moment-line { margin: 0 0 1.25rem; font-size: 1.05rem; color: var(--ink-soft); }
.moment-line strong { font-weight: 600; color: var(--ink); }
/* Home: the day's energy in a wide column, short reference items beside it */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.5rem; align-items: start; }
.home-main .moment-line { margin: 1rem 0 0; }
.home-side > .card:first-child { margin-top: 0; }
.home-side .details > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
.card-invite { padding: 1.5rem; text-align: center; background: var(--accent-soft); border-color: var(--accent); }
.invite-title { font-size: 1.5rem; }
.card-invite p { margin: .6rem 0 1.1rem; font-size: 1.05rem; line-height: 1.45; }
.button-link { display: flex; align-items: center; justify-content: center; height: 3rem; font-size: 1.05rem; color: #fff; }
.button-link:hover { color: #fff; }
.element-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.4; color: var(--ink-soft); }
.element-grid strong { font-weight: 600; color: var(--ink); }
.chart-flow { width: 100%; height: 20rem; margin-top: .5rem; }
.element-list { margin: .9rem 0 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.4; }
.element-list li { padding: .3rem 0; border-top: 1px solid var(--line); color: var(--ink-soft); }
.element-list strong { font-weight: 600; color: var(--ink); }
.chart-caption { margin: .25rem 0 0; font-size: .85rem; text-align: center; color: var(--ink-soft); }
.donut-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .2rem .5rem; margin: .5rem 0 0; padding: 0; list-style: none; font-size: .85rem; white-space: nowrap; }
.link-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.link-list li { padding: .35rem 0; }
.link-list a { text-decoration: underline; text-underline-offset: 3px; }
.result:empty { display: none; }
.pillar-row-luck { grid-template-columns: repeat(12, minmax(0, 1fr)); margin-top: .85rem; }
.pillar { display: flex; flex-direction: column; padding: .7rem .15rem; border-radius: var(--radius-small); text-align: center; }
/* Above the stem: the stem's colour. Under the branch's name, twice as thick: its main qi's colour, with any sub qi at the ends. */
.pillar-line { display: block; flex: none; width: 80%; height: 3px; margin: .4rem auto 0; border-radius: 2px; }
.pillar-qi { display: flex; flex: none; gap: 2px; width: 80%; height: 6px; margin: auto auto 0; }
.pillar-qi > span { display: block; min-width: 0; border-radius: 2px; }
.qi-sub { flex: 1 1 0; }
.qi-main-0 { flex: 1 1 0; }
.qi-main-1 { flex: 7 1 0; }
.qi-main-2 { flex: 6 1 0; }
.pillar-name { margin-bottom: .4rem !important; }
.pillar p { margin: 0; }
.pillar.marked { background: var(--accent-soft); }
.pillar.marked .pillar-label { color: var(--accent); font-weight: 600; }
.pillar-label { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.pillar-glyph { margin-top: .4rem !important; font-size: 2.6rem; line-height: 1.15; }
.pillar-name { margin-top: .4rem !important; font-size: .85rem; line-height: 1.25; color: var(--ink-soft); }
.pillar-row-luck .pillar-label { font-size: .72rem; font-variant-numeric: lining-nums tabular-nums; }
.pillar-row-luck .pillar-glyph { font-size: 1.7rem; margin-top: .3rem !important; }
.pillar-row-luck .pillar-name { font-size: .72rem; }
.details { margin: .6rem 0 0; }
.details > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.details > div:first-child { border-top: 0; }
.details dt { color: var(--ink-soft); }
.details dd { margin: 0; }
.swatch { display: inline-block; width: .8rem; height: .8rem; margin-right: .45rem; border-radius: 2px; box-shadow: inset 0 0 0 1px rgb(28 26 23 / .35); vertical-align: -.05rem; }
.two-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-top: .75rem; }
.chart-subtitle { font-size: .9rem; font-weight: 400; color: var(--ink-soft); text-align: center; }
.chart-half { width: 100%; height: 22rem; margin-top: .4rem; }

/* --- Natal vs moment --- */
.compare { width: 100%; border-collapse: collapse; }
.compare th { padding: 0 1rem .5rem 0; font-size: .85rem; font-weight: 600; text-align: left; }
.compare td { padding: .55rem 1rem .55rem 0; border-top: 1px solid var(--line); vertical-align: middle; }
.compare th:last-child, .compare td:last-child { padding-right: 0; }
.compare-stem { width: 2.2rem; color: var(--ink-soft); font-size: 1.15rem; }
.compare-name { width: 34%; }
.compare-status { display: block; font-size: .8rem; line-height: 1.3; color: var(--ink-faint); }
.compare-absent tr:first-child td { border-top: 2px solid var(--ink-soft); }
.meter { display: flex; align-items: center; gap: .6rem; }
.meter-track { flex: 1; height: .8rem; overflow: hidden; border-radius: 3px; background: var(--fill); }
.meter-fill { height: 100%; }
.meter-value { width: 2.2rem; font-size: .9rem; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.input-datetime { width: 11rem; }

/* --- 10K View --- */
.month-nav { display: flex; align-items: center; gap: .25rem; }
.month-gods { white-space: nowrap; }
.god { white-space: nowrap; font-variant-numeric: lining-nums; }
.dot { display: inline-block; width: .6rem; height: .6rem; margin-right: .25rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(28 26 23 / .2); }
.nav-arrow { width: 2.6rem; height: 2.6rem; padding: 0; border: 0; border-radius: var(--radius-small); background: none; color: var(--ink-soft); font: 2rem/1 system-ui, sans-serif; cursor: pointer; }
.nav-arrow:hover { background: var(--fill); color: var(--ink); }
.month-toggle { font-size: 1.15rem; font-weight: 600; }
.month-popover { left: 50%; transform: translateX(-50%); width: 18rem; }
.year-row { display: flex; align-items: center; justify-content: center; gap: .3rem; }
.year-input { width: 5.5rem; text-align: center; font-weight: 600; }
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; margin-top: .75rem; }
.month-grid button { height: 2.3rem; padding: 0; border: 0; border-radius: var(--radius-small); background: none; cursor: pointer; }
.month-grid button:hover { background: var(--fill); }
.month-grid button[aria-current] { background: var(--accent); color: #fff; font-weight: 600; }
.term-list { list-style: none; margin: .75rem 0 0; padding: 0 0 0 1rem; border-left: 3px solid var(--gold); }
.term-list li + li { margin-top: .75rem; }
.term-list p { margin: 0; }
.term-list strong { font-weight: 600; }
.term-time { color: var(--accent); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.term-end { font-size: .9rem; color: var(--ink-soft); }
.month-table { width: 100%; margin-top: .6rem; border-collapse: collapse; }
.month-table th { padding: .4rem .75rem .5rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft); text-align: left; }
.month-table td { padding: .5rem .75rem; border-top: 1px solid var(--line); }
.month-table .weekend td { background: var(--ground); }
.month-day { color: var(--ink-soft); font-weight: 600; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.star { white-space: nowrap; }

/* --- Long text: Privacy --- */
.prose { max-width: 46rem; }
.prose-date { margin: .3rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.prose p { margin: 1rem 0 0; }
.prose h2 { margin-top: 2rem; font-size: 1.25rem; }
.prose ul { margin: .6rem 0 0; padding-left: 1.4rem; }
.prose li + li { margin-top: .35rem; }

/* --- Results --- */
.result { margin-top: 1.5rem; }
.result-note { margin: 0 0 .6rem; font-size: .9rem; color: var(--ink-soft); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1.5rem; }
.chart-panel { padding: 1.25rem 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-title { text-align: center; font-size: 1.1rem; }
.chart { width: 100%; height: 32rem; margin-top: .75rem; }

.notice { margin-top: 1.5rem; padding: .9rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); }
.notice a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-left: .4rem; }
.notice-error { color: var(--bad); }

.footer { padding: 1.25rem; border-top: 1px solid var(--line); text-align: center; font-size: .85rem; color: var(--ink-soft); }
.footer p { margin: 0; }
.footer a { color: var(--ink-soft); }

/* --- Calendars --- */
.flatpickr-calendar { font-family: var(--font); box-shadow: 0 6px 24px rgb(28 26 23 / .16); border-radius: var(--radius); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus { background: var(--accent); border-color: var(--accent); }
.flatpickr-day.today { border-color: var(--gold); }
.flatpickr-day.today:hover { background: var(--gold); border-color: var(--gold); }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { font-family: var(--font); font-weight: 600; }

/* --- Narrow screens: the menus move into the burger --- */
@media (min-width: 52.01rem) {
  .side-empty { display: none; }
}
/* Too narrow for three columns: the right-hand column drops below the main one */
@media (max-width: 75rem) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-side > .card:first-child { margin-top: 1.25rem; }
}
@media (max-width: 52rem) {
  .bar { gap: .75rem; padding: 0 1rem; }
  .burger { display: flex; }
  .top-menu { display: none; }
  .account .email { display: none; }
  .side { position: fixed; z-index: 100000; inset: 0 auto 0 0; width: min(18rem, 85vw); padding: 1.25rem .9rem;
    overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
    transform: translateX(-100%); visibility: hidden; transition: transform .18s ease-out, visibility .18s; }
  .menu-open .side { transform: none; visibility: visible; }
  .side-top { display: block; margin-bottom: 1.25rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
  .side-title { margin-left: .75rem; }
  .menu-open .scrim { display: block; position: fixed; z-index: 99999; inset: 0; background: rgb(28 26 23 / .35); }
  .menu-open { overflow: hidden; }
  .content { padding: 1.5rem 1rem 2.5rem; }
  .panel, .chart-panel { padding: 1rem; }
  .controls .button { width: 100%; }
  .panel { position: relative; }
  .month-popover { left: 1rem; right: 1rem; width: auto; transform: none; }
  .month-table, .month-table tbody { display: block; }
  .month-table thead { display: none; }
  .month-table tr { display: block; padding: .6rem .5rem; border-top: 1px solid var(--line); }
  .month-table td { display: block; padding: .05rem 0; border: 0; background: none !important; }
  .month-table .weekend { background: var(--ground); }
  .compare, .compare thead, .compare tbody { display: block; }
  .compare tr { display: grid; grid-template-columns: 2rem 1fr 1fr; column-gap: .75rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
  .compare thead tr { border-top: 0; padding: 0 0 .3rem; }
  .compare th, .compare td { display: block; width: auto; padding: 0; border: 0; }
  .compare-absent tr:first-child { border-top: 2px solid var(--ink-soft); }
  .compare-absent tr:first-child td { border-top: 0; }
  .compare-stem { grid-row: 1; grid-column: 1; }
  .compare-name { grid-row: 1; grid-column: 2 / 4; }
  .compare td:nth-child(3), .compare th:nth-child(3) { grid-row: 2; grid-column: 2; margin-top: .3rem; }
  .compare td:nth-child(4), .compare th:nth-child(4) { grid-row: 2; grid-column: 3; margin-top: .3rem; }
  .compare thead .compare-stem, .compare thead .compare-name { display: none; }
  .card { padding: 1rem; }
  .natal { flex-direction: column; }
  .gua { flex-direction: row; gap: .9rem; min-width: 0; padding: .5rem .9rem; }
  .gua-number, .gua-name, .gua-word, .gua-trigram { margin-top: 0 !important; }
  .gua-number { font-size: 1.8rem; }
  .gua { flex-wrap: wrap; justify-content: center; gap: .3rem .8rem; }
  .trigram { width: 2.2rem; margin-top: 0; }
  .pillar-label { font-size: .68rem; }
  .pillar-glyph { font-size: 1.75rem; }
  .pillar-name { font-size: .72rem; }
  .pillar-row-luck { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pillar-row-luck .pillar-label { font-size: .62rem; }
  .two-charts, .element-grid { grid-template-columns: minmax(0, 1fr); }
  /* Phone: Daily Details straight after the pillars, then the charts, then the rest */
  .home-grid { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .home-main, .home-side, #moment, #daily-details { display: contents; }
  .home-grid > * > .page-title { order: 1; }
  .home-grid .page-lead { order: 2; }
  .moment-line { order: 3; }
  .card-invite { order: 4; }
  .card-pillars { order: 5; }
  .card-details { order: 6; }
  .card-snapshot { order: 7; }
  .card-flow { order: 8; }
  .card-resources { order: 9; }
  .home-grid .notice { order: 5; }
  .donut-legend { grid-template-columns: repeat(auto-fit, minmax(4.6rem, 1fr)); }
  .details > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .period { position: static; }
  .popover { left: 1rem; right: 1rem; top: auto; width: auto; margin-top: .4rem; }
  .person-summary { margin-left: -.5rem; padding: 0 .5rem; }
  .chart { height: 26rem; }
}

/* Life view (/life), after docs/ideas/life-view-mockup.html */
.life-busy { opacity: 0; transition: opacity .2s; }
.life-busy.htmx-request { opacity: 1; }
.life-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.life-god { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.life-dm { margin-left: .2rem; color: var(--accent); }
.life-pinyin { font-weight: 400; font-style: italic; color: var(--ink-soft); font-size: 1.25rem; }
.life-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .9rem; margin-top: .6rem; }
.life-big { font-size: 3rem; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.life-delta { font-size: 1.15rem; font-variant-numeric: lining-nums tabular-nums; }
.life-delta.down { color: var(--bad); }   /* up: config/web.yaml life.up_colour */
.life-delta-what { color: var(--ink-faint); font-size: .9rem; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; height: 2.3rem; min-width: 3rem; padding: 0 .8rem;
  border: 0; border-radius: 999px; background: var(--fill); color: var(--ink-soft); font: inherit; cursor: pointer; font-variant-numeric: lining-nums; }
.pill:hover { background: var(--fill-hover); color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--panel); font-weight: 600; }
.pill:disabled { cursor: not-allowed; color: var(--ink-faint); background: var(--fill); }
.life-gran { margin: .8rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.life-chart { height: 320px; margin-top: .4rem; }
.life-stats { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 2rem; margin-top: .6rem; }
.stat { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: lining-nums tabular-nums; }
.stat b { font-weight: 600; }
.stat small { margin-left: .35rem; color: var(--ink-faint); }
@media (max-width: 640px) {
  .life-stats { grid-template-columns: 1fr; }
  .life-big { font-size: 2.4rem; }
}

/* Life view by period (/life-view) */
.lv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; }
.lv-anchor, .lv-stops { display: flex; flex-wrap: wrap; gap: .4rem; }
.lv-anchor { padding-right: 1rem; border-right: 1px solid var(--line); }
.lv-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; margin-top: 1rem; font-size: 1.05rem; }
.lv-crumb { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.lv-crumb:hover { text-decoration: underline; }
.lv-sep { color: var(--ink-faint); }
.lv-here { font-weight: 600; }
.lv-period { display: flex; align-items: center; gap: .25rem; margin-left: -.6rem; }
.lv-dates { color: var(--ink-soft); font-variant-numeric: lining-nums tabular-nums; }
.lv-drill { cursor: pointer; }
@media (max-width: 640px) { .lv-anchor { padding-right: 0; border-right: 0; } }

/* Natal vs moment, "Compared with" (docs/ideas/compare-control-mockup.html) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.compare-word { color: var(--ink-soft); }
.compare-pop { min-width: 31rem; }
.pop-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; margin-top: .85rem; }
.pop-label { font-size: .85rem; color: var(--ink-soft); cursor: pointer; }
.nav-btn { width: 2.6rem; height: 2.6rem; border: 0; border-radius: var(--radius-small); background: var(--fill); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.nav-btn:hover { background: var(--fill-hover); }
.chip { display: inline-flex; align-items: center; gap: .35rem; height: 2.6rem; padding: 0 .85rem; border: 0; border-radius: var(--radius-small);
  background: var(--fill); color: var(--ink); font: inherit; cursor: pointer; }
.chip:hover { background: var(--fill-hover); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip.locked { color: var(--ink-faint); cursor: not-allowed; }
.luck-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; margin-top: .85rem; }
.luck-chips .chip { flex-direction: column; align-items: flex-start; gap: 0; height: auto; padding: .45rem .6rem; line-height: 1.3; }
.luck-chips .chip small { color: var(--ink-soft); font-size: .8rem; font-weight: 400; }
.luck-chips .chip.current { box-shadow: inset 0 0 0 1.5px var(--accent); }
.luck-chips .span-line { grid-column: 1 / -1; }
.span-line { margin: .7rem 0 0; font-size: .9rem; color: var(--ink-soft); }
@media (max-width: 640px) {
  .compare-pop { min-width: 0; }
  .luck-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
