/* Site-wide base components (UI_COMPONENT_DECISIONS step 1). Structure and motion are adapted from the
   Uiverse.io pieces named on each block (all MIT); colours, radii and timing come from VISUAL_SPEC §3 tokens.
   Every component is keyboard-usable, shows a focus ring, and goes still under prefers-reduced-motion. */

.ui-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:where(.ui-btn, .ui-check, .ui-tick, .ui-seg-tab, .ui-menu-item, .ui-delete, .ui-search-button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Buttons ---------------------------------------------------------------------------------------- */
/* P23 secondary — From Uiverse.io by ErzenXz (MIT): plain ground, thin edge, greys on hover, presses in. */
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: fit-content; min-height: 36px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-small);
  line-height: 1; white-space: nowrap; cursor: pointer; user-select: none; box-shadow: none;
  transition: background-color 200ms ease-in-out, border-color 200ms ease-in-out, color 200ms ease-in-out, transform 200ms ease-in-out; }
.ui-btn:hover { background: var(--sunken); }
.ui-btn:active { transform: scale(.95); }
.ui-btn:disabled, .ui-btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
@media (max-width: 767px) { .ui-btn { min-height: 44px; } }

/* P31 primary — From Uiverse.io by cssbuttons-io (MIT): a capsule that lifts 2px and fills with the accent on hover. */
.ui-btn.is-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent);
  transition: background-color 300ms ease, color 300ms ease, transform 300ms ease, box-shadow 300ms ease; }
.ui-btn.is-primary:hover { background: var(--accent-deep, var(--accent)); transform: translateY(-2px); box-shadow: 0 4px 10px var(--accent-soft); }
.ui-btn.is-primary:active { transform: translateY(-1px); }

/* P84 key cap (sign-in only) — From Uiverse.io by elijahgummer (MIT): stacked shadows give it depth; pressing sinks it. */
.ui-btn.is-key { min-height: 44px; padding: 0 24px; border: 0; border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 16px; font-weight: 600;
  box-shadow: inset 0 1px 0 0 var(--paper), 0 1px 0 0 var(--line), 0 2px 0 0 var(--line), 0 4px 0 0 color-mix(in srgb, var(--line) 80%, var(--muted)),
    0 5px 0 0 color-mix(in srgb, var(--line) 70%, var(--muted)), 0 6px 0 0 color-mix(in srgb, var(--line) 60%, var(--muted)), 0 6px 8px 0 color-mix(in srgb, var(--line) 70%, transparent);
  transition: transform 150ms ease, box-shadow 150ms ease; }
.ui-btn.is-key:hover { background: var(--paper); }
.ui-btn.is-key:active { transform: translateY(3px);
  box-shadow: inset 0 1px 0 0 var(--paper), 0 1px 0 0 var(--line), 0 1px 0 0 var(--line), 0 2px 0 0 color-mix(in srgb, var(--line) 80%, var(--muted)),
    0 2px 0 0 color-mix(in srgb, var(--line) 70%, var(--muted)), 0 3px 0 0 color-mix(in srgb, var(--line) 60%, var(--muted)), 0 3px 5px 0 color-mix(in srgb, var(--line) 70%, transparent); }

/* ---- Inputs ----------------------------------------------------------------------------------------- */
/* P35 / P4 stand-alone field — From Uiverse.io by reglobby (P35) and ozgeozkaraa01 (P4) (MIT):
   a soft ground that turns to paper with an accent edge and a faint ring on hover / focus. P4 adds a leading icon. */
.ui-field { position: relative; display: inline-flex; align-items: center; width: 100%; max-width: 320px; }
.ui-input { width: 100%; min-height: 44px; padding: 0 14px; border: 2px solid transparent; border-radius: 10px; outline: none; background: var(--sunken); color: var(--ink);
  font: inherit; transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease; }
.ui-input::placeholder { color: var(--muted); }
.ui-input:hover, .ui-input:focus { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 4px var(--accent-soft); }
.ui-field.has-icon .ui-input { padding-left: 42px; }
.ui-field-icon { position: absolute; left: 14px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ui-field-label { display: block; margin: 0 0 6px; color: var(--muted); font-size: var(--text-small); }

/* P3 in-place edit — From Uiverse.io by dovatgabriel (MIT): just an underline; the label floats up and the
   accent line grows from the middle when focused. Used for 「点了才编辑」 inside pages. */
.ui-inline { position: relative; display: inline-block; min-width: 8ch; padding-top: 16px; }
.ui-inline input { display: block; width: 100%; padding: 6px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline: none; background: transparent; color: var(--ink); font: inherit; }
.ui-inline label { position: absolute; left: 2px; top: 22px; color: var(--muted); font-size: var(--text-body); pointer-events: none; transition: top 200ms ease, font-size 200ms ease, color 200ms ease; }
.ui-inline input:focus ~ label, .ui-inline input:not(:placeholder-shown) ~ label { top: 0; font-size: var(--text-label); color: var(--accent); }
.ui-inline input:not(:focus):not(:placeholder-shown) ~ label { color: var(--muted); }
.ui-inline-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
.ui-inline-bar::before, .ui-inline-bar::after { content: ""; position: absolute; bottom: 0; width: 0; height: 2px; background: var(--accent); transition: width 200ms ease; }
.ui-inline-bar::before { left: 50%; }
.ui-inline-bar::after { right: 50%; }
.ui-inline input:focus ~ .ui-inline-bar::before, .ui-inline input:focus ~ .ui-inline-bar::after { width: 50%; }
.ui-inline.is-number { width: 8ch; }

/* P71 search — From Uiverse.io by joe-watson-sbf (MIT): a quiet capsule with the magnifier on the right. */
.ui-search { display: inline-flex; align-items: center; width: 100%; max-width: 360px; border-radius: 999px; background: var(--sunken);
  box-shadow: 0 0 0 0 transparent; transition: box-shadow 200ms ease, background-color 200ms ease; }
.ui-search:hover { box-shadow: 0 0 0 1px var(--line); }
.ui-search:focus-within { background: var(--paper); box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--line); }
.ui-search input { flex: 1; min-width: 0; min-height: 40px; padding: 0 4px 0 16px; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; }
.ui-search input::placeholder { color: var(--muted); }
.ui-search-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.ui-search-button svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

