:root {
    --ps-primary: #8a5ac5;
    --ps-primary-dark: #6f3eaf;
    --ps-accent: #35c3ff;
    --ps-bg: #f5f7fb;
    --ps-card: #ffffff;
    --ps-border: #e2e8f0;
    --ps-text: #0f172a;
    --ps-muted: #475569;
    --ps-success: #22c55e;
    --ps-danger: #ef4444;
    --ps-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.06);
    --ps-shadow-md: 0 16px 26px -20px rgba(15, 23, 42, 0.42);
    --ps-shadow-lg: 0 24px 36px -28px rgba(15, 23, 42, 0.52);
}

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

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--ps-text);
    background:
        radial-gradient(circle at 16% 0%, rgba(138, 90, 197, 0.07), transparent 42%),
        radial-gradient(circle at 92% 10%, rgba(53, 195, 255, 0.07), transparent 38%),
        var(--ps-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.psg-container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.psg-container-wide {
    width: min(1240px, calc(100% - 28px));
}

.fallback-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--ps-border);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
}

.fallback-header-inner {
    height: 70px;
    display: flex;
    align-items: center;
}

.fallback-logo {
    color: var(--ps-primary);
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.generator-shell {
    padding-bottom: 48px;
    flex: 1 0 auto;
}

.hero {
    padding: 44px 0 52px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.9));
    border-bottom: 1px solid rgba(203, 213, 225, 0.75);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    right: -130px;
    top: -130px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(138, 90, 197, 0.14), rgba(53, 195, 255, 0.02) 65%, transparent 78%);
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
    justify-items: center;
    text-align: center;
    max-width: 920px;
}

.hero h1 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: #101626;
    font-size: clamp(1.65rem, 3.4vw, 2.45rem);
}

.hero p {
    margin: 0;
    color: #334155;
    line-height: 1.58;
    font-size: clamp(0.95rem, 1.45vw, 1.03rem);
}

.hero-cta {
    display: inline-flex;
    margin-top: 4px;
    padding: 9px 16px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d5dde9;
    text-decoration: none;
    color: #364152;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--ps-shadow-sm);
}

.hero-cta:hover {
    transform: translateY(-1px);
    border-color: #c6d0df;
    box-shadow: 0 10px 16px -14px rgba(15, 23, 42, 0.42);
}

.generator-stage {
    margin-top: 20px;
    border: 1px solid #dbe4f2;
    border-radius: 20px;
    background: rgba(252, 253, 255, 0.92);
    box-shadow: 0 24px 34px -30px rgba(15, 23, 42, 0.55);
    overflow: hidden;
}

.builder-strip {
    padding: 14px 18px 12px;
    background: rgba(246, 249, 255, 0.75);
    border-bottom: 1px solid #e4ebf7;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.builder-pill {
    border: 1px solid #d3dce8;
    background: #fff;
    border-radius: 999px;
    color: #475569;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.content-section {
    padding: 24px 22px 30px;
}

.signature-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 18px;
}

.tool-card {
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 16px 26px -26px rgba(15, 23, 42, 0.55);
    padding: 18px;
}

.card-header {
    margin-bottom: 16px;
}

.card-header h2 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: 0.01em;
}

.card-header p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.52;
}

.form-grid {
    display: grid;
    gap: 14px;
}

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

label,
legend {
    display: grid;
    gap: 6px;
    font-size: 0.83rem;
    color: #334155;
    font-weight: 600;
}

fieldset {
    margin: 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

legend {
    padding: 0 6px;
    font-size: 0.79rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-family: 'Orbitron', sans-serif;
    color: #64748b;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    padding: 10px 11px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="color"] {
    min-height: 42px;
    padding: 4px;
    cursor: pointer;
}

input[type="file"] {
    padding: 8px;
}

textarea {
    resize: vertical;
    min-height: 86px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #8a5ac5;
    box-shadow: 0 0 0 4px rgba(138, 90, 197, 0.14);
}

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

.preview-surface {
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
    min-height: 240px;
    padding: 14px;
    overflow: auto;
}

.result-label {
    margin-top: 14px;
    display: inline-block;
    font-size: 0.86rem;
    color: #334155;
    font-weight: 600;
}

#signatureCode {
    min-height: 250px;
    margin-top: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.78rem;
    line-height: 1.45;
}

.actions-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #8a5ac5, #6f3eaf);
    border-color: #7f4bbb;
    box-shadow: 0 12px 18px -16px rgba(15, 23, 42, 0.85);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 22px -18px rgba(15, 23, 42, 0.85);
}

.btn-secondary {
    color: #334155;
    background: #fff;
    border-color: #cbd5e1;
}

.btn-secondary:hover {
    border-color: #94a3b8;
    color: #0f172a;
}

.tips-section {
    margin-top: 20px;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #fff;
    padding: 18px;
}

.tips-section h2 {
    margin: 0;
    font-size: 1rem;
}

.tips-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

details {
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fbff;
    padding: 10px 12px;
}

summary {
    cursor: pointer;
    font-weight: 700;
    color: #1e293b;
}

details ol {
    margin: 10px 0 0;
    padding-left: 20px;
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.55;
}

.generator-seo {
    padding: 42px 0;
    margin-top: 12px;
    border-top: 1px solid #deebf7;
    background: linear-gradient(180deg, rgba(248, 250, 253, 0.9), rgba(241, 247, 255, 0.85));
}

.generator-seo h2 {
    margin: 0;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    font-size: clamp(1rem, 2.2vw, 1.34rem);
}

.seo-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.seo-grid article {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.seo-grid h3 {
    margin: 0;
    font-size: 0.95rem;
}

.seo-grid p {
    margin: 8px 0 0;
    color: #475569;
    line-height: 1.58;
    font-size: 0.9rem;
}

.generator-footer {
    padding: 14px 0 24px;
}

.generator-footer p {
    margin: 0;
    text-align: center;
    color: #64748b;
    font-size: 0.82rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 18px);
    opacity: 0;
    background: #0f172a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 300;
}

.toast.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast.is-error {
    background: #b91c1c;
}

@media (max-width: 1120px) {
    .signature-layout {
        grid-template-columns: 1fr;
    }

    .preview-card {
        order: -1;
    }
}

@media (max-width: 760px) {
    .content-section {
        padding: 18px 14px 24px;
    }

    .field-grid,
    .field-grid-colors,
    .tips-grid,
    .seo-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        padding: 14px;
    }

    .builder-strip {
        padding: 10px;
    }

    .builder-pill {
        font-size: 0.68rem;
        padding: 5px 8px;
    }

    .actions-row {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}
