/* ==========================================================================
   KurdishDNA design system
   --------------------------------------------------------------------------
   Ported from the original site's app.css: Montserrat, the Kurdish flag
   palette, a radial-gradient ground and frosted translucent cards.

   Everything downstream reads these tokens, so the whole app rethemes from
   this block. Dark is the default (as it was on the original site); light is
   opt-in via [data-theme="light"].
   ========================================================================== */

:root, [data-theme="dark"] {
    /* --- Kurdish flag palette (the brand constants) --- */
    --kurdish-red: #CE1126;
    --kurdish-red-deep: #a00e1e;
    --kurdish-yellow: #EFD700;
    --kurdish-green: #00843D;

    /* --- Ground --- */
    --bg-dark: #171719;
    --bg-gradient:
        radial-gradient(1200px 600px at 10% -10%, rgba(206, 17, 38, 0.22), transparent 60%),
        radial-gradient(1000px 500px at 110% 10%, rgba(239, 215, 0, 0.18), transparent 60%),
        radial-gradient(900px 500px at 50% 120%, rgba(0, 132, 61, 0.18), transparent 60%);

    /* --- Surfaces: frosted glass over the gradient --- */
    --bg-card: rgba(23, 23, 27, 0.62);
    --bg-card-hover: rgba(38, 38, 44, 0.72);
    --card-inner-bg: rgba(255, 255, 255, 0.04);
    --pop-card-bg: rgba(23, 23, 27, 0.72);
    --nav-bg: rgba(24, 24, 27, 0.72);

    /* Raised / hover surfaces. These replace the hardcoded
       rgba(255,255,255,0.05) hovers, which were invisible in light mode. */
    --surface-raised: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.09);
    --surface-sunken: rgba(0, 0, 0, 0.22);

    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.12);
    --border-color: rgba(255, 255, 255, 0.10);
    --border-glow: rgba(255, 255, 255, 0.14);

    /* --- Accents --- */
    --primary: #CE1126;
    --primary-hover: #a00e1e;
    --primary-gradient: linear-gradient(135deg, #CE1126 0%, #a00e1e 100%);
    --primary-soft: rgba(206, 17, 38, 0.16);
    --primary-ring: rgba(206, 17, 38, 0.30);
    --primary-text: #f4707f;   /* 6.4:1 on the dark ground */
    --on-primary: #ffffff;

    --kurd-gold: #EFD700;
    --kurd-red: #CE1126;
    --kurd-green: #00843D;
    --kurd-cyan: #3FB6A8;
    /* Text tints of the flag colours: the flag values themselves do not
       clear 4.5:1 as small text, so anything that is read rather than
       just seen uses these. */
    --gold-text: #EFD700;
    --green-text: #4fc98a;

    /* Semantic status colours, tuned to sit beside the flag palette */
    --ok: #34d399;
    --ok-strong: #10b981;
    --warn: #EFD700;
    --danger: #f87171;
    --danger-strong: #CE1126;
    --info: #7dd3fc;

    --ok-soft: rgba(0, 132, 61, 0.15);
    --warn-soft: rgba(239, 215, 0, 0.15);
    --danger-soft: rgba(206, 17, 38, 0.16);
    --info-soft: rgba(125, 211, 252, 0.15);

    /* --- Type --- */
    --text-bright: #f4f4f5;
    --text-main: #d4d4d8;
    --text-muted: #8b8b93;

    /* --- Geometry: the old site's rounded-2xl language --- */
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 10px;

    --export-bg: #171719;
    --shadow-glass: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 4px 12px rgba(206, 17, 38, 0.25);
    --blur: 12px;
}

[data-theme="light"] {
    --bg-dark: #ffffff;
    --bg-gradient:
        radial-gradient(1200px 600px at 10% -10%, rgba(206, 17, 38, 0.15), transparent 60%),
        radial-gradient(1000px 500px at 110% 10%, rgba(239, 215, 0, 0.18), transparent 60%),
        radial-gradient(900px 500px at 50% 120%, rgba(0, 132, 61, 0.15), transparent 60%);

    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-card-hover: rgba(255, 255, 255, 0.92);
    --card-inner-bg: rgba(255, 255, 255, 0.55);
    --pop-card-bg: rgba(255, 255, 255, 0.85);
    --nav-bg: rgba(255, 255, 255, 0.72);

    --surface-raised: rgba(0, 0, 0, 0.04);
    --surface-hover: rgba(0, 0, 0, 0.07);
    --surface-sunken: rgba(0, 0, 0, 0.05);

    --input-bg: rgba(255, 255, 255, 0.80);
    --input-border: rgba(0, 0, 0, 0.14);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow: rgba(0, 0, 0, 0.12);

    --primary: #CE1126;
    --primary-hover: #a00e1e;
    --primary-gradient: linear-gradient(135deg, #CE1126 0%, #a00e1e 100%);
    --primary-soft: rgba(206, 17, 38, 0.10);
    --primary-ring: rgba(206, 17, 38, 0.25);
    --primary-text: #a00e1e;   /* 7.4:1 on white */
    --on-primary: #ffffff;

    /* Gold is unreadable on white, so light mode uses a darker ochre in its
       place while the flag yellow stays for fills and borders. */
    --kurd-gold: #9a7b00;
    --kurd-red: #CE1126;
    --kurd-green: #00843D;
    --kurd-cyan: #11705f;
    --gold-text: #7a6100;
    --green-text: #036b48;

    --ok: #036b48;
    --ok-strong: #025c3e;
    --warn: #7a6100;
    --danger: #dc2626;
    --danger-strong: #CE1126;
    --info: #0369a1;

    --ok-soft: rgba(5, 150, 105, 0.10);
    --warn-soft: rgba(154, 123, 0, 0.12);
    --danger-soft: rgba(206, 17, 38, 0.09);
    --info-soft: rgba(3, 105, 161, 0.10);

    --text-bright: #18181b;
    --text-main: #3f3f46;
    --text-muted: #5f5f69;

    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 10px;

    --export-bg: #ffffff;
    --shadow-glass: 0 6px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 4px 12px rgba(206, 17, 38, 0.20);
    --blur: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    font-family: 'Montserrat', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 72px !important;
    padding-bottom: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Minimalist Clean Navbar */
.navbar-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    height: 60px;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1380px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap !important;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.brand-logo:hover .brand-logo-img {
    transform: scale(1.04);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
    line-height: 1.35;
}

.brand-title span {
    color: var(--gold-text);
    display: inline-block;
}

/* Navbar Tabs */
.nav-tabs-custom {
    display: flex;
    gap: 3px;
    list-style: none;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 5px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-width: 0;
    scrollbar-width: thin;
}

.menu-lang-section {
    display: none;
}

.nav-tabs-custom::-webkit-scrollbar {
    height: 3px;
}

.nav-tabs-custom::-webkit-scrollbar-track {
    background: transparent;
}

.nav-tabs-custom::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nav-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-tab-btn:hover {
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
    color: var(--on-primary);
    background: var(--primary-gradient);
    border-color: transparent;
    font-weight: 600;
    box-shadow: var(--shadow-glow);
}

/* User Auth Area in Navbar */
.nav-user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-lang-select {
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-lang-select:hover {
    background: var(--surface-hover);
    border-color: var(--border-glow);
}

.nav-lang-select:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Matches the thin separator the original header used between the language
   switcher and the action buttons. */
.nav-divider {
    width: 1px;
    height: 16px;
    background: currentColor;
    opacity: 0.2;
}

@media (max-width: 900px) {
    .nav-lang-select,
    .nav-divider {
        display: none;
    }
}

.btn-auth-nav {
    background: rgba(206, 17, 38, 0.12);
    color: var(--primary-text);
    border: 1px solid rgba(206, 17, 38, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-auth-nav:hover {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

.btn-auth-mobile {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(206, 17, 38, 0.3);
    transition: all 0.2s ease;
}

.btn-auth-mobile:hover {
    filter: brightness(1.1);
}

.mobile-user-profile-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(0, 0, 0, 0.9);
    border: 1.5px solid var(--border-glow);
    border-radius: 8px;
    padding: 10px 14px;
}

.mobile-user-icon {
    color: var(--gold-text);
    font-size: 1.2rem;
}

.mobile-user-name {
    color: var(--text-bright);
    font-weight: 800;
    font-size: 0.92rem;
}

.mobile-user-logout-btn {
    background: rgba(206, 17, 38, 0.2);
    border: 1px solid var(--danger-strong);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-user-logout-btn:hover {
    background: var(--danger-strong);
    color: white;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-bright);
    font-weight: 600;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: var(--on-primary);
}

.btn-logout {
    background: rgba(206, 17, 38, 0.15);
    color: var(--kurd-red);
    border: 1px solid rgba(206, 17, 38, 0.4);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--kurd-red);
    color: white;
}

/* Mobile Hamburger Toggle */
.mobile-menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-bright);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

/* Layout Containers */
.main-wrapper {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 12px 20px 20px 20px;
    margin-top: 0 !important;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    scroll-margin-top: 75px;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }}

/* Clean Surface Cards & Containers */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-glass);
    margin-bottom: 20px;
    scroll-margin-top: 160px;
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    overflow: hidden;
}