/* ---- Checks ----------------------------------------------------------------------------------------- */
/* P9 task tick — From Uiverse.io by mrhyddenn (MIT): a thin square whose lines withdraw while a tick is drawn.
   Works on <label class="ui-check"><input …><svg>…</svg></label> and on <button class="ui-check" aria-pressed>. */
.ui-check { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.ui-check::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--accent-soft); opacity: 0; transition: opacity 200ms ease; }
.ui-check:hover::before { opacity: .6; }
.ui-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ui-check svg { position: relative; z-index: 1; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke 200ms ease; }
.ui-check svg path { stroke-dasharray: 60; stroke-dashoffset: 0; }
.ui-check svg polyline { stroke-dasharray: 22; stroke-dashoffset: 66; }
.ui-check:hover svg { stroke: var(--accent); }
.ui-check:is([aria-pressed="true"], :has(input:checked)) svg { stroke: var(--accent); stroke-width: 2; }
.ui-check:is([aria-pressed="true"], :has(input:checked)) svg path { stroke-dashoffset: 60; transition: stroke-dashoffset 300ms linear; }
.ui-check:is([aria-pressed="true"], :has(input:checked)) svg polyline { stroke-dashoffset: 42; transition: stroke-dashoffset 200ms linear 150ms; }
.ui-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* P5 check-in circle — From Uiverse.io by Shoh2008 (MIT): the circle fills and throws six dots outward, then a
   tick is drawn. For repeated check-ins (早 / 中 / 晚). Same two markups as .ui-check. */
.ui-tick { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ui-tick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.ui-tick-ring { position: absolute; inset: 2px; border: 2px solid var(--muted); border-radius: 50%; transition: border-color 200ms ease; }
.ui-tick svg { position: relative; z-index: 1; width: 12px; height: 10px; fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ui-tick svg path { stroke-dasharray: 19; stroke-dashoffset: 19; transition: stroke-dashoffset 300ms ease 200ms; }
.ui-tick:is([aria-pressed="true"], :has(input:checked)) .ui-tick-ring { border-color: var(--accent); animation: ui-splash 600ms ease forwards; }
.ui-tick:is([aria-pressed="true"], :has(input:checked)) svg path { stroke-dashoffset: 0; }
.ui-tick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.ui-tick.is-settled .ui-tick-ring { animation: none; background: var(--accent); }
@keyframes ui-splash {
  40% { background: var(--accent); box-shadow: 0 -18px 0 -8px var(--accent), 16px -8px 0 -8px var(--accent), 16px 8px 0 -8px var(--accent), 0 18px 0 -8px var(--accent), -16px 8px 0 -8px var(--accent), -16px -8px 0 -8px var(--accent); }
  100% { background: var(--accent); box-shadow: 0 -36px 0 -10px transparent, 32px -16px 0 -10px transparent, 32px 16px 0 -10px transparent, 0 36px 0 -10px transparent, -32px 16px 0 -10px transparent, -32px -16px 0 -10px transparent; }
}

/* ---- Segmented switch ------------------------------------------------------------------------------- */
/* P63 — From Uiverse.io by Pradeepsaranbishnoi (MIT): a tinted glider slides under the chosen option; options can
   carry a small count. The glider is placed by script from the chosen tab's real size, so any number of options works. */
.ui-seg { position: relative; display: inline-flex; gap: 2px; max-width: 100%; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); scrollbar-width: none; }
.ui-seg::-webkit-scrollbar { display: none; }
.ui-seg-glider { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--accent-soft);
  transform: translateX(var(--x, 0px)); width: var(--w, 0px); transition: transform 250ms ease-out, width 250ms ease-out; }
.ui-seg-tab { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none;
  color: var(--ink); font: inherit; font-size: var(--text-small); white-space: nowrap; cursor: pointer; transition: color 150ms ease-in; }
.ui-seg-tab[aria-selected="true"] { color: var(--seg-on, var(--accent)); }  /* --seg-on: a theme whose glider is a solid colour sets the text on it */
.ui-seg-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-family: var(--font-mono); font-size: 13px; transition: background-color 150ms ease-in, color 150ms ease-in; }
.ui-seg-tab[aria-selected="true"] .ui-seg-count { background: var(--accent); color: var(--on-accent); }
.ui-seg-count:empty { display: none; }
@media (max-width: 767px) { .ui-seg-tab { min-height: 36px; padding: 0 12px; } }

/* ---- Notice bar ------------------------------------------------------------------------------------- */
/* P43 — From Uiverse.io by Cybercom682 (MIT): a rounded bar with a left band, an icon and one line.
   Two kinds only: plain information, and something that needs handling (accent band, bold, an action). */
