body.page-tools {
    background:
        radial-gradient(circle at 12% 8%, rgba(90, 127, 255, 0.2), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(36, 224, 196, 0.14), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(82, 94, 214, 0.14), transparent 42%),
        linear-gradient(180deg, #eef4ff 0%, #e4ebfb 52%, #dbe3f6 100%);
}

body.page-tools .main-content {
    margin-left: var(--mx-sidebar-width);
    width: calc(100% - var(--mx-sidebar-width));
    min-height: 100vh;
    padding: clamp(24px, 3vw, 36px) 0 56px;
    background: transparent;
    border-radius: 0;
}

.tools-container.ai-lab-shell {
    position: relative;
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 clamp(18px, 3vw, 34px);
}

.tools-container.ai-lab-shell::before {
    content: "";
    position: absolute;
    inset: 14px 24px auto;
    height: 360px;
    border-radius: 32px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.08));
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

.lab-hero,
.lab-featured,
.lab-group {
    position: relative;
    z-index: 1;
}

.lab-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 24px;
    padding: 34px;
    border: 1px solid rgba(157, 178, 255, 0.34);
    border-radius: 32px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(231, 238, 255, 0.56)),
        linear-gradient(180deg, rgba(117, 146, 255, 0.16), rgba(58, 223, 193, 0.08));
    box-shadow:
        0 26px 60px rgba(33, 52, 108, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.lab-hero::after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    top: -140px;
    right: -60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(86, 110, 255, 0.28), rgba(86, 110, 255, 0));
    pointer-events: none;
}

.lab-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 8px 14px;
    border: 1px solid rgba(88, 109, 214, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.54);
    color: #536694;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    width: fit-content;
}

.lab-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #536cff, #28d6c8);
    box-shadow: 0 0 18px rgba(83, 108, 255, 0.5);
}

.lab-title {
    margin: 0;
    font-size: clamp(46px, 8vw, 74px);
    line-height: 0.94;
    letter-spacing: -0.04em;
    color: #0f1837;
    font-weight: 800;
}

.lab-title span {
    display: block;
    margin-top: 8px;
    font-size: clamp(20px, 3vw, 30px);
    letter-spacing: -0.02em;
    color: #4d5a87;
    font-weight: 600;
}

.lab-subtitle {
    max-width: 720px;
    margin: 18px 0 0;
    font-size: 17px;
    line-height: 1.72;
    color: #4e5b83;
}

.lab-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.lab-badge-entry {
    position: relative;
    display: inline-flex;
    width: fit-content;
}

.lab-primary-link,
.lab-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.lab-primary-link {
    position: relative;
    color: #fff;
    background: linear-gradient(135deg, #202631 0%, #3c4657 100%);
    box-shadow: 0 18px 30px rgba(31, 41, 55, 0.18);
}

.lab-action-badge {
    position: absolute;
    top: -9px;
    right: -12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    pointer-events: none;
    text-transform: uppercase;
}

.lab-action-badge--new {
    border: 1px solid rgba(113, 61, 234, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 241, 255, 0.96));
    color: #713dea;
    box-shadow: 0 12px 24px rgba(113, 61, 234, 0.14);
}

.lab-action-badge--hot {
    border: 1px solid rgba(251, 113, 133, 0.22);
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.98), rgba(255, 240, 234, 0.96));
    color: #dc4c64;
    box-shadow: 0 12px 24px rgba(251, 113, 133, 0.16);
}

.lab-secondary-link {
    color: #1f2937;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.24);
}

.lab-primary-link:hover,
.lab-secondary-link:hover {
    transform: translateY(-2px);
}

.lab-badge-entry:hover .lab-action-badge {
    transform: translateY(-1px);
}

.lab-hero-side {
    display: grid;
    gap: 14px;
}

.lab-signal-card,
.lab-mini-grid article {
    border: 1px solid rgba(148, 168, 255, 0.18);
    border-radius: 26px;
    background: rgba(14, 25, 55, 0.9);
    color: #eef4ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.lab-signal-card {
    position: relative;
    min-height: 214px;
    padding: 24px;
    overflow: hidden;
}

.lab-signal-card::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 24px;
    border: 1px solid rgba(95, 242, 229, 0.16);
    pointer-events: none;
}

