:root {
  color-scheme: dark;
  --ink: #f3eaf4;
  --muted: #b5a7b9;
  --paper: #100d14;
  --card: #1a1420;
  --line: #423047;
  --accent: #b72767;
  --accent-dark: #ed83ad;
  --teal: #d98be9;
  --shadow: 0 24px 60px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
/* Reserve scrollbar space before results load so navigation stays in place. */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}
body { margin: 0; min-width: min(320px, 100%); color: var(--ink); background: radial-gradient(circle at 85% -10%, #321b38 0, transparent 35%), var(--paper); }
body::before { content: ""; display: block; height: 4px; background: var(--accent); }
.shell { display: flex; flex-direction: column; min-height: calc(100vh - 4px); max-width: 1040px; margin: 0 auto; padding: 26px 28px 34px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 0 22px; }
.brand { min-width: 0; }
.brand-link { display: inline-block; color: inherit; text-decoration: none; border-radius: 4px; }
.brand .eyebrow { margin: 0 0 12px; color: #cf719a; text-transform: uppercase; }
.brand h1 { margin: 0; font-size: clamp(2.7rem, 5vw, 4.2rem); }
.site-nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.site-nav a { padding: 9px 12px; border-radius: 7px; color: var(--muted); font-size: .85rem; text-decoration: none; }
.site-nav a:hover { color: var(--ink); background: #2b2030; }
.site-nav a[aria-current="page"] { color: var(--accent-dark); background: #302033; }
:is(a, button, select):focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
:is(a, button, select) { -webkit-tap-highlight-color: transparent; }
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: .72rem; font-weight: 800; letter-spacing: .17em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.2vw, 2.7rem); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 2.3vw, 1.8rem); font-weight: 400; letter-spacing: -.03em; }
h3 { margin-bottom: 16px; font-size: .73rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.intro { max-width: 540px; margin-bottom: 0; color: var(--muted); font-size: .95rem; line-height: 1.5; }
.result, .notes { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.date-controls { margin-bottom: 26px; }
.date-controls[aria-busy="true"] { visibility: hidden; }
.single-date { max-width: 465px; margin-top: 30px; }
.load-message { color: var(--accent-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.section-heading, .result-topline, footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.chip { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.picker-wrap { position: relative; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 12px 32px rgba(0, 0, 0, .22); cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.picker-wrap:hover, .picker-wrap:focus-within { border-color: var(--accent); background: #211827; }
.date-trigger { width: 100%; padding: 0; border: 0; color: var(--ink); background: transparent; font: inherit; font-size: .98rem; text-align: left; }
button { border: 0; border-radius: 8px; padding: 11px 15px; color: #fff; background: var(--accent); font: inherit; font-weight: 800; cursor: pointer; }
button:hover { background: #d33d7d; }
button span { padding-left: 8px; font-size: 1rem; }
button.date-trigger, button.date-trigger:hover, button.date-trigger[aria-expanded="true"] { background: transparent; text-align: left; }
.date-popover { position: absolute; z-index: 10; top: calc(100% + 8px); left: 0; width: min(340px, 82vw); padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #211827; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.date-popover h3 { margin: 0 0 12px; padding-right: 30px; color: var(--ink); font-size: .7rem; }
.picker-close { position: absolute; top: 3px; right: 5px; width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; font-size: 1.6rem; font-weight: 400; }
.picker-close:hover { background: #34223a; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.month-button, .day-button { padding: 8px 6px; color: var(--muted); background: #2b2030; font-size: .78rem; font-weight: 700; }
.month-button:hover, .day-button:hover { color: #fff; background: var(--accent); }
.day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-button { padding: 8px 2px; }
.back-to-months { margin-bottom: 12px; padding: 5px 8px; color: var(--accent-dark); background: transparent; font-size: .72rem; }
.back-to-months:hover { background: #34223a; }
.result { margin-top: 26px; padding: 34px; scroll-margin-top: 20px; }
.periods { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin: 30px 0 42px; }
.period { display: grid; gap: 6px; padding: 17px 18px; border-left: 3px solid var(--accent); background: #211827; }
.period-label { color: var(--accent-dark); font-size: .65rem; font-weight: 800; letter-spacing: .15em; }
.period strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; font-weight: 400; }
.period span:last-child { color: var(--muted); font-size: .8rem; }
.period-picker-detail { color: var(--muted); font-size: .8rem; }
.plus { color: var(--accent-dark); font-family: Georgia, "Times New Roman", serif; font-size: 2rem; }
.profile { border-top: 1px solid var(--line); padding-top: 34px; }
.profile-kicker { margin-bottom: 10px; color: var(--muted); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.profile h2 { font-size: clamp(2.4rem, 5vw, 4.8rem); }
.sample-note { max-width: 700px; margin: 20px 0 0; padding: 13px 15px; border-radius: 8px; color: #f2c2d6; background: #342039; font-size: .86rem; line-height: 1.5; }
.profile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 36px 0 42px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-grid section { min-height: 145px; padding: 22px 18px 22px 0; border-right: 1px solid var(--line); }
.profile-grid section + section { padding-left: 18px; }
.profile-grid section:last-child { border-right: 0; }
.profile-grid ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; color: var(--teal); font-weight: 700; line-height: 1.35; }
.big-value { color: var(--teal); font-family: Georgia, "Times New Roman", serif; font-size: 1.45rem; }
.description { max-width: 760px; }
.description p { color: #d1c5d4; font-family: Georgia, "Times New Roman", serif; font-size: 1.16rem; line-height: 1.72; }
.source-line { margin: 28px 0 0; color: var(--muted); font-size: .78rem; }
.empty-state { padding: 30px 0 12px; }
.empty-state p { max-width: 660px; margin-top: 16px; color: var(--muted); line-height: 1.65; }
code { padding: 2px 5px; border-radius: 4px; color: var(--teal); background: #2b2030; font-size: .88em; }
.notes { display: grid; grid-template-columns: 1fr 1.4fr; gap: 36px; margin-top: 26px; padding: 30px 34px; box-shadow: none; }
.notes p:last-child { margin: 0; color: var(--muted); line-height: 1.65; }
footer { padding: 34px 2px 0; color: var(--muted); font-size: .78rem; }
footer a { color: var(--teal); font-weight: 700; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.site-footer { display: block; margin-top: auto; padding: 48px 0 0; line-height: 1.6; }
.site-footer a { color: var(--muted); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--teal); }
.overview-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 34px 0 22px; }
.overview-heading h2 { font-size: 2rem; }
.overview-hint { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.type-filter { display: grid; gap: 7px; color: var(--muted); font-size: .72rem; }
.type-filter select { appearance: none; width: 185px; padding: 10px 36px 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #211827 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23b5a7b9' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px; color: var(--ink); font: inherit; font-size: .85rem; line-height: 1.4; }
.match-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.mobile-match-switch { display: none; }
.match-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.match-card-title { margin: 0; padding: 19px 20px; border-bottom: 1px solid var(--line); color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; font-weight: 400; text-transform: none; letter-spacing: -.02em; }
.match-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.match-column { min-width: 0; padding: 16px 14px; }
.match-column + .match-column { border-left: 1px solid var(--line); }
.match-column h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 13px; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.match-column h4 span { border-radius: 5px; padding: 3px 6px; background: #302033; font-size: .7rem; letter-spacing: 0; }
.best-label { color: var(--teal); }
.worst-label { color: var(--accent-dark); }
.match-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.match-link { display: grid; gap: 5px; padding: 11px 10px; border: 1px solid transparent; border-radius: 7px; background: #241b29; color: var(--ink); text-decoration: none; }
.match-link:hover { background: #302237; border-color: var(--teal); }
.match-link.worst-match:hover { border-color: var(--accent-dark); }
.match-range { font-size: .85rem; font-weight: 650; line-height: 1.4; }
.match-period { font-size: .73rem; color: var(--muted); line-height: 1.4; }
.match-type { color: var(--teal); font-size: .69rem; line-height: 1.4; }
.worst-match .match-type { color: var(--accent-dark); }
.no-matches { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.birthday-view { flex: 1; }
.birthday-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 14px 0 20px; }
.birthday-heading .eyebrow { margin-bottom: 8px; }
.birthday-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.birthday-tools label { display: grid; gap: 7px; color: var(--muted); font-size: .75rem; }
.birthday-tools label:first-child { flex: 1 1 250px; }
.birthday-tools input, .birthday-tools select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #211827; font: inherit; font-size: .9rem; }
.birthday-tools input { width: 100%; }
.birthday-tools select { min-width: 180px; }
.birthday-sort-field { display: grid; gap: 7px; }
.birthday-sort-controls { display: flex; gap: 6px; }
.birthday-sort-controls select { flex: 1; min-width: 0; }
#birthday-sort-direction { flex-shrink: 0; width: 44px; padding: 8px; border: 1px solid var(--line); background: #211827; color: var(--teal); font-size: 1.2rem; }
#birthday-sort-direction:hover { background: #302033; }
.birthday-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.birthday-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .83rem; }
.birthday-table th, .birthday-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.birthday-table th { padding: 0; color: var(--muted); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; }
.birthday-sort-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 44px; padding: 13px 12px; background: transparent; color: inherit; font: inherit; font-weight: 700; letter-spacing: inherit; text-transform: inherit; text-align: left; border-radius: 0; }
.birthday-sort-header:hover { background: #302033; color: var(--ink); }
.birthday-sort-header:focus-visible { outline-offset: -3px; }
.birthday-sort-header span { padding: 0; font-size: .9rem; }
.birthday-table th[aria-sort] { color: var(--teal); }
.birthday-table tr:last-child td { border-bottom: 0; }
.birthday-table a { color: var(--teal); }
.birthday-table a:hover { color: var(--ink); }
#birthday-error { color: var(--accent-dark); }
@media (max-width: 720px) {
  .shell { padding: 20px 16px max(24px, env(safe-area-inset-bottom)); }
  .hero { gap: 10px; padding: 0 0 22px; }
  .brand .eyebrow { margin-bottom: 8px; font-size: .64rem; letter-spacing: .13em; }
  .brand h1 { font-size: 2.7rem; }
  .site-nav { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; }
  .site-nav a { display: grid; place-items: center; min-height: 40px; padding: 8px 10px; font-size: .76rem; }
  .birthday-heading { align-items: start; flex-direction: column; gap: 3px; }
  .birthday-tools { display: grid; }
  .birthday-tools select { width: 100%; }
  .birthday-table-wrap { overflow: visible; border: 0; background: transparent; }
  .birthday-table, .birthday-table tbody, .birthday-table tr, .birthday-table td { display: block; width: 100%; }
  .birthday-table thead { display: none; }
  .birthday-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .birthday-table td { min-width: 0; padding: 7px 5px; border: 0; overflow-wrap: anywhere; }
  .birthday-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; }
  .birthday-table td:first-child, .birthday-table td:last-child { grid-column: 1 / -1; }
  .birthday-table td:first-child { font-size: 1.05rem; font-weight: 700; }
  .birthday-table td:first-child::before { display: none; }
  .date-controls { margin: 0 0 20px; }
  .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 10px; margin: 0; }
  .date-picker-periods .period { grid-template-rows: auto auto 1fr; }
  .plus { display: none; }
  .period { min-width: 0; padding: 14px 12px; border-left-width: 2px; gap: 7px; }
  .period-label { font-size: .6rem; letter-spacing: .12em; }
  .date-trigger { font-size: 1rem; line-height: 1.4; }
  .period-picker-detail { font-size: .74rem; line-height: 1.5; }
  .single-date { width: 100%; max-width: none; }
  .single-date .period { grid-template-columns: 1fr 1fr; }
  .single-date .period-label, .single-date .date-trigger { grid-column: 1; }
  .single-date .period-picker-detail { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
  .result { padding: 20px 16px; margin: 0; border-radius: 16px; box-shadow: none; }
  .result-topline .eyebrow { font-size: .6rem; letter-spacing: .13em; margin-bottom: 15px; }
  .profile { border: 0; padding: 0; }
  .profile-kicker { font-size: .68rem; line-height: 1.5; margin-bottom: 8px; }
  .profile h2 { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.08; overflow-wrap: break-word; }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 22px 0 28px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .profile-grid section, .profile-grid section + section { min-width: 0; min-height: 0; padding: 15px 12px; border: 0; }
  .profile-grid section:nth-child(odd) { border-right: 1px solid var(--line); }
  .profile-grid section:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .profile-grid h3 { font-size: .62rem; letter-spacing: .09em; margin-bottom: 12px; }
  .profile-grid ul { font-size: .9rem; line-height: 1.4; overflow-wrap: break-word; }
  .big-value { font-size: 1.3rem; margin: 0; overflow-wrap: break-word; }
  .description h3 { font-size: .65rem; margin-bottom: 12px; }
  .description p { font-size: 1.04rem; line-height: 1.7; }
  .source-line { font-size: .7rem; line-height: 1.5; }
  .site-footer { padding-top: 32px; font-size: .7rem; line-height: 1.8; }
  .date-popover { position: fixed; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; max-width: 480px; max-height: calc(100dvh - 24px); margin-inline: auto; overflow-y: auto; padding: 22px 18px 18px; border-radius: 20px; z-index: 100; cursor: default; }
  body:has(.date-popover:not([hidden]))::after { content: ""; position: fixed; inset: 0; z-index: 90; background: rgb(8 5 12 / .72); backdrop-filter: blur(4px); }
  .picker-close { top: 5px; right: 8px; width: 44px; height: 44px; }
  .date-popover h3 { min-height: 20px; margin-bottom: 16px; padding-right: 32px; font-size: .74rem; }
  .month-grid { gap: 8px; }
  .month-button, .day-button { min-height: 44px; font-size: .9rem; }
  .back-to-months { min-height: 44px; margin-top: -10px; margin-bottom: 8px; font-size: .85rem; }
  .overview-heading { align-items: stretch; flex-direction: column; gap: 16px; margin: 0 0 16px; }
  .overview-heading h2 { font-size: 1.8rem; }
  .overview-hint { font-size: .76rem; line-height: 1.5; margin-top: 6px; }
  .type-filter { width: 100%; }
  .type-filter select { width: 100%; min-height: 46px; font-size: 1rem; }
  .mobile-match-switch { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
  .mobile-match-switch button { flex: 1; min-height: 44px; padding: 8px; color: var(--muted); background: transparent; font-size: .9rem; }
  .mobile-match-switch button[aria-pressed="true"] { background: #3c2747; color: #efc8ff; }
  .mobile-match-switch button[data-match-view="worst"][aria-pressed="true"] { background: #422237; color: #ffb0ce; }
  .match-grid { grid-template-columns: 1fr; gap: 16px; }
  .match-card-title { padding: 16px; font-size: 1.4rem; }
  .match-columns { grid-template-columns: 1fr; }
  .match-grid[data-view="best"] .match-column-worst, .match-grid[data-view="worst"] .match-column-best { display: none; }
  .match-column, .match-column + .match-column { padding: 12px 16px 4px; border: 0; }
  .match-column h4 { font-size: .65rem; margin: 0 0 4px; }
  .match-list { gap: 0; }
  .match-list li + li { border-top: 1px solid #342739; }
  .match-link { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; min-height: 72px; padding: 14px 0; border: 0; border-radius: 0; background: transparent; }
  .match-link:hover { background: #241b29; }
  .match-range { grid-column: 1; font-size: .92rem; }
  .match-period { grid-column: 1; font-size: .75rem; }
  .match-type { grid-column: 2; grid-row: 1 / span 2; align-self: center; max-width: 100px; padding: 5px 7px; border-radius: 6px; background: #302137; font-size: .68rem; text-align: center; }
  .worst-match .match-type { background: #38202e; }
  .no-matches { padding: 12px 0 16px; }
}
@media (max-width: 360px) {
  .shell { padding-inline: 12px; }
  .brand .eyebrow { font-size: .61rem; letter-spacing: .1em; }
  .site-nav a { padding-inline: 8px; font-size: .72rem; }
  .period { padding-inline: 10px; }
  .profile-grid section, .profile-grid section + section { padding: 13px 9px; }
  .match-type { max-width: 80px; }
}