.ui-alert { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-left: 4px solid var(--line); border-radius: 10px; background: var(--sunken); color: var(--ink); font-size: var(--text-small); }
.ui-alert svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.ui-alert p { flex: 1; margin: 0; }
.ui-alert.is-action { border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.ui-alert.is-action svg { color: var(--accent); }
.ui-alert .ui-btn { flex: none; font-weight: 400; }
.ui-alert-close { flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.ui-alert-close:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }

/* ---- Loading ---------------------------------------------------------------------------------------- */
/* P14 Momo replying — From Uiverse.io by david-mohseni (MIT): twelve short bars fading round in turn. */
.ui-spinner { position: relative; display: inline-block; width: 20px; height: 20px; flex: none; }
.ui-spinner i { position: absolute; left: 46%; top: 30%; width: 8%; height: 24%; border-radius: 50px; background: var(--muted); opacity: .25; animation: ui-fade 1s linear infinite; }
.ui-spinner i:nth-child(1) { transform: rotate(0deg) translate(0, -130%); animation-delay: 0s; }
.ui-spinner i:nth-child(2) { transform: rotate(30deg) translate(0, -130%); animation-delay: -1.1s; }
.ui-spinner i:nth-child(3) { transform: rotate(60deg) translate(0, -130%); animation-delay: -1s; }
.ui-spinner i:nth-child(4) { transform: rotate(90deg) translate(0, -130%); animation-delay: -.9s; }
.ui-spinner i:nth-child(5) { transform: rotate(120deg) translate(0, -130%); animation-delay: -.8s; }
.ui-spinner i:nth-child(6) { transform: rotate(150deg) translate(0, -130%); animation-delay: -.7s; }
.ui-spinner i:nth-child(7) { transform: rotate(180deg) translate(0, -130%); animation-delay: -.6s; }
.ui-spinner i:nth-child(8) { transform: rotate(210deg) translate(0, -130%); animation-delay: -.5s; }
.ui-spinner i:nth-child(9) { transform: rotate(240deg) translate(0, -130%); animation-delay: -.4s; }
.ui-spinner i:nth-child(10) { transform: rotate(270deg) translate(0, -130%); animation-delay: -.3s; }
.ui-spinner i:nth-child(11) { transform: rotate(300deg) translate(0, -130%); animation-delay: -.2s; }
.ui-spinner i:nth-child(12) { transform: rotate(330deg) translate(0, -130%); animation-delay: -.1s; }
@keyframes ui-fade { from { opacity: 1; } to { opacity: .25; } }

/* P27 longer work — From Uiverse.io by Donewenfu (MIT): three bars hop in turn. */
.ui-bars { display: inline-flex; align-items: flex-end; gap: 4px; height: 18px; flex: none; }
.ui-bars i { width: 4px; height: 12px; background: var(--accent); opacity: .75; animation: ui-hop 800ms ease-in-out infinite; }
.ui-bars i:nth-child(2) { animation-delay: 160ms; }
.ui-bars i:nth-child(3) { animation-delay: 320ms; }
@keyframes ui-hop { 0%, 80%, 100% { height: 12px; opacity: .75; } 40% { height: 16px; opacity: 1; } }

/* P54 opening screen — From Uiverse.io by andrew-manzyk (MIT): three shapes fall in from left, middle and right,
   swell, then shrink away. Here the shapes are Momo's paw prints. */
.ui-paws { position: relative; display: inline-block; width: 64px; height: 64px; flex: none; }
.ui-paws svg { position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; fill: var(--accent); opacity: 0; }
.ui-paws svg:nth-child(1) { animation: ui-fall-one 1s linear infinite; }
.ui-paws svg:nth-child(2) { animation: ui-fall-two 1s linear .3s infinite; }
.ui-paws svg:nth-child(3) { animation: ui-fall-three 1s linear .6s infinite; }
@keyframes ui-fall-one { 0% { transform: scale(.5) translateY(-50px); opacity: 0; } 25% { transform: scale(.75) translateY(-25px); opacity: 1; } 50% { transform: scale(1) translateY(0); opacity: 1; } 75% { transform: scale(.5) translateY(12px); opacity: 1; } 100% { transform: scale(0) translateY(25px); opacity: 0; } }
@keyframes ui-fall-two { 0% { transform: scale(.5) rotate(-10deg) translate(-25px, -50px); opacity: 0; } 25% { transform: scale(1) rotate(-5deg) translate(-12px, -25px); opacity: 1; } 50% { transform: scale(1) rotate(0) translate(-6px, 0); opacity: 1; } 75% { transform: scale(.5) rotate(5deg) translate(0, 12px); opacity: 1; } 100% { transform: scale(0) rotate(10deg) translate(6px, 25px); opacity: 0; } }
@keyframes ui-fall-three { 0% { transform: scale(.5) rotate(10deg) translate(25px, -50px); opacity: 0; } 25% { transform: scale(1) rotate(5deg) translate(12px, -25px); opacity: 1; } 50% { transform: scale(1) rotate(0) translate(6px, 0); opacity: 1; } 75% { transform: scale(.5) rotate(-5deg) translate(0, 12px); opacity: 1; } 100% { transform: scale(0) rotate(-10deg) translate(-6px, 25px); opacity: 0; } }

/* P86 Moon theme loading — From Uiverse.io by narmesh_sah (MIT): five stars of growing size, turning out of step. */
.ui-stars { position: relative; display: inline-grid; place-items: center; width: 52px; height: 52px; flex: none; filter: drop-shadow(0 0 1px var(--ink)); }
.ui-stars i { position: absolute; width: 20%; aspect-ratio: 1; background: var(--ink);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); animation: ui-turn 6s infinite; }
.ui-stars i:nth-child(2) { width: 24%; animation-delay: 1s; }
.ui-stars i:nth-child(3) { width: 28%; animation-delay: 1.5s; }
.ui-stars i:nth-child(4) { width: 32%; animation-delay: 2s; }
.ui-stars i:nth-child(5) { width: 36%; animation-delay: 2.5s; }
@keyframes ui-turn { to { transform: rotate(360deg); } }
/* Loading in context: an icon plus a status line; 「还在等」 after a long wait is set by script. */
.ui-loading { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--text-small); }
/* Each theme keeps at most two loaders: paper uses bars / paws, Moon uses the stars for both. */
html[data-theme="moon"] .ui-loading :is(.ui-bars, .ui-paws) { display: none; }
html:not([data-theme="moon"]) .ui-loading .ui-stars { display: none; }

/* ---- 「⋯」 menu ------------------------------------------------------------------------------------- */
/* P37 — From Uiverse.io by reglobby (MIT): stacked options; the active one gets a slim accent band on the left.
   The band follows the arrow-key selection. Destructive items go last, behind a divider. */
.ui-menu-wrap { position: relative; display: inline-flex; }
.ui-menu-toggle { display: grid; place-items: center; width: 32px; height: 32px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 18px; cursor: pointer; }
.ui-menu-toggle:hover, .ui-menu-toggle[aria-expanded="true"] { background: var(--sunken); color: var(--ink); }
.ui-menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; display: flex; flex-direction: column; min-width: 152px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ui-menu[hidden] { display: none; }
.ui-menu-item { position: relative; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink);
  font: inherit; font-size: var(--text-small); text-align: left; white-space: nowrap; cursor: pointer; }
.ui-menu-item::before { content: ""; position: absolute; left: -2px; top: 20%; width: 3px; height: 60%; border-radius: 3px; background: var(--accent); opacity: 0; transition: opacity 150ms ease; }
.ui-menu-item:not(:active):hover, .ui-menu-item:focus { background: var(--sunken); outline: none; }
.ui-menu-item:focus::before, .ui-menu-item:active::before { opacity: 1; }
.ui-menu-sep { height: 1px; margin: 4px 8px; background: var(--line); }
.ui-menu-item.is-danger.is-armed { background: var(--accent-deep, var(--accent)); color: var(--on-accent); }