.lab-signal-overline {
    margin: 0 0 14px;
    color: rgba(218, 232, 255, 0.72);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lab-signal-title {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}

.lab-signal-copy {
    margin: 12px 0 0;
    color: rgba(225, 234, 255, 0.78);
    line-height: 1.6;
}

.lab-signal-ring {
    position: absolute;
    right: 24px;
    bottom: 22px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    border: 1px solid rgba(95, 242, 229, 0.28);
    box-shadow:
        0 0 0 18px rgba(74, 102, 255, 0.08),
        0 0 36px rgba(52, 222, 204, 0.18),
        inset 0 0 30px rgba(88, 120, 255, 0.26);
}

.lab-signal-ring::before,
.lab-signal-ring::after {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.lab-signal-ring::before {
    inset: 12px;
    border: 1px dashed rgba(95, 242, 229, 0.42);
    animation: lab-spin 14s linear infinite;
}

.lab-signal-ring::after {
    inset: 31px;
    background: radial-gradient(circle, rgba(95, 242, 229, 0.94), rgba(73, 99, 255, 0.6) 60%, transparent 100%);
    box-shadow: 0 0 28px rgba(62, 212, 196, 0.4);
}

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

.lab-mini-grid article {
    min-height: 128px;
    padding: 18px;
}

.lab-mini-label {
    margin: 0;
    color: rgba(216, 230, 255, 0.72);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lab-mini-value {
    margin: 12px 0 6px;
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
}

.lab-mini-copy {
    margin: 0;
    color: rgba(228, 236, 255, 0.74);
    font-size: 13px;
    line-height: 1.5;
}

.lab-featured,
.lab-group {
    margin-top: 26px;
}

.lab-group {
    padding: 28px;
    border-radius: 32px;
    border: 1px solid rgba(151, 173, 244, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(246, 249, 255, 0.18)),
        rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.52),
        0 18px 34px rgba(72, 91, 152, 0.06);
    backdrop-filter: blur(10px);
}

.lab-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.lab-section-head h2 {
    margin: 0;
    color: #17203f;
    font-size: clamp(22px, 4vw, 30px);
    letter-spacing: -0.03em;
}

.lab-section-head p {
    margin: 6px 0 0;
    color: #5a678f;
    font-size: 15px;
}

.lab-section-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(90, 112, 210, 0.18);
    color: #4d5c86;
    font-size: 13px;
    font-weight: 700;
}

/* ── Unified Card System ─────────────────────────────────── */
.lab-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(153, 175, 255, 0.26);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(235, 242, 255, 0.58)),
        rgba(255, 255, 255, 0.82);
    text-decoration: none;
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 46px rgba(39, 57, 114, 0.09);
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
    display: flex;
    flex-direction: column;
    color: inherit;
}

.lab-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 54px rgba(39, 57, 114, 0.14);
    border-color: rgba(96, 126, 255, 0.38);
}

.lab-card--coming {
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
}

.lab-card--coming .preview-content {
    filter: grayscale(1) opacity(0.5);
}

