body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f2f4f8;
    color: #1f2937;
}

header {
    background: #1f4b8b;
    color: #fff;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 20px;
}

.brand {
    font-size: 1.5rem;
    text-decoration: none;
    color: white;
    font-weight: 700;
}

.brand-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    flex: 0 0 auto;
}

nav a {
    color: #e2e8f0;
    text-decoration: none;
    margin-left: 18px;
}

.inline-form {
    display: inline;
    margin-left: 18px;
}

.inline-form button {
    border: none;
    background: transparent;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 1rem;
}

.user-menu {
    display: inline-block;
    position: relative;
    margin-left: 14px;
}

.user-menu summary {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    list-style: none;
    font-weight: 800;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 230px;
    z-index: 20;
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 10px;
}

main {
    max-width: 1120px;
    margin: 24px auto;
    padding: 0 20px 48px;
}

.subscription-disabled > *:not(.subscription-lock):not(.flash-container) {
    opacity: 0.58;
    pointer-events: none;
}

.subscription-lock {
    pointer-events: auto;
}

.subscription-lock a {
    color: inherit;
    font-weight: 800;
    margin-left: 10px;
}

@media screen {
    :root {
        --royal-black: #070707;
        --royal-panel: #111111;
        --royal-panel-soft: #181510;
        --royal-gold: #d4a84f;
        --royal-gold-light: #f4d27a;
        --royal-border: rgba(212, 168, 79, 0.42);
        --royal-text: #f7f0df;
        --royal-muted: #c8bd9f;
        --royal-paper: #15130f;
    }

    body {
        background:
            radial-gradient(circle at top left, rgba(212, 168, 79, 0.16), transparent 34rem),
            linear-gradient(135deg, #060606 0%, #11100d 48%, #070707 100%);
        color: var(--royal-text);
    }

    header {
        background: linear-gradient(90deg, #050505, #15110a);
        border-bottom: 1px solid var(--royal-border);
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
    }

    .brand {
        color: var(--royal-gold-light);
        letter-spacing: 0.02em;
    }

    nav a,
    .inline-form button,
    .language-switch a {
        color: #eadfbd;
    }

    nav a:hover,
    .language-switch a.active {
        color: var(--royal-gold-light);
    }

    footer {
        color: var(--royal-muted);
    }

    .home-hero,
    .home-card,
    .landing-video,
    .feature-grid article,
    .price-card,
    .form-card,
    .search-form,
    .import-card,
    .page-header,
    .levels-info,
    .pedigree-grid,
    .template-preview-editor,
    .template-choice,
    .preview-slot-card,
    .danger-zone,
    .offspring-summary,
    .pigeon-table {
        background: linear-gradient(180deg, rgba(26, 23, 17, 0.98), rgba(13, 13, 12, 0.98));
        border: 1px solid var(--royal-border);
        color: var(--royal-text);
        box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
    }

    .home-hero p,
    .page-title-row p,
    .home-card p,
    .landing-copy p,
    .feature-grid p,
    .pricing-section p,
    .price-card p,
    .form-note,
    .admin-list span,
    .import-card p,
    .offspring-summary p,
    .ancestor-meta,
    .ancestor-name {
        color: var(--royal-muted);
    }

    h1,
    h2,
    h3,
    .home-card h2,
    .price-card strong,
    .page-title-row h1 {
        color: var(--royal-gold-light);
    }

    .eyebrow,
    .subscription-note,
    .levels-info a,
    .small-link {
        color: var(--royal-gold-light) !important;
    }

    .button,
    .form-card button,
    .search-form button,
    .auth-card button,
    .import-card button,
    .card-search-form button {
        background: linear-gradient(180deg, #f1d17a, #b88328);
        color: #0a0907;
        border: 1px solid #f4d27a;
        font-weight: 800;
        box-shadow: 0 8px 18px rgba(212, 168, 79, 0.22);
    }

    .button.secondary {
        background: #15130f;
        color: var(--royal-gold-light);
        border: 1px solid var(--royal-border);
    }

    .home-card:hover,
    .template-choice.selected,
    .price-card.highlighted,
    .template-option.selected {
        border-color: var(--royal-gold);
        box-shadow: 0 0 0 2px rgba(212, 168, 79, 0.22), 0 14px 38px rgba(0, 0, 0, 0.34);
    }

    .home-card-icon {
        background: rgba(212, 168, 79, 0.15);
        color: var(--royal-gold-light);
        border: 1px solid var(--royal-border);
    }

    .video-placeholder {
        background: linear-gradient(135deg, #080807, #20180b 46%, #5b4115);
        color: var(--royal-gold-light);
        border: 1px solid var(--royal-border);
    }

    .search-form input,
    .form-card input,
    .form-card select,
    .form-card textarea,
    .auth-card input,
    .card-search-form input,
    .preview-slot-card input,
    .preview-slot-card select,
    .preview-slot-card textarea,
    .owner-style-control select,
    .owner-style-control input {
        background: #0b0b0a;
        border-color: var(--royal-border);
        color: var(--royal-text);
    }

    .pigeon-table th,
    .pigeon-table td {
        border-bottom-color: rgba(212, 168, 79, 0.18);
    }

    .pigeon-table a,
    .table-actions a {
        color: var(--royal-gold-light);
    }

    .flash.success {
        background: rgba(212, 168, 79, 0.18);
        color: var(--royal-gold-light);
        border: 1px solid var(--royal-border);
    }

    .flash.error {
        background: rgba(153, 27, 27, 0.24);
        color: #fecaca;
        border: 1px solid rgba(248, 113, 113, 0.35);
    }

    .template-preview-sheet,
    .template-sheet,
    .template-preview-empty {
        background: #0f0f0e;
        border-color: var(--royal-border);
    }
}

.home-hero {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.home-hero h1 {
    margin: 0 0 6px;
    font-size: 2rem;
}

.home-hero p,
.page-title-row p {
    margin: 0;
    color: #475569;
}

.subscription-note {
    margin-top: 10px !important;
    font-weight: 700;
    color: #1f4b8b !important;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.home-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    padding: 18px;
    border-radius: 12px;
    background: #ffffff;
    color: #1f2937;
    text-decoration: none;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.home-card-link {
    display: grid;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.home-card:hover {
    border-color: #1f4b8b;
}

.home-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0f4a6f;
    font-weight: 800;
    font-size: 1.3rem;
}

.home-card h2 {
    margin: 0;
    font-size: 1.2rem;
}

.home-card p {
    margin: 0;
    color: #475569;
    line-height: 1.45;
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
    gap: 34px;
    align-items: center;
    padding: 42px 0 30px;
}

.landing-copy h1 {
    margin: 0 0 18px;
    font-size: 3rem;
    line-height: 1.05;
    max-width: 760px;
}

.landing-copy p {
    margin: 0;
    color: #475569;
    font-size: 1.08rem;
    line-height: 1.65;
}

.eyebrow {
    color: #1f4b8b;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin-bottom: 10px !important;
}

.landing-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.landing-video {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.video-placeholder {
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: linear-gradient(135deg, #17283a, #1f4b8b);
    color: #f8fafc;
    font-weight: 700;
}

.landing-section,
.pricing-section {
    margin-top: 28px;
}

.landing-section h2,
.pricing-section h2 {
    margin: 0 0 16px;
    font-size: 2rem;
}

.feature-grid,
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.feature-grid article,
.price-card {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.feature-grid h3,
.price-card h3 {
    margin: 0 0 8px;
}

.feature-grid p,
.pricing-section p,
.price-card p {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}

.pricing-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
    gap: 24px;
    align-items: start;
}

.price-card strong {
    display: block;
    margin: 10px 0;
    font-size: 2rem;
    color: #17283a;
}

.price-card.highlighted {
    border-color: #1f4b8b;
    box-shadow: 0 0 0 2px rgba(31, 75, 139, 0.14);
}

.price-card .button {
    margin-top: 16px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 18px;
    align-items: start;
}

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-list > div {
    display: grid;
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.admin-list form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 6px;
}

.admin-list input {
    min-width: 150px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.admin-list button {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.admin-list > div:last-child {
    border-bottom: none;
}

.admin-list span {
    color: #475569;
}

.admin-user-edit {
    align-items: end;
}

.admin-user-edit label,
.admin-user-edit small {
    display: grid;
    gap: 4px;
    font-size: 0.85rem;
}

.admin-search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin: 12px 0 16px;
}

.admin-search-form input {
    min-width: min(100%, 360px);
    flex: 1;
}

.admin-search-form .button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.template-settings-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(980px, 1188px) minmax(150px, 190px);
    gap: 20px;
    align-items: start;
}

.template-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.template-option {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.template-option.selected {
    border-color: #1f4b8b;
    box-shadow: 0 0 0 2px rgba(31, 75, 139, 0.16);
}

.template-option img {
    display: block;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
}

.template-editor-form {
    width: min(1740px, calc(100vw - 32px));
    margin-left: 50%;
    transform: translateX(-50%);
    overflow-x: auto;
    padding-bottom: 10px;
}

.template-preview-editor {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    min-width: 980px;
}

.template-preview-sheet {
    position: relative;
    width: 100%;
    max-width: 1188px;
    margin: 0 auto;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.template-preview-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.template-preview-empty {
    display: grid;
    place-items: center;
    height: 100%;
    color: #64748b;
    background: #f8fafc;
}

.preview-owner {
    cursor: move;
    user-select: none;
    touch-action: none;
    outline: 1px dashed rgba(31, 75, 139, 0.72);
    outline-offset: 3px;
}

.preview-owner.dragging {
    outline-style: solid;
    background: rgba(255, 255, 255, 0.16);
}

.preview-owner span {
    display: block;
    min-height: 1em;
}

.template-select-hidden-label,
.template-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.template-choice-rail {
    display: grid;
    gap: 12px;
}

.template-choice {
    display: grid;
    gap: 8px;
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 8px;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.template-choice.selected {
    border-color: #1f4b8b;
    box-shadow: 0 0 0 2px rgba(31, 75, 139, 0.18);
}

.template-choice img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 6px;
}

.template-choice span {
    font-weight: 600;
    font-size: 0.9rem;
}

.highlight-settings {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(212, 168, 79, 0.28);
}

.highlight-settings h2 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.highlight-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 10px;
    align-items: end;
    margin-top: 10px;
}

.highlight-row label {
    margin-top: 0;
}

.highlight-row input[type="color"] {
    min-height: 42px;
    padding: 4px;
}

.card-search-form {
    display: grid;
    gap: 8px;
    margin-top: auto;
}

.card-search-form input {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

.card-search-form button {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: #1f4b8b;
    color: #ffffff;
    cursor: pointer;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title-row h1 {
    margin: 0 0 4px;
}

footer {
    text-align: center;
    padding: 18px 20px;
    color: #475569;
}

footer small {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
}

.search-form,
.form-card,
.import-card,
.page-header,
.levels-info,
.pedigree-grid {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
}

.search-form input,
.form-card input,
.form-card select,
.form-card textarea,
.search-form button {
    font-size: 1rem;
    padding: 10px 12px;
}

.search-form input,
.form-card input,
.form-card select,
.form-card textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.search-form button,
.form-card button,
.button {
    background: #1f4b8b;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
}

.pigeon-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.pigeon-table th,
.pigeon-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.pigeon-table tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-actions form {
    margin: 0;
}

.table-actions button {
    border: none;
    background: #dc2626;
    color: white;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

.form-card label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
}

.checkbox-line,
.checkbox-row,
.loft-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.checkbox-line input,
.checkbox-row input,
.loft-check input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.loft-check {
    margin: 0;
    font-weight: 500;
}

.auth-card {
    max-width: 420px;
    margin: 40px auto;
}

.auth-card label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
}

.auth-card input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.auth-card button {
    margin-top: 18px;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #1f4b8b;
    color: white;
    cursor: pointer;
}

.form-card button {
    margin-top: 18px;
}

.flash-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
}

.flash.success {
    background: #d1fae5;
    color: #065f46;
}

.flash.error {
    background: #fee2e2;
    color: #991b1b;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.page-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.pigeon-summary-form {
    display: grid;
    grid-template-columns: minmax(220px, 0.45fr) minmax(460px, 1.55fr) auto;
    column-gap: 24px;
    row-gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.pigeon-summary-form label {
    display: grid;
    grid-template-rows: 22px auto;
    gap: 6px;
    font-weight: 700;
    color: #1f2937;
}

.pigeon-summary-form input,
.pigeon-summary-form textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    padding: 9px 10px;
    font: inherit;
    color: #111827;
}

.pigeon-summary-form textarea {
    height: 86px;
    min-height: 86px;
    resize: vertical;
}

.summary-info-field {
    margin-left: 8px;
}

.pigeon-summary-form .button {
    margin-top: 28px;
    min-height: 42px;
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    text-decoration: none;
}

.button.danger {
    background: #dc2626;
}

.import-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.danger-zone {
    background: #fff7f7;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
}

.danger-zone h2 {
    margin: 0 0 4px;
}

.danger-zone p {
    margin: 0 0 14px;
    color: #7f1d1d;
}

.danger-forms {
    display: grid;
    gap: 10px;
}

.danger-forms form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.danger-forms input {
    padding: 10px 12px;
    border: 1px solid #fca5a5;
    border-radius: 8px;
}

.danger-forms button {
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #475569;
    color: white;
}

.danger-forms .danger-button {
    background: #dc2626;
}

.import-card h2 {
    margin: 0 0 4px;
}

.import-card p {
    margin: 0;
    color: #475569;
}

.import-card form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.import-card button {
    padding: 10px 14px;
    background: #1f4b8b;
    border: none;
    border-radius: 8px;
    color: #fff;
}

.file-action-button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.file-action-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.form-note {
    margin-top: 12px;
    color: #475569;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-field input[type="color"] {
    width: 56px;
    flex: 0 0 56px;
}

.color-field code {
    min-width: 82px;
    border: 1px solid rgba(212, 168, 79, 0.28);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(255, 248, 220, 0.82);
    color: #3b2a0d;
    font-weight: 800;
}

.language-switch {
    margin-left: 18px;
    position: relative;
}

.language-switch summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(212, 168, 79, 0.5);
    border-radius: 8px;
    background: #11100d;
    color: #f4d27a;
    padding: 7px 10px;
    font-weight: 700;
    cursor: pointer;
}

.language-switch summary::-webkit-details-marker {
    display: none;
}

.language-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 50;
    min-width: 150px;
    border: 1px solid rgba(212, 168, 79, 0.5);
    border-radius: 8px;
    background: #11100d;
    padding: 6px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.language-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    color: #f4d27a;
    padding: 8px 10px;
    font-weight: 700;
    text-decoration: none;
}

.language-menu a:hover,
.language-menu a.active {
    background: rgba(212, 168, 79, 0.14);
}

.flag-icon {
    width: 22px;
    height: 15px;
    display: inline-block;
    flex: 0 0 auto;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.flag-sr {
    background: linear-gradient(to bottom, #c6363c 0 33.333%, #0c4076 33.333% 66.666%, #ffffff 66.666% 100%);
}

.flag-en {
    background:
        linear-gradient(to bottom, transparent 42%, #ffffff 42% 58%, transparent 58%),
        linear-gradient(to right, transparent 42%, #ffffff 42% 58%, transparent 58%),
        linear-gradient(to bottom, transparent 46%, #c8102e 46% 54%, transparent 54%),
        linear-gradient(to right, transparent 46%, #c8102e 46% 54%, transparent 54%),
        linear-gradient(33deg, transparent 44%, #ffffff 44% 50%, #c8102e 50% 54%, #ffffff 54% 60%, transparent 60%),
        linear-gradient(-33deg, transparent 44%, #ffffff 44% 50%, #c8102e 50% 54%, #ffffff 54% 60%, transparent 60%),
        #012169;
}

.preview-slot-card {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 16px;
}

.preview-root-slot {
    border: 2px solid #1f4b8b;
}

.preview-slot-card h2 {
    margin-top: 0;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.preview-slot-card label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

.preview-slot-card input,
.preview-slot-card select,
.preview-slot-card textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

.preview-description-label {
    margin-top: 12px;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 20px 0;
}

.editable-pedigree-sheet {
    height: auto;
    min-height: 297mm;
}

.editable-pedigree-sheet .sheet-grid {
    min-height: 265mm;
}

.editable-sheet-cell {
    display: flex;
    flex-direction: column;
    gap: 1mm;
}

.editable-sheet-cell input,
.editable-sheet-cell select,
.editable-sheet-cell textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 1mm;
    font: inherit;
    background: rgba(255, 255, 255, 0.92);
}

.editable-sheet-cell textarea {
    flex: 1;
    min-height: 0;
    resize: none;
}

.uncertain-sheet-cell input,
.uncertain-sheet-cell select,
.uncertain-sheet-cell textarea {
    color: inherit;
    border-color: transparent;
}

.uncertain-sheet-cell {
    box-shadow: none;
}

.editable-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1mm;
}

.editable-root-cell {
    color: inherit;
    font-size: 3.4mm;
}

@media (max-width: 900px) {
    .preview-grid {
        grid-template-columns: 1fr;
    }
}

.button.secondary {
    background: #475569;
}

.pedigree-grid {
    display: grid;
    gap: 18px;
}

.pedigree-row {
    display: grid;
    grid-template-columns: minmax(100px, 140px) repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.generation-label {
    font-weight: 700;
    color: #1f2937;
    padding: 12px;
    background: #eef2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
}

.pedigree-card {
    border: 1px solid #e5e7eb;
    padding: 12px;
    border-radius: 12px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
}

.ancestor-ring {
    font-weight: 700;
    margin-bottom: 8px;
}

.ancestor-name {
    color: #334155;
    margin-bottom: 6px;
}

.ancestor-meta {
    color: #475569;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.small-link {
    color: #1f4b8b;
    text-decoration: none;
}

.ancestor-empty {
    color: #9ca3af;
    font-style: italic;
}

.levels-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.levels-info a {
    color: #1f4b8b;
    text-decoration: none;
}

.template-sheet {
    position: relative;
    width: min(100%, 1188px);
    aspect-ratio: 1684 / 1191;
    margin: 0 auto;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.10);
}

.template-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.template-sheet {
    container-type: inline-size;
}

.template-owner,
.template-root,
.template-cell {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    color: var(--pedigree-name-color, #1f2937);
    overflow: hidden;
}

.template-owner {
    left: 4.8%;
    top: 33.2%;
    width: 20.5%;
    display: flex;
    flex-direction: column;
    gap: 0.22vw;
    font-size: clamp(5px, calc(var(--owner-font-size, 12) * 0.089cqw), calc(var(--owner-font-size, 12) * 1px));
    line-height: 1.22;
    color: #f4c766;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.template-owner strong {
    font-size: clamp(6px, calc(var(--owner-name-font-size, 14) * 0.089cqw), calc(var(--owner-name-font-size, 14) * 1px));
}

.template-owner input,
.template-root input,
.template-root textarea,
.template-cell input,
.template-cell textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    padding: 0;
    resize: none;
    overflow: hidden;
}

.template-owner input:focus,
.template-root input:focus,
.template-root textarea:focus,
.template-cell input:focus,
.template-cell textarea:focus {
    outline: none;
    border-color: rgba(31, 75, 139, 0.45);
    background: rgba(255, 255, 255, 0.72);
}

.template-owner input::placeholder,
.template-root input::placeholder,
.template-root textarea::placeholder,
.template-cell input::placeholder,
.template-cell textarea::placeholder {
    color: rgba(71, 85, 105, 0.65);
}

.template-root {
    left: 5.6%;
    top: 15.0%;
    width: 17.2%;
    min-height: 17.8%;
    display: block;
    font-size: clamp(9px, 0.95vw, 15px);
    color: var(--pedigree-name-color, #1f2937);
}

.root-ring {
    display: block;
    margin-bottom: 1.2%;
    font-weight: 500;
    font-size: var(--pedigree-ring-font-size, clamp(13px, 1.25vw, 20px));
    color: var(--pedigree-ring-color, #111827);
}

.root-name {
    display: block;
    font-size: var(--pedigree-name-font-size, inherit);
    color: var(--pedigree-name-color, inherit);
}

.root-sex {
    margin-top: 3.6%;
    padding-left: 39%;
    font-size: var(--pedigree-name-font-size, inherit);
    color: var(--pedigree-name-color, inherit);
}

.root-year {
    margin-top: 4.6%;
    padding-left: 39%;
}

.root-description {
    display: block;
    margin-top: 11.5%;
    width: 100%;
    height: 24%;
    font-size: clamp(8px, 0.82vw, 13px);
    line-height: 1.22;
    color: var(--pedigree-desc-color, #1f2937);
    font-size: var(--pedigree-desc-font-size, clamp(8px, 0.82vw, 13px));
    white-space: pre-wrap;
    overflow-wrap: normal;
    word-break: normal;
}

.template-cell {
    padding: 0.55%;
    display: flex;
    flex-direction: column;
    gap: 0.15vw;
    justify-content: flex-start;
    font-size: clamp(7px, 0.72vw, 12px);
    line-height: 1.18;
    overflow: hidden;
}

.cell-main-line {
    display: contents;
}

.cell-ring {
    font-weight: 400;
    font-size: inherit;
    color: var(--pedigree-ring-color, #111827);
    white-space: nowrap;
}

.cell-name {
    font-size: var(--pedigree-name-font-size, inherit);
    color: var(--pedigree-name-color, inherit);
    white-space: nowrap;
}

.cell-description {
    flex: 1;
    min-height: 0;
    font-size: var(--pedigree-desc-font-size, inherit);
    color: var(--pedigree-desc-color, #475569);
    white-space: pre-wrap;
    overflow-wrap: normal;
    word-break: normal;
}

.empty-cell-name {
    display: none;
}

.large-cell {
    font-size: clamp(8px, 0.85vw, 14px);
    padding: 0.8%;
}

.compact-cell {
    font-size: clamp(7px, 0.67vw, 11px);
}

.tiny-cell {
    padding: 0.25% 0.45%;
    font-size: clamp(6px, 0.55vw, 9px);
    line-height: 1.05;
    gap: 0.05vw;
}

.tiny-cell .cell-main-line {
    display: flex;
    align-items: baseline;
    gap: 3px;
    min-height: 1.15em;
}

.tiny-cell .cell-ring {
    width: 56%;
    flex: 0 0 56%;
}

.tiny-cell .cell-name {
    width: 44%;
    flex: 1 1 44%;
}

.tiny-cell .cell-year,
.tiny-cell .manual-cell-meta {
    display: none;
}

.tiny-cell .cell-description {
    display: block;
    flex: 0 0 1.25em;
    height: 1.25em;
    min-height: 1.25em;
    line-height: 1.15;
    white-space: nowrap;
}

.template-root.horizontal-root-cell,
.manual-template-cell.horizontal-root-cell {
    top: 15%;
    min-height: 42%;
    height: 42%;
}

.horizontal-root-cell .root-ring,
.horizontal-root-cell .cell-ring {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
}

.horizontal-root-cell .cell-main-line {
    display: block;
    min-height: 0;
}

.horizontal-root-cell .root-name,
.horizontal-root-cell .root-sex,
.horizontal-root-cell .root-description,
.horizontal-root-cell .cell-name,
.horizontal-root-cell .manual-cell-meta,
.horizontal-root-cell .cell-description {
    position: relative;
    top: 55%;
}

.horizontal-root-cell .manual-cell-meta {
    display: block;
}

.horizontal-main-root {
    top: 15%;
    height: 42%;
    min-height: 42%;
}

.horizontal-main-root .root-ring,
.horizontal-main-root .cell-ring {
    left: -2%;
    top: 0;
    width: 104%;
    height: 1.35em;
    text-align: center;
    font-weight: 500;
    transform: none;
    transform-origin: center;
}

.horizontal-main-root .root-name,
.horizontal-main-root .root-sex,
.horizontal-main-root .root-description,
.horizontal-main-root .cell-name,
.horizontal-main-root .manual-cell-meta,
.horizontal-main-root .cell-description {
    position: relative;
    top: 8%;
}

.horizontal-main-root .root-name {
    margin-top: 0;
}

.horizontal-main-root .root-sex {
    margin-top: 1.5%;
}

.horizontal-main-root .root-description,
.horizontal-main-root .cell-description {
    height: 62%;
    margin-top: 1%;
    line-height: 1.16;
}

.horizontal-main-root .root-description {
    top: 8%;
    height: 62%;
    margin-top: 1%;
    line-height: 1.16;
    white-space: pre-wrap;
}

.horizontal-3g-parent,
.horizontal-3g-grandparent,
.horizontal-3g-last {
    box-shadow: none;
}

.horizontal-4g-parent,
.horizontal-4g-grandparent,
.horizontal-4g-great,
.horizontal-4g-last {
    box-shadow: none;
}

.horizontal-3g-parent,
.horizontal-3g-grandparent,
.horizontal-3g-last,
.horizontal-4g-parent,
.horizontal-4g-grandparent,
.horizontal-4g-great,
.horizontal-4g-last {
    font-size: clamp(8px, 0.72vw, 12px);
    line-height: 1.08;
}

.horizontal-4g-great {
    font-size: clamp(8px, 0.72vw, 12px);
    line-height: 1.08;
}

.horizontal-4g-parent .cell-description,
.horizontal-4g-grandparent .cell-description,
.horizontal-4g-great .cell-description {
    min-height: 0;
    flex: 1 1 0;
    height: auto;
    padding-bottom: 0;
    margin-bottom: -0.72em;
}

.horizontal-3g-parent .cell-description,
.horizontal-3g-grandparent .cell-description,
.horizontal-3g-last .cell-description {
    min-height: 0;
    flex: 1 1 0;
    height: auto;
    padding-bottom: 0;
    margin-bottom: -0.72em;
}

.horizontal-4g-last {
    padding: 0.10% 0.32%;
    font-size: clamp(8px, 0.72vw, 12px);
    line-height: 1.08;
}

.horizontal-4g-last .cell-main-line {
    display: flex;
    align-items: baseline;
    gap: 1px;
    flex: 0 0 auto;
    min-height: 0.92em;
}

.horizontal-4g-last .cell-ring {
    flex: 0 0 57%;
    width: 57%;
    font-size: 1em;
}

.horizontal-4g-last .cell-name {
    flex: 1 1 43%;
    width: 43%;
    overflow: hidden;
    text-overflow: clip;
    font-size: 1em;
}

.horizontal-4g-last .cell-description {
    display: block;
    height: 1.22em;
    min-height: 1.22em;
    flex: 0 0 1.22em;
    font-size: 0.70em;
    line-height: 1.02;
    margin-top: -0.08em;
    white-space: nowrap;
    overflow: hidden;
}

.offspring-summary {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 20px;
}

.offspring-summary h2 {
    margin: 0 0 4px;
}

.offspring-summary p {
    margin: 0;
    color: #475569;
}

@media (max-width: 900px) {
    .landing-hero,
    .pricing-section {
        grid-template-columns: 1fr;
    }

    .landing-copy h1 {
        font-size: 2.35rem;
    }

    .feature-grid,
    .pricing-cards,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-title-row,
    .import-card {
        align-items: stretch;
        flex-direction: column;
    }

    .template-settings-layout {
        grid-template-columns: 1fr;
    }

    .page-header,
    .action-group {
        flex-direction: column;
    }

    .pigeon-summary-form {
        grid-template-columns: 1fr;
    }

    .summary-info-field {
        margin-left: 0;
    }

    .pedigree-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar,
    nav {
        display: flex;
        flex-wrap: wrap;
    }

    nav a,
    .inline-form,
    .language-switch,
    .user-menu {
        margin-left: 0;
        margin-right: 12px;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }

    .home-card {
        min-height: auto;
    }

    .pigeon-table {
        display: block;
        overflow-x: auto;
    }
}

.sheet-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.owner-style-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: #334155;
}

.owner-style-control select,
.owner-style-control input {
    min-height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 8px;
    background: #fff;
    font: inherit;
}

.owner-style-control.compact input {
    width: 72px;
}

.owner-style-control input[type="color"] {
    width: 44px;
    padding: 3px;
}

.pedigree-sheet {
    background: #fff;
    border: 1px solid #111827;
    width: 210mm;
    height: 297mm;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 4mm;
    overflow: hidden;
}

.sheet-banner {
    height: 11mm;
    margin-bottom: 2mm;
    padding: 1.5mm 3mm;
    box-sizing: border-box;
    background: #fff200;
    color: #e11d1d;
    font-weight: 700;
    font-size: 3.2mm;
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 0 5mm;
    align-content: center;
}

.sheet-banner span:nth-child(5) {
    grid-column: 1 / span 2;
}

.sheet-banner span:nth-child(6) {
    grid-column: 3 / span 2;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 13mm;
    margin-bottom: 2mm;
}

.sheet-owner {
    color: #dc2626;
    font-size: 10mm;
    letter-spacing: 0.08em;
    line-height: 1;
}

.sheet-date {
    align-self: flex-end;
    color: #dc2626;
    font-weight: 700;
    font-size: 4mm;
}

.sheet-grid {
    display: grid;
    grid-template-columns: 1.35fr 1.25fr 1.12fr 1.06fr 1fr;
    height: 265mm;
    min-height: 0;
}

.sheet-column {
    display: grid;
    min-height: 0;
}

.root-column {
    grid-template-rows: 1fr;
    align-items: center;
    padding-right: 8px;
}

.generation-1 {
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.generation-2 {
    grid-template-rows: repeat(4, minmax(0, 1fr));
}

.generation-3 {
    grid-template-rows: repeat(8, minmax(0, 1fr));
}

.generation-4 {
    grid-template-rows: repeat(16, minmax(0, 1fr));
}

.sheet-cell {
    border: 1px solid #111827;
    min-height: 0;
    padding: 1.2mm;
    white-space: pre-line;
    font-family: "Courier New", monospace;
    font-size: 2.9mm;
    line-height: 1.02;
    overflow: hidden;
}

.generation-1 .sheet-cell,
.generation-2 .sheet-cell {
    border-color: #16a34a;
}

.generation-3 .sheet-cell,
.generation-4 .sheet-cell {
    border-color: #ef4444;
}

.root-cell {
    background: #d1d5db;
    border-width: 2px;
    color: #dc2626;
    font-size: 4.2mm;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 2mm;
}

.sheet-ring,
.sheet-name {
    font-weight: 700;
}

.sheet-description {
    margin-top: 1mm;
}

.edit-form-card {
    margin-top: 20px;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 0;
    }

    html,
    body {
        background: #fff;
        width: 297mm;
        height: 210mm;
        margin: 0;
        overflow: hidden;
    }

    body * {
        visibility: hidden;
    }

    main {
        max-width: none;
        margin: 0;
        padding: 0;
        width: 297mm;
        height: 210mm;
    }

    .pedigree-sheet {
        border: none;
        padding: 0;
        width: 297mm;
        height: 210mm;
        margin: 0;
        overflow: hidden;
    }

    .template-sheet,
    .template-sheet * {
        visibility: visible;
    }

    .template-sheet {
        position: fixed;
        left: 0;
        top: 0;
        width: 297mm;
        height: 210mm;
        max-width: none;
        margin: 0;
        box-shadow: none;
        border: none;
        overflow: hidden;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .template-owner {
        font-size: 2.65mm;
        gap: 0.8mm;
    }

    .template-owner strong {
        font-size: 1.08em;
    }

    .template-root {
        font-size: clamp(9px, 0.95vw, 15px);
    }

    .root-ring {
        font-size: var(--pedigree-ring-font-size, clamp(13px, 1.25vw, 20px));
    }

    .root-description {
        font-size: var(--pedigree-desc-font-size, clamp(8px, 0.82vw, 13px));
        line-height: 1.22;
    }

    .template-cell {
        font-size: clamp(7px, 0.72vw, 12px);
        line-height: 1.18;
    }

    .large-cell {
        font-size: clamp(8px, 0.85vw, 14px);
    }

    .compact-cell {
        font-size: clamp(7px, 0.67vw, 11px);
    }

    .tiny-cell {
        font-size: clamp(6px, 0.55vw, 9px);
        line-height: 1.05;
    }

    .horizontal-3g-parent,
    .horizontal-3g-grandparent,
    .horizontal-3g-last,
    .horizontal-4g-parent,
    .horizontal-4g-grandparent,
    .horizontal-4g-great,
    .horizontal-4g-last {
        font-size: clamp(8px, 0.72vw, 12px);
        line-height: 1.08;
    }

    .horizontal-main-root .root-ring,
    .horizontal-main-root .cell-ring {
        font-size: var(--pedigree-ring-font-size, clamp(13px, 1.25vw, 20px));
        font-weight: 500;
    }

    .horizontal-4g-last .cell-description {
        font-size: 0.70em;
        line-height: 1.02;
    }

    .template-root textarea,
    .template-cell textarea {
        white-space: pre-wrap;
        word-break: normal;
        overflow-wrap: normal;
    }

    .template-owner input,
    .template-root input,
    .template-root textarea,
    .template-cell input,
    .template-cell textarea {
        border-color: transparent;
        background: transparent;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

@media screen {
    body {
        background:
            radial-gradient(circle at top left, rgba(212, 168, 79, 0.18), transparent 34rem),
            linear-gradient(135deg, #060606 0%, #11100d 48%, #070707 100%);
        color: #f7f0df;
    }

    header {
        background: linear-gradient(90deg, #050505, #15110a);
        border-bottom: 1px solid rgba(212, 168, 79, 0.42);
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
    }

    .brand,
    h1,
    h2,
    h3,
    .home-card h2,
    .price-card strong,
    .page-title-row h1,
    .eyebrow,
    .subscription-note,
    .levels-info a,
    .small-link {
        color: #f4d27a !important;
    }

    nav a,
    .inline-form button,
    .language-switch a {
        color: #eadfbd;
    }

    .home-hero,
    .home-card,
    .landing-video,
    .feature-grid article,
    .price-card,
    .form-card,
    .search-form,
    .import-card,
    .page-header,
    .levels-info,
    .pedigree-grid,
    .template-preview-editor,
    .template-choice,
    .preview-slot-card,
    .danger-zone,
    .offspring-summary,
    .pigeon-table,
    .auth-card {
        background: linear-gradient(180deg, rgba(26, 23, 17, 0.98), rgba(13, 13, 12, 0.98));
        border: 1px solid rgba(212, 168, 79, 0.42);
        color: #f7f0df;
        box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
    }

    .home-hero p,
    .page-title-row p,
    .home-card p,
    .landing-copy p,
    .feature-grid p,
    .pricing-section p,
    .price-card p,
    .form-note,
    .admin-list span,
    .import-card p,
    .offspring-summary p,
    .ancestor-meta,
    .ancestor-name,
    footer {
        color: #c8bd9f !important;
    }

    .button,
    .form-card button,
    .search-form button,
    .auth-card button,
    .import-card button,
    .card-search-form button,
    .preview-actions button {
        background: linear-gradient(180deg, #f1d17a, #b88328);
        color: #0a0907;
        border: 1px solid #f4d27a;
        font-weight: 800;
        box-shadow: 0 8px 18px rgba(212, 168, 79, 0.22);
    }

    .button.secondary {
        background: #15130f;
        color: #f4d27a;
        border: 1px solid rgba(212, 168, 79, 0.42);
    }

    .home-card:hover,
    .template-choice.selected,
    .price-card.highlighted,
    .template-option.selected {
        border-color: #d4a84f;
        box-shadow: 0 0 0 2px rgba(212, 168, 79, 0.22), 0 14px 38px rgba(0, 0, 0, 0.34);
    }

    .home-card-icon {
        background: rgba(212, 168, 79, 0.15);
        color: #f4d27a;
        border: 1px solid rgba(212, 168, 79, 0.42);
    }

    .video-placeholder {
        background: linear-gradient(135deg, #080807, #20180b 46%, #5b4115);
        color: #f4d27a;
        border: 1px solid rgba(212, 168, 79, 0.42);
    }

    .search-form input,
    .form-card input,
    .form-card select,
    .form-card textarea,
    .auth-card input,
    .card-search-form input,
    .preview-slot-card input,
    .preview-slot-card select,
    .preview-slot-card textarea,
    .owner-style-control select,
    .owner-style-control input {
        background: #0b0b0a;
        border-color: rgba(212, 168, 79, 0.42);
        color: #f7f0df;
    }

    .pigeon-table th,
    .pigeon-table td {
        border-bottom-color: rgba(212, 168, 79, 0.18);
    }

    .pigeon-table a,
    .table-actions a {
        color: #f4d27a;
    }

    .flash.success {
        background: rgba(212, 168, 79, 0.18);
        color: #f4d27a;
        border: 1px solid rgba(212, 168, 79, 0.42);
    }

    .flash.error {
        background: rgba(153, 27, 27, 0.24);
        color: #fecaca;
        border: 1px solid rgba(248, 113, 113, 0.35);
    }

    .template-preview-sheet,
    .template-sheet,
    .template-preview-empty,
    .generation-label,
    .pedigree-card {
        background: #0f0f0e;
        border-color: rgba(212, 168, 79, 0.42);
        color: #f7f0df;
    }
}

@media screen {
    :root {
        --app-black: #060606;
        --app-black-soft: #100f0d;
        --app-panel: #17140f;
        --app-panel-deep: #0d0d0c;
        --app-gold: #d4a84f;
        --app-gold-light: #f4d27a;
        --app-gold-deep: #8f641e;
        --app-border: rgba(212, 168, 79, 0.44);
        --app-border-soft: rgba(212, 168, 79, 0.22);
        --app-text: #f7f0df;
        --app-muted: #c8bd9f;
        --app-danger: #ef4444;
    }

    html,
    body {
        min-height: 100%;
    }

    body {
        background:
            radial-gradient(circle at 14% 0%, rgba(244, 210, 122, 0.16), transparent 30rem),
            radial-gradient(circle at 86% 18%, rgba(143, 100, 30, 0.14), transparent 28rem),
            linear-gradient(135deg, var(--app-black) 0%, #11100d 44%, #080807 100%);
        color: var(--app-text);
    }

    header {
        background:
            linear-gradient(90deg, #050505 0%, #17110a 55%, #080807 100%);
        border-bottom: 1px solid var(--app-border);
        box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
    }

    main {
        position: relative;
    }

    .brand,
    h1,
    h2,
    h3,
    .home-card h2,
    .page-title-row h1,
    .price-card strong,
    .ancestor-ring,
    .sheet-owner {
        color: var(--app-gold-light) !important;
    }

    .brand {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        text-shadow: 0 0 18px rgba(244, 210, 122, 0.22);
    }

    .brand-logo {
        width: 92px;
        height: 92px;
        filter: drop-shadow(0 0 10px rgba(212, 168, 79, 0.25));
    }

    nav a,
    .inline-form button,
    .language-switch a,
    .user-menu summary,
    .small-link,
    .levels-info a,
    .pigeon-table a,
    .table-actions a {
        color: #eadfbd;
    }

    nav a:hover,
    .inline-form button:hover,
    .language-switch a.active,
    .user-menu summary:hover,
    .small-link:hover,
    .levels-info a:hover,
    .pigeon-table a:hover,
    .table-actions a:hover {
        color: var(--app-gold-light);
    }

    .home-hero,
    .home-card,
    .landing-video,
    .feature-grid article,
    .price-card,
    .form-card,
    .search-form,
    .import-card,
    .page-header,
    .levels-info,
    .pedigree-grid,
    .template-preview-editor,
    .template-choice,
    .template-option,
    .preview-slot-card,
    .danger-zone,
    .offspring-summary,
    .auth-card,
    .pigeon-table,
    .admin-list,
    .pedigree-card,
    .generation-label,
    .user-menu-panel {
        background:
            linear-gradient(135deg, rgba(91, 65, 21, 0.16), transparent 42%),
            linear-gradient(180deg, rgba(26, 23, 17, 0.98), rgba(13, 13, 12, 0.98));
        border: 1px solid var(--app-border);
        color: var(--app-text);
        box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
    }

    .home-hero,
    .home-card,
    .form-card,
    .search-form,
    .import-card,
    .page-header,
    .levels-info,
    .pedigree-grid,
    .preview-slot-card,
    .danger-zone,
    .offspring-summary,
    .auth-card {
        border-radius: 10px;
    }

    .user-menu summary {
        background: linear-gradient(180deg, #f1d17a 0%, #d4a84f 46%, #9a6d23 100%);
        color: #0a0907;
        border: 1px solid #f4d27a;
        box-shadow: 0 8px 18px rgba(212, 168, 79, 0.24);
    }

    .user-menu-panel span {
        color: var(--app-muted);
    }

    .home-card:hover,
    .template-choice:hover,
    .template-choice.selected,
    .template-option.selected,
    .price-card.highlighted,
    .preview-root-slot {
        border-color: var(--app-gold);
        box-shadow:
            0 0 0 2px rgba(212, 168, 79, 0.2),
            0 16px 42px rgba(0, 0, 0, 0.38);
    }

    .landing-video,
    .video-placeholder,
    .home-card-icon {
        background:
            linear-gradient(135deg, #080807 0%, #20180b 46%, #5b4115 100%);
        border: 1px solid var(--app-border);
        color: var(--app-gold-light);
    }

    .video-placeholder {
        box-shadow: inset 0 0 36px rgba(244, 210, 122, 0.12);
    }

    .home-hero p,
    .page-title-row p,
    .home-card p,
    .landing-copy p,
    .feature-grid p,
    .pricing-section p,
    .price-card p,
    .form-note,
    .admin-list span,
    .import-card p,
    .offspring-summary p,
    .ancestor-meta,
    .ancestor-name,
    footer,
    label,
    .owner-style-control {
        color: var(--app-muted) !important;
    }

    .eyebrow,
    .subscription-note {
        color: var(--app-gold-light) !important;
    }

    .button,
    .form-card button,
    .search-form button,
    .auth-card button,
    .import-card button,
    .card-search-form button,
    .preview-actions button,
    .danger-forms button,
    .table-actions button {
        background: linear-gradient(180deg, #f1d17a 0%, #d4a84f 46%, #9a6d23 100%);
        border: 1px solid #f4d27a;
        color: #0a0907;
        font-weight: 800;
        box-shadow: 0 8px 18px rgba(212, 168, 79, 0.24);
    }

    .button:hover,
    .form-card button:hover,
    .search-form button:hover,
    .auth-card button:hover,
    .import-card button:hover,
    .card-search-form button:hover,
    .preview-actions button:hover,
    .danger-forms button:hover,
    .table-actions button:hover {
        filter: brightness(1.08);
    }

    .button.secondary,
    .danger-forms button {
        background: linear-gradient(180deg, #20180b, #0d0d0c);
        color: var(--app-gold-light);
        border: 1px solid var(--app-border);
    }

    .button.danger,
    .danger-forms .danger-button,
    .table-actions button {
        background: linear-gradient(180deg, #b91c1c, #7f1d1d);
        border-color: rgba(248, 113, 113, 0.55);
        color: #fff1f2;
    }

    input,
    select,
    textarea,
    .search-form input,
    .form-card input,
    .form-card select,
    .form-card textarea,
    .auth-card input,
    .card-search-form input,
    .preview-slot-card input,
    .preview-slot-card select,
    .preview-slot-card textarea,
    .owner-style-control select,
    .owner-style-control input,
    .danger-forms input {
        background: #0b0b0a;
        border: 1px solid var(--app-border);
        color: var(--app-text);
    }

    input::placeholder,
    textarea::placeholder {
        color: rgba(200, 189, 159, 0.72);
    }

    input:focus,
    select:focus,
    textarea:focus {
        outline: none;
        border-color: var(--app-gold-light);
        box-shadow: 0 0 0 3px rgba(212, 168, 79, 0.18);
    }

    .pigeon-table th,
    .pigeon-table td,
    .admin-list > div {
        border-bottom-color: var(--app-border-soft);
    }

    .pigeon-table tr:hover td {
        background: rgba(212, 168, 79, 0.06);
    }

    .template-choice img,
    .template-option img,
    .template-preview-empty {
        background: #0f0f0e;
        border: 1px solid var(--app-border-soft);
    }

    .template-preview-sheet,
    .template-sheet {
        background: #0f0f0e;
        border: 1px solid var(--app-border);
        box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
    }

    .template-root,
    .template-cell,
    .root-description {
        color: var(--pedigree-name-color, #20180b);
    }

    .cell-description {
        color: var(--pedigree-desc-color, #6f634b);
    }

    .cell-ring,
    .root-ring {
        color: var(--pedigree-ring-color, #20180b);
    }

    .editable-sheet-cell input,
    .editable-sheet-cell select,
    .editable-sheet-cell textarea,
    .template-owner input:focus,
    .template-root input:focus,
    .template-root textarea:focus,
    .template-cell input:focus,
    .template-cell textarea:focus {
        background: rgba(255, 248, 220, 0.88);
        color: #111827;
        border-color: rgba(212, 168, 79, 0.72);
    }

    .flash.success {
        background: rgba(212, 168, 79, 0.18);
        color: var(--app-gold-light);
        border: 1px solid var(--app-border);
    }

    .flash.error {
        background: rgba(153, 27, 27, 0.28);
        color: #fecaca;
        border: 1px solid rgba(248, 113, 113, 0.42);
    }

    .template-owner input,
    .template-root input,
    .template-root textarea,
    .template-cell input,
    .template-cell textarea {
        background: transparent;
        border-color: transparent;
        color: inherit;
        box-shadow: none;
    }

    .manual-template-cell {
        gap: 0.08vw;
    }

    .manual-cell-meta {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 2px;
    }

    .template-cell:not(.horizontal-root-cell) .manual-cell-meta {
        display: none;
    }

    .manual-root-cell .manual-cell-meta {
        display: block;
    }

    .manual-template-cell input,
    .manual-template-cell textarea {
        min-height: 0;
    }

    .manual-template-cell textarea {
        flex: 1;
    }

    .manual-root-cell {
        font-size: clamp(8px, 0.82vw, 13px);
    }

    .manual-template-cell.tiny-cell .manual-cell-meta {
        display: none;
    }
}