/* ---- Delete (two steps) ----------------------------------------------------------------------------- */
/* P38 — From Uiverse.io by vinodjangid07 (MIT): a small round bin that stretches into a 「确认删除」 capsule;
   the second press deletes. It folds back after a few seconds. */
.ui-delete { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; overflow: hidden; border: 0; border-radius: 999px;
  background: var(--sunken); color: var(--muted); font: inherit; font-size: var(--text-small); cursor: pointer; transition: width 300ms ease, background-color 300ms ease, color 300ms ease; }
.ui-delete svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms ease, opacity 300ms ease; }
.ui-delete-label { position: absolute; white-space: nowrap; opacity: 0; transform: translateY(-14px); transition: opacity 300ms ease, transform 300ms ease; }
.ui-delete:hover { color: var(--ink); }
.ui-delete.is-armed { width: 96px; background: var(--accent-deep, var(--accent)); color: var(--on-accent); }
.ui-delete.is-armed svg { opacity: 0; transform: translateY(14px); }
.ui-delete.is-armed .ui-delete-label { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .ui-btn, .ui-btn:active, .ui-btn.is-primary:hover, .ui-btn.is-key:active { transform: none !important; transition: none !important; }
  .ui-check svg *, .ui-tick svg path, .ui-seg-glider, .ui-delete, .ui-delete *, .ui-inline label, .ui-inline-bar::before, .ui-inline-bar::after, .ui-input, .ui-search { transition: none !important; }
  .ui-tick:is([aria-pressed="true"], :has(input:checked)) .ui-tick-ring { animation: none; background: var(--accent); }
  .ui-spinner i, .ui-bars i, .ui-paws svg, .ui-stars i { animation: none !important; }
  .ui-spinner i { opacity: .6; }
  .ui-paws svg:nth-child(1) { opacity: 1; transform: none; }
}

