/*
 * Sun and Moon: the tool's own components, styled in the site's design language (3 Nov 2026, on the UltraCompress Pro
 * template, after AgeCalc, QR Generator, Biodata Maker, Payslip Studio and ResumeForge, whose shared block the first part
 * of this file copies). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus rings)
 * and /libs/shared-nav.css (the site's header and footer). The second part is the original's components (the sky dial,
 * the timeline, the charts, the moon, the calendar, the lists) on the site's tokens, each view's parts in cards. Light is
 * the default; dark applies when <html> has no data-theme.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --stage: #f3f4f8;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --stage: #1c1c2b;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Cards ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:empty { display: none; }
.card--wide { grid-column: span 2; }
.card--full { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; margin-bottom: 0; }
.view > .card { margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; min-width: 0; }
.card-body > * + * { margin-top: 16px; }
.form-hint { font-size: 0.8rem; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== Sun and Moon components ===== */

/* ----- The original's colours of the sky, the Sun and the Moon (both themes), and its names for the site's tokens ----- */
:root {
    --sun: #e8930c;
    --sun-ink: #8a4f00;
    --moon: #7d89a4;
    --moon-lit: #f6f0de;
    --moon-dark: #cdd3de;
    --moon-maria: #a39d88;
    --z-day: #f8d77c;
    --z-golden: #f2a03b;
    --z-blue: #4d7bd8;
    --z-nautical: #2e4a9b;
    --z-astro: #1f2a64;
    --z-night: #121734;
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --border: var(--surface-border);
    --border-strong: var(--line-strong);
}
:root:not([data-theme="light"]) {
    --sun: #f5a524;
    --sun-ink: #f7c56a;
    --moon: #c3cde0;
    --moon-lit: #f1ead6;
    --moon-dark: #222b48;
    --moon-maria: #a9a38f;
}

