:root {
    color-scheme: dark;
    --bg: #070812;
    --panel: rgba(18, 18, 38, 0.76);
    --panel-strong: rgba(26, 24, 52, 0.92);
    --line: rgba(230, 200, 120, 0.44);
    --line-soft: rgba(217, 222, 235, 0.18);
    --gold: #e6c878;
    --silver: #d9deeb;
    --text: #f7f1ff;
    --muted: #b8b3cf;
    --violet: #8f62ff;
    --rose: #da6ea8;
    --good: #72d6c9;
    --bad: #f08a9a;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

img,
svg {
    max-width: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 8%, rgba(143, 98, 255, 0.3), transparent 28rem),
        radial-gradient(circle at 84% 0%, rgba(230, 200, 120, 0.16), transparent 22rem),
        linear-gradient(145deg, #050610 0%, #0c1025 48%, #180d2c 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.82) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(230,200,120,0.56) 0 1px, transparent 1.4px);
    background-size: 48px 48px, 86px 86px;
    background-position: 0 0, 20px 31px;
    opacity: 0.2;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
}

button,
input,
select,
a {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
li,
td,
th,
span,
strong,
a,
button {
    overflow-wrap: break-word;
}

.lab-shell,
.cosmic-section-nav,
.cosmic-section-nav__links,
.hero-panel,
.panel,
.lab-grid,
.chart-stage,
.chart-form,
.cosmic-reading__block,
.table-panel,
.wheel-wrap {
    max-width: 100%;
    min-width: 0;
}

.lab-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 12px 10px 52px;
}

.cosmic-section-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid rgba(217, 222, 235, 0.16);
    border-radius: 20px;
    background: rgba(8, 9, 22, 0.78);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
}

.cosmic-section-nav__brand,
.cosmic-section-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.cosmic-section-nav__brand {
    flex: 0 0 auto;
    padding: 8px 12px;
    color: var(--gold);
    font-size: 0.94rem;
}

.cosmic-section-nav__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.cosmic-section-nav__link {
    min-width: 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--silver);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.cosmic-section-nav__link:hover,
.cosmic-section-nav__link:focus-visible,
.cosmic-section-nav__link.is-active {
    border-color: rgba(230, 200, 120, 0.5);
    background: rgba(230, 200, 120, 0.12);
    color: var(--text);
    outline: none;
    transform: translateY(-1px);
}

.cosmic-section-nav__link.is-active {
    box-shadow: inset 0 0 0 1px rgba(230, 200, 120, 0.18);
}

.cosmic-context-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.cosmic-context-links a {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid rgba(230, 200, 120, 0.34);
    border-radius: 999px;
    background: rgba(230, 200, 120, 0.09);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.cosmic-context-links a:hover,
.cosmic-context-links a:focus-visible {
    border-color: rgba(230, 200, 120, 0.62);
    background: rgba(230, 200, 120, 0.14);
    outline: none;
    transform: translateY(-1px);
}

.hero-panel,
.panel {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background: linear-gradient(145deg, var(--panel), rgba(9, 10, 24, 0.78));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-panel {
    padding: clamp(22px, 6vw, 44px);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.05;
    letter-spacing: 0;
}

h1 {
    max-width: 12ch;
    font-size: clamp(2.35rem, 11vw, 5.2rem);
}

h2 {
    font-size: 1.35rem;
}

.hero-copy {
    max-width: 44rem;
    margin: 14px 0 0;
    color: var(--silver);
    font-size: 1.02rem;
    line-height: 1.6;
}

.experiment-notice {
    max-width: 42rem;
    margin: 18px 0 0;
    padding: 12px 14px;
    border: 1px solid rgba(230, 200, 120, 0.24);
    border-radius: 14px;
    background: rgba(230, 200, 120, 0.08);
    color: var(--silver);
    font-size: 0.94rem;
    line-height: 1.5;
}

.lab-grid {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.how-panel {
    margin-top: 12px;
}

.how-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.how-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--silver);
    font-weight: 800;
}

.how-list span {
    display: inline-grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(230, 200, 120, 0.36);
    border-radius: 999px;
    background: rgba(230, 200, 120, 0.1);
    color: var(--gold);
    font-size: 0.82rem;
}

.accuracy-note {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.panel {
    padding: 16px;
}

.panel-heading {
    margin-bottom: 14px;
}

.panel-heading.split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.panel-heading.split > *,
.chart-action-row > *,
.aspect-legend > *,
.cosmic-reading__grid > * {
    min-width: 0;
}

.chart-form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--silver);
    font-size: 0.88rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background-color: #121126;
    color: var(--text);
    outline: none;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--gold) 50%),
        linear-gradient(135deg, var(--gold) 50%, transparent 50%);
    background-color: #121126;
    background-position:
        calc(100% - 18px) 19px,
        calc(100% - 12px) 19px;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px;
    color: #f8f5ff;
}