/* Sizes include padding and borders, so a component never spills out of its card. */
:where([class^="ui-"], [class*=" ui-"]) { box-sizing: border-box; }
/* Older page rules give every button a minimum height; the round controls keep their own size. */
:is(#health, #tasksPage, #pendingTasks) :is(.ui-tick, .ui-check, .ui-delete, .ui-menu-toggle) { min-height: 0; min-width: 0; }
:is(#health, #tasksPage, #pendingTasks) :is(.ui-tick, .ui-check) { width: 28px; height: 28px; padding: 0; border: 0; background: none; }

/* =====================================================================================================
   Step 2 (首页) components
   ===================================================================================================== */

/* P96 desk calendar — From Uiverse.io by ashif_6672 (MIT): a small hanging pad — hook, header with year and
   pin, a large date, and a foot with a mini month, the weekday and the lunar date. Warm tones, no side shadow. */
.ui-desk { position: relative; flex: none; width: 184px; margin-top: 16px; border: 1px solid var(--line); border-radius: 4px 4px 10px 10px; background: var(--paper); color: var(--ink); }
.ui-desk::after { content: ""; position: absolute; top: 2px; left: -6px; width: 6px; height: calc(100% - 4px); border-radius: 2px 0 0 2px; background: color-mix(in srgb, var(--line) 70%, var(--label, var(--muted))); transform: skew(0, 12deg); transform-origin: top right; }
.ui-desk-hook { position: absolute; z-index: 1; left: 10%; top: -16px; width: 80%; height: 16px; border-radius: 4px 4px 0 0; background: linear-gradient(0deg, var(--line) 0%, var(--sunken) 100%); }
.ui-desk-hook::before { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 8px; border-radius: 100%; background: var(--bg); }
.ui-desk-head { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 4px 10px; border-radius: 4px 4px 0 0; background: var(--sunken); color: var(--muted); font-size: 13px; font-weight: 600; }
.ui-desk-pin { width: 10px; height: 10px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); }
.ui-desk-body { position: relative; z-index: 3; padding: 10px 14px 12px; }
.ui-desk-body::before, .ui-desk-body::after { content: ""; position: absolute; left: 0; top: 46%; width: 3px; height: 10px; }
.ui-desk-body::before { margin-top: -10px; background: var(--accent); }
.ui-desk-body::after { background: var(--label, var(--muted)); }
.ui-desk-month { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.ui-desk-date { margin: -2px 0 2px; color: var(--accent); font-family: var(--font-mono); font-size: 72px; font-weight: 700; line-height: 1; text-align: center; letter-spacing: -.03em; }
.ui-desk-foot { display: flex; align-items: flex-end; gap: 8px; }
.ui-desk-mini { width: 48%; border-collapse: collapse; color: var(--muted); font-family: var(--font-mono); font-size: 7px; line-height: 1.5; text-align: center; }
.ui-desk-mini th { color: var(--accent); font-weight: 400; }
.ui-desk-mini td.is-now { border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.ui-desk-week { flex: 1; text-align: center; }
.ui-desk-day { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.ui-desk-lunar { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
/* Phones: one line, 「10 / 21 周三 · 九月十二」. */
.ui-desk-line { display: none; margin: 0; color: var(--ink); font-size: var(--text-small); }
.ui-desk-line .ui-desk-lunar { display: inline; margin: 0; font-size: inherit; }

/* P85 weather — From Uiverse.io by vinodjangid07 (MIT): city, condition, a large temperature, then
   「最高 | 最低」. A soft ball sits behind the card and drifts on hover. Frosted only on Moon. */
.ui-weather { position: relative; isolation: isolate; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px;
  width: 200px; padding: 16px 10px 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
.ui-weather::before { content: ""; position: absolute; z-index: -1; right: -36px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--accent-soft); transition: transform 500ms ease; }
.ui-weather:hover::before { transform: translate(-30px, 40px); }
.ui-weather-city { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.ui-weather-desc { margin: 0; color: var(--muted); font-size: 13px; }
.ui-weather-now { display: flex; align-items: center; gap: 6px; }
.ui-weather-temp { margin: 0; font-family: var(--font-mono); font-size: 32px; line-height: 1; }
.ui-weather-range { display: flex; width: 100%; }
.ui-weather-range > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; width: 50%; padding: 0 14px; }
.ui-weather-range > div + div { align-items: flex-start; border-left: 1px solid var(--line); }
.ui-weather-range b { font-size: 13px; font-weight: 600; }
.ui-weather-range span { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }
/* Moon keeps a solid --paper card too (VISUAL_SPEC v0.2.2 §3: every card is --paper); no frosted glass. */

/* P53 weather icon — From Uiverse.io by zanina-yassine (MIT): a low warm sun with a slow halo, two clouds that
   drift. Sunny = sun; cloudy = sun + clouds; overcast = clouds; rain = clouds + lines. Always beside a word. */
.ui-wicon { --sun-a: #D9B25E; --sun-b: #E9CF8E; --cloud: color-mix(in srgb, var(--line) 75%, var(--muted)); position: relative; display: inline-block; flex: none; width: 40px; height: 32px; }
.ui-wicon .sun, .ui-wicon .glow { position: absolute; left: 4px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(to right, var(--sun-a), var(--sun-b)); }
.ui-wicon .glow { animation: ui-sunshine 3s infinite; }
.ui-wicon .cloud { position: absolute; display: flex; align-items: flex-end; animation: ui-clouds 10s ease-in-out infinite; }
.ui-wicon .cloud.front { left: 10px; top: 13px; z-index: 2; }
.ui-wicon .cloud.back { left: 22px; top: 6px; z-index: 1; opacity: .8; animation-duration: 14s; }
.ui-wicon .cloud i:first-child { width: 14px; height: 14px; border-radius: 50% 50% 0 50%; background: var(--cloud); }
.ui-wicon .cloud i:last-child { width: 10px; height: 10px; margin-left: -4px; border-radius: 50% 50% 50% 0; background: var(--cloud); }
.ui-wicon .rain { position: absolute; left: 14px; top: 28px; width: 16px; height: 4px; background: repeating-linear-gradient(90deg, var(--muted) 0 1.5px, transparent 1.5px 5px); }
.ui-wicon .snow { position: absolute; left: 13px; top: 28px; width: 18px; height: 4px; background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.6px) 0 0 / 6px 4px repeat-x; }
.ui-wicon.is-sunny .cloud, .ui-wicon:not(.is-rain) .rain, .ui-wicon:not(.is-snow) .snow, .ui-wicon:is(.is-overcast, .is-rain, .is-snow) :is(.sun, .glow) { display: none; }
.ui-wicon:is(.is-overcast, .is-rain, .is-snow) .cloud.front { left: 6px; }
@keyframes ui-sunshine { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes ui-clouds { 0%, 100% { transform: translateX(3px); } 50% { transform: translateX(0); } }

/* P91 progress — From Uiverse.io by Juanes200122 (MIT): a slim bar that grows in from the left once; an optional
   tip shows a real number. The tip stays inside the bar near 100%. Width is set from data (--p). */
.ui-progress { position: relative; height: 8px; border-radius: 6px; background: var(--line); }
.ui-progress > i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); border-radius: 6px; background: var(--accent); animation: ui-grow 400ms ease-in-out both; }
.ui-progress-tip { position: absolute; right: -14px; top: -26px; z-index: 1; padding: 2px 6px; border-radius: 3px; background: var(--ink); color: var(--paper); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.ui-progress-tip::before { content: ""; position: absolute; z-index: -1; left: 50%; bottom: -3px; width: 8px; height: 8px; background: var(--ink); transform: translateX(-50%) rotate(45deg); }
.ui-progress.is-near-end .ui-progress-tip { right: 0; }
.ui-progress.is-near-end .ui-progress-tip::before { left: auto; right: 6px; transform: rotate(45deg); }
@keyframes ui-grow { from { width: 0; } }

/* P50 stat card — From Uiverse.io by Yaya12085 (MIT): a round icon and a title, a large number, then a bar.
   No change-percentages (MO-14a). The accent card turns the scheme around. */
.ui-stat { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; }
a.ui-stat:hover { border-color: var(--accent); }
a.ui-stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-stat-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--text-small); }
.ui-stat-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); }
.ui-stat-icon svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ui-stat-value { margin: auto 0 0; font-family: var(--font-mono); font-size: 36px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.ui-stat-value small { margin-left: 4px; color: var(--muted); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; letter-spacing: 0; }
.ui-stat-text { margin: auto 0 0; font-size: 20px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ui-stat-sub { font-family: var(--font-mono); font-size: var(--text-small); }
/* The emphasised card (「下一项」) stays a paper card; only its content takes the accent (Kain 10/21). */
.ui-stat.is-accent { color: var(--accent); }
.ui-stat.is-accent .ui-stat-title { color: var(--ink); }
.ui-stat.is-accent small, .ui-stat.is-accent .ui-stat-sub { color: var(--accent); }

/* P62 week summary — From Uiverse.io by themrsami (MIT): two figures, then one bar per day: a pale base (what was
   planned) holding a solid fill (what was done); today in the accent. No growth percentages, no 「Live」 badge. */
.ui-week { display: grid; gap: 14px; min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
.ui-week-head { display: flex; align-items: center; gap: 10px; }
.ui-week-head h3 { margin: 0; font-size: 16px; font-weight: 500; }
.ui-week-head .ui-seg { margin-left: auto; }
.ui-week-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ui-week-nums p { margin: 0; color: var(--muted); font-size: var(--text-label); }
.ui-week-nums b { display: block; margin-top: 2px; color: var(--ink); font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.ui-week-nums b small { margin-left: 3px; color: var(--muted); font-family: var(--font-ui); font-size: var(--text-small); font-weight: 400; }
.ui-week-bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 88px; }
.ui-week-bar { position: relative; display: flex; align-items: flex-end; flex: 1 1 0; max-width: 14px; height: var(--h, 0%); min-height: 3px; border-radius: 3px; background: var(--accent-soft); }
.ui-week-bar > i { width: 100%; height: var(--f, 0%); border-radius: 3px; background: color-mix(in srgb, var(--accent) 45%, var(--paper)); transition: height 300ms ease; }
.ui-week-bar.is-today > i { background: var(--accent); }
.ui-week-bar.is-empty { background: var(--sunken); }
.ui-week-days { display: flex; justify-content: space-between; gap: 6px; margin-top: -8px; color: var(--muted); font-size: 13px; }
.ui-week-days span { flex: 1 1 0; max-width: 14px; text-align: center; }
.ui-week-days span.is-today { color: var(--accent); }
.ui-week.is-month .ui-week-bars, .ui-week.is-month .ui-week-days { gap: 2px; }
.ui-week.is-month .ui-week-bar, .ui-week.is-month .ui-week-days span { max-width: 8px; }
.ui-week-foot { display: flex; align-items: center; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  .ui-wicon .glow, .ui-wicon .cloud, .ui-progress > i { animation: none !important; }
  .ui-weather::before, .ui-week-bar > i { transition: none !important; }
}

/* =====================================================================================================
   Step 3 (Momo 面板) components
   ===================================================================================================== */

/* P2 message bar — adapted from a Uiverse.io message box Kain shared (author not recorded; Uiverse content is MIT):
   one compact rounded bar, a self-growing text area (up to ~5 lines) and a send icon that turns to the accent
   once there is something to send. The attachment slot stays out until Momo can take pictures. */
.ui-message { display: flex; align-items: flex-end; gap: 4px; min-height: 40px; padding: 2px 4px 2px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); transition: border-color 200ms ease; }
.ui-message:focus-within { border-color: var(--muted); }
.ui-message textarea { flex: 1; min-width: 0; min-height: 36px; max-height: 132px; padding: 8px 0; border: 0; outline: none; resize: none; background: transparent; color: var(--ink); font: inherit; line-height: 1.5; }
.ui-message textarea::placeholder { color: var(--muted); opacity: 1; }
.ui-send { display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; transition: color 200ms ease, background-color 200ms ease; }
.ui-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ui-message textarea:valid ~ .ui-send, .ui-send:hover { color: var(--accent); }
.ui-send:hover { background: var(--sunken); }
.ui-send:disabled { opacity: .5; cursor: default; }
.ui-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) { .ui-message { min-height: 44px; } .ui-send { width: 40px; height: 40px; } }

/* P25 copy — From Uiverse.io by Galahhad (MIT): a small clipboard button; a tip says 「复制」, then 「已复制」 with a tick.
   Success is set by script after the clipboard call (not by focus tricks) and read out politely. Phones show it always. */
.ui-copy { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.ui-copy:hover, .ui-copy.is-done { background: var(--sunken); color: var(--accent); }
.ui-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ui-copy .ui-copy-done, .ui-copy.is-done .ui-copy-icon { display: none; }
.ui-copy.is-done .ui-copy-done { display: block; }
.ui-copy-tip { position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 5; padding: 4px 7px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 13px; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateX(-50%); pointer-events: none; }
.ui-copy-tip::after { content: ""; position: absolute; left: 50%; bottom: -3px; width: 7px; height: 7px; background: inherit; transform: translateX(-50%) rotate(45deg); }
.ui-copy-tip::before { content: attr(data-text-initial); }
.ui-copy.is-done .ui-copy-tip::before { content: attr(data-text-end); }
.ui-copy.is-failed .ui-copy-tip::before { content: attr(data-text-fail); }
.ui-copy:hover .ui-copy-tip, .ui-copy:focus-visible .ui-copy-tip, .ui-copy:is(.is-done, .is-failed) .ui-copy-tip { opacity: 1; visibility: visible; }

/* P78 toolbar — From Uiverse.io by geekgao (MIT): a slim capsule of icon buttons. Only buttons that work today; one
   shared hover (a ground appears, the icon takes the accent). Solid paper, no glass, no shadow. */
.ui-toolbar { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.ui-toolbar button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: background-color 200ms ease, color 200ms ease; }
.ui-toolbar button:hover { background: var(--sunken); color: var(--accent); }
.ui-toolbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-toolbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* P56 Zzz — From Uiverse.io by necatimertmetin (MIT): small italic z's drift up and right, turn a little and fade.
   Shown beside Momo's paw late at night; it never comments on when anyone sleeps. */
.ui-zzz { position: absolute; right: -6px; top: -8px; width: 22px; height: 22px; pointer-events: none; }
.ui-zzz i { position: absolute; left: 0; bottom: 0; color: var(--muted); font-family: var(--font-display, serif); font-size: 13px; font-style: italic; line-height: 1; opacity: 0; animation: ui-sway 2s ease-out infinite; }
.ui-zzz i:nth-child(2) { font-size: 13px; animation-delay: .5s; }
.ui-zzz i:nth-child(3) { font-size: 9px; animation-delay: 1s; }
.ui-zzz i:nth-child(4) { font-size: 8px; animation-delay: 1.5s; }
@keyframes ui-sway { 0% { transform: translate(0, 0) rotate(0deg); opacity: 1; } 100% { transform: translate(14px, -18px) rotate(30deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-message, .ui-send, .ui-toolbar button { transition: none !important; }
  .ui-zzz i { animation: none !important; opacity: 1; }
  .ui-zzz i:nth-child(2) { transform: translate(5px, -6px); }
  .ui-zzz i:nth-child(3) { transform: translate(10px, -12px); }
  .ui-zzz i:nth-child(4) { display: none; }
}

/* P92 mood — From Uiverse.io by JkHuger (MIT): three faces (开心 / 一般 / 难过) in a soft capsule. Paper and Moon use one
   colour (the chosen face takes the accent); only the Chat theme keeps green / amber / red. Optional: tap again to clear. */
.ui-mood { display: inline-flex; gap: 2px; min-width: 0; margin: 0; padding: 3px; border: 0; border-radius: 999px; background: var(--sunken); }
.ui-mood button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: color 200ms ease, background-color 200ms ease; }
.ui-mood button:hover { color: var(--ink); }
.ui-mood button[aria-pressed="true"] { background: var(--paper); color: var(--accent); }
.ui-mood button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-mood svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ui-mood svg .eye { stroke-width: 2.4; }
html[data-theme="chat"] .ui-mood .is-good[aria-pressed="true"] { color: #2E9E62; }
html[data-theme="chat"] .ui-mood .is-ok[aria-pressed="true"] { color: #C9A227; }
html[data-theme="chat"] .ui-mood .is-bad[aria-pressed="true"] { color: #D2544B; }

/* 首页「今天」: day status (P63), mood (P92), medicine (P5) — three small rows on one paper card. */
.ui-today { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
.ui-today h3 { margin: 0; font-size: 16px; font-weight: 500; }
.ui-today-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 40px; }
.ui-today-label { color: var(--muted); font-size: var(--text-small); }
.ui-today-row .ui-seg { justify-self: start; }
.ui-today-doses { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.ui-today-dose { display: inline-flex; align-items: center; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .ui-mood button { transition: none; } }

/* =====================================================================================================
   Step 4 (任务页) components
   ===================================================================================================== */

/* P8 add — From Uiverse.io by catraco (MIT): a ringed plus that turns 90° on hover; the ring fills with the soft
   accent (no dark fill). On the 任务 page it opens into the add field (component 01) and turns into ×. */
.ui-add { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.ui-add svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; transition: transform 300ms ease, fill 300ms ease, stroke 300ms ease; }
.ui-add svg .ring { fill: transparent; transition: fill 300ms ease, stroke 300ms ease; }
.ui-add:hover { color: var(--accent); }
.ui-add:hover svg { transform: rotate(90deg); }
.ui-add:hover svg .ring { fill: var(--accent-soft); }
.ui-add:active svg .ring { fill: color-mix(in srgb, var(--accent) 25%, var(--paper)); transition-duration: 0ms; }
.ui-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* P22 pin — From Uiverse.io by boryanakrasteva (MIT): an icon button that grows a little on hover with a word fading
   in below. Pinned stays visible and filled; the word is real text (and the button's label), not CSS content. */
.ui-pin { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.ui-pin svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms linear; }
.ui-pin:hover { color: var(--accent); }
.ui-pin:hover svg { transform: scale(1.1); }
.ui-pin[aria-pressed="true"] { color: var(--accent); }
.ui-pin[aria-pressed="true"] svg .head { fill: currentColor; }
.ui-pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-pin-tip { position: absolute; top: 108%; left: 50%; z-index: 4; padding: 2px 6px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 13px; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateX(-50%); transition: opacity 200ms linear, top 200ms linear; pointer-events: none; }
.ui-pin:hover .ui-pin-tip, .ui-pin:focus-visible .ui-pin-tip { opacity: 1; visibility: visible; top: 100%; }

/* P65 steps — From Uiverse.io by PriyanshuGupta28 (MIT): an ordered list of steps joined by a line; done = filled
   circle with a tick, current = accent ring, still to do = pale ring. No status badges, no prev / next, no timestamps. */
.ui-steps { display: grid; margin: 0; padding: 0; list-style: none; }
.ui-step { position: relative; display: flex; align-items: flex-start; gap: 10px; padding-bottom: 10px; }
.ui-step:last-child { padding-bottom: 0; }
.ui-step::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.ui-step.is-done::before { background: var(--accent); }
.ui-step:last-child::before { display: none; }
.ui-step-circle { position: relative; z-index: 1; display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--on-accent); cursor: pointer; }
.ui-step-circle svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ui-step.is-done .ui-step-circle { border-color: var(--accent); background: var(--accent); }
.ui-step.is-done .ui-step-circle svg { opacity: 1; }
.ui-step.is-active .ui-step-circle { border-color: var(--accent); }
.ui-step-circle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-step-title { padding-top: 2px; font-size: var(--text-small); line-height: 1.5; }
.ui-step.is-done .ui-step-title { color: var(--muted); }
.ui-step-meta { margin-left: 6px; color: var(--muted); font-family: var(--font-mono); font-size: var(--text-label); }

@media (prefers-reduced-motion: reduce) {
  .ui-add svg, .ui-add svg .ring, .ui-pin svg, .ui-pin-tip { transition: none !important; }
  .ui-add:hover svg { transform: none; }
}

/* P47 entry row — From Uiverse.io by vinodjangid07 (MIT): an icon and a name; on hover the row lightens and an arrow
   slides in from the left; pressing nudges it 1px. Paper colours, full width of its list, arrow always shown on touch. */
.ui-entry { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 44px 0 14px; border: 0; border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background-color 200ms ease; }
.ui-entry:hover { background: var(--sunken); }
.ui-entry:active { transform: translate(1px, 1px); }
.ui-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-entry-icon { display: inline-grid; place-items: center; color: var(--muted); }
.ui-entry-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ui-entry-label { flex: 1; min-width: 0; }
.ui-entry-arrow { position: absolute; right: 16px; top: 50%; color: var(--muted); font-size: 18px; line-height: 1; opacity: 0; transform: translate(-8px, -50%); transition: opacity 200ms ease, transform 200ms ease; }
.ui-entry:hover .ui-entry-arrow, .ui-entry:focus-visible .ui-entry-arrow { opacity: 1; transform: translate(0, -50%); }
@media (hover: none) { .ui-entry-arrow { opacity: 1; transform: translate(0, -50%); } }
@media (prefers-reduced-motion: reduce) {
  .ui-entry, .ui-entry-arrow { transition: none; }
  .ui-entry:active { transform: none; }
}

/* 今天: today's food and last night's sleep as two plain numbers under the three rows (Kain 10/21). */
.ui-today-nums { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.ui-today { grid-template-rows: auto auto auto auto 1fr; }
.ui-today-num { display: inline-flex; align-items: baseline; gap: 8px; color: var(--ink); text-decoration: none; }
.ui-today-num:hover b { color: var(--accent); }
.ui-today-num b { font-size: 26px; font-weight: 700; }
.ui-today-num small { color: var(--muted); font-size: var(--text-small); }

/* P16 weather scene — From Uiverse.io by KSAplay (MIT), redrawn as one inline SVG (Kain 10/21): the landscape is a
   strip about 40% of the card, colours are low-saturation per theme, no hard shadow, decoration only (aria-hidden). */
.ui-weather.is-scene { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; padding: 0; overflow: hidden;
  --sky-top: #EADFCF; --sky-bottom: #F6EEE2; --sun: #FFFBF4; --sea-top: #E9DCCB; --sea-bottom: #DDCBB6; --glint: #FFFBF4;
  --hill-1: #DCC7B3; --hill-2: #C9A795; --hill-3: #B48C82; --tree: #9A7268; --cloud: #FFFDF9; --cloud-grey: #E3D9CD; --rain: #9E8A7D; --snow: #FFFFFF; }
.ui-weather.is-scene::before { content: none; }
.ui-weather.is-scene.is-overcast, .ui-weather.is-scene.is-rain, .ui-weather.is-scene.is-snow { --sky-top: #E2DCD4; --sky-bottom: #EEE9E2; --sea-top: #E3DACF; --sea-bottom: #D8CCBE; }
html[data-theme="moon"] .ui-weather.is-scene { --sky-top: #121A2B; --sky-bottom: #213049; --sun: #E9E4D6; --sea-top: #1B2639; --sea-bottom: #141C2B; --glint: #C9CFDA;
  --hill-1: #2A3651; --hill-2: #222D45; --hill-3: #19212F; --tree: #121825; --cloud: #3B4762; --cloud-grey: #2F3A52; --rain: #8FA3BC; --snow: #DDE3EA; }
html[data-theme="moon"] .ui-weather.is-scene:is(.is-overcast, .is-rain, .is-snow) { --sky-top: #161C28; --sky-bottom: #242D3E; }
.ui-scene { display: block; flex: 0 0 40%; width: 100%; min-height: 0; }
.ui-scene .sky-top { stop-color: var(--sky-top); }
.ui-scene .sky-bottom { stop-color: var(--sky-bottom); }
.ui-scene .sea-top { stop-color: var(--sea-top); }
.ui-scene .sea-bottom { stop-color: var(--sea-bottom); }
.ui-scene .sun .disc, .ui-scene .moon .disc { fill: var(--sun); }
.ui-scene .halo-1 { fill: var(--sun); opacity: .35; }
.ui-scene .halo-2 { fill: var(--sun); opacity: .14; }
.ui-scene .stars { fill: var(--sun); opacity: .7; display: none; }
.ui-scene .glint { stroke: var(--glint); stroke-width: 1.4; stroke-linecap: round; opacity: .55; }
.ui-scene .hill-1 { fill: var(--hill-1); }
.ui-scene .hill-2 { fill: var(--hill-2); }
.ui-scene .hill-3 { fill: var(--hill-3); }
.ui-scene .tree { fill: var(--tree); }
.ui-scene .cloud { fill: var(--cloud); display: none; }
.ui-scene .cloud.is-grey { fill: var(--cloud-grey); }
.ui-scene .rain { stroke: var(--rain); stroke-width: 1; stroke-linecap: round; display: none; }
.ui-scene .snow { fill: var(--snow); display: none; }
.ui-scene .moon { display: none; }
html[data-theme="moon"] .ui-scene .sun { display: none; }
html[data-theme="moon"] .ui-scene .moon, html[data-theme="moon"] .ui-scene .stars { display: inline; }
/* 晴: sun only.  多云: a cloud in front of the sun and one far off.  阴 / 雨 / 雪: grey clouds only, then rain lines or snow dots. */
.ui-weather.is-cloudy .ui-scene :is(.cloud.is-near, .cloud.is-far) { display: inline; }
.ui-weather:is(.is-overcast, .is-rain, .is-snow) .ui-scene :is(.sun, .moon, .stars, .glint) { display: none; }
.ui-weather:is(.is-overcast, .is-rain, .is-snow) .ui-scene .cloud.is-grey { display: inline; }
.ui-weather.is-rain .ui-scene .rain, .ui-weather.is-snow .ui-scene .snow { display: inline; }
.ui-weather-body { display: flex; flex: 1; flex-direction: column; justify-content: space-between; gap: 8px; padding: 12px 16px 14px; }
.ui-weather-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ui-weather.is-scene .ui-weather-city { margin: 0; font-family: var(--font-mono); font-size: 15px; font-weight: 700; }
.ui-weather.is-scene .ui-weather-desc { margin: 0; color: var(--muted); font-size: var(--text-small); }
.ui-weather-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.ui-weather.is-scene .ui-weather-temp { margin: 0; font-family: var(--font-mono); font-size: 34px; line-height: 1; }
.ui-weather.is-scene .ui-weather-range { display: grid; justify-items: end; gap: 2px; margin: 0; width: auto; color: var(--muted); font-size: 13px; }
.ui-weather.is-scene .ui-weather-range .num { color: var(--ink); }
/* Rain lines fall slowly; nothing moves with reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .ui-scene .rain { animation: ui-scene-rain 1.2s linear infinite; }
}
@keyframes ui-scene-rain { from { transform: translateY(-3px); opacity: .6; } to { transform: translateY(3px); opacity: 1; } }

/* ---- P16 weather scene in its original colours (Kain 10/21): bright, not greyed, not themed --------------- */
.ui-weather.is-scene, .ui-weather.is-scene:is(.is-overcast, .is-rain, .is-snow) {
  --sky-top: #E96594; --sky-bottom: #F7E157; --sun: #FFFFFF; --sea-top: #F7DA96; --sea-bottom: #F1C07D; --glint: #FFFFFF;
  --hill-far-1: #F1C7A0; --hill-far-2: #E5BB96; --hill-1: #E6B29D; --hill-2: #C29182; --hill-3: #B77873; --tree: #A16773;
  --cloud: #FFFFFF; --cloud-grey: #EFE9EC; --rain: #FFFFFF; --snow: #FFFFFF; }
html[data-theme="moon"] .ui-weather.is-scene, html[data-theme="moon"] .ui-weather.is-scene:is(.is-overcast, .is-rain, .is-snow) {
  --sky-top: #121A52; --sky-bottom: #5A2C82; --sun: #FFD86E; --sea-top: #2E2470; --sea-bottom: #1C1748; --glint: #FFD86E;
  --hill-far-1: #6B3A7E; --hill-far-2: #7A3A6C; --hill-1: #5A2F72; --hill-2: #7B3460; --hill-3: #3E2160; --tree: #2A1640;
  --cloud: #6E62A8; --cloud-grey: #5B4F94; --rain: #C9C2FF; --snow: #FFFFFF; }
.ui-scene .hill-far-1 { fill: var(--hill-far-1); }
.ui-scene .hill-far-2 { fill: var(--hill-far-2); }
.ui-scene .halo-1 { opacity: .5; }
.ui-scene .halo-2 { opacity: .1; }
.ui-scene .sun .disc { filter: drop-shadow(0 0 3px #fff); }
.ui-scene .stars { opacity: .9; }
/* Weather only adds things: the sun stays, clouds cover part of it, then rain lines or snow dots. */
.ui-weather:is(.is-overcast, .is-rain, .is-snow) .ui-scene :is(.sun, .glint) { display: inline; }
html[data-theme="moon"] .ui-weather:is(.is-overcast, .is-rain, .is-snow) .ui-scene :is(.moon, .stars) { display: inline; }
html[data-theme="moon"] .ui-weather .ui-scene .sun { display: none; }
.ui-weather:is(.is-overcast, .is-rain, .is-snow) .ui-scene .cloud.is-near { display: inline; }
.ui-scene .rain { stroke-width: 1.1; opacity: .9; }

