:root {
    --bg-main: #07111f;
    --bg-grad-1: rgba(124, 92, 255, 0.18);
    --bg-grad-2: rgba(52, 211, 153, 0.10);
    --bg-grad-3: #0b1426;
    --text-main: #f4f7fb;
    --text-soft: #c9d5e6;
    --text-muted: #8fb3d9;
    --nav-text: #d8e4f2;
    --panel-bg: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent: #7c5cff;
    --accent-glow: rgba(124, 92, 255, 0.35);
    --dot-label: #94a9c3;
    --input-bg: rgba(255, 255, 255, 0.03);
    --success: #1f9d68;
    --warning: #c88916;
    --neutral: #4e6a8a;
    --secondary: #39506f;
    --danger: #b84a62;
    --flash-error-bg: rgba(184, 74, 98, 0.16);
    --flash-success-bg: rgba(31, 157, 104, 0.16);
}

body.theme-light {
    --bg-main: #eef3f9;
    --bg-grad-1: rgba(124, 92, 255, 0.10);
    --bg-grad-2: rgba(52, 211, 153, 0.08);
    --bg-grad-3: #dfe9f4;
    --text-main: #102033;
    --text-soft: #30465f;
    --text-muted: #5c7390;
    --nav-text: #20354d;
    --panel-bg: rgba(255, 255, 255, 0.78);
    --panel-border: rgba(16, 32, 51, 0.10);
    --accent: #6a4df0;
    --accent-glow: rgba(106, 77, 240, 0.18);
    --dot-label: #5c7390;
    --input-bg: rgba(255, 255, 255, 0.90);
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: Arial, sans-serif;
    transition: background 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, var(--bg-grad-1), transparent 28%),
        radial-gradient(circle at top right, var(--bg-grad-2), transparent 22%),
        linear-gradient(180deg, var(--bg-main) 0%, var(--bg-grad-3) 100%);
    transition: background 0.25s ease;
}

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

.topbar {
    padding-top: 18px;
    padding-bottom: 18px;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.nav {
    display: flex;
    gap: 18px;
    font-size: 14px;
    color: var(--nav-text);
    align-items: center;
    flex-wrap: wrap;
}

.theme-toggle {
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.flash-stack {
    margin-top: 8px;
    margin-bottom: 8px;
}

.flash-box {
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid var(--panel-border);
    margin-bottom: 10px;
    line-height: 1.5;
}

.flash-error {
    background: var(--flash-error-bg);
}

.flash-success {
    background: var(--flash-success-bg);
}

.eyebrow {
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

h1 {
    font-size: 52px;
    line-height: 1.08;
    margin: 0 0 16px 0;
}

h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.lead {
    max-width: 760px;
    color: var(--text-soft);
    font-size: 18px;
    line-height: 1.7;
    margin: 0;
}

.form-page,
.pricing-page,
.audit-page,
.workspace-page {
    padding-top: 48px;
    padding-bottom: 56px;
}

.form-hero {
    margin-bottom: 24px;
}

.form-hero-simple {
    text-align: center;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.form-card,
.price-card,
.sidebar-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    padding: 24px;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
}

.form-card-narrow {
    max-width: 860px;
    margin: 0 auto;
}

.opt-form {
    display: block;
}

.step-block {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 18px;
    padding: 22px 0;
    border-bottom: 1px solid var(--panel-border);
}

.step-block:last-of-type {
    border-bottom: 0;
    padding-bottom: 8px;
}

.step-number {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 0 24px var(--accent-glow);
}

.step-content {
    min-width: 0;
}

.step-text {
    margin: 0 0 16px 0;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1.6;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 14px;
    font-weight: 700;
    color: var(--nav-text);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--panel-border);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 14px;
    padding: 14px 14px;
    font-size: 15px;
}

.field textarea {
    resize: vertical;
    min-height: 220px;
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

.wysiwyg-wrap {
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: var(--input-bg);
    overflow: hidden;
}

.wysiwyg-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.03);
}

.wysiwyg-btn {
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    min-width: 42px;
}

.wysiwyg-editor {
    min-height: 180px;
    padding: 14px;
    outline: none;
    line-height: 1.6;
}

.wysiwyg-editor-tall {
    min-height: 300px;
}

.wysiwyg-source {
    display: none;
}

.char-count {
    font-size: 13px;
    color: var(--dot-label);
    text-align: right;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
}

.button-pill {
    border-radius: 999px;
}

.button-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 24px var(--accent-glow);
}

.button-accent {
    background: #2557c7;
    color: #ffffff;
}

.button-success {
    background: var(--success);
    color: #ffffff;
}

.button-warning {
    background: var(--warning);
    color: #ffffff;
}

.button-neutral {
    background: var(--neutral);
    color: #ffffff;
}

.button-secondary {
    background: var(--secondary);
    color: #ffffff;
}

.pricing-grid,
.score-grid,
.lock-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.price-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 28px;
}

.price {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 18px;
}

.price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--dot-label);
    margin-left: 6px;
}

.price-card ul,
.audit-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-main);
    line-height: 1.8;
}

.featured {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.score-card,
.lock-card,
.pro-output,
.version-card,
.saved-profile-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 18px;
}

.score-label {
    font-size: 13px;
    color: var(--dot-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.score-value {
    font-size: 34px;
    font-weight: 700;
}

.audit-section {
    padding-top: 16px;
    padding-bottom: 16px;
    border-top: 1px solid var(--panel-border);
}

.audit-section-first {
    padding-top: 0;
    border-top: 0;
}

.pro-output {
    line-height: 1.7;
    white-space: pre-wrap;
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.12);
    border: 1px solid var(--panel-border);
    font-size: 14px;
    font-weight: 700;
}

.copy-source {
    white-space: pre-wrap;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 340px;
    gap: 24px;
    align-items: start;
}

.workspace-sidebar {
    position: sticky;
    top: 20px;
}

.saved-profile-card {
    display: block;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.saved-profile-card:hover {
    transform: translateY(-1px);
}

.saved-profile-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 18px var(--accent-glow);
}

.saved-profile-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.saved-profile-meta {
    font-size: 14px;
    color: var(--dot-label);
}

.version-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--panel-border);
}

.version-row:last-child {
    border-bottom: 0;
}

.version-meta {
    min-width: 0;
}

.version-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 18, 0.68);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    padding: 28px;
    min-width: 260px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.18);
    border-top-color: var(--accent);
    margin: 0 auto 14px auto;
    animation: spin 0.9s linear infinite;
}

.loading-text {
    font-size: 16px;
    color: var(--text-main);
}

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

.site-footer {
    margin-top: auto;
    padding-top: 18px;
    padding-bottom: 26px;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-copy {
    color: var(--dot-label);
    font-size: 14px;
}

.footer-copy a {
    color: var(--text-main);
    font-weight: 700;
}

@media (max-width: 1000px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .workspace-sidebar {
        position: static;
    }
}

@media (max-width: 900px) {
    .form-grid,
    .pricing-grid,
    .score-grid,
    .lock-grid,
    .step-block,
    .version-row {
        grid-template-columns: 1fr;
    }

    .step-number {
        margin-bottom: 4px;
    }

    h1 {
        font-size: 40px;
    }

    .form-actions {
        justify-content: stretch;
    }

    .version-row {
        display: block;
    }

    .version-actions {
        margin-top: 12px;
    }
}