.card-inner-box {
    background: var(--card-inner-bg);
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 18px;
}

.results-box {
    background: var(--card-inner-bg);
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-top: 18px;
    animation: fadeIn 0.2s ease;
}

.section-header {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 3px;
}

/* Form Controls & Grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-row-right {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.form-label {
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.form-label-bold {
    color: var(--text-bright);
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
}

.input-custom, .select-custom, .textarea-custom {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 9px 13px;
    color: var(--text-bright);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-custom:focus, .select-custom:focus, .textarea-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.btn-primary-custom {
    background: var(--primary-gradient);
    color: var(--on-primary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-glow);
}

.btn-primary-custom:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(206, 17, 38, 0.35);
}

.btn-secondary-custom {
    background: var(--surface-raised);
    color: var(--text-bright);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary-custom:hover {
    background: var(--surface-hover);
    border-color: var(--border-glow);
}

.radio-toggle-group {
    display: flex;
    gap: 8px;
    background: var(--card-inner-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.radio-btn-label {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.radio-btn-label input {
    accent-color: var(--primary);
}

/* Map Styling & Custom Borders */
.map-container {
    height: 520px;
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    z-index: 1;
}

.leaflet-tooltip {
    border: 1px solid var(--border-color) !important;
    background: var(--bg-card) !important;
    color: var(--text-bright) !important;
    font-size: 0.82rem;
    font-family: 'Montserrat', sans-serif;
    border-radius: 6px !important;
    box-shadow: var(--shadow-glass) !important;
    padding: 5px 10px !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-bright) !important;
    box-shadow: var(--shadow-glass) !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

.era-selector {
    display: flex;
    gap: 8px;
}

.era-btn {
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-inner-bg);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.era-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.era-btn.active {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-era-admin {
    padding: 7px 14px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-era-admin:hover {
    background: var(--bg-card-hover);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-era-admin.active {
    background: rgba(239, 215, 0, 0.12);
    border: 1px solid var(--kurd-gold);
    color: var(--gold-text);
}

/* Y-DNA & Regional Cards with Clean Borders */
.ydna-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.ydna-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.ydna-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: var(--bg-card-hover);
}

.ydna-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.subclade-pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-family: 'JetBrains Mono', monospace;
    margin: 2px;
}

/* --- Y-DNA SOURCE BANNER --- */
.ydna-source-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.source-banner-left {
    flex: 1;
    min-width: 260px;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 215, 0, 0.16);
    color: var(--gold-text);
    border: 1px solid rgba(239, 215, 0, 0.35);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.source-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.source-desc {
    font-size: 0.86rem;
    color: var(--text-main);
    line-height: 1.5;
}

.btn-source-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1d9bf0;
    border: 1px solid #1a8cd8;
    color: var(--on-primary);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(29, 155, 240, 0.35);
}

.btn-source-link:hover {
    background: #1a8cd8;
    border-color: #1570ad;
    color: var(--on-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 155, 240, 0.55);
}

.ydna-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.ydna-stat-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
    transition: all 0.15s ease;
}

.ydna-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--bg-card-hover);
}

.ydna-stat-card .stat-num {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-bright);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
}

.ydna-stat-card .stat-lbl {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

.ydna-filter-wrapper {
    margin-bottom: 20px;
}

.ydna-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.ydna-hg-dropdown {
    height: 36px !important;
    padding: 5px 10px !important;
    font-size: 0.82rem !important;
    border-radius: 6px !important;
    min-width: 240px;
    background: var(--card-inner-bg) !important;
}

.ydna-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ydna-action-btn {
    padding: 5px 11px !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--border-color) !important;
}

.ydna-action-btn.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--on-primary) !important;
}

.ydna-filter-summary-badge {
    font-size: 0.8rem;
    color: var(--gold-text);
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(239, 215, 0, 0.08);
    border: 1px solid rgba(239, 215, 0, 0.2);
    border-radius: 4px;
}

.ydna-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ydna-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.ydna-filter-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-glow);
    color: var(--text-bright);
}

.ydna-filter-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: var(--on-primary);
    font-weight: 600;
}

.ydna-pill-checkbox {
    font-size: 0.78rem;
    color: var(--primary-text);
    display: none;
}

.multiselect-active .ydna-pill-checkbox {
    display: inline-block;
}