/* ----- The site's text rules (p, ul, li, table) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.app-shell) dl,
:where(.app-shell) dd, :where(.app-shell) figure { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) table { margin: 0; background: none; border-radius: 0; overflow: visible; }
:where(.app-shell) th, :where(.app-shell) td { border: 0; padding: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ----- Toolbar: the place, the date, the link, settings and help ----- */
.app-toolbar .icon-btn { width: 40px; height: 40px; border-color: var(--surface-border); background: var(--surface); }
.app-toolbar .icon-btn:disabled, .card-header .icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.app-toolbar .icon-btn:disabled:hover { border-color: var(--surface-border); color: var(--text-2); }
.card-header .icon-btn { border-color: var(--surface-border); background: var(--surface); }
.place-pill { display: inline-flex; align-items: center; gap: 12px; padding: 8px 18px 8px 12px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 0; max-width: 100%; font-family: inherit; text-align: left; color: var(--text); cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease; }
.place-pill:hover { border-color: var(--brand); transform: translateY(-1px); }
.place-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.place-pill .status-main { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; white-space: normal; font-size: 1rem; }
.place-pill .status-sub { white-space: normal; font-size: 0.78rem; overflow-wrap: anywhere; }
.place-change { font-size: 0.8rem; font-weight: 600; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.datebar { display: flex; align-items: center; gap: 8px; }
.date-pick { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 156px; padding: 0 14px; border: 1px solid var(--surface-border); border-radius: 9999px; background: var(--surface); cursor: pointer; transition: border-color 0.2s ease; }
.date-pick:hover { border-color: var(--brand); }
.date-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.date-pick strong { font-size: 0.9rem; font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.date-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.date-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.app-shell > .view-tabs { margin: 0 0 1.25rem; display: flex; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }

/* ----- Views: cards in one column, two from 1000 px ----- */
.view > * + * { margin-top: 20px; }
.view-lede { color: var(--text-2); font-size: 1rem; max-width: 75ch; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (min-width: 1000px) { .cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.card-body > * + * { margin-top: 14px; }
.card-title .ct-text { min-width: 0; }
.hint { font-size: 0.85rem; color: var(--text-3); max-width: 75ch; }
.empty { color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 18px 8px; text-align: center; font-size: 0.925rem; }
.more { align-self: flex-start; }

/* ----- Hero cards (Today and Moon) ----- */
.hero { display: grid; gap: 20px 48px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "figure" "facts"; align-items: start; padding: 24px; }
.hero.card-body > * + * { margin-top: 0; }
.hero-head { grid-area: head; display: flex; flex-direction: column; gap: 8px; }
.hero-figure { grid-area: figure; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.hero-facts { grid-area: facts; min-width: 0; }
@media (min-width: 900px) {
    .hero { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); grid-template-areas: "figure head" "figure facts"; align-content: center; }
    .hero-head { align-self: end; }
}
.hero-title { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); letter-spacing: -0.02em; line-height: 1.2; }
.kicker { font-weight: 600; color: var(--sun-ink); }
.kicker .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 8px; vertical-align: -1px; }
.lede { color: var(--text-2); font-size: 1.02rem; max-width: 62ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) and (max-width: 1199px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { border-top: 1px solid var(--surface-border); padding: 10px 0 12px; min-width: 0; }
.fact dt { font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
.fact dd { margin: 0; }
.fact .v { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.25; }
.fact .s { font-size: 0.82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ----- Sky dial ----- */
.dial { width: 100%; max-width: 420px; aspect-ratio: 1; display: block; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.dial:active { cursor: grabbing; }
.dial:focus-visible, .chart:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 12px; }
.dial text { font-family: inherit; fill: var(--text); }
.dial .t-muted { fill: var(--text-2); }
.dial-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .swatch, .tl .swatch:not(.ring), .kicker .swatch { box-shadow: inset 0 0 0 1px var(--line-strong); } /* night colours on a dark card */
.hero-figure .legend { justify-content: center; }
.legend .line { width: 18px; height: 0; border-top: 3px solid; flex: none; }
.legend .dash { width: 18px; height: 0; border-top: 2px dashed; flex: none; }

/* ----- The day, hour by hour ----- */
.tl { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--surface-border); }
.tl:last-child { border-bottom: 0; }
.tl .swatch { width: 12px; height: 12px; border-radius: 4px; }
.tl .swatch.ring { background: transparent !important; border: 2px solid var(--moon); border-radius: 50%; }
.tl-name { font-weight: 600; color: var(--text-strong); }
.tl-note { font-size: 0.82rem; color: var(--text-2); }
.tl-time { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; color: var(--text-strong); }
.tl.past .tl-name, .tl.past .tl-time { color: var(--text-3); font-weight: 500; } /* the original faded past rows to 55%, below 4.5:1 */
.tl.past .swatch { opacity: 0.55; }
.tl.now { border-bottom: 2px solid var(--sun); padding: 6px 0; }
.tl.now .tl-name, .tl.now .tl-time { color: var(--sun-ink); }

/* ----- Small summaries ----- */
.brief { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.brief p + p { margin-top: 4px; }
.rows { display: flex; flex-direction: column; }
.rows > div { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 4px 16px; padding: 9px 0; border-bottom: 1px solid var(--surface-border); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--text-2); font-size: 0.9rem; }
.rows dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.rows dd strong { font-weight: 650; color: var(--text-strong); }
.rows .sub { display: block; font-size: 0.82rem; color: var(--text-3); }

/* ----- Charts ----- */
.chart { position: relative; width: 100%; height: 300px; border: 1px solid var(--surface-border); border-radius: 12px; background: var(--surface); touch-action: pan-y; cursor: ew-resize; user-select: none; -webkit-user-select: none; overflow: hidden; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart text { font-family: inherit; }
@media (max-width: 639px) { .chart { height: 250px; } }
.readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (min-width: 760px) { .readout { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.readout > div { border-top: 1px solid var(--surface-border); padding: 8px 0; min-width: 0; }
.readout dt { font-size: 0.82rem; color: var(--text-2); }
.readout dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.readout .s { font-weight: 400; font-size: 0.82rem; color: var(--text-3); }
.skymap-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 560px) { .skymap-wrap { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); } }
.skymap { width: 100%; max-width: 300px; aspect-ratio: 1; display: block; margin: 0 auto; }
.skymap text { font-family: inherit; }
.year-canvas { width: 100%; height: 280px; display: block; border: 1px solid var(--surface-border); border-radius: 12px; touch-action: pan-y; cursor: crosshair; }
@media (max-width: 639px) { .year-canvas { height: 220px; } }

/* ----- Shadow ----- */
.shadow-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.shadow-form .select { width: 100%; }
.shadow-out { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.6rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
#shadowOut > * + * { margin-top: 8px; }
.shadow-svg { width: 100%; height: auto; display: block; max-height: 150px; }

/* ----- The next 30 days ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--surface-border); white-space: nowrap; color: var(--text); }
.table th { font-weight: 600; color: var(--text-2); font-size: 0.82rem; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--tint-brand); }
.table td .moon-cell, .table td.moon-cell { display: flex; align-items: center; gap: 6px; }
.day-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--text-strong); cursor: pointer; text-align: left; }
.table tr.weekend .day-link { color: var(--sun-ink); }
.day-link:hover { color: var(--link); text-decoration: underline; }
.day-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ----- Moon ----- */
.moon-big { width: min(100%, 320px); aspect-ratio: 1; display: block; }
.moon-mini { display: inline-block; vertical-align: middle; flex: none; }
.dist-box { margin-top: 12px; }
.gauge { position: relative; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--sun), var(--line-strong) 50%, var(--moon)); margin: 10px 0 6px; }
.gauge i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text-strong); transform: translate(-50%, -50%); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-2); gap: 12px; }
.gauge-labels span:nth-child(2) { text-align: center; }
.gauge-labels span:last-child { text-align: right; }
.phase-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (min-width: 760px) { .phase-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.phase-card { border-top: 1px solid var(--surface-border); padding: 12px 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.phase-card .moon-mini { grid-row: span 3; }
.phase-card b { font-weight: 650; color: var(--text-strong); }
.phase-card span { font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mcal .dow { text-align: center; font-size: 0.78rem; color: var(--text-2); padding: 2px 0; }
.mcal button { position: relative; min-height: 64px; border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; padding: 5px 2px 4px; font-family: inherit; color: var(--text); font-variant-numeric: tabular-nums; min-width: 0; cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease; }
.mcal button:hover { border-color: var(--brand); transform: translateY(-1px); }
.mcal button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.mcal button .d { font-size: 0.8rem; font-weight: 600; align-self: flex-start; padding-left: 4px; line-height: 1; }
.mcal button .tag { font-size: 0.62rem; padding: 0 5px; }
.mcal button.today { border-color: var(--sun); box-shadow: inset 0 0 0 1px var(--sun); }
.mcal button[aria-pressed="true"] { background: var(--gradient-brand); border-color: transparent; color: #fff; }
.mcal .pad { visibility: hidden; }
@media (min-width: 760px) { .mcal button { min-height: 78px; } }

/* ----- Lists of events ----- */
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--surface-border); }
.item:last-child { border-bottom: 0; }
.item.clickable { cursor: pointer; }
.item.next { box-shadow: inset 3px 0 0 var(--sun); padding-left: 10px; }
.item-icon { width: 40px; display: grid; place-items: center; padding-top: 2px; }
.item-title { font-weight: 650; color: var(--text-strong); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
button.item-title { background: none; border: 0; padding: 0; font-family: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
button.item-title:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
button.item-title:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.item-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-text { font-size: 0.875rem; color: var(--text-2); overflow-wrap: anywhere; }
.item-text strong { color: var(--text-strong); font-weight: 600; }
.item-when { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.item-when b { font-weight: 650; color: var(--text-strong); }
.item-when span { font-size: 0.82rem; color: var(--text-2); }
.item-when .icon-btn { border-color: var(--surface-border); background: var(--surface); margin-top: 4px; }
.date-badge { width: 48px; text-align: center; line-height: 1.1; }
.date-badge b { display: block; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.35rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.date-badge span { font-size: 0.75rem; color: var(--text-2); }
@media (max-width: 559px) {
    .item { grid-template-columns: auto minmax(0, 1fr); }
    .item-when { grid-column: 2; align-items: flex-start; text-align: left; flex-direction: row; gap: 8px; flex-wrap: wrap; white-space: normal; }
}
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 650; background: var(--surface-2); border: 1px solid var(--surface-border); color: var(--text); white-space: nowrap; line-height: 1.5; }
.tag.sun { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); border-color: color-mix(in srgb, var(--sun) 50%, var(--surface)); }
.tag.moon { background: color-mix(in srgb, var(--moon) 22%, var(--surface)); border-color: color-mix(in srgb, var(--moon) 45%, var(--surface)); }
.tag.good { color: var(--ok); border-color: currentColor; background: transparent; }
.tag.warn { color: var(--warn); border-color: currentColor; background: transparent; }
.tag.bad { color: var(--bad); border-color: currentColor; background: transparent; }
.tag.red { background: color-mix(in srgb, #c43d2f 20%, var(--surface)); border-color: color-mix(in srgb, #c43d2f 45%, var(--surface)); }
.mcal button[aria-pressed="true"] .tag { color: var(--text); }
.glossary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
@media (min-width: 760px) { .glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.glossary div { border-top: 1px solid var(--surface-border); padding: 10px 0; }
.glossary dt { font-weight: 650; color: var(--text-strong); }
.glossary dd { margin: 2px 0 0; color: var(--text-2); font-size: 0.9rem; }

/* ----- Windows: the place, settings, the link, help ----- */
.city-list { max-height: 300px; overflow-y: auto; border-top: 1px solid var(--surface-border); margin: 0; padding: 0; list-style: none; }
.city-list li { margin: 0; }
.city-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; padding: 10px 6px; min-height: 48px; border: 0; border-bottom: 1px solid var(--surface-border); background: transparent; font-family: inherit; font-size: 0.95rem; color: var(--text); cursor: pointer; }
.city-list button:hover, .city-list button:focus-visible { background: var(--tint-brand); outline: none; }
.city-list strong { color: var(--text-strong); }
.city-list small { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.city-list .empty { margin: 12px 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.select.input { width: 100%; }
details.manual { border-top: 1px solid var(--surface-border); padding-top: 12px; }
details.manual summary { cursor: pointer; font-weight: 600; color: var(--text-strong); min-height: 32px; }
details.manual[open] summary { margin-bottom: 12px; }
.manual-body { display: flex; flex-direction: column; gap: 12px; }
.set-group { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--surface-border); padding-top: 14px; }
.set-group:first-child { border-top: 0; padding-top: 0; }
.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li { color: var(--text-2); margin-bottom: 6px; }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Print: the open view only, in light colours ----- */
@media print {
    :root:not([data-theme="light"]) { --surface: #ffffff; --surface-2: #f3f4f8; --surface-border: rgba(0, 0, 0, 0.12); --line-strong: rgba(0, 0, 0, 0.24); --text: #0a0a14; --text-strong: #0a0a14; --text-2: #4b5563; --text-3: #5f6673; --sun: #e8930c; --sun-ink: #8a4f00; --moon: #7d89a4; --moon-dark: #cdd3de; --moon-maria: #a39d88; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    html, body { background: #fff !important; }
    body::before { display: none !important; }
    body > *:not(main):not(.icon-sprite) { display: none !important; }
    main > *:not(.app-shell), .app-toolbar, .view-tabs, .shell-hint, .card-header .actions, .dial-actions, #chartNowBtn, .chips, .more, .item-when .icon-btn { display: none !important; }
    .card { box-shadow: none !important; break-inside: avoid; }
    ins.adsbygoogle, .google-auto-placed, .theme-toggle, #zdu-cookie-banner { display: none !important; }
}

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .info-section .info-grid { grid-template-columns: repeat(2, 1fr); }
    .info-three { grid-template-columns: 1fr; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .place-pill { flex: 1 1 100%; border-radius: 18px; } /* its second line may wrap on a phone */
    .datebar { flex: 1 1 100%; }
    .date-pick { flex: 1; min-width: 0; }
    .toolbar-right .btn { flex: 1 1 auto; }
    .toolbar-right .datebar .btn { flex: 0 0 auto; }
    .app-shell > .view-tabs { width: 100%; }
    .app-shell > .view-tabs .view-tab { flex: 1 1 auto; justify-content: center; padding: 8px 10px; font-size: 0.85rem; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .hero { padding: 16px; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
    .rows > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 399px) {
    .date-pick .wd { display: none; }
    .mcal { gap: 2px; margin: 0 -14px; } /* seven day buttons of 44 px: the calendar takes most of the card's side space */
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .toast, .chip, .seg button, .view-tab, .place-pill, .date-pick, .mcal button { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The dial, the charts and the moon pictures
   are drawings and keep their own sizes. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]) { min-height: 44px; }
    main .icon-btn, .app-toolbar .icon-btn, .card-header .icon-btn { min-width: 44px; min-height: 44px; }
    main .seg button { min-width: 44px; min-height: 44px; }
    main .view-tab { min-height: 44px; }
    main .chip { min-height: 44px; }
    main .date-pick { min-height: 44px; }
    main button.item-title, main .day-link { min-height: 44px; }
    main :is(p, li, dd, dt, td, th, figcaption, .form-hint, .hint, .muted, .small, .label, .input, .select, .chip, .card-note,
        .tl-name, .tl-note, .tl-time, .item-text, .item-when span, .item-when b, .fact dt, .fact .s, .readout dt, .readout .s,
        .gauge-labels, .legend, .date-badge span, .status-sub, .place-change, .lede, .kicker, .rows .sub, .date-pick strong,
        .mcal button .d, .mcal .dow, .phase-card span, .glossary dd, .city-list small) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog summary, .dialog details.manual summary { min-height: 44px; }
    .dialog details.manual summary { padding: 10px 0; }
    .dialog .dialog-close { width: 44px; height: 44px; }
    .dialog p, .dialog li, .dialog .form-hint, .dialog .input, .dialog .label, .dialog .city-list button, .dialog .city-list small { font-size: 1rem; }
}