.lab-card-preview {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.lab-card-preview-stage {
    position: absolute;
    inset: 0;
}

.lab-card-preview-stage--airy {
    inset: 0;
}

.lab-card--large .lab-card-preview {
    height: 220px;
    background: linear-gradient(180deg, rgba(246, 249, 255, 0.88), rgba(241, 244, 255, 0.62));
}

.lab-card--medium .lab-card-preview {
    /* height set by content for img, by svg viewBox for svg */
}

.lab-card-preview .preview-content {
    display: block;
    width: 100%;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Banner images: show full design, no crop */
.lab-card-preview img.preview-content {
    height: auto;
}

/* SVG previews: fill container (fallback for non-image cards) */
.lab-card-preview svg.preview-content {
    height: 168px;
}


/* Corner badges (FREE / NEW / HOT) */
.lab-card-corner-badges {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.lab-corner-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.lab-corner-badge--free {
    background: rgba(255,255,255,0.88);
    color: #0c8c72;
    border: 1px solid rgba(22,163,74,0.2);
}

.lab-corner-badge--new {
    background: rgba(255,255,255,0.88);
    color: #7c3aed;
    border: 1px solid rgba(139,92,246,0.2);
}

.lab-corner-badge--hot {
    background: rgba(255,255,255,0.88);
    color: #dc2626;
    border: 1px solid rgba(239,68,68,0.2);
}

.lab-card-cta {
    position: absolute;
    bottom: -48px;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, rgba(var(--card-accent-rgb), 0.92), transparent);
    color: white;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: bottom 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.lab-card:hover .preview-content {
    transform: scale(1.03);
}

.lab-card-preview-stage--airy .preview-content {
    transform: none;
}

.lab-card:hover .lab-card-preview-stage--airy .preview-content {
    transform: translateY(-5px);
}

.lab-card:hover .lab-card-cta {
    bottom: 0;
}

.lab-card-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.lab-card--large .lab-card-body {
    padding: 20px 24px 24px;
    gap: 10px;
}

.lab-card-body h3 {
    margin: 4px 0 0;
    color: #0f1837;
    font-size: 18px;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.lab-card--large .lab-card-body h3 {
    font-size: clamp(22px, 3vw, 28px);
}

.lab-card-body p {
    margin: 4px 0 0;
    color: #53628d;
    font-size: 14px;
    line-height: 1.66;
}

.lab-card--large .lab-card-body p {
    font-size: 15px;
    max-width: 680px;
}

.lab-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.lab-card-kernel {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(90, 112, 210, 0.18);
    color: #44538b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.lab-card-kernel::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #566cff, #36d8c1);
    box-shadow: 0 0 14px rgba(86, 108, 255, 0.38);
}

.lab-card-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 2px;
}

.lab-card-flow span {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(100, 122, 214, 0.12);
    color: #32406b;
    font-size: 13px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.lab-card-flow span:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -12px;
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-top: 1.5px solid rgba(95, 108, 196, 0.55);
    border-right: 1.5px solid rgba(95, 108, 196, 0.55);
    transform: rotate(45deg);
}

.lab-card-note {
    margin: 0;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(242, 246, 255, 0.62));
    border: 1px solid rgba(106, 126, 218, 0.14);
    color: #4f5d88;
    font-size: 13px;
    line-height: 1.66;
}

.lab-card-note strong {
    color: #223468;
    font-weight: 800;
}

.lab-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lab-card-badge.featured {
    background: linear-gradient(135deg, rgba(92, 118, 255, 0.14), rgba(53, 204, 189, 0.12));
    color: #2f4bd1;
    border: 1px solid rgba(91, 116, 223, 0.14);
}


.lab-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}


.lab-card-badge.available {
    background: rgba(43, 207, 173, 0.12);
    color: #0c8c72;
    border: 1px solid rgba(32, 159, 129, 0.12);
}

.lab-card-badge.coming {
    background: rgba(255, 179, 65, 0.14);
    color: #a06000;
    border: 1px solid rgba(182, 125, 24, 0.1);
}


.lab-coming-note {
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px dashed rgba(109, 132, 224, 0.26);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(247, 250, 255, 0.42));
    color: #5c6a92;
    line-height: 1.7;
}

