:root {
    color-scheme: dark;
    --page-bg: #0a0b10;
    --surface: #0f111a;
    --surface-raised: rgba(15, 17, 26, 0.88);
    --surface-soft: rgba(10, 11, 16, 0.72);
    --text: #f8fafc;
    --text-soft: #f1f5f9;
    --muted: rgba(255, 255, 255, 0.62);
    --muted-soft: rgba(255, 255, 255, 0.42);
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-bright: #c084fc;
    --border: rgba(255, 255, 255, 0.08);
    --border-soft: rgba(255, 255, 255, 0.05);
    --border-accent: rgba(192, 132, 252, 0.32);
    --danger: #fda4af;
    --danger-bg: rgba(127, 29, 54, 0.22);
    --success: #ddd6fe;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--page-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::selection { color: var(--page-bg); background: var(--accent-bright); }

.site-backdrop {
    position: fixed;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 82% 14%, rgba(139, 92, 246, 0.14), transparent 32%),
        radial-gradient(circle at 12% 84%, rgba(49, 46, 129, 0.18), transparent 32%),
        radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.06) 1px, transparent 0);
    background-size: auto, auto, 40px 40px;
}

.page-shell {
    display: grid;
    min-height: 100vh;
    padding: clamp(16px, 4vw, 56px);
    place-items: center;
}

.app-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
    width: min(100%, 1180px);
    min-height: 720px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface-raised);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), 0 0 60px rgba(139, 92, 246, 0.08);
}

.brand-panel {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    padding: clamp(28px, 4vw, 48px);
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(139, 92, 246, 0.11), transparent 32%),
        rgba(15, 17, 26, 0.72);
}

.brand-panel::before {
    position: absolute;
    top: -120px;
    right: -140px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.12);
    content: "";
    filter: blur(80px);
    pointer-events: none;
}

.brand-lockup,
.brand-copy,
.banner-frame,
.brand-footer-note { position: relative; z-index: 1; }

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-lockup img {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.brand-name {
    margin: 0;
    color: var(--text);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.45rem;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    margin: 1px 0 0;
    color: var(--muted-soft);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.brand-copy { margin: clamp(42px, 7vw, 76px) 0 26px; }

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent-bright);
    font-size: 0.65rem;
    font-weight: 650;
    letter-spacing: 0.25em;
    line-height: 1.4;
    text-transform: uppercase;
}

.brand-copy h1,
.form-heading h2,
.result-card h2 {
    margin: 0;
    color: var(--text);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.brand-copy h1 {
    max-width: 420px;
    font-size: clamp(2.5rem, 4.6vw, 4.2rem);
    line-height: 0.98;
}

.brand-copy > p:last-child {
    max-width: 390px;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 0.93rem;
    font-weight: 300;
    line-height: 1.75;
}

.banner-frame {
    display: flex;
    min-height: 340px;
    margin: auto 0 0;
    overflow: hidden;
    aspect-ratio: 0.88;
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 18px;
    background: var(--page-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.banner-frame::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 58%, rgba(10, 11, 16, 0.82) 100%);
    content: "";
    pointer-events: none;
}

.banner-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.banner-frame figcaption {
    position: absolute;
    z-index: 1;
    bottom: 17px;
    left: 18px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.brand-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 25px;
}

.brand-footer-line {
    display: block;
    width: 34px;
    height: 1px;
    margin-top: 10px;
    flex: 0 0 auto;
    background: linear-gradient(90deg, var(--accent-bright), transparent);
}

.brand-footer-note p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.71rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1.55;
    text-transform: uppercase;
}

.brand-footer-note p span {
    color: var(--muted-soft);
    font-size: 0.64rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: none;
}

.workspace {
    min-width: 0;
    padding: clamp(28px, 5vw, 58px);
    background: rgba(10, 11, 16, 0.54);
}

.workspace-meta,
.result-card-header,
.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.workspace-meta {
    margin-bottom: 44px;
    color: var(--muted-soft);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.workspace-meta-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 14px;
}