.hg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.hg-count-pill {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.ydna-hg-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.ydna-controls-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.ydna-search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.ydna-search-input {
    padding-left: 36px !important;
    padding-right: 32px !important;
    height: 38px !important;
    border-radius: 6px !important;
    width: 100%;
}

.ydna-search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.btn-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 4px 6px;
    border-radius: 4px;
}

.btn-search-clear:hover {
    color: var(--on-primary);
}

.ydna-sort-select {
    height: 38px !important;
    border-radius: 6px !important;
    min-width: 200px;
    font-size: 0.82rem !important;
}

.ydna-clades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
}

.clade-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 18px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clade-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: var(--bg-card-hover);
}

.clade-mutation-title {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-bright);
    word-break: break-word;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clade-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 132, 61, 0.1);
    border: 1px solid rgba(0, 132, 61, 0.25);
    color: var(--ok);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.clade-links-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.tree-link-btn {
    flex: 1;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    text-align: center;
}

.tree-link-btn.yfull-btn {
    background: rgba(206, 17, 38, 0.1);
    border: 1px solid rgba(206, 17, 38, 0.3);
    color: var(--primary-text);
}

.tree-link-btn.yfull-btn:hover {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

.tree-link-btn.ftdna-btn {
    background: rgba(0, 132, 61, 0.1);
    border: 1px solid rgba(0, 132, 61, 0.3);
    color: var(--ok);
}

.tree-link-btn.ftdna-btn:hover {
    background: var(--ok-strong);
    color: var(--on-primary);
    border-color: var(--ok-strong);
}

.tree-link-btn.disabled {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.ydna-data-table {
    width: 100%;
    border-collapse: collapse;
}

.ydna-data-table th {
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border-color);
}

.ydna-data-table td {
    padding: 12px 16px;
    font-size: 0.86rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.ydna-data-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sample-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.sample-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sample-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.sample-card-header {
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sample-title {
    color: var(--text-bright);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    display: block;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.sample-location-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.location-badge {
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.city-badge {
    background: rgba(206, 17, 38, 0.12);
    color: var(--primary-text);
    border: 1px solid rgba(206, 17, 38, 0.25);
}

.province-badge {
    background: rgba(0, 132, 61, 0.12);
    color: var(--ok);
    border: 1px solid rgba(0, 132, 61, 0.25);
}

.sample-lineage-row {
    color: var(--text-muted);
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.lineage-divider {
    color: rgba(255, 255, 255, 0.2);
}

.ydna-pill {
    color: var(--green-text);
}

.mtdna-pill {
    color: var(--kurd-cyan);
}

.sample-dialect-row {
    color: var(--text-muted);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sample-card-footer {
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--primary-text);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-glass);
    animation: fadeIn 0.25s ease;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.auth-modal-content {
    max-width: 440px;
}

.modal-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Auth Modal Tabs & Elements */
.auth-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 8px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    color: white;
    background: var(--primary);
    box-shadow: var(--shadow-glow);
}

.auth-pane {
    display: none;
}

.auth-pane.active {
    display: block;
}

.auth-msg-box {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
}

/* Tables */
.table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    margin-bottom: 12px;
}

.table-custom {
    width: 100% !important;
    min-width: 620px !important;
    border-collapse: collapse;
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-custom th, .table-custom td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
}

.table-custom th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-custom td {
    font-size: 0.88rem;
}

/* Code Box */
.code-box {
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.84rem;
    color: var(--green-text);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ==============================================================================
   MOBILE RESPONSIVENESS
   ============================================================================== */
@media (max-width: 1024px) {
    .nav-container {
        flex-wrap: nowrap !important;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px !important;
        padding-bottom: 40px;
    }

    .navbar-custom {
        height: 56px;
        padding: 6px 12px;
    }

    .nav-container {
        flex-wrap: nowrap !important;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        color: var(--text-bright);
        width: 36px;
        height: 36px;
        border-radius: 6px;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    .nav-tabs-custom {
        display: none;
        position: absolute;
        top: 60px;
        left: 12px;
        right: 12px;
        width: calc(100% - 24px);
        flex-direction: column;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        padding: 10px;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        z-index: 2000;
    }

    .nav-tabs-custom.mobile-open {
        display: flex !important;
    }

    .nav-tab-btn {
        padding: 10px 12px;
        font-size: 0.88rem;
        justify-content: flex-start;
        min-height: 40px;
    }

    .nav-user-area {
        display: none !important;
    }

    .btn-auth-nav, .btn-user-profile {
        padding: 4px 8px;
        font-size: 0.76rem;
    }

    .btn-theme-toggle {
        padding: 4px 6px;
        font-size: 0.76rem;
    }

    .menu-lang-section {
        display: block !important;
        width: 100%;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
    }

    .lang-picker-card {
        background: var(--card-inner-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 10px;
    }

    .lang-picker-header {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.76rem;
        font-weight: 700;
        color: var(--gold-text);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
    }

    .lang-pills-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .lang-pill-btn {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--border-color);
        color: var(--text-muted);
        padding: 7px 10px;
        border-radius: 6px;
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.15s ease;
        width: 100%;
        font-family: inherit;
    }

    .lang-pill-btn:hover {
        background: var(--bg-card-hover);
        color: white;
        border-color: rgba(255, 255, 255, 0.2);
    }

    .lang-pill-btn.active {
        background: var(--primary);
        border: 1px solid var(--primary);
        color: white;
    }

    .lang-pill-btn .flag-icon {
        font-size: 1rem;
        line-height: 1;
    }

    .btn-help-nav, .btn-auth-nav {
        padding: 6px 10px !important;
        font-size: 0.78rem !important;
        min-height: 38px;
    }

    .main-wrapper {
        padding: 10px 8px;
    }

    .glass-card {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .era-selector {
        width: 100%;
        justify-content: space-between;
    }

    .era-btn {
        flex: 1;
        text-align: center;
        padding: 10px 4px;
        min-height: 42px;
    }

    .map-container {
        height: 360px;
    }

    .form-grid-2, .form-grid-4, .ydna-grid, .sample-grid {
        grid-template-columns: 1fr;
    }

    .btn-primary-custom, .btn-secondary-custom {
        width: 100%;
        min-height: 44px;
        padding: 10px;
    }

    .btn-row-right {
        justify-content: stretch;
    }

    .modal-content-custom {
        padding: 16px;
        width: 95%;
    }}

@media (max-width: 480px) {
    .brand-title {
        font-size: 1rem;
    }

    .map-container {
        height: 320px;
    }

    .table-custom th, .table-custom td {
        padding: 8px 6px;
        font-size: 0.78rem;
    }}

/* ==============================================================================
   SIMPLE BREAKDOWN & SEGMENTED RESULTS VIEWS
   ============================================================================== */
.result-view-segmented-bar {
    display: flex;
    background: var(--card-inner-bg);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    gap: 3px;
    margin-bottom: 16px;
    width: fit-content;
}

.result-view-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.result-view-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.result-view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pop-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.simple-breakdown-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
    width: 100%;
    cursor: pointer;
}

.simple-breakdown-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.pop-card-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.pop-card-img-container {
    position: relative;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--card-inner-bg);
}

.pop-img-thumb {
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    object-fit: cover;
    display: block;
    background: var(--card-inner-bg);
    border-radius: 10px;
    filter: brightness(1.05) contrast(1.05);
    transition: filter 0.25s ease;
}

.pop-card-info-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.pop-card-title-text {
    font-size: 0.86rem;
    font-weight: 750;
    color: var(--text-bright);
    margin: 0;
    line-height: 1.25;
    word-break: break-word;
}

.pop-card-era-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.2;
}

.pop-card-stats-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pop-card-pct-bold {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-bright);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.pop-donut-ring-sm {
    width: 32px;
    height: 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-edit-pop-img {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: var(--kurd-gold);
    color: var(--text-bright);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    transition: transform 0.2s ease;
    z-index: 2;
}

.btn-edit-pop-img:hover {
    transform: scale(1.2);
}

.pop-card-info {
    flex: 1;
    min-width: 0;
}

.pop-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-bright);
    margin: 0 0 4px 0;
    letter-spacing: -0.2px;
}

.pop-card-era {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pop-card-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.pop-card-pct {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    font-family: 'JetBrains Mono', monospace;
}

.pop-donut-ring {
    width: 44px;
    height: 44px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- THEME TOGGLE BUTTON STYLES --- */
.btn-theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-inner-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-bright);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-theme-toggle:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-theme-toggle-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

/* Glass & Card Theme Adaptations */
.glass-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

.card-inner-box {
    background: var(--card-inner-bg) !important;
    border: 1px solid var(--border-color) !important;
}

.simple-breakdown-card {
    background: var(--pop-card-bg) !important;
    border: 1px solid var(--border-color) !important;
}

.textarea-custom, .input-custom, .select-lang-custom, .select-sm, .input-sm {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-bright) !important;
}

.navbar-custom {
    background: var(--nav-bg) !important;
}

/* --- REPORT HEADER BANNER & USER BADGES --- */
.admixture-report-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-glass);
    transition: all 0.2s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.brand-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.report-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-bright);
    margin: 0;
}