select option {
    background-color: #ffffff;
    color: #111111;
}

input:focus,
select:focus {
    border-color: rgba(230, 200, 120, 0.66);
    box-shadow: 0 0 0 3px rgba(230, 200, 120, 0.12);
}

.field-help {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.field-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-action {
    min-height: 48px;
    border: 1px solid rgba(230, 200, 120, 0.72);
    border-radius: 14px;
    background: linear-gradient(135deg, #f4dc95, #cfa65d);
    color: #17100a;
    cursor: pointer;
    font-weight: 900;
}

.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--silver);
    cursor: pointer;
    font-weight: 800;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.secondary-action:hover,
.secondary-action:focus-visible {
    border-color: rgba(230, 200, 120, 0.5);
    background: rgba(230, 200, 120, 0.09);
    box-shadow: 0 0 18px rgba(143, 98, 255, 0.16);
    outline: none;
    transform: translateY(-1px);
}

.primary-action:hover,
.primary-action:focus-visible {
    box-shadow: 0 0 24px rgba(230, 200, 120, 0.28);
    outline: none;
}

.primary-action:disabled {
    cursor: wait;
    filter: grayscale(0.35);
    opacity: 0.74;
}

.form-note,
.status-message,
.regenerate-hint,
.birth-summary {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.status-message {
    padding: 10px 12px;
    border: 1px solid rgba(217, 222, 235, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
}

.status-message:empty,
.status-message[hidden] {
    display: none;
}

.status-message[data-tone="success"] {
    border-color: rgba(114, 214, 201, 0.34);
    background: rgba(114, 214, 201, 0.08);
    color: var(--good);
}

.status-message[data-tone="error"] {
    border-color: rgba(240, 138, 154, 0.38);
    background: rgba(240, 138, 154, 0.08);
    color: var(--bad);
}

.status-message[data-tone="info"] {
    border-color: rgba(230, 200, 120, 0.24);
    background: rgba(230, 200, 120, 0.08);
    color: var(--silver);
}

.regenerate-hint {
    color: var(--gold);
}

.chart-stage {
    min-width: 0;
}

.chart-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid rgba(230, 200, 120, 0.28);
    border-radius: 999px;
    background: rgba(230, 200, 120, 0.09);
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: 800;
}

.wheel-wrap {
    display: grid;
    place-items: center;
    min-height: 320px;
    border: 1px solid rgba(217, 222, 235, 0.12);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 50%, rgba(230, 200, 120, 0.1), transparent 10rem),
        rgba(255, 255, 255, 0.035);
    overflow: hidden;
}

.wheel-wrap svg {
    display: block;
    width: min(100%, 620px);
    max-width: 100%;
    height: auto;
    padding: 6px;
}

.empty-state {
    display: grid;
    gap: 6px;
    max-width: 16rem;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
}

.empty-state strong {
    color: var(--silver);
}

.empty-state span {
    display: block;
}

.empty-state.is-loading strong {
    color: var(--gold);
}

.empty-state.is-error strong {
    color: var(--bad);
}

.wheel-ring {
    fill: rgba(4, 5, 14, 0.42);
    stroke-width: 1.4;
}

.wheel-ring.outer {
    stroke: rgba(230, 200, 120, 0.72);
}

.wheel-ring.inner {
    stroke: rgba(217, 222, 235, 0.3);
}

.zodiac-line {
    stroke: rgba(230, 200, 120, 0.38);
    stroke-width: 1;
}

.zodiac-label {
    fill: rgba(244, 220, 149, 0.94);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    paint-order: stroke;
    stroke: rgba(5, 6, 16, 0.86);
    stroke-width: 3px;
}

.house-line {
    stroke: rgba(217, 222, 235, 0.22);
    stroke-width: 1;
}

.house-label {
    fill: rgba(217, 222, 235, 0.7);
    font-size: 10px;
    font-weight: 800;
}

.aspect-line {
    opacity: 0.58;
    stroke-width: 1.2;
}

.aspect-conjunction {
    stroke: #f4dc95;
    border-color: #f4dc95;
}

.aspect-opposition {
    stroke: #da6ea8;
    border-color: #da6ea8;
}

.aspect-trine {
    stroke: #72d6c9;
    border-color: #72d6c9;
}

.aspect-square {
    stroke: #e07070;
    border-color: #e07070;
}

.aspect-sextile {
    stroke: #8fbcff;
    border-color: #8fbcff;
}

.aspect-other {
    stroke: rgba(217, 222, 235, 0.5);
}

.planet-dot {
    fill: var(--planet-color, var(--gold));
    stroke: rgba(5, 6, 16, 0.9);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--planet-color, var(--gold)) 62%, transparent));
}