body.page-tools.theme-night {
    background:
        radial-gradient(circle at 12% 8%, rgba(85, 117, 255, 0.2), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(34, 207, 186, 0.12), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(65, 77, 176, 0.2), transparent 46%),
        linear-gradient(180deg, #0d1427 0%, #11192e 52%, #121c33 100%);
}

body.page-tools.theme-night .lab-hero,
body.page-tools.theme-night .lab-card,
body.page-tools.theme-night .lab-group,
body.page-tools.theme-night .lab-section-tag,
body.page-tools.theme-night .lab-coming-note {
    border-color: rgba(116, 142, 224, 0.2);
    background:
        linear-gradient(145deg, rgba(19, 27, 49, 0.92), rgba(20, 31, 58, 0.84)),
        rgba(18, 27, 49, 0.9);
    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.page-tools.theme-night .lab-card--large .lab-card-preview {
    background: linear-gradient(180deg, rgba(20, 31, 58, 0.92), rgba(18, 27, 49, 0.72));
}

body.page-tools.theme-night .lab-title,
body.page-tools.theme-night .lab-section-head h2,
body.page-tools.theme-night .lab-card-body h3,
body.page-tools.theme-night .lab-secondary-link,
body.page-tools.theme-night .lab-card-badge.available,
body.page-tools.theme-night .lab-card-badge.coming {
    color: #edf3ff;
}

body.page-tools.theme-night .lab-subtitle,
body.page-tools.theme-night .lab-section-head p,
body.page-tools.theme-night .lab-card-body p,
body.page-tools.theme-night .lab-coming-note,
body.page-tools.theme-night .lab-title span {
    color: rgba(225, 234, 255, 0.74);
}

body.page-tools.theme-night .lab-card-kernel,
body.page-tools.theme-night .lab-card-flow span,
body.page-tools.theme-night .lab-card-note {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(126, 152, 239, 0.16);
    color: rgba(232, 239, 255, 0.82);
    box-shadow: none;
}

body.page-tools.theme-night .lab-card-note strong {
    color: #edf3ff;
}

body.page-tools.theme-night .lab-card-flow span:not(:last-child)::after {
    border-top-color: rgba(176, 190, 255, 0.66);
    border-right-color: rgba(176, 190, 255, 0.66);
}

body.page-tools.theme-night .lab-section-tag,
body.page-tools.theme-night .lab-secondary-link {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(126, 152, 239, 0.16);
    color: rgba(232, 239, 255, 0.82);
}

body.page-tools.theme-night .lab-card-badge.featured {
    background: rgba(81, 104, 255, 0.18);
    color: #b7c6ff;
}

body.page-tools.theme-night .lab-action-badge--new {
    border-color: rgba(171, 122, 255, 0.22);
    background: linear-gradient(180deg, rgba(34, 43, 71, 0.96), rgba(25, 32, 56, 0.96));
    color: #d8c2ff;
    box-shadow: 0 14px 26px rgba(10, 14, 28, 0.28);
}

body.page-tools.theme-night .lab-action-badge--hot {
    border-color: rgba(251, 113, 133, 0.24);
    background: linear-gradient(180deg, rgba(67, 35, 45, 0.96), rgba(47, 25, 33, 0.96));
    color: #ffb8c5;
    box-shadow: 0 14px 26px rgba(10, 14, 28, 0.28);
}

body.page-tools.theme-night .lab-card-badge.available {
    background: rgba(43, 207, 173, 0.16);
    color: #9af0d8;
}

body.page-tools.theme-night .lab-card-badge.coming {
    background: rgba(255, 179, 65, 0.18);
    color: #ffd49b;
}

body.page-tools.theme-night .lab-corner-badge {
    background: rgba(30, 35, 60, 0.85);
}

@media (max-width: 1180px) {
    .lab-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    body.page-tools .main-content {
        margin-left: 0;
        width: 100%;
        padding: 18px 0 34px;
    }

    .tools-container.ai-lab-shell {
        padding: 0 14px;
    }

    .lab-hero {
        padding: 24px 20px;
    }

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

    .lab-mini-grid {
        grid-template-columns: 1fr;
    }

    .lab-action-badge {
        right: -8px;
    }

    .lab-card--large .lab-card-preview {
        height: 180px;
    }

    .lab-card-preview svg.preview-content {
        height: 140px;
    }
}

@media (max-width: 680px) {
    .lab-title {
        font-size: 38px;
    }

    .lab-title span {
        font-size: 17px;
    }

    .lab-subtitle {
        font-size: 14px;
        line-height: 1.62;
    }

    .lab-hero {
        padding: 22px 18px;
        gap: 18px;
    }

    .lab-action-badge {
        top: -7px;
        right: -6px;
    }

    .lab-signal-card {
        min-height: 182px;
    }

    .lab-signal-title {
        font-size: 24px;
    }

    .lab-signal-copy,
    .lab-mini-copy {
        font-size: 12px;
    }

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

    .lab-tools-grid {
        grid-template-columns: 1fr;
    }

    .lab-card {
        border-radius: 20px;
    }

    .lab-card--large .lab-card-body {
        padding: 18px 18px 20px;
        gap: 8px;
    }

    .lab-card--large .lab-card-preview {
        height: 160px;
    }

    .lab-card-preview svg.preview-content {
        height: 110px;
    }

    .lab-card-flow {
        gap: 8px;
    }

    .lab-card-flow span {
        min-height: 32px;
        font-size: 12px;
    }

    .lab-card-flow span::after {
        display: none;
    }

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

    .lab-group {
        padding: 22px 18px;
        border-radius: 26px;
    }
}

@keyframes lab-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