.report-brand-title span {
    color: var(--primary-text);
}

.report-brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.report-user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.meta-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
}

.meta-badge .badge-label {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.meta-badge .badge-sample-name,
.meta-badge .badge-value,
.meta-badge span:not(.badge-label) {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.meta-badge.is-multiline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 2px;
    padding: 4px 8px;
    max-width: 100%;
    width: fit-content;
    box-sizing: border-box;
}

.meta-badge.is-multiline .badge-label {
    font-size: 0.68rem;
    opacity: 0.9;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.meta-badge.is-multiline .badge-sample-name,
.meta-badge.is-multiline .badge-value {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    box-sizing: border-box;
}

.meta-badge.user-badge {
    background: rgba(206, 17, 38, 0.18);
    border: 1.5px solid var(--primary);
    color: var(--primary-text);
}

.meta-badge.sample-badge {
    background: rgba(239, 215, 0, 0.15);
    border: 1.5px solid var(--kurd-gold);
    color: var(--gold-text);
    max-width: 100%;
    box-sizing: border-box;
}

.meta-badge.fit-badge,
.meta-badge.fit-badge.fit-badge-good {
    background: rgba(0, 132, 61, 0.15);
    border: 1.5px solid var(--kurd-green);
    color: var(--green-text);
}

.meta-badge.fit-badge.fit-badge-medium {
    background: rgba(239, 215, 0, 0.15);
    border: 1.5px solid var(--kurd-gold);
    color: var(--gold-text);
}

.meta-badge.fit-badge.fit-badge-poor {
    background: rgba(206, 17, 38, 0.15);
    border: 1.5px solid var(--kurd-red);
    color: var(--kurd-red);
}

/* Controls Bar (Excluded from exported PNG) */
.report-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
}

.input-sm {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    outline: none;
    min-width: 140px;
}

.select-sm {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

/* EXPORT MODES FOR CANVAS HIGH CONTRAST */
.export-mode-light {
    background: var(--bg-card) !important;
    color: var(--text-bright) !important;
    border: 2px solid var(--input-border) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

.export-mode-light .report-brand-title,
.export-mode-light h2,
.export-mode-light h3,
.export-mode-light h4,
.export-mode-light .pop-card-title-text,
.export-mode-light th,
.export-mode-light td {
    color: var(--text-bright) !important;
}

.export-mode-light .pop-card-pct-bold {
    color: var(--primary-hover) !important;
}

.export-mode-light .report-brand-sub,
.export-mode-light p,
.export-mode-light span:not(.meta-badge span) {
    color: var(--text-muted) !important;
}

.export-mode-light .simple-breakdown-card,
.export-mode-light .card-inner-box {
    background: var(--bg-card) !important;
    border: 1.5px solid var(--border-color) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04) !important;
}

.export-mode-light .meta-badge.user-badge {
    background: var(--primary-soft) !important;
    color: var(--primary-hover) !important;
    border: 1.5px solid var(--primary) !important;
}
.export-mode-light .meta-badge.user-badge .badge-sample-name,
.export-mode-light .meta-badge.user-badge span,
.export-mode-light .meta-badge.user-badge i {
    color: var(--primary-hover) !important;
}

.export-mode-light .meta-badge.sample-badge {
    background: var(--warn-soft) !important;
    color: var(--warn) !important;
    border: 1.5px solid var(--kurd-gold) !important;
}
.export-mode-light .meta-badge.sample-badge .badge-sample-name,
.export-mode-light .meta-badge.sample-badge span,
.export-mode-light .meta-badge.sample-badge i {
    color: var(--warn) !important;
}

.export-mode-light .meta-badge.fit-badge,
.export-mode-light .meta-badge.fit-badge.fit-badge-good {
    background: var(--ok-soft) !important;
    color: var(--ok) !important;
    border: 1.5px solid var(--ok-strong) !important;
}
.export-mode-light .meta-badge.fit-badge strong,
.export-mode-light .meta-badge.fit-badge.fit-badge-good strong,
.export-mode-light .meta-badge.fit-badge span,
.export-mode-light .meta-badge.fit-badge.fit-badge-good span,
.export-mode-light .meta-badge.fit-badge i,
.export-mode-light .meta-badge.fit-badge.fit-badge-good i {
    color: var(--ok) !important;
}

.export-mode-light .meta-badge.fit-badge.fit-badge-medium {
    background: var(--warn-soft) !important;
    color: var(--warn) !important;
    border: 1.5px solid var(--kurd-gold) !important;
}
.export-mode-light .meta-badge.fit-badge.fit-badge-medium strong,
.export-mode-light .meta-badge.fit-badge.fit-badge-medium span,
.export-mode-light .meta-badge.fit-badge.fit-badge-medium i {
    color: var(--warn) !important;
}

.export-mode-light .meta-badge.fit-badge.fit-badge-poor {
    background: var(--danger-soft) !important;
    color: var(--danger) !important;
    border: 1.5px solid var(--danger-strong) !important;
}
.export-mode-light .meta-badge.fit-badge.fit-badge-poor strong,
.export-mode-light .meta-badge.fit-badge.fit-badge-poor span,
.export-mode-light .meta-badge.fit-badge.fit-badge-poor i {
    color: var(--danger) !important;
}

.export-mode-light svg path[stroke="rgba(255,255,255,0.12)"],
.export-mode-light svg path[stroke="rgba(255,255,255,0.1)"] {
    stroke: rgba(0, 0, 0, 0.12) !important;
}

.export-mode-dark {
    background: #171719 !important;
    color: #ffffff !important;
    border: 2px solid rgba(206, 17, 38, 0.5) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7) !important;
}

.export-mode-dark .report-brand-title,
.export-mode-dark h2,
.export-mode-dark h3,
.export-mode-dark h4,
.export-mode-dark .pop-card-title-text,
.export-mode-dark th,
.export-mode-dark td {
    color: var(--on-primary) !important;
}

.export-mode-dark .pop-card-pct-bold {
    color: var(--warn) !important;
}

.export-mode-dark .report-brand-sub,
.export-mode-dark p {
    color: var(--text-muted) !important;
}

.export-mode-dark .simple-breakdown-card {
    background: var(--border-color) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.export-mode-dark .meta-badge.user-badge {
    background: rgba(206, 17, 38, 0.25) !important;
    color: var(--primary-text) !important;
    border: 1.5px solid var(--primary) !important;
}

.export-mode-dark .meta-badge.sample-badge {
    background: rgba(239, 215, 0, 0.25) !important;
    color: var(--gold-text) !important;
    border: 1.5px solid var(--kurd-gold) !important;
}

.export-mode-dark .meta-badge.fit-badge,
.export-mode-dark .meta-badge.fit-badge.fit-badge-good {
    background: rgba(0, 132, 61, 0.25) !important;
    color: var(--ok) !important;
    border: 1.5px solid var(--ok-strong) !important;
}

.export-mode-dark .meta-badge.fit-badge.fit-badge-medium {
    background: rgba(239, 215, 0, 0.25) !important;
    color: var(--gold-text) !important;
    border: 1.5px solid var(--kurd-gold) !important;
}

.export-mode-dark .meta-badge.fit-badge.fit-badge-poor {
    background: rgba(206, 17, 38, 0.25) !important;
    color: var(--danger) !important;
    border: 1.5px solid var(--danger-strong) !important;
}

/* Light-mode adjustments that are not pure colour (colour itself now
   comes from the token layer at the top of this file). */

[data-theme="light"] .g25-notice-title {
    font-weight: 800 !important;
}

[data-theme="light"] .g25-notice-text {
    font-weight: 500 !important;
}

[data-theme="light"] .notice-box-blue p {
    font-weight: 500 !important;
}

[data-theme="light"] .notice-box-green p {
    font-weight: 500 !important;
}

[data-theme="light"] .notice-box-cyan p {
    font-weight: 500 !important;
}

/* Form & Inputs */
[data-theme="light"] .input-custom,
[data-theme="light"] .textarea-custom,
[data-theme="light"] .select-custom {
    font-weight: 500;
}

/* Genetic Distance Value Colors (Light & Dark Mode) */
.dist-number-colored {
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
}

.dist-green {
    color: var(--ok) !important;
}

.dist-orange {
    color: var(--warn) !important;
}

.dist-red {
    color: var(--danger) !important;
}

/* ==============================================================================
   FREE QPADM PORTAL AVAILABILITY STATUS STYLES
   ============================================================================== */
.qpadm-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 12px;
    transition: all 0.25s ease;
    margin-bottom: 20px;
}

.qpadm-status-banner.status-available {
    background: rgba(0, 132, 61, 0.12);
    border: 1.5px solid var(--ok-strong);
    box-shadow: 0 4px 20px rgba(0, 132, 61, 0.18);
}

.qpadm-status-banner.status-unavailable {
    background: rgba(206, 17, 38, 0.12);
    border: 1.5px solid var(--danger-strong);
    box-shadow: 0 4px 20px rgba(206, 17, 38, 0.18);
}

.qpadm-status-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.qpadm-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.qpadm-status-dot.dot-available {
    background: var(--ok-strong);
    box-shadow: 0 0 10px var(--ok-strong), 0 0 18px rgba(0, 132, 61, 0.7);
    animation: statusPulseGreen 2s infinite ease-in-out;
}

.qpadm-status-dot.dot-unavailable {
    background: var(--danger-strong);
    box-shadow: 0 0 10px var(--danger-strong), 0 0 18px rgba(206, 17, 38, 0.7);
    animation: statusPulseRed 2s infinite ease-in-out;
}

@keyframes statusPulseGreen {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.22); opacity: 0.82; }}