.planet-stem {
    stroke: color-mix(in srgb, var(--planet-color, var(--gold)) 58%, transparent);
    stroke-width: 1;
}

.planet-label-bg {
    fill: rgba(5, 6, 16, 0.86);
    stroke: var(--planet-color, rgba(230, 200, 120, 0.76));
    stroke-width: 1.25;
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--planet-color, var(--gold)) 38%, transparent));
}

.planet-label {
    fill: var(--text);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

.aspect-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.84rem;
}

.chart-actions {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(230, 200, 120, 0.2);
    border-radius: 16px;
    background:
        radial-gradient(circle at 12% 0%, rgba(143, 98, 255, 0.16), transparent 16rem),
        rgba(255, 255, 255, 0.045);
}

.chart-actions[hidden] {
    display: none;
}

.chart-actions-note,
.share-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.chart-actions-note {
    color: var(--silver);
}

.chart-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-action-row .secondary-action {
    flex: 1 1 160px;
    min-width: 0;
}

.share-status[data-tone="success"] {
    color: var(--good);
}

.share-status[data-tone="error"] {
    color: var(--bad);
}

.aspect-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    display: inline-block;
    width: 22px;
    height: 0;
    border-top-width: 3px;
    border-top-style: solid;
}

.table-panel {
    margin-top: 12px;
}

.cosmic-reading {
    margin-top: 12px;
    border-color: rgba(230, 200, 120, 0.24);
}

.cosmic-reading[hidden] {
    display: none;
}

.cosmic-reading__note,
.cosmic-reading__privacy {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.cosmic-reading__privacy {
    margin: -4px 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(114, 214, 201, 0.2);
    border-radius: 12px;
    background: rgba(114, 214, 201, 0.065);
    color: var(--silver);
}

.cosmic-reading__grid {
    display: grid;
    gap: 12px;
}

.reading-print-action {
    width: fit-content;
    min-width: 180px;
}

.cosmic-reading__block {
    border: 1px solid rgba(217, 222, 235, 0.14);
    border-radius: 16px;
    background:
        radial-gradient(circle at 12% 0%, rgba(143, 98, 255, 0.14), transparent 14rem),
        rgba(255, 255, 255, 0.045);
    padding: 14px;
}

.cosmic-reading__title {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 1rem;
    line-height: 1.2;
}

.cosmic-reading__block p,
.cosmic-reading__aspect-list {
    margin: 0;
    color: var(--silver);
    line-height: 1.58;
}

.cosmic-reading__aspect-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-left: 18px;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(217, 222, 235, 0.12);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
}

td {
    color: var(--silver);
    overflow-wrap: break-word;
}

@media (max-width: 560px) {
    .field-row,
    .field-row.two {
        grid-template-columns: 1fr;
    }

    .panel-heading.split {
        display: grid;
    }

    .reading-print-action {
        width: 100%;
    }

    .wheel-wrap {
        min-height: 286px;
    }

    table {
        min-width: 500px;
    }

    .zodiac-label {
        font-size: 9px;
    }

    .planet-label {
        font-size: 10px;
    }

    .aspect-legend {
        gap: 7px 10px;
        font-size: 0.8rem;
    }

    .chart-action-row {
        display: grid;
    }

    .chart-action-row .secondary-action {
        width: 100%;
    }

    .cosmic-section-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .cosmic-section-nav__brand {
        justify-content: flex-start;
    }

    .cosmic-section-nav__links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    .cosmic-section-nav__link {
        width: 100%;
        min-height: 44px;
        padding-inline: 10px;
        text-align: center;
    }
}

@media (min-width: 860px) {
    .lab-shell {
        padding: 30px 24px 70px;
    }

    .lab-grid {
        grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
        align-items: start;
        gap: 14px;
    }

    .panel {
        padding: 22px;
    }

    .how-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cosmic-reading__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cosmic-reading__block--wide {
        grid-column: 1 / -1;
    }
}