.admin-shortcut {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid rgba(192, 132, 252, 0.28);
    border-radius: 999px;
    background: rgba(21, 24, 39, 0.72);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: none;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.admin-shortcut:hover {
    border-color: rgba(192, 132, 252, 0.72);
    background: rgba(139, 92, 246, 0.14);
    color: #ffffff;
}

.admin-shortcut:focus-visible {
    outline: 2px solid #c084fc;
    outline-offset: 3px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.61rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.status-chip i {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c084fc;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.8);
}

.form-heading { margin-bottom: 32px; }
.form-heading .eyebrow { margin-bottom: 10px; }

.form-heading h2,
.result-card h2 { font-size: clamp(2.15rem, 4vw, 3.25rem); line-height: 1; }

.form-heading > p:last-child {
    max-width: 530px;
    margin: 15px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.7;
}

.message,
.result-card {
    margin-bottom: 30px;
    border-radius: 16px;
}

.message {
    padding: 15px 17px;
    color: var(--danger);
    border: 1px solid rgba(253, 164, 175, 0.32);
    background: var(--danger-bg);
    font-size: 0.84rem;
    line-height: 1.55;
}

.message strong { color: #fecdd3; }
.message p { margin: 7px 0 0; }
.message-detail { font-weight: 600; }
.message ul { margin: 3px 0 0 19px; padding: 0; }

.result-card {
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--border-accent);
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.13), rgba(15, 17, 26, 0.78) 50%);
}

.result-card--short {
    border-color: rgba(192, 132, 252, 0.28);
    background: linear-gradient(145deg, rgba(192, 132, 252, 0.1), rgba(15, 17, 26, 0.82) 52%);
}

.result-card-header { margin-bottom: 22px; }

.result-kicker,
.result-mode {
    color: var(--accent-bright);
    font-size: 0.63rem;
    font-weight: 650;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.result-mode {
    padding: 5px 8px;
    border: 1px solid rgba(192, 132, 252, 0.24);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.56rem;
    white-space: nowrap;
}

.result-card h2 { font-size: clamp(2rem, 4vw, 2.75rem); }

.result-name {
    margin: 12px 0 0;
    color: var(--text-soft);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.42rem;
}

.result-date {
    margin: 1px 0 0;
    color: var(--muted-soft);
    font-size: 0.75rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 25px 0;
}

.result-item,
.short-result-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 10px;
    background: rgba(10, 11, 16, 0.46);
}

.result-item span,
.short-result-item span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.69rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-item strong,
.short-result-item strong {
    color: var(--text-soft);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.27rem;
    font-weight: 500;
}

.result-actions { display: grid; gap: 9px; }
.result-admin-note { margin: 0; padding: 12px 14px; border: 1px solid rgba(192, 132, 252, 0.2); border-radius: 10px; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.primary-action,
.secondary-action,
button {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 13px 20px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.primary-action,
button {
    border: 1px solid var(--accent);
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    cursor: pointer;
}

.primary-action:hover,
button:hover:not(:disabled) {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.secondary-action {
    border: 1px solid rgba(192, 132, 252, 0.28);
    color: var(--text-soft);
    background: rgba(10, 11, 16, 0.28);
}

.secondary-action:hover {
    border-color: rgba(192, 132, 252, 0.58);
    color: #fff;
    background: rgba(139, 92, 246, 0.12);
}

.secondary-action--wide { width: 100%; margin-top: 18px; }

.result-footnote {
    margin: 14px 0 0;
    color: var(--muted-soft);
    font-size: 0.69rem;
    text-align: center;
}

.short-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin: 25px 0 18px;
}

.short-notice {
    padding: 14px 15px;
    border-left: 2px solid var(--accent-bright);
    background: rgba(192, 132, 252, 0.08);
}

.short-notice strong { color: #e9d5ff; font-size: 0.81rem; }
.short-notice p { margin: 5px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.65; }
.short-notice small { display: block; margin-top: 8px; color: var(--muted-soft); font-size: 0.7rem; }

.developer-diagnostics {
    margin-top: 18px;
    border-top: 1px solid var(--border-soft);
    padding-top: 13px;
    color: var(--muted-soft);
    font-size: 0.7rem;
}

.developer-diagnostics summary { cursor: pointer; color: var(--muted); }
.developer-diagnostics dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 14px 0 0; }
.developer-diagnostics dt { color: var(--muted-soft); }
.developer-diagnostics dd { min-width: 0; margin: 0; color: var(--text-soft); overflow-wrap: anywhere; }
.developer-diagnostics pre { margin: 0; white-space: pre-wrap; }

.reading-form { display: grid; gap: 21px; }
.form-field { display: grid; min-width: 0; gap: 9px; margin: 0; border: 0; padding: 0; }
.dob-fieldset { min-inline-size: 0; }

.field-header { align-items: baseline; }
.field-header label,
.field-label {
    color: var(--text-soft);
    font-size: 0.83rem;
    font-weight: 600;
}

.field-header label span,
.field-label span { color: var(--accent-bright); }
.field-required,
.field-optional { color: var(--muted-soft); font-size: 0.65rem; letter-spacing: 0.04em; }
.field-label { display: block; margin-bottom: 9px; }

input,
textarea,
select {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: rgba(10, 11, 16, 0.78);
    font: inherit;
    font-size: 0.9rem;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

input,
select { min-height: 51px; padding: 13px 14px; }
textarea { min-height: 112px; padding: 13px 14px; resize: vertical; }

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-bright);
    background: rgba(15, 17, 26, 0.96);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.13);
}