@keyframes statusPulseRed {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.22); opacity: 0.82; }}

.qpadm-status-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qpadm-status-title-badge.avail {
    color: var(--ok);
}

.qpadm-status-title-badge.unavail {
    color: var(--danger);
}

.qpadm-status-text {
    font-size: 0.86rem;
    color: var(--text-main);
    margin-top: 3px;
    line-height: 1.4;
}

/* Admin Status Switch Controls */
.admin-status-btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-status-toggle.btn-avail {
    background: rgba(0, 132, 61, 0.15);
    border: 1.5px solid var(--ok-strong);
    color: var(--ok);
}

.btn-status-toggle.btn-avail.active,
.btn-status-toggle.btn-avail:hover {
    /* the flag green clears 4.5:1 against white text; --ok-strong does not */
    background: var(--kurd-green);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(0, 132, 61, 0.4);
}

.btn-status-toggle.btn-unavail {
    background: rgba(206, 17, 38, 0.15);
    border: 1.5px solid var(--danger-strong);
    color: var(--danger);
}

.btn-status-toggle.btn-unavail.active,
.btn-status-toggle.btn-unavail:hover {
    background: var(--danger-strong);
    color: white;
    box-shadow: 0 0 14px rgba(206, 17, 38, 0.4);
}

/* Enhanced Image Upload Dropzone */
.img-upload-dropzone {
    border: 2px dashed rgba(239, 215, 0, 0.45);
    background: rgba(239, 215, 0, 0.04);
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.img-upload-dropzone:hover,
.img-upload-dropzone.dragover {
    border-color: var(--kurd-gold);
    background: rgba(239, 215, 0, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 215, 0, 0.15);
}

/* COMPACT & FRIENDLY MOBILE RESPONSIVE OVERRIDES */
@media (max-width: 768px) {
    .main-wrapper {
        padding: 8px 10px 20px 10px !important;
    }

    .glass-card {
        padding: 16px 12px 14px 12px !important;
        margin-bottom: 14px !important;
        border-radius: 14px !important;
    }

    .card-inner-box {
        padding: 12px 10px !important;
        margin-bottom: 12px !important;
        border-radius: 10px !important;
    }

    .section-title {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
    }

    .section-subtitle {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
        margin-top: 2px !important;
    }

    .form-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .form-label, .form-label-bold {
        font-size: 0.76rem !important;
        margin-bottom: 3px !important;
    }

    .input-custom, .select-custom, .textarea-custom {
        padding: 7px 10px !important;
        font-size: 0.82rem !important;
    }

    .btn-primary-custom, .btn-secondary-custom {
        padding: 7px 12px !important;
        font-size: 0.8rem !important;
    }

    .pop-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .simple-breakdown-card {
        padding: 8px 10px !important;
    }

    .pop-card-title-text {
        font-size: 0.88rem !important;
    }

    .pop-card-pct-bold {
        font-size: 1rem !important;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ==============================================================================
   CREDITS & COMMUNITY HUBS
   ============================================================================== */
.credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
}

.credit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.credit-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.credit-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.credit-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.avatar-dev { background: rgba(206, 17, 38, 0.18); color: var(--primary-text); border: 1px solid rgba(206, 17, 38, 0.35); }
.avatar-data { background: rgba(239, 215, 0, 0.18); color: var(--gold-text); border: 1px solid rgba(239, 215, 0, 0.35); }
.avatar-comp { background: rgba(0, 132, 61, 0.18); color: var(--ok); border: 1px solid rgba(0, 132, 61, 0.35); }
.avatar-admix { background: rgba(236, 72, 153, 0.18); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.35); }
.avatar-discord { background: rgba(88, 101, 242, 0.18); color: var(--primary-text); border: 1px solid rgba(88, 101, 242, 0.35); }
.avatar-x { background: rgba(255, 255, 255, 0.08); color: var(--on-primary); border: 1px solid rgba(255, 255, 255, 0.2); }
.avatar-fb { background: rgba(24, 119, 242, 0.18); color: var(--primary-text); border: 1px solid rgba(24, 119, 242, 0.35); }

.credit-meta {
    flex: 1;
    min-width: 120px;
}

.credit-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-bright);
    line-height: 1.2;
}

