/* ========================================
   CHEAT SHEET PARADISE - MAIN STYLES
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&display=swap');

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

/* Pas de flash avant auth-guard / redirection tarifs */
html.csp-auth-pending {
    visibility: hidden !important;
}

/* Mobile/tablette : évite le zoom au double-tap sur les éléments interactifs */
a,
button,
input[type="button"],
input[type="submit"],
select,
[role="button"],
[role="tab"] {
    touch-action: manipulation;
}

/* Bandeau aperçu gratuit (python.html) */
.csp-preview-banner {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(239, 74, 52, 0.35);
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.1) 0%, rgba(139, 92, 246, 0.06) 100%);
}

.csp-preview-banner p {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dark, #1e293b);
}

.csp-preview-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

html.theme-dark .csp-preview-banner {
    border-color: rgba(255, 138, 114, 0.4);
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.2) 0%, rgba(30, 41, 59, 0.9) 100%);
}

html.theme-dark .csp-preview-banner p {
    color: #e2e8f0;
}

::selection {
    background: rgba(239, 74, 52, 0.22);
    color: inherit;
}

::-moz-selection {
    background: rgba(239, 74, 52, 0.22);
    color: inherit;
}

:root {
    --primary: #ef4a34;
    --primary-dark: #c93620;
    --primary-light: #ef4a34;
    --secondary: #b5590b;
    --accent: #d97706;
    --success: #059669;
    --danger: #dc2626;
    --warning: #ea580c;
    --dark-bg: #0f172a;
    --dark-light: #1e293b;
    --light-bg: #f3f4f8;
    --text-dark: #111827;
    --text-light: #5b6577;
    --border: #dde3ed;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
    --font-mono: ui-monospace, Consolas, "Courier New", monospace;
}

/* Pas de ligatures (Cascadia Code, Fira Code…) : != reste « != », pas le symbole barré */
code,
pre,
.lang-snippet,
.code-box,
.code-output,
.py-row__code,
.py-code-win__body,
.py-pip-btn,
.py-import-details__name,
.cheatsheet-content code,
.page-topic .cheatsheet-content p.csp-ref-line > code {
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0, "dlig" 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f3f4f8;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

body > header {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border);
    backdrop-filter: blur(10px);
}

.navbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    position: relative;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.95rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.nav-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.nav-links .nav-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========================================
   LANDING PAGE
   ======================================== */