input::placeholder,
textarea::placeholder { color: var(--muted-soft); }

.dob-group {
    display: grid;
    grid-template-columns: 0.82fr 1.35fr 1fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 11px;
    background: rgba(10, 11, 16, 0.78);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.dob-group:focus-within,
.dob-group.is-invalid { border-color: var(--accent-bright); box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.13); }
.dob-group.is-invalid { border-color: rgba(253, 164, 175, 0.7); box-shadow: 0 0 0 3px rgba(253, 164, 175, 0.1); }

.dob-group select {
    min-height: 51px;
    border: 0;
    border-radius: 0;
    color-scheme: dark;
    color: var(--text);
    background-color: var(--surface);
}

.dob-group select + select { border-left: 1px solid rgba(255, 255, 255, 0.1); }
.dob-group select:hover,
.dob-group select:focus { color: var(--text); background-color: var(--surface); }
.dob-group select option { color: var(--text); background-color: var(--surface); }
.dob-group select option:hover,
.dob-group select option:focus { color: #fff; background-color: var(--accent-bright); }
.dob-group select option:checked { color: #fff; background-color: var(--accent); }
.dob-group select option:disabled { color: var(--muted-soft); background-color: var(--surface); }
.field-help { margin: 0; color: var(--muted-soft); font-size: 0.71rem; line-height: 1.5; }
.field-error { margin: 0; color: var(--danger); font-size: 0.74rem; }

button {
    position: relative;
    width: 100%;
    margin-top: 4px;
    min-height: 56px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 3px;
}

button:disabled { cursor: wait; opacity: 0.78; }
.button-spinner { display: none; width: 16px; height: 16px; margin-left: 10px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; }
button[aria-busy="true"] .button-spinner { display: block; animation: spin 0.8s linear infinite; }

.fine-print {
    max-width: 470px;
    margin: 19px auto 0;
    color: var(--muted-soft);
    font-size: 0.68rem;
    line-height: 1.6;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; }
    .brand-panel { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
    .brand-copy { margin-top: 44px; }
    .banner-frame { width: min(100%, 430px); min-height: 300px; margin-top: 10px; }
    .brand-footer-note { margin-top: 22px; }
    .workspace { padding-top: 38px; }
}

@media (max-width: 600px) {
    .page-shell { padding: 10px; }
    .app-layout { border-radius: 20px; }
    .brand-panel,
    .workspace { padding: 24px 20px; }
    .brand-lockup img { width: 54px; height: 54px; }
    .brand-copy { margin-top: 38px; }
    .brand-copy h1 { font-size: clamp(2.6rem, 13vw, 3.5rem); }
    .banner-frame { min-height: 280px; }
    .workspace-meta { margin-bottom: 34px; }
    .workspace-meta { align-items: flex-start; }
    .workspace-meta-actions { gap: 9px; }
    .workspace-meta > span:first-child { max-width: 130px; line-height: 1.45; }
    .result-card-header { align-items: flex-start; flex-direction: column; }
    .result-grid,
    .short-result-grid { grid-template-columns: 1fr; }
    .developer-diagnostics dl { grid-template-columns: 1fr; gap: 2px; }
    .developer-diagnostics dd { margin-bottom: 7px; }
}