.credit-handle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.credit-handle a {
    color: var(--info);
    text-decoration: none;
    font-weight: 600;
}

.credit-handle a:hover {
    text-decoration: underline;
}

.credit-role-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-dev { background: rgba(206, 17, 38, 0.15); color: var(--primary-text); border: 1px solid rgba(206, 17, 38, 0.3); }
.badge-data { background: rgba(239, 215, 0, 0.15); color: var(--gold-text); border: 1px solid rgba(239, 215, 0, 0.3); }
.badge-comp { background: rgba(0, 132, 61, 0.15); color: var(--ok); border: 1px solid rgba(0, 132, 61, 0.3); }
.badge-admix { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-discord { background: rgba(88, 101, 242, 0.15); color: var(--primary-text); border: 1px solid rgba(88, 101, 242, 0.3); }
.badge-x { background: rgba(255, 255, 255, 0.1); color: var(--on-primary); border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-fb { background: rgba(24, 119, 242, 0.15); color: var(--primary-text); border: 1px solid rgba(24, 119, 242, 0.3); }

.credit-desc {
    font-size: 0.88rem;
    color: var(--text-main);
    line-height: 1.55;
    margin-bottom: 18px;
}

.credit-card-footer {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-credit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-x-link {
    background: var(--surface-sunken);
    color: var(--on-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-x-link:hover {
    background: #1a8cd8;
    border-color: #1570ad;
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-discord-link {
    background: #5865f2;
    color: var(--on-primary);
    border: 1px solid #4752c4;
}
.btn-discord-link:hover {
    background: #4752c4;
    transform: translateY(-1px);
    color: var(--on-primary);
}

.btn-fb-link {
    background: #1877f2;
    color: var(--on-primary);
    border: 1px solid #0c63d4;
}
.btn-fb-link:hover {
    background: #0c63d4;
    transform: translateY(-1px);
    color: var(--on-primary);
}

/* ==========================================================================
   Y-DNA CLADE FINDER & KURDISH BRANCH PREDICTOR STYLES (Light & Dark Theme)
   ========================================================================== */
.ydna-clade-finder-box {
    margin-bottom: 24px;
    border-radius: var(--radius-xl);
    padding: 22px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-glass);
    transition: all 0.2s ease;
}

.ydna-finder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.ydna-finder-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ydna-finder-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.ydna-finder-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: -0.3px;
}

.ydna-finder-subtitle {
    margin: 3px 0 0 0;
    font-size: 0.86rem;
    color: var(--text-main);
    line-height: 1.45;
}

.ydna-finder-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ydna-badge-clades {
    background: rgba(206, 17, 38, 0.15);
    color: var(--primary-text);
    border: 1px solid rgba(206, 17, 38, 0.3);
    font-size: 0.76rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
}

.ydna-badge-kurd {
    background: rgba(0, 132, 61, 0.15);
    color: var(--ok);
    border: 1px solid rgba(0, 132, 61, 0.3);
    font-size: 0.76rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
}

.ydna-finder-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.ydna-upload-tile {
    background: var(--card-inner-bg);
    border: 2px dashed rgba(206, 17, 38, 0.4);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ydna-upload-tile:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.ydna-upload-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: var(--primary-text);
}

.ydna-upload-title {
    font-weight: 800;
    font-size: 0.94rem;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.ydna-upload-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ydna-input-tile {
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ydna-finder-label {
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--text-bright);
    margin-bottom: 8px;
    display: block;
}

.ydna-finder-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-bright);
    font-weight: 600;
}

.ydna-quick-links-row {
    margin-top: 10px;
}

.ydna-quick-links {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ydna-quick-links a {
    color: var(--primary-text);
    font-weight: 700;
    text-decoration: underline;
    margin: 0 2px;
}

.ydna-finder-actions-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn-ydna-find {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 50%, var(--primary) 100%) !important;
    color: var(--on-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    padding: 12px 28px !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.2px !important;
    border-radius: 50px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(160, 14, 30, 0.35) !important;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn-ydna-find:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 24px rgba(160, 14, 30, 0.5) !important;
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-hover) 50%, var(--primary-hover) 100%) !important;
    color: var(--on-primary) !important;
}

.btn-ydna-find:active {
    transform: translateY(0) scale(0.99) !important;
    box-shadow: 0 2px 8px rgba(160, 14, 30, 0.35) !important;
}

.btn-ydna-find i {
    font-size: 1.05rem;
    transition: transform 0.22s ease;
}

.btn-ydna-find:hover i {
    transform: scale(1.18);
}

.btn-ydna-clear {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-main) !important;
    border: 1.5px solid var(--border-color) !important;
    padding: 12px 22px !important;
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.btn-ydna-clear:hover {
    background: rgba(206, 17, 38, 0.12) !important;
    border-color: rgba(206, 17, 38, 0.45) !important;
    color: var(--danger) !important;
    transform: translateY(-1px) !important;
}

.btn-ydna-clear:active {
    transform: translateY(0) !important;
}

.ydna-finder-spinner {
    color: var(--primary-text);
    font-size: 0.9rem;
    font-weight: 700;
}

/* Results Container */
.ydna-result-box {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 22px;
    box-shadow: var(--shadow-glass);
}

.ydna-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.ydna-result-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-bright);
    letter-spacing: -0.5px;
}