.hero {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ef4a34 0%, #b5590b 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-description {
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    line-height: 1.8;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.btn-card {
    padding: 1.25rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-python {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-javascript {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-html {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-css {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(8, 145, 178, 0.3);
}

.btn-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(239, 74, 52, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-card .icon {
    font-size: 1.5rem;
}

.btn-card .lang-img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ========================================
   HERO VISUAL (logos + badges)
   ======================================== */

.hero-image {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.hero-glow {
    position: absolute;
    inset: -15% -10%;
    background:
        radial-gradient(ellipse 70% 55% at 50% 50%, rgba(239, 74, 52, 0.18) 0%, transparent 58%),
        radial-gradient(ellipse 40% 35% at 72% 28%, rgba(181, 89, 11, 0.08) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.lang-stack {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.9rem;
    width: 100%;
    max-width: 400px;
}

.lang-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    animation: langCardIn 0.65s ease backwards;
}

.lang-card:nth-child(1) { animation-delay: 0.04s; }
.lang-card:nth-child(2) { animation-delay: 0.12s; }
.lang-card:nth-child(3) { animation-delay: 0.2s; }
.lang-card:nth-child(4) { animation-delay: 0.28s; }

@keyframes langCardIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.lang-card:hover {
    transform: translateX(-6px) scale(1.015);
    box-shadow: var(--shadow-lg);
    border-color: rgba(239, 74, 52, 0.35);
}

.lang-card img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.lang-card-python:hover { border-color: rgba(59, 130, 246, 0.45); }
.lang-card-js:hover { border-color: rgba(245, 158, 11, 0.5); }
.lang-card-html:hover { border-color: rgba(239, 68, 68, 0.45); }
.lang-card-css:hover { border-color: rgba(8, 145, 178, 0.5); }

.lang-label {
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.lang-snippet {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
    opacity: 0.88;
}

.code-box {
    position: absolute;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-family: var(--font-mono), ui-monospace, 'Courier New', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    z-index: 2;
    white-space: nowrap;
    pointer-events: none;
    animation: codeBubbleFloat 4s ease-in-out infinite;
}

.code-box-1 {
    top: 4%;
    left: -2%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    animation-duration: 3.4s;
    box-shadow: 0 10px 36px rgba(59, 130, 246, 0.35);
}

.code-box-2 {
    top: 12%;
    right: 4%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    animation-duration: 3.9s;
    animation-delay: 0.35s;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.28);
    font-size: 0.68rem;
    opacity: 0.92;
}

.code-box-3 {
    bottom: 8%;
    left: 0%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation-name: codeBubbleFloatCentered;
    animation-duration: 3.6s;
    animation-delay: 0.15s;
    box-shadow: 0 10px 36px rgba(239, 68, 68, 0.35);
}

.code-box-4 {
    bottom: -30%;
    right: -10%;
    background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
    color: white;
    animation-duration: 4.2s;
    animation-delay: 0.55s;
    box-shadow: 0 10px 36px rgba(8, 145, 178, 0.35);
}

@keyframes codeBubbleFloat {
    0%, 100% {
        transform: translateY(0) rotate(-3deg);
    }
    50% {
        transform: translateY(-12px) rotate(3deg);
    }
}

@keyframes codeBubbleFloatCentered {
    0%, 100% {
        transform: translateX(-50%) translateY(0) rotate(-2deg);
    }
    50% {
        transform: translateX(-50%) translateY(-12px) rotate(2deg);
    }
}

@media (max-width: 900px) {
    .code-box {
        display: none;
    }
}

/* ========================================
   FEATURES SECTION
   ======================================== */

.features {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 4rem 2rem;
}

.features h2 {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
    font-weight: 800;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: all 0.4s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.feature-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-weight: 700;
}

.feature-card p {
    color: var(--text-light);
    line-height: 1.7;
}

/* ========================================
   CTA SECTION
   ======================================== */

.cta {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 20px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.cta h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.cta p {
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
}

.cta-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.page-header h1 {
    font-size: 2.8rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 500;
}

.page-header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.page-header-brand .page-logo {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    object-fit: contain;
    box-shadow: var(--shadow-lg);
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.page-header-brand h1 {
    margin-top: 0;
    margin-bottom: 0;
}

.cta .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    text-decoration: none;
}

.cta .btn-primary .cta-lang-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ========================================
   CONTENT LAYOUT
   ======================================== */

.content-layout {
    max-width: 52rem;
    margin: 0 auto;
}

.lang-intro {
    max-width: 52rem;
    margin: 0 auto 1.25rem;
    padding: 1.25rem 1.35rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.65;
}

.lang-intro h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.lang-intro p {
    margin: 0 0 0.65rem;
}

.lang-intro p:last-child {
    margin-bottom: 0;
}

.lang-intro-use {
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.35rem !important;
}

.page-actions {
    max-width: 52rem;
    margin: 0 auto 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn-try-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    color: #fff;
    background: #111827;
    border: 1px solid #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-try-code:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

.page-html .btn-try-code {
    background: #c2410c;
    border-color: #c2410c;
}

.page-html .btn-try-code:hover {
    background: #9a3412;
}

.page-python .btn-try-code {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.page-python .btn-try-code:hover {
    background: #1e40af;
}

.page-javascript .btn-try-code {
    background: #b45309;
    border-color: #b45309;
}

.page-javascript .btn-try-code:hover {
    background: #92400e;
}

.page-css .btn-try-code {
    background: #0e7490;
    border-color: #0e7490;
}

.page-css .btn-try-code:hover {
    background: #155e75;
}

/* ========================================
   CHEATSHEET SECTION
   ======================================== */

.cheatsheet-section {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    padding: 1.75rem 1.85rem;
    max-height: none;
    min-height: 0;
    overflow-y: visible;
}

.cheatsheet-section::before {
    display: none;
}

.cheatsheet-content h3 {
    color: #0f172a;
    font-size: 1.2rem;
    margin-top: 1.75rem;
    margin-bottom: 0.85rem;
    padding: 0;
    border: none;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
    background: none;
    border-radius: 0;
}

.cheatsheet-content h3:first-child {
    margin-top: 0;
}

/* Ligne « code : explication » (ancien format fiches référence uniquement) */
.cheatsheet-content p.csp-ref-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.45rem 0.85rem;
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.cheatsheet-content p.csp-ref-line:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.cheatsheet-content p {
    color: #6b7280;
    line-height: 1.6;
    font-size: 0.92rem;
}

.cheatsheet-content p:not(.csp-ref-line) {
    margin-bottom: 0.65rem;
}

.cheatsheet-content code {
    background: #fff;
    color: #111827;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.82em;
    border: 1px solid #e5e7eb;
    box-shadow: none;
    display: inline;
    vertical-align: baseline;
    white-space: nowrap;
    word-break: normal;
}

.page-html .cheatsheet-content h3 {
    color: #9a3412;
}

.page-python .cheatsheet-content h3 {
    color: #1e3a8a;
}

.page-javascript .cheatsheet-content h3 {
    color: #78350f;
}

.page-css .cheatsheet-content h3 {
    color: #164e63;
}

.page-css .cheatsheet-section {
    border-color: #e0f2fe;
    box-shadow: 0 4px 24px rgba(8, 145, 178, 0.08);
}

/* Fiches thème (toutes langues) : carte + lignes type showcase */
.page-topic .cheatsheet-section {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: calc(1.65rem + 3px) 1.85rem 1.75rem;
    box-shadow: 0 4px 28px rgba(15, 23, 42, 0.08);
}

.page-topic .cheatsheet-section::before {
    display: none;
}

.page-topic .cheatsheet-section {
    padding: 1.65rem 1.85rem 1.75rem;
}

.page-topic .cheatsheet-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.9rem;
    padding: 0;
    font-size: 1.22rem;
    border-radius: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.page-topic .cheatsheet-content h3:first-child {
    margin-top: 0;
}

/* Cours (texte + listes) : flux normal, code inline */
.page-topic .cheatsheet-content h4 {
    margin: 1.15rem 0 0.45rem;
    font-size: 0.98rem;
    font-weight: 700;
    color: #334155;
}

.page-topic .cheatsheet-content ul,
.page-topic .cheatsheet-content ol {
    margin: 0 0 0.85rem;
    padding-left: 1.35rem;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.65;
}

.page-topic .cheatsheet-content li {
    margin-bottom: 0.35rem;
}

.page-topic .cheatsheet-content li:last-child {
    margin-bottom: 0;
}

.page-topic .cheatsheet-content p:not(.csp-ref-line) code,
.page-topic .cheatsheet-content li code {
    display: inline;
    flex: none;
    max-width: none;
    white-space: normal;
    word-break: normal;
    background: rgba(239, 74, 52, 0.07);
    border: none;
    padding: 0.08em 0.32em;
    font-weight: 500;
    border-radius: 4px;
}

/* Fiche importation : chapitres regroupés : continuité visuelle entre modules */
.page-topic .importation-fiche > .cheatsheet-module:first-child h3 {
    margin-top: 0;
}

.page-topic .importation-fiche .cheatsheet-module h3 {
    margin-top: 0;
}

.page-topic .importation-fiche > .cheatsheet-module + .cheatsheet-module {
    margin-top: 0.9rem;
}

.importation-fiche .cheatsheet-module {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.88) 100%);
    padding: 0.5rem 0.75rem 0.9rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Importation : syntaxes visibles sans accordéon vide */
.py-import-list {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
}

.py-import-item .py-row {
    margin: 0;
}

.importation-biblio-heading {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
}

.importation-biblio-intro {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.55;
    max-width: 42rem;
}

/* Bibliothèques repliées (importation) : sobre, comme le reste du cours */
.py-biblio-fold {
    margin-bottom: 0.75rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.py-biblio-fold__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.py-biblio-fold__summary::-webkit-details-marker {
    display: none;
}

.py-biblio-fold__summary::marker {
    content: "";
}

.py-biblio-fold:not([open]):hover .py-biblio-fold__summary {
    background: #f8fafc;
}

.py-biblio-fold[open] > .py-biblio-fold__summary {
    border-bottom: 1px solid #e2e8f0;
}

.py-biblio-fold__title {
    flex: 1;
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-dark);
}

.py-biblio-fold__count {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b6b73;
}

.py-biblio-fold__chev {
    flex-shrink: 0;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.py-biblio-fold[open] > .py-biblio-fold__summary .py-biblio-fold__chev {
    transform: rotate(-135deg);
    margin-top: 0.12rem;
}

.py-biblio-fold__body {
    padding: 0.55rem 0.85rem 0.85rem;
}

.py-biblio-fold__body > p {
    margin: 0 0 0.65rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #475569;
}

.py-biblio-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #475569;
}

.py-biblio-list li {
    margin-bottom: 0.3rem;
}

.py-biblio-list li:last-child {
    margin-bottom: 0;
}

.py-biblio-list code {
    display: inline;
    background: rgba(239, 74, 52, 0.07);
    border: none;
    padding: 0.08em 0.32em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    font-weight: 500;
    white-space: normal;
    word-break: break-word;
    color: #1e293b;
}

/* Ancien markup (au cas où) */
.py-biblio-api {
    list-style: none;
    margin: 0;
    padding: 0;
}

.py-biblio-api__item {
    display: block;
    padding: 0.2rem 0;
    background: none;
    border: none;
}

.py-biblio-api__code,
.py-biblio-api__desc {
    display: inline;
    text-align: left;
    font-size: inherit;
    color: inherit;
}

html.theme-dark .importation-biblio-heading {
    color: #f1f5f9;
}

html.theme-dark .importation-biblio-intro {
    color: #94a3b8;
}

html.theme-dark .py-biblio-fold {
    background: #1e293b;
    border-color: #334155;
}

html.theme-dark .py-biblio-fold:not([open]):hover .py-biblio-fold__summary {
    background: #243044;
}

html.theme-dark .py-biblio-fold[open] > .py-biblio-fold__summary {
    border-bottom-color: #334155;
}

html.theme-dark .py-biblio-fold__title {
    color: #f1f5f9;
}

html.theme-dark .py-biblio-fold__count {
    color: #64748b;
}

html.theme-dark .py-biblio-fold__body > p,
html.theme-dark .py-biblio-list {
    color: #94a3b8;
}

html.theme-dark .py-biblio-list code {
    background: rgba(255, 138, 114, 0.12);
    color: #e2e8f0;
}

.importation-fiche .cheatsheet-module > p:not(:has(> code)) {
    margin-bottom: 0.55rem;
    padding: 0;
    border: none;
    background: none;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #475569;
}

.page-topic .cheatsheet-content p.csp-ref-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.page-topic .cheatsheet-content p.csp-ref-line:hover {
    border-color: rgba(239, 74, 52, 0.28);
    box-shadow: 0 2px 12px rgba(239, 74, 52, 0.08);
}

.page-topic .cheatsheet-content p.csp-ref-line > code {
    flex: 0 0 auto;
    max-width: none;
    align-self: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-right: 1px solid #cbd5e1;
    padding: 0.28rem 0.75rem 0.28rem 0.45rem;
    margin-right: 0.15rem;
    border-radius: 6px;
    white-space: nowrap;
    word-break: normal;
    font-weight: 600;
}


@media (max-width: 720px) {
    .page-topic .cheatsheet-content p.csp-ref-line {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .page-topic .cheatsheet-content p.csp-ref-line > code {
        border-right: none;
        padding-right: 0.45rem;
        margin-right: 0;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
        width: auto;
    }
}

/* Hub sujets : même esprit carte */
.page-python.page-topic .topic-navigation,
.page-javascript.page-topic .topic-navigation,
.page-html.page-topic .topic-navigation,
.page-css.page-topic .topic-navigation {
    position: relative;
    overflow: hidden;
    max-width: 52rem;
    margin: 1.5rem auto 0;
    padding: calc(2rem + 3px) 1.75rem 2rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 28px rgba(15, 23, 42, 0.08);
}

.page-python.page-topic .topic-navigation::before,
.page-javascript.page-topic .topic-navigation::before,
.page-html.page-topic .topic-navigation::before,
.page-css.page-topic .topic-navigation::before {
    display: none;
}

.page-python.page-topic .topic-navigation h2,
.page-javascript.page-topic .topic-navigation h2,
.page-html.page-topic .topic-navigation h2,
.page-css.page-topic .topic-navigation h2 {
    margin-top: 0;
}

.page-javascript .btn-topic:hover {
    border-color: #ca8a04;
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
}

.page-html .btn-topic:hover {
    border-color: #ea580c;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.page-css .btn-topic:hover {
    border-color: #0891b2;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.page-css.page-topic .cheatsheet-section {
    border-color: #e0f2fe;
    box-shadow: 0 4px 28px rgba(8, 145, 178, 0.1);
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    border: 3px solid white;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ========================================
   BUTTONS
   ======================================== */

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-run,
.btn-clear,
.btn-primary {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* Btn Run - Gradient Button with ripple */
.btn-run {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-run::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-run:active::before {
    width: 300px;
    height: 300px;
}

/* Btn Clear - Glass Button */
.btn-clear {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text-dark);
    font-weight: 600;
    border: 1.5px solid rgba(239, 74, 52, 0.2);
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(239, 74, 52, 0.4);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
}

/* Btn Primary - Main CTA */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1rem 2rem;
    font-size: 1rem;
    box-shadow: 0 0 20px rgba(239, 74, 52, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(239, 74, 52, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

/* ========================================
   OUTPUT
   ======================================== */

.output-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.output-section label {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.code-output {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    background: var(--dark-bg);
    color: #e2e8f0;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.code-output.success {
    border-color: var(--success);
    color: #86efac;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.code-output.error {
    border-color: var(--danger);
    color: #fca5a5;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.code-output.html-preview {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border);
}

/* ========================================
   TOPIC NAVIGATION
   ======================================== */

.topic-navigation {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.05) 0%, rgba(181, 89, 11, 0.05) 100%);
    border-radius: 20px;
    border: 2px solid rgba(239, 74, 52, 0.1);
    box-shadow: var(--shadow-md);
}

.topic-navigation h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-weight: 800;
}

.topic-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-topic {
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-topic:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.page-python .btn-topic:hover {
    border-color: #2563eb;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* ========================================
   FOOTER
   ======================================== */

footer {
    background: var(--dark-bg);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 2px solid var(--primary);
}

footer p {
    font-weight: 500;
}

footer .legal-site-footer a {
    color: #ffb199;
    text-decoration: underline;
    text-underline-offset: 2px;
}

footer .legal-site-footer a:hover {
    color: #fff;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 2rem;
        gap: 2rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-image {
        min-height: 320px;
    }

    .code-box {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 1.5rem 1rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-description {
        font-size: 0.95rem;
        max-width: 100%;
    }

    .hero-buttons {
        gap: 1rem;
    }

    .btn-card {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn-card .lang-img {
        width: 24px;
        height: 24px;
    }

    .lang-stack {
        max-width: 100%;
    }

    .lang-card {
        padding: 0.8rem 1rem;
    }

    .lang-card img {
        width: 44px;
        height: 44px;
    }

    .lang-label {
        font-size: 1rem;
    }

    .lang-snippet {
        font-size: 0.68rem;
    }
}

@media (max-width: 768px) {
    body > header {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    /* Drawer mobile : top-nav.js (portal) + top-nav.css */
    .navbar:not(.navbar--enhanced) {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.6rem 0.85rem;
    }

    .navbar:not(.navbar--enhanced) .nav-links a::after {
        display: none;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .btn-card {
        width: 100%;
        justify-content: center;
    }

    .features h2,
    .cta h2 {
        font-size: 2rem;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .container {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .page-header-brand .page-logo {
        width: 64px;
        height: 64px;
    }

    /* Overlay when menu is open */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .nav-overlay.active {
        display: block;
        pointer-events: auto;
    }

    body.nav-open .nav-overlay {
        display: block;
        pointer-events: auto;
    }

    /* Features section mobile */
    .features {
        padding: 2rem 1rem;
        margin: 2rem auto;
    }

    .features h2 {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .feature-card {
        padding: 1.5rem 1.25rem;
    }

    .feature-icon {
        font-size: 2.5rem;
    }

    .feature-card h3 {
        font-size: 1.2rem;
    }

    /* CTA section mobile */
    .cta {
        padding: 2.5rem 1.5rem;
        margin: 2rem auto;
    }

    .cta h2 {
        font-size: 1.8rem;
    }

    .cta p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .cta-buttons {
        gap: 1rem;
    }

    .btn-primary {
        padding: 0.85rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   PYTHON IMPORTATION : SHOWCASE CARDS
   (layout inspiré maquettes, couleurs site)
   ======================================== */

.page-topic .page-header,
.page-import .page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem 1.75rem;
    text-align: left;
    padding: 2rem 1.75rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.08) 0%, rgba(181, 89, 11, 0.06) 50%, rgba(245, 158, 11, 0.05) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.page-topic .page-header-brand,
.page-import .page-header-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    min-width: 240px;
}

.page-topic .page-header-brand h1,
.page-import .page-header-brand h1 {
    -webkit-text-fill-color: unset;
    background: none;
    color: var(--text-dark);
    font-size: clamp(1.75rem, 3.5vw, 2.4rem);
    margin: 0;
}

.page-topic .page-header > p,
.page-import .page-header > p {
    flex: 1 1 100%;
    margin: 0;
    padding-left: calc(76px + 1.25rem);
}

.page-topic .btn-try-code.is-secondary,
.page-import .btn-try-code.is-secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 2px solid rgba(239, 74, 52, 0.4);
    box-shadow: none;
}

.page-topic .btn-try-code.is-secondary:hover,
.page-import .btn-try-code.is-secondary:hover {
    background: rgba(239, 74, 52, 0.06);
}

@media (max-width: 640px) {
    .page-topic .page-header > p,
    .page-import .page-header > p {
        padding-left: 0;
    }
}

.py-showcase {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

/* Hub Python : deux cartes côte à côte sur grand écran */
/* Blocs centrés et alignés sur les fiches langage */
.page-topic main.container > .page-header.page-topic-header,
.page-topic main.container > .lang-intro,
.page-topic main.container > .page-actions,
.page-topic main.container > .page-actions.lang-tools,
.page-topic main.container > .lang-tools,
.page-topic main.container > .py-showcase--hub,
.page-topic main.container > .py-showcase--topic-lede,
.page-topic main.container > .py-hub-more {
    max-width: 52rem;
    margin-left: auto;
    margin-right: auto;
}

.page-actions.lang-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0;
}

.py-showcase--hub {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: min(52rem, 100%);
    margin: 0 auto 1.25rem;
    width: 100%;
}

@media (min-width: 640px) {
    .py-showcase--hub {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem 1.1rem;
    }

    .py-showcase--hub .py-card:only-child {
        grid-column: 1 / -1;
        max-width: 36rem;
        justify-self: center;
        width: 100%;
    }
}

.page-topic main.container > .content-layout:has(.py-showcase--hub) {
    max-width: min(52rem, 100%);
    width: 100%;
}

/* Hub Python : liste compacte (pas d’accordéon vide) */
.py-hub-modules {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.py-hub-module {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 0.4rem 0.65rem;
    padding: 0.55rem 0.7rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.py-hub-module__code {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.4;
    min-width: 0;
}

.py-hub-module__desc {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.35;
    text-align: right;
    min-width: 0;
}

.py-hub-module--pip {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center;
}

.py-hub-module--pip .py-pip-btn {
    justify-self: end;
    font-size: 0.62rem;
    padding: 0.22rem 0.45rem;
}

.page-python .py-showcase--hub .py-card {
    padding: 1.2rem 1.1rem 1.25rem;
}

.page-python .py-showcase--hub .py-callout-grid {
    margin-top: 0.85rem;
}

@media (max-width: 520px) {
    .py-hub-module,
    .py-hub-module--pip {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .py-hub-module__desc {
        text-align: left;
    }

    .py-hub-module--pip .py-pip-btn {
        justify-self: start;
    }
}

html.theme-dark .py-hub-module {
    background: #0f172a;
    border-color: #334155;
}

html.theme-dark .py-hub-module__desc {
    color: #94a3b8;
}

.py-showcase--topic-lede {
    margin-bottom: 1.25rem;
}

.py-hub-more {
    max-width: min(34rem, 100%);
    margin: -0.25rem auto 1.25rem;
    text-align: center;
    font-size: 0.92rem;
}

.py-hub-more a {
    font-weight: 700;
    color: var(--primary-dark);
    text-decoration: none;
}

.py-hub-more a:hover {
    text-decoration: underline;
}

.py-hub-more a code {
    color: inherit;
    font-weight: 800;
    background: rgba(239, 74, 52, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.py-card__foot {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.88rem;
}

.py-card__foot a {
    font-weight: 700;
    color: var(--primary-dark);
    text-decoration: none;
}

.py-card__foot a:hover {
    text-decoration: underline;
}

.py-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 1.6rem 1.6rem;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.py-card::before {
    display: none;
}

.py-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.py-card__icon {
    font-size: 1.35rem;
    line-height: 1;
}

.py-card__title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin: 0;
    flex: 1 1 auto;
}

.py-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.py-pill--primary {
    color: var(--primary-dark);
    background: rgba(239, 74, 52, 0.12);
    border-color: rgba(239, 74, 52, 0.25);
}

.py-pill--accent {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
}

.py-card__lead {
    color: var(--text-light);
    font-size: 0.94rem;
    line-height: 1.65;
    margin: 0.5rem 0 1.1rem;
}

.py-card__lead strong {
    color: var(--text-dark);
    font-weight: 700;
}

.py-card__lead .py-accent {
    color: var(--primary);
    font-weight: 600;
}

.py-card__foot {
    margin: 0.65rem 0 0;
    padding-top: 0.55rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-light);
}

.py-card__foot code {
    font-size: 0.78rem;
}

html.theme-dark .py-card__foot {
    border-top-color: #334155;
    color: #94a3b8;
}

.py-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.py-row {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.py-row:hover {
    border-color: rgba(239, 74, 52, 0.28);
    box-shadow: 0 2px 12px rgba(239, 74, 52, 0.08);
}

@media (max-width: 720px) {
    .py-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .py-row__sep {
        display: none;
    }

    .py-row__meta {
        grid-column: 1;
    }
}

/* Hubs langage : moins de scroll vertical (HTML, CSS, Java, C…) */
@media (max-width: 768px) {
    .page-topic main.container:has(.py-showcase--hub) > .page-header.page-topic-header {
        padding: 1rem 0.9rem;
        margin-bottom: 0.75rem;
        gap: 0.65rem 1rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .page-header-brand .page-logo {
        width: 52px;
        height: 52px;
    }

    .page-topic main.container:has(.py-showcase--hub) .page-header-brand h1 {
        font-size: 1.35rem;
    }

    .page-topic main.container:has(.py-showcase--hub) > .lang-intro,
    .page-topic main.container:has(.py-showcase--hub) > .lang-intro--fold {
        margin-bottom: 0.65rem;
        padding: 0.7rem 0.85rem;
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .page-topic main.container:has(.py-showcase--hub) > .lang-tools,
    .page-topic main.container:has(.py-showcase--hub) > .page-actions.lang-tools {
        margin-bottom: 0.65rem;
        gap: 0.45rem;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .page-html.page-topic main.container:has(.py-showcase--hub) .page-actions.lang-tools .btn-tool {
        flex: 1 1 calc(33% - 0.35rem);
        min-width: 5.5rem;
        justify-content: center;
        text-align: center;
    }

    .page-topic main.container:has(.py-showcase--hub) .csp-page-nav {
        margin-bottom: 0.65rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .py-showcase--hub {
        gap: 0.75rem;
        margin-bottom: 0.85rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .py-card {
        padding: 0.85rem 0.75rem 0.9rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .py-card__lead {
        margin-bottom: 0.45rem;
        font-size: 0.84rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .py-code-win__body {
        max-height: 9.5rem;
        overflow: auto;
    }

    .page-topic main.container:has(.py-showcase--hub) .py-callout {
        margin-top: 0.5rem;
        padding: 0.55rem 0.65rem;
        font-size: 0.82rem;
    }

    .page-python.page-topic .topic-navigation,
    .page-javascript.page-topic .topic-navigation,
    .page-html.page-topic .topic-navigation,
    .page-css.page-topic .topic-navigation,
    .page-java.page-topic .topic-navigation,
    .page-c.page-topic .topic-navigation {
        margin-top: 0.75rem;
        padding: 1rem 0.85rem 1.1rem;
    }

    .page-python.page-topic .topic-navigation h2,
    .page-javascript.page-topic .topic-navigation h2,
    .page-html.page-topic .topic-navigation h2,
    .page-css.page-topic .topic-navigation h2,
    .page-java.page-topic .topic-navigation h2,
    .page-c.page-topic .topic-navigation h2 {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
    }

    .page-topic main.container:has(.py-showcase--hub) .topic-buttons:not(.topic-buttons--enhanced) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        justify-content: stretch;
    }

    .page-topic main.container:has(.py-showcase--hub) .topic-buttons:not(.topic-buttons--enhanced) .btn-topic {
        width: 100%;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
}

.lang-intro--fold summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-dark);
    list-style: none;
}

.lang-intro--fold summary::-webkit-details-marker {
    display: none;
}

.lang-intro--fold summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}

.lang-intro--fold[open] summary::before {
    transform: rotate(90deg);
}

.lang-intro--fold:not([open]) {
    padding-bottom: 0.65rem;
}

.lang-intro--fold:not([open]) .lang-intro-use {
    display: none;
}

@media (max-width: 768px) {
    .py-showcase,
    .py-showcase--hub,
    .py-card,
    .py-examples-panel,
    .content-layout {
        max-width: 100%;
        min-width: 0;
    }

    .py-showcase--hub .py-card {
        min-width: 0;
    }

    .py-card {
        padding: 1.15rem 0.85rem 1.2rem;
    }

    .py-examples-panel {
        padding: 0.95rem 0.7rem 1rem;
    }

    .py-import-details__summary {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.4rem 0.5rem;
        padding: 0.6rem 0.65rem;
    }

    .py-import-details__thumb {
        flex: 1 1 100%;
        min-width: 0;
    }

    .py-import-details__chev {
        flex-shrink: 0;
        margin-left: auto;
    }

    .py-import-details__collapse {
        display: none;
    }

    .py-code-win__body {
        padding: 0.85rem 0.75rem;
        font-size: 0.72rem;
        line-height: 1.5;
    }

    .py-code-win__fname {
        font-size: 0.72rem;
    }
}

.py-row__code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.py-row__sep {
    width: 1px;
    height: 1.25rem;
    background: #cbd5e1;
    border-radius: 1px;
}

.py-row__desc {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.45;
}

.py-row__meta {
    justify-self: end;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Page HTML formulaires : aperçu live des input à droite */
.py-rows--html-inputs .py-row--html-input {
    grid-template-columns: minmax(0, 1.05fr) auto minmax(0, 0.95fr) minmax(130px, 1.2fr);
}

.html-input-preview {
    width: 100%;
    max-width: 200px;
    justify-content: flex-end;
}

.html-input-preview input,
.html-input-preview select,
.html-input-preview textarea {
    font-size: 0.8rem;
    font-family: inherit;
    max-width: 100%;
}

.html-input-preview input[type="range"] {
    width: 100%;
    min-width: 100px;
}

.html-input-preview input[type="color"] {
    width: 2.5rem;
    height: 2rem;
    padding: 0.15rem;
    cursor: pointer;
}

.html-input-preview input[type="file"] {
    max-width: 160px;
    font-size: 0.72rem;
}

.html-input-preview input[type="image"] {
    cursor: pointer;
    border-radius: 6px;
}

.html-input-preview__label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-dark);
    white-space: nowrap;
}

.html-input-preview__badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.28rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
    color: var(--primary-dark);
    background: rgba(239, 74, 52, 0.12);
    border: 1px solid rgba(239, 74, 52, 0.28);
}

html.theme-dark .html-input-preview__label {
    color: #e2e8f0;
}

html.theme-dark .html-input-preview__badge {
    color: #ffb199;
    background: rgba(239, 74, 52, 0.2);
    border-color: rgba(255, 138, 114, 0.35);
}

/* Formulaires HTML : mobile / tablette */
@media (max-width: 720px) {
    .py-rows--html-inputs .py-row--html-input {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.8rem 0.75rem;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__sep {
        display: none;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__code {
        order: 1;
        font-size: 0.72rem;
        padding: 0.5rem 0.6rem;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__desc {
        order: 2;
        font-size: 0.86rem;
        line-height: 1.5;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__meta.html-input-preview {
        order: 3;
        width: 100%;
        max-width: none;
        justify-content: stretch;
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
        padding: 0.7rem 0.75rem;
        background: #fff;
        border: 1px dashed rgba(239, 74, 52, 0.38);
        border-radius: 10px;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__meta.html-input-preview::before {
        content: "Aperçu";
        font-size: 0.62rem;
        font-weight: 800;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: var(--primary-dark);
    }

    .html-input-preview {
        max-width: none;
        justify-content: stretch;
    }

    .html-input-preview input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="image"]),
    .html-input-preview select,
    .html-input-preview textarea {
        width: 100%;
        min-height: 2.75rem;
        font-size: 1rem;
        padding: 0.5rem 0.65rem;
        border-radius: 8px;
        border: 1px solid #cbd5e1;
        box-sizing: border-box;
    }

    .html-input-preview input[type="range"] {
        width: 100%;
        min-width: 0;
        min-height: 2.25rem;
        padding: 0;
    }

    .html-input-preview input[type="color"] {
        width: 3rem;
        height: 3rem;
        min-height: 3rem;
        align-self: flex-start;
    }

    .html-input-preview input[type="file"] {
        max-width: 100%;
        min-height: 2.75rem;
        font-size: 0.85rem;
    }

    .html-input-preview input[type="image"] {
        max-width: 100%;
        height: auto;
    }

    .html-input-preview input[type="submit"],
    .html-input-preview input[type="reset"],
    .html-input-preview input[type="button"] {
        width: 100%;
        min-height: 2.75rem;
        font-size: 1rem;
        cursor: pointer;
    }

    .html-input-preview__label {
        white-space: normal;
        flex-wrap: wrap;
        min-height: 2.25rem;
        align-items: center;
    }

    .html-input-preview__label input[type="checkbox"],
    .html-input-preview__label input[type="radio"] {
        width: 1.25rem;
        height: 1.25rem;
        min-height: auto;
        flex-shrink: 0;
    }

    .py-examples-panel--html-inputs {
        padding: 0.85rem 0.65rem 0.9rem;
        border-radius: 12px;
    }

    .py-examples-panel--html-inputs .py-examples-panel__cap {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 0.65rem;
    }

    .page-html.page-topic .py-card {
        padding: 1.1rem 0.85rem 1.15rem;
    }

    .page-html.page-topic .py-card__head {
        gap: 0.5rem;
    }

    .page-html.page-topic .py-card__title {
        font-size: 1.05rem;
        flex: 1 1 100%;
    }

    .page-html.page-topic .py-card__lead {
        font-size: 0.88rem;
        margin-bottom: 0.5rem;
    }

    .page-html.page-topic .py-card__lead strong {
        display: block;
        margin-top: 0.2rem;
    }

    .page-topic .page-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-topic .page-actions .btn-try-code {
        display: flex;
        width: 100%;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }

    .page-html.page-topic .page-header.page-topic-header {
        padding: 1.25rem 1rem;
        gap: 0.85rem;
    }

    .page-html.page-topic .page-header-brand {
        min-width: 0;
        gap: 0.85rem;
    }

    .page-html.page-topic .page-header-brand .page-logo {
        width: 56px;
        height: 56px;
    }

    .page-html.page-topic .page-header > p {
        padding-left: 0;
        font-size: 0.9rem;
    }

    .page-html.page-topic .cheatsheet-section {
        margin-top: 0.5rem;
    }

    html.theme-dark .py-rows--html-inputs .py-row--html-input .py-row__code,
    html.theme-dark .py-rows--html-inputs .py-row--html-input .py-row__meta.html-input-preview {
        background: #0f172a;
        border-color: #334155;
    }

    html.theme-dark .html-input-preview input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="image"]),
    html.theme-dark .html-input-preview select,
    html.theme-dark .html-input-preview textarea {
        background: #1e293b;
        border-color: #475569;
        color: #f1f5f9;
    }

    html.theme-dark .py-rows--html-inputs .py-row--html-input .py-row__meta.html-input-preview::before {
        color: #ffb199;
    }
}

@media (max-width: 480px) {
    .py-rows--html-inputs .py-row--html-input {
        padding: 0.7rem 0.6rem;
    }

    .py-rows--html-inputs .py-row--html-input .py-row__code {
        font-size: 0.68rem;
    }

    .page-html.page-topic .page-header-brand h1 {
        font-size: 1.35rem;
    }
}

@media (max-width: 720px) {
    .py-row__meta {
        justify-self: start;
        justify-content: flex-start;
    }
}

.py-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    white-space: nowrap;
}

.py-status--ok {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.py-status--no {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.py-pip-btn {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    color: #b45309;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.55);
    background: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

/* Panneau : grand cadre pour regrouper les exemples d’import (page importation) */
.py-examples-panel {
    margin-top: 0.55rem;
    padding: 1.15rem 1.2rem 1.2rem;
    border-radius: 16px;
    border: 2px solid rgba(239, 74, 52, 0.32);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.97) 0%, #f8fafc 40%, rgba(238, 242, 255, 0.75) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 4px 20px rgba(15, 23, 42, 0.07);
}

.py-examples-panel__cap {
    display: block;
    width: fit-content;
    max-width: 100%;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.14) 0%, rgba(181, 89, 11, 0.1) 100%);
    border: 1px solid rgba(239, 74, 52, 0.22);
}

.py-examples-panel .py-rows {
    gap: 0.42rem;
}

.py-examples-panel .py-row {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.py-examples-panel .py-row:hover {
    border-color: rgba(239, 74, 52, 0.3);
}

/* Accordion : exemples d’import repliés (aperçu syntaxe + description) */
.py-import-details {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.py-import-details__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    list-style: none;
    cursor: pointer;
    background: #f8fafc;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.py-import-details__summary::-webkit-details-marker {
    display: none;
}

.py-import-details__summary::marker {
    content: "";
}

.py-import-details:not([open]):hover .py-import-details__summary {
    background: #f1f5f9;
}

.py-import-details[open] > .py-import-details__summary {
    border-bottom: 1px solid #e5e7eb;
}

.py-import-details__thumb {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.45rem 1rem;
}

.py-import-details__name {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.py-import-details__desc {
    flex: 1 1 10rem;
    min-width: 0;
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.45;
}

.py-import-details__collapse {
    display: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.py-import-details[open] > .py-import-details__summary .py-import-details__thumb {
    display: none;
}

.py-import-details[open] > .py-import-details__summary .py-import-details__collapse {
    display: inline;
}

.py-import-details__chev {
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    margin-left: auto;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    transition: transform 0.2s ease, border-color 0.15s ease;
    opacity: 0.75;
}

.py-import-details[open] > .py-import-details__summary .py-import-details__chev {
    transform: rotate(-135deg);
    margin-top: 0.2rem;
}

.py-import-details__body {
    padding: 0.35rem 0.5rem 0.65rem;
    background: #fff;
}

.py-rows--accordion {
    gap: 0.42rem;
}

.py-examples-panel .py-import-details {
    border-color: #e2e8f0;
}

.py-examples-panel .py-code-win--in-panel {
    margin-top: 0.7rem;
    border-radius: 10px;
    box-shadow: none;
    border-color: #e2e8f0;
}

.py-examples-panel--with-code > .py-rows + .py-code-win--in-panel {
    margin-top: 0.95rem;
}

.py-examples-panel .py-code-win--in-panel + .py-code-win--in-panel {
    margin-top: 0.65rem;
}

/* syntax spans (showcase rows) */
.syn-kw {
    color: var(--primary-dark);
}

.syn-mod {
    color: #2563eb;
}

.syn-name {
    color: #1e40af;
}

.syn-str {
    color: #059669;
}

.syn-num {
    color: #c2410c;
}

.syn-cmt {
    color: #94a3b8;
    font-style: italic;
}

.syn-builtin {
    color: #b5590b;
}

/* Fenêtre code : palette type IDE (fond sombre) */
.py-code-win__body .syn-kw {
    color: #c792ea;
    font-weight: 600;
}

.py-code-win__body .syn-builtin {
    color: #82aaff;
}

.py-code-win__body .syn-mod {
    color: #ffcb6b;
}

.py-code-win__body .syn-name {
    color: #e2e8f0;
}

.py-code-win__body .syn-str {
    color: #c3e88d;
}

.py-code-win__body .syn-num {
    color: #f78c6c;
}

.py-code-win__body .syn-cmt {
    color: #5c6370;
    font-style: italic;
}

.py-code-win__body .syn-punct {
    color: #89ddff;
}

.py-code-win__copy {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.py-code-win__copy:hover {
    border-color: #94a3b8;
    color: #1e293b;
}

.py-code-win__copy.is-copied {
    border-color: #4ade80;
    color: #15803d;
    background: #f0fdf4;
}

html.theme-dark .py-code-win__copy {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

html.theme-dark .py-code-win__copy:hover {
    border-color: #64748b;
    color: #f8fafc;
}

html.theme-dark .py-code-win__copy.is-copied {
    background: rgba(34, 197, 94, 0.15);
    border-color: #4ade80;
    color: #86efac;
}

.py-code-win__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex-shrink: 0;
}

.py-code-win__try {
    padding: 0.2rem 0.55rem;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.py-code-win__try:hover {
    border-color: #3b82f6;
    color: #1e3a8a;
    background: #dbeafe;
}

html.theme-dark .py-code-win__try {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(96, 165, 250, 0.45);
    color: #93c5fd;
}

html.theme-dark .py-code-win__try:hover {
    background: rgba(59, 130, 246, 0.28);
    color: #bfdbfe;
}

/* fenêtre code type IDE */
.py-code-win {
    margin-top: 1rem;
    max-width: 100%;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.py-code-win__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 1px solid #cbd5e1;
}

.py-code-win__dots {
    display: flex;
    gap: 5px;
}

.py-code-win__dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.py-code-win__dots span:nth-child(1) {
    background: #f87171;
}

.py-code-win__dots span:nth-child(2) {
    background: #fbbf24;
}

.py-code-win__dots span:nth-child(3) {
    background: #4ade80;
}

.py-code-win__fname {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.py-code-win__body {
    margin: 0;
    padding: 1rem 1.1rem;
    background: var(--dark-bg);
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    max-width: 100%;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
    overflow-x: auto;
    overflow-y: hidden;
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

.py-code-win__body::-webkit-scrollbar {
    height: 6px;
}

.py-code-win__body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 4px;
}

.py-callout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

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

.py-callout {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.55;
}

.py-callout--good {
    border: 1px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.06);
}

.py-callout--good .py-callout__title {
    color: #047857;
    font-weight: 800;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.py-callout--tip {
    border: 1px solid rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.06);
}

.py-callout--tip .py-callout__title {
    color: #8a4308;
    font-weight: 800;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.py-callout--note {
    margin-top: 1rem;
    border: 1px solid rgba(239, 74, 52, 0.35);
    background: rgba(239, 74, 52, 0.05);
}

.py-callout--note .py-callout__title {
    color: var(--primary-dark);
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.py-callout p {
    margin: 0;
    color: var(--text-dark);
}

.py-callout p code {
    font-size: 0.8em;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(239, 74, 52, 0.1);
    color: var(--primary-dark);
    font-weight: 700;
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.75rem 0.5rem;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .nav-icon {
        width: 16px !important;
        height: 16px !important;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header-brand .page-logo {
        width: 48px;
        height: 48px;
    }

    .page-header p {
        font-size: 0.95rem;
    }

    .content-layout {
        flex-direction: column;
    }

    .cheatsheet-content h3 {
        font-size: 1.1rem;
        margin-top: 1rem;
    }

    .cheatsheet-content p {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }

    .cheatsheet-content code {
        font-size: 0.8rem;
    }

    .page-actions {
        margin: 1rem 0;
    }

    .btn-try-code {
        display: inline-block;
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
}

/* ========================================
   MODE SOMBRE + bouton thème
   ======================================== */

.navbar-brand-start {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: nowrap;
}

.theme-toggle {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.96);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
    border-color: rgba(239, 74, 52, 0.45);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle--floating {
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 1100;
}

html.theme-dark {
    color-scheme: dark;
    --text-dark: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --light-bg: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

html.theme-dark body {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 42%, #1e1b4b 100%);
    color: var(--text-dark);
}

html.theme-dark .theme-toggle {
    background: #1e293b;
    border-color: #475569;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

html.theme-dark body > header {
    background: #0f172a;
    border-bottom-color: #334155;
    box-shadow: var(--shadow-md);
}

html.theme-dark .navbar:not(.navbar--enhanced) .nav-links {
    background: #1e293b;
}

html.theme-dark .nav-links a {
    color: #94a3b8;
}

html.theme-dark .nav-links a:hover,
html.theme-dark .nav-links a.active {
    color: var(--primary-light);
    background: rgba(239, 74, 52, 0.1);
}

html.theme-dark .mobile-menu-btn span {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
}

html.theme-dark .nav-links a {
    color: #94a3b8;
}

html.theme-dark .nav-links a:hover,
html.theme-dark .nav-links a.active {
    color: var(--primary-light);
}

html.theme-dark .lang-card {
    background: rgba(30, 41, 59, 0.92);
    border-color: #334155;
    color: var(--text-dark);
}

html.theme-dark .lang-label {
    color: var(--text-dark);
}

html.theme-dark .lang-snippet {
    color: #94a3b8;
}

html.theme-dark .feature-card {
    background: #1e293b;
    border-color: #334155;
    color: var(--text-dark);
}

html.theme-dark .feature-card h3 {
    color: var(--text-dark);
}

html.theme-dark .feature-card p {
    color: var(--text-light);
}

html.theme-dark .hero-subtitle,
html.theme-dark .hero-description {
    color: var(--text-light);
}

html.theme-dark .lang-intro {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

html.theme-dark .lang-intro h2 {
    color: var(--text-dark);
}

html.theme-dark .lang-intro-use {
    border-top-color: #334155;
}

html.theme-dark .topic-navigation {
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.12) 0%, rgba(181, 89, 11, 0.08) 100%);
    border-color: rgba(239, 74, 52, 0.25);
}

html.theme-dark .topic-navigation h2 {
    color: var(--text-dark);
}

html.theme-dark .btn-topic {
    background: #0f172a;
    border-color: #475569;
    color: var(--text-dark);
}

html.theme-dark .btn-topic:hover {
    color: #fff;
}

html.theme-dark .page-header h1 {
    filter: brightness(1.15);
}

html.theme-dark .page-header p,
html.theme-dark .page-header-brand + p {
    color: var(--text-light);
}

html.theme-dark .page-topic .page-header,
html.theme-dark .page-import .page-header {
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.14) 0%, rgba(181, 89, 11, 0.1) 55%, rgba(245, 158, 11, 0.08) 100%);
    border-color: #334155;
}

html.theme-dark .page-topic .page-header-brand h1,
html.theme-dark .page-import .page-header-brand h1 {
    color: var(--text-dark);
}

html.theme-dark .page-topic .btn-try-code.is-secondary,
html.theme-dark .page-import .btn-try-code.is-secondary {
    background: #0f172a;
    color: var(--primary-light);
    border-color: rgba(255, 138, 114, 0.5);
}

html.theme-dark .page-topic .btn-try-code.is-secondary:hover,
html.theme-dark .page-import .btn-try-code.is-secondary:hover {
    background: #1e293b;
}

html.theme-dark .cheatsheet-section {
    background: #1e293b;
    border-color: #334155;
    box-shadow: var(--shadow-lg);
}

html.theme-dark .cheatsheet-content h3 {
    color: #f1f5f9;
}

html.theme-dark .cheatsheet-content p {
    color: var(--text-light);
}

html.theme-dark .cheatsheet-content p strong {
    color: var(--text-dark);
}

html.theme-dark .cheatsheet-content p.csp-ref-line {
    background: #0f172a;
    border-color: #334155;
}

html.theme-dark .cheatsheet-content p.csp-ref-line:hover {
    border-color: rgba(255, 138, 114, 0.35);
}

html.theme-dark .cheatsheet-content code {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}

html.theme-dark .py-card {
    background: #1e293b;
    border-color: #334155;
}

html.theme-dark .py-card__title {
    color: var(--text-dark);
}

html.theme-dark .py-card__lead {
    color: var(--text-light);
}

html.theme-dark .py-card__lead strong {
    color: var(--text-dark);
}

html.theme-dark .py-pill--primary {
    color: #e0e7ff;
    background: rgba(239, 74, 52, 0.35);
    border-color: rgba(255, 138, 114, 0.55);
}

html.theme-dark .py-pill--accent {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(251, 191, 36, 0.45);
}

html.theme-dark .py-card__lead .py-accent {
    color: #ffb199;
}

html.theme-dark .py-row {
    background: #0f172a;
    border-color: #334155;
}

html.theme-dark .py-row__desc {
    color: var(--text-light);
}

html.theme-dark .py-row__sep {
    background: #475569;
}

html.theme-dark .py-examples-panel {
    border-color: rgba(255, 138, 114, 0.38);
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 55%, rgba(49, 46, 129, 0.35) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 4px 24px rgba(0, 0, 0, 0.35);
}

html.theme-dark .py-examples-panel__cap {
    color: #ffb199;
    border-color: rgba(255, 138, 114, 0.32);
    background: linear-gradient(135deg, rgba(239, 74, 52, 0.22) 0%, rgba(181, 89, 11, 0.12) 100%);
}

html.theme-dark .py-examples-panel .py-row {
    background: #0f172a;
    border-color: #334155;
}

html.theme-dark .py-import-details {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

html.theme-dark .py-import-details__summary {
    background: #1e293b;
}

html.theme-dark .py-import-details[open] > .py-import-details__summary {
    border-bottom: 1px solid #334155;
}

html.theme-dark .py-import-details:not([open]):hover .py-import-details__summary {
    background: #243146;
}

html.theme-dark .py-import-details__desc {
    color: #94a3b8;
}

html.theme-dark .py-import-details__collapse {
    color: #ffb199;
}

html.theme-dark .py-import-details__chev {
    border-color: #94a3b8;
}

html.theme-dark .py-import-details__body {
    background: #0f172a;
}

html.theme-dark .py-examples-panel .py-code-win--in-panel {
    border-color: #334155;
}

html.theme-dark .py-code-win {
    border-color: #475569;
}

html.theme-dark .py-code-win__bar {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    border-bottom-color: #475569;
}

html.theme-dark .py-code-win__fname {
    color: #94a3b8;
}

html.theme-dark .py-pip-btn {
    background: #0f172a;
    border-color: rgba(245, 158, 11, 0.45);
    color: #fbbf24;
}

html.theme-dark .py-callout p {
    color: #e2e8f0;
}

html.theme-dark .py-callout p code {
    background: rgba(239, 74, 52, 0.2);
    color: #ffb199;
}

html.theme-dark .py-card__foot,
html.theme-dark .py-card__foot a,
html.theme-dark .py-hub-more a {
    color: var(--primary-light);
}

html.theme-dark .py-hub-more a code {
    background: rgba(239, 74, 52, 0.2);
    color: #ffb199;
}

html.theme-dark .page-topic .cheatsheet-content h3 {
    background: none;
    border: none;
    color: #f8fafc;
}

html.theme-dark .py-card__head {
    border-bottom-color: #334155;
}

html.theme-dark .importation-fiche .cheatsheet-module {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.88) 100%);
    border-color: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

html.theme-dark .importation-fiche .cheatsheet-module > p:not(:has(> code)) {
    background: rgba(239, 74, 52, 0.1);
    border-color: rgba(239, 74, 52, 0.22);
}

html.theme-dark .page-topic .cheatsheet-content p.csp-ref-line > code {
    border-right-color: #475569;
    background: #1e293b;
    border-color: #475569;
}

html.theme-dark .page-topic .cheatsheet-content p:not(.csp-ref-line) code,
html.theme-dark .page-topic .cheatsheet-content li code {
    background: rgba(255, 138, 114, 0.12);
    color: #e2e8f0;
}

html.theme-dark .page-topic .cheatsheet-content h4 {
    color: #cbd5e1;
}

html.theme-dark .page-topic .cheatsheet-content ul,
html.theme-dark .page-topic .cheatsheet-content ol {
    color: #94a3b8;
}

html.theme-dark .page-python.page-topic .topic-navigation,
html.theme-dark .page-javascript.page-topic .topic-navigation,
html.theme-dark .page-html.page-topic .topic-navigation,
html.theme-dark .page-css.page-topic .topic-navigation {
    background: #1e293b;
    border-color: #334155;
}

html.theme-dark .page-python.page-topic .topic-navigation h2,
html.theme-dark .page-javascript.page-topic .topic-navigation h2,
html.theme-dark .page-html.page-topic .topic-navigation h2,
html.theme-dark .page-css.page-topic .topic-navigation h2 {
    color: var(--text-dark);
}

html.theme-dark .page-css.page-topic .cheatsheet-section {
    border-color: rgba(8, 145, 178, 0.35);
}

html.theme-dark footer {
    background: #020617;
    border-top-color: #334155;
}

html.theme-dark .code-output.html-preview {
    background: #1e293b;
    color: var(--text-dark);
    border-color: #334155;
}

html.theme-dark .home-body {
    background:
        radial-gradient(ellipse 130% 70% at 50% -15%, rgba(239, 74, 52, 0.18), transparent 52%),
        linear-gradient(168deg, #0f172a 0%, #1e293b 45%, #1e1b4b 100%);
}

html.theme-dark ::-webkit-scrollbar-track {
    background: #0f172a;
}

html.theme-dark .features h2 {
    color: var(--text-dark);
}

html.theme-dark .page-python .cheatsheet-content h3 {
    color: #bfdbfe;
}

html.theme-dark .page-javascript .cheatsheet-content h3 {
    color: #fde68a;
}

html.theme-dark .page-html .cheatsheet-content h3 {
    color: #fecaca;
}

html.theme-dark .page-css .cheatsheet-content h3 {
    color: #a5f3fc;
}

html.theme-dark ::-webkit-scrollbar-thumb {
    border-color: #1e293b;
}

/* Java & C */
.btn-java {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(234, 88, 12, 0.3);
}

.btn-c {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(71, 85, 105, 0.35);
}

.lang-emoji,
.lang-card-emoji {
    font-size: 1.75rem;
    line-height: 1;
}

.nav-icon--emoji {
    font-size: 1.1rem;
    width: auto;
    height: auto;
}

.page-logo--emoji {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    font-size: 3rem;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(239, 74, 52, 0.15), rgba(181, 89, 11, 0.12));
    border: 1px solid var(--border);
}

.lang-card-java {
    border-color: rgba(234, 88, 12, 0.35);
}

.lang-card-c {
    border-color: rgba(100, 116, 139, 0.45);
}

.page-java .btn-try-code,
.page-java .btn-topic:hover {
    border-color: rgba(234, 88, 12, 0.5);
}

.page-c .btn-try-code,
.page-c .btn-topic:hover {
    border-color: rgba(100, 116, 139, 0.55);
}

html.theme-dark .page-java.page-topic .topic-navigation,
html.theme-dark .page-c.page-topic .topic-navigation {
    border-color: #334155;
}

html.theme-dark .page-java .cheatsheet-content h3 {
    color: #fdba74;
}

html.theme-dark .page-c .cheatsheet-content h3 {
    color: #cbd5e1;
}

.admin-quiz-card--java {
    border-top: 3px solid #ea580c;
}

.admin-quiz-card--c {
    border-top: 3px solid #64748b;
}

/* Cours NSI Réseau : tableaux et schémas texte */
.csp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1rem;
    font-size: 0.92rem;
}
.csp-table th,
.csp-table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.65rem;
    text-align: left;
    vertical-align: top;
}
.csp-table th {
    background: var(--surface-2, rgba(239, 74, 52, 0.08));
    font-weight: 600;
}
.csp-diagram {
    display: block;
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    background: var(--surface-2, rgba(15, 23, 42, 0.04));
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow-x: auto;
    white-space: pre;
}
html.theme-dark .csp-diagram {
    background: rgba(15, 23, 42, 0.5);
}

/* Cours NSI : lisibilité des fiches (libellés français, pas police code) */
.page-nsi .py-row {
    grid-template-columns: minmax(7.5rem, 11.5rem) auto minmax(0, 1fr);
    align-items: start;
}

.page-nsi .py-row__code {
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.5;
    word-break: normal;
    overflow-wrap: anywhere;
    font-variant-ligatures: normal;
    font-feature-settings: normal;
}

.page-nsi .py-row__code code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
}

.page-nsi .py-row__code em {
    font-style: italic;
    font-weight: 600;
}

.page-nsi .py-row__desc {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.55;
}

.page-nsi .py-row__desc sub,
.page-nsi .py-row__desc sup,
.page-nsi .csp-table sub,
.page-nsi .csp-table sup {
    font-size: 0.75em;
}

.page-nsi .cheatsheet-content h4 {
    margin: 1.1rem 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.page-nsi .cheatsheet-content ul,
.page-nsi .cheatsheet-content ol {
    margin: 0.35rem 0 1rem;
    padding-left: 1.35rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #475569;
}

.page-nsi .cheatsheet-content li {
    margin-bottom: 0.45rem;
}

.page-nsi .cheatsheet-content li:last-child {
    margin-bottom: 0;
}

.page-nsi .cheatsheet-content li strong {
    color: var(--text-dark, #1e293b);
    font-weight: 700;
}

.page-nsi .cheatsheet-content h4 + ul,
.page-nsi .cheatsheet-content h4 + ol {
    margin-top: 0.35rem;
}

.page-nsi .csp-block {
    margin: 0.85rem 0 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border, #e2e8f0);
    background: #f8fafc;
}

.page-nsi .csp-block h4 {
    margin-top: 0;
    margin-bottom: 0.55rem;
}

.page-nsi .csp-block > :last-child {
    margin-bottom: 0;
}

.page-nsi .csp-block--tip {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.page-nsi .csp-compare-grid {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.page-nsi .csp-compare-grid__head,
.page-nsi .csp-compare-grid__row {
    display: grid;
    grid-template-columns: minmax(7rem, 9rem) 1fr;
    gap: 0.65rem 1rem;
    align-items: baseline;
    padding: 0.4rem 0;
}

.page-nsi .csp-compare-grid__head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid var(--border, #e2e8f0);
    padding-bottom: 0.45rem;
}

.page-nsi .csp-compare-grid__row + .csp-compare-grid__row {
    border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.page-nsi .csp-compare-grid__label {
    font-weight: 700;
    color: var(--text-dark, #1e293b);
}

.page-nsi .csp-compare-grid__value {
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.page-nsi .csp-compare-intro {
    margin: 0 0 0.55rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #475569;
}

.page-nsi .csp-block p {
    margin: 0 0 0.55rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #475569;
}

.page-nsi .csp-block p:last-child {
    margin-bottom: 0;
}

.page-nsi .csp-block--tip p strong {
    color: var(--text-dark, #1e293b);
}

.page-nsi .cheatsheet-content .table-wrap {
    overflow-x: auto;
    margin: 0.5rem 0 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.page-nsi .csp-compare-grid__note {
    margin: 0.55rem 0 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border, #e2e8f0);
    font-size: 0.88rem;
    line-height: 1.5;
    color: #475569;
}

.page-nsi .csp-compare-grid__note strong {
    color: var(--text-dark, #1e293b);
}

.page-nsi .cheatsheet-content .csp-diagram {
    font-size: 0.8rem;
    line-height: 1.5;
    tab-size: 4;
    -webkit-font-smoothing: antialiased;
}

.page-nsi .cheatsheet-content .csp-diagram--text {
    font-family: inherit;
    font-size: 0.92rem;
    white-space: normal;
}

.page-nsi .csp-table {
    width: 100%;
    margin: 0.75rem 0;
    font-size: 0.88rem;
}

.page-nsi main.container > .cheatsheet-section {
    max-width: 52rem;
    margin-left: auto;
    margin-right: auto;
}

html.theme-dark .page-nsi .py-row__code {
    color: #e2e8f0;
}

html.theme-dark .page-nsi .py-row__desc {
    color: #94a3b8;
}

html.theme-dark .page-nsi .cheatsheet-content h4 {
    color: #e2e8f0;
}

html.theme-dark .page-nsi .cheatsheet-content ul,
html.theme-dark .page-nsi .cheatsheet-content ol,
html.theme-dark .page-nsi .cheatsheet-content li,
html.theme-dark .page-nsi .csp-compare-grid__value,
html.theme-dark .page-nsi .csp-compare-grid__note {
    color: #94a3b8;
}

html.theme-dark .page-nsi .cheatsheet-content li strong,
html.theme-dark .page-nsi .csp-compare-grid__label {
    color: #e2e8f0;
}

html.theme-dark .page-nsi .csp-block {
    background: rgba(15, 23, 42, 0.55);
    border-color: #334155;
}

html.theme-dark .page-nsi .csp-block--tip {
    background: rgba(15, 23, 42, 0.55);
    border-color: #334155;
}

html.theme-dark .page-nsi .csp-compare-grid__head {
    color: #94a3b8;
    border-bottom-color: #334155;
}

html.theme-dark .page-nsi .csp-compare-grid__row + .csp-compare-grid__row {
    border-top-color: rgba(71, 85, 105, 0.65);
}

html.theme-dark .page-nsi .csp-compare-grid__note {
    border-top-color: #334155;
}

html.theme-dark .page-nsi .csp-compare-intro,
html.theme-dark .page-nsi .csp-block p {
    color: #94a3b8;
}

html.theme-dark .page-nsi .csp-block--tip p strong,
html.theme-dark .page-nsi .csp-compare-grid__note strong {
    color: #e2e8f0;
}

@media (max-width: 720px) {
    .page-nsi .py-row {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Schémas NSI : couches TCP/IP et rôles OS */
.nsi-stack-diagram {
    margin: 1rem 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nsi-stack-diagram__layer {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 0.84rem;
}

.nsi-stack-diagram__layer--4 { border-left: 4px solid #ef4a34; }
.nsi-stack-diagram__layer--3 { border-left: 4px solid #2563eb; }
.nsi-stack-diagram__layer--2 { border-left: 4px solid #0891b2; }
.nsi-stack-diagram__layer--1 { border-left: 4px solid #059669; }

.nsi-stack-diagram__num {
    font-weight: 800;
    color: #64748b;
    text-align: center;
}

.nsi-stack-diagram__name {
    font-weight: 700;
    color: #0f172a;
}

.nsi-stack-diagram__ex {
    font-size: 0.78rem;
    color: #64748b;
    text-align: right;
}

.nsi-stack-diagram__cap {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: #64748b;
    text-align: center;
}

.nsi-roles-diagram {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.nsi-roles-diagram__item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 0.82rem;
    text-align: center;
}

.nsi-roles-diagram__item strong {
    color: #1e40af;
    font-size: 0.88rem;
}

.nsi-roles-diagram__item span {
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.35;
}

html.theme-dark .nsi-stack-diagram__layer,
html.theme-dark .nsi-roles-diagram__item {
    background: rgba(15, 23, 42, 0.55);
    border-color: #334155;
}

html.theme-dark .nsi-stack-diagram__name,
html.theme-dark .nsi-roles-diagram__item strong {
    color: #e2e8f0;
}

@media (max-width: 640px) {
    .nsi-roles-diagram {
        grid-template-columns: 1fr;
    }

    .nsi-stack-diagram__layer {
        grid-template-columns: 2rem 1fr;
    }

    .nsi-stack-diagram__ex {
        grid-column: 2;
        text-align: left;
    }
}