.ydna-stat-tiles-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ydna-stat-tile {
    background: var(--card-inner-bg);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ydna-stat-tile-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.ydna-stat-tile-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-bright);
}

.ydna-trail-container {
    background: var(--card-inner-bg);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.ydna-trail-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ydna-node-badge {
    display: inline-block;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-card);
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    margin: 2px 0;
}

.ydna-node-badge.terminal {
    font-weight: 900;
    color: var(--warn);
    background: rgba(239, 215, 0, 0.15);
    border-color: rgba(239, 215, 0, 0.4);
}

.ydna-kurdish-placement-box {
    background: var(--card-inner-bg);
    border: 1.5px solid rgba(63, 182, 168, 0.35);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
}

.ydna-placement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ydna-placement-title {
    color: var(--info);
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ydna-placement-desc {
    margin: 0 0 14px 0;
    font-size: 0.88rem;
    color: var(--text-main);
    line-height: 1.55;
}

.ydna-candidate-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary) !important;
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-glow);
}

/* Privacy Trust Badge */
.privacy-trust-badge {
    background: rgba(0, 132, 61, 0.08);
    border: 1.5px solid rgba(0, 132, 61, 0.35);
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0, 132, 61, 0.05);
    transition: all 0.2s ease;
}
.privacy-trust-badge:hover {
    border-color: rgba(0, 132, 61, 0.55);
    background: rgba(0, 132, 61, 0.12);
}
.privacy-trust-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 132, 61, 0.15);
    border: 1.5px solid rgba(0, 132, 61, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ok);
    font-size: 1.15rem;
    flex-shrink: 0;
}
.privacy-trust-text {
    font-size: 0.86rem;
    color: var(--text-main);
    line-height: 1.45;
}
.privacy-trust-title {
    font-weight: 800;
    color: var(--ok);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    font-size: 0.90rem;
    letter-spacing: 0.2px;
}

/* Calculator Model Selection Cards */
.calc-models-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 6px;
}

.calc-model-card-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-inner-bg);
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
    user-select: none;
}

.calc-model-card-btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(206, 17, 38, 0.4);
    transform: translateY(-1px);
}

.calc-model-card-btn.active {
    background: rgba(206, 17, 38, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 2px 8px rgba(206, 17, 38, 0.15);
}

.calc-model-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.calc-model-card-btn.active .calc-model-icon-box {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.calc-model-info {
    flex: 1;
    min-width: 0;
}

.calc-model-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.calc-model-name {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-bright);
}

.calc-model-pill {
    font-size: 0.70rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(239, 215, 0, 0.15);
    color: var(--gold-text);
    border: 1px solid rgba(239, 215, 0, 0.3);
}

.calc-model-card-btn.active .calc-model-pill {
    background: rgba(206, 17, 38, 0.15);
    color: var(--primary-text);
    border-color: rgba(206, 17, 38, 0.3);
}

.calc-model-desc {
    font-size: 0.77rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* Site Footer */
.site-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 24px 20px 28px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: transparent;
    text-align: center;
}

.site-footer-inner {
    max-width: 1380px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
}

/* Social row, carried over from the original site's footer. */
.site-footer-social {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.site-footer-social a {
    color: var(--text-muted);
    display: inline-flex;
    opacity: 0.75;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.site-footer-social a:hover {
    opacity: 1;
    color: var(--primary-text);
}

.site-footer-copy {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    margin: 0;
}
/* ==========================================================================
   HOME / LANDING
   Rebuilt from the original site's hero and feature grid.
   ========================================================================== */

.hero {
    position: relative;
    padding: 44px 0 24px;
    overflow: hidden;
}

.hero::before {
    /* the soft red bloom the original hero had in its top-right corner */
    content: "";
    position: absolute;
    top: -16rem;
    right: -14rem;
    width: 34rem;
    height: 34rem;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.35;
    pointer-events: none;
    background: radial-gradient(closest-side, rgba(206, 17, 38, 0.25), transparent);
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    background: var(--surface-raised);
    border-radius: 999px;
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

.hero-eyebrow i {
    color: var(--gold-text);
}

.hero-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.hero-icon {
    height: 64px;
    width: auto;
    flex-shrink: 0;
}

.hero-title {
    font-size: clamp(2rem, 4.2vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text-bright);
    margin: 0;
}

.hero-title span {
    color: var(--primary-text);
}

.hero-subtitle {
    margin-top: 18px;
    font-size: 1.06rem;
    line-height: 1.65;
    color: var(--text-main);
    opacity: 0.9;
    max-width: 46ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 30px;
}

.btn-hero {
    padding: 14px 26px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 24px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.hero-trust span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-trust i {
    color: var(--green-text);
}

/* --- hero illustration --- */

.hero-preview-card {
    margin-bottom: 0;
    padding: 16px;
}

.hero-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.hero-preview-tile {
    border: 1px solid var(--border-color);
    background: var(--card-inner-bg);
    border-radius: var(--radius-lg);
    padding: 12px;
}

.hero-preview-wide {
    grid-column: span 2;
}

.hero-preview-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.hero-preview-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
}

.hero-preview-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.hero-preview-rows span:first-child {
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-preview-swatches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    height: 92px;
}

.hero-preview-swatches span {
    border-radius: var(--radius-md);
}

.hero-preview-heatmap {
    height: 110px;
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 40% 50%, rgba(206, 17, 38, 0.85) 4%, transparent 9%),
        radial-gradient(circle at 60% 60%, rgba(63, 182, 168, 0.85) 6%, transparent 11%),
        radial-gradient(circle at 70% 30%, rgba(239, 215, 0, 0.85) 5%, transparent 10%),
        radial-gradient(circle at 50% 70%, rgba(0, 132, 61, 0.85) 5%, transparent 11%),
        var(--surface-sunken);
}

/* --- trust tags --- */

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0 6px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.hero-tags span {
    padding: 5px 11px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

/* --- feature grid --- */

.home-features-title {
    text-align: center;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    margin: 48px 0 4px;
}

.home-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 28px;
    padding-bottom: 20px;
}

.feature-card {
    margin-bottom: 0;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover,
.feature-card:focus-visible {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    outline: none;
}

.feature-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-lg);
    display: grid;
    place-content: center;
    font-size: 1.05rem;
}

.feature-card h3 {
    margin-top: 14px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
}

.feature-card p {
    margin-top: 6px;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-main);
    opacity: 0.85;
}

@media (max-width: 1000px) {
    .home-features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .hero-grid { grid-template-columns: 1fr; gap: 28px; }
    .hero-preview { display: none; }
    .hero { padding-top: 28px; }
    .hero-icon { height: 48px; }
}

@media (max-width: 640px) {
    .home-features-grid { grid-template-columns: 1fr; }
    .hero-actions .btn-hero { width: 100%; }
}

/* ==========================================================================
   BLOG
   Index cards, article typography and the haplotree renderer, carried over
   from the original site's blog.
   ========================================================================== */

.blog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.blog-loading {
    color: var(--text-muted);
    text-align: center;
    padding: 30px 0;
}

.blog-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.blog-card:hover,
.blog-card:focus-visible {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    outline: none;
}

.blog-card-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}

.blog-card-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.35;
}

.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.blog-card-excerpt {
    margin-top: 10px;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-main);
    opacity: 0.85;
}

.blog-card-langs {
    display: flex;
    gap: 6px;
    margin-top: 14px;
}

.blog-card-langs span {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 2px 7px;
}

.blog-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.86rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: 22px;
    transition: color 0.15s ease;
}

.blog-back-btn:hover {
    color: var(--primary-text);
}

/* --- article typography --- */

.blog-article {
    max-width: 72ch;
    margin: 0 auto;
    color: var(--text-main);
    line-height: 1.75;
}

.blog-article h1 {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    line-height: 1.2;
}

.blog-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 28px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.blog-article h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 34px 0 10px;
}

.blog-article h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 26px 0 8px;
}

.blog-article p { margin: 14px 0; }

.blog-article a {
    color: var(--primary-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-article ul,
.blog-article ol { margin: 14px 0 14px 22px; }

.blog-article li { margin: 6px 0; }

.blog-article blockquote {
    margin: 18px 0;
    padding: 4px 18px;
    border-left: 3px solid var(--primary);
    color: var(--text-muted);
    font-style: italic;
}

.blog-article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
}

.blog-article code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.86em;
    background: var(--surface-sunken);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
}

.blog-article pre {
    background: var(--surface-sunken);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 18px 0;
}

.blog-article pre code {
    background: none;
    border: none;
    padding: 0;
}

.blog-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 0.88rem;
}

.blog-article th,
.blog-article td {
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    text-align: left;
}

.blog-article th {
    background: var(--surface-raised);
    color: var(--text-bright);
    font-weight: 700;
}

.blog-cover {
    width: 100%;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
}

.blog-umap {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin: 22px 0;
}

.blog-sources {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.blog-sources h3 { margin-top: 0; }

.blog-sources ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.84rem;
}

.blog-sources li {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    word-break: break-word;
}

.blog-sources li::before {
    content: "•";
    color: var(--primary-text);
    flex-shrink: 0;
}

/* --- haplotree --- */

.blog-haplo-block {
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 26px 0;
}

.blog-haplo-block h3 { margin: 0 0 14px; }

.haplo-scroll { overflow-x: auto; }

.haplo-tree {
    font-size: 0.84rem;
    line-height: 1.5;
    min-width: max-content;
}

.haplo-node {
    position: relative;
    padding-left: 18px;
}

.haplo-node.has-children > .haplo-children {
    border-left: 2px solid var(--border-glow);
    margin-left: 2px;
}

.haplo-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 3px 0;
    position: relative;
}

.haplo-row::before {
    /* the elbow connecting a node to its parent's spine */
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    width: 14px;
    border-top: 2px solid var(--border-glow);
}

.haplo-clade {
    background: var(--kurd-green);
    color: #ffffff;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.haplo-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

.haplo-person { opacity: 0.5; user-select: none; }

.haplo-sample {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.haplo-flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    display: inline-block;
}

@media (max-width: 640px) {
    .blog-list { grid-template-columns: 1fr; }
}

/* The Kurdistan flag is not in flag-icons, so it ships with the site.
   Posts reference it as the `krd` code. */
.fi-krd {
    background-image: url('/flags/kr.svg');
    background-size: cover;
    background-position: center;
}

/* --- blog editor (Admin Studio) --- */

.blog-admin-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.blog-admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blog-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.blog-admin-row-title {
    font-weight: 700;
    color: var(--text-bright);
    font-size: 0.92rem;
}

.blog-admin-row-meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.blog-admin-row-meta code {
    font-family: 'JetBrains Mono', monospace;
}

.blog-admin-body {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.84rem;
    line-height: 1.6;
}

.blog-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.admin-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 4px 0 10px;
    line-height: 1.55;
}

.admin-hint code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--surface-sunken);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 1px 4px;
}

.haplo-editor-row {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
    background: var(--surface-raised);
}

.haplo-editor-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.haplo-editor-row .haplo-tree {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

/* ==========================================================================
   MY ACCOUNT
   ========================================================================== */

.account-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.account-field {
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
}

.account-field span {
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.account-field strong {
    color: var(--text-bright);
    font-size: 0.98rem;
    font-weight: 700;
    word-break: break-word;
}

.account-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.account-result-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s ease;
}

.account-result-row:hover {
    border-color: var(--primary);
}

.account-result-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: grid;
    place-content: center;
    background: var(--primary-soft);
    color: var(--primary-text);
}

.account-result-main {
    flex: 1;
    min-width: 0;
}

.account-result-label {
    font-weight: 700;
    color: var(--text-bright);
    font-size: 0.94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-result-meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.account-result-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.account-delete-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* "Save to my account" buttons appear only for a signed-in user.
   Driven by a class on <body> rather than by toggling each element, so result
   markup rendered after login picks the state up on its own. */
.save-result-btn {
    display: none;
}

body.is-signed-in .save-result-btn {
    display: inline-flex;
}

@media (max-width: 620px) {
    .account-result-row { flex-wrap: wrap; }
    .account-result-actions { width: 100%; justify-content: flex-end; }
}

/* --- stale results / model updates --- */

.stale-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 14px 18px;
    background: var(--warn-soft);
    border: 1px solid var(--kurd-gold);
    border-radius: var(--radius-lg);
}

.stale-banner strong {
    color: var(--text-bright);
    display: block;
    margin-bottom: 3px;
}

.stale-banner p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-main);
    max-width: 62ch;
}

.stale-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--warn);
    background: var(--warn-soft);
    border: 1px solid var(--kurd-gold);
    border-radius: 999px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.account-result-row.is-stale {
    border-color: var(--kurd-gold);
}
