/* ══════════════════════════════════════════════════════════════
   NEXUS FRAMES STUDIO
   Utilise les design tokens du thème (var(--bg-card), etc.)
   ══════════════════════════════════════════════════════════════ */

/* ── Shell layout ─────────────────────────────────────────────── */
.a2-shell.a2-shell--no-aside {
    grid-template-columns: 248px minmax(0, 1fr) !important;
}
.a2-shell.a2-shell--no-aside > .nfs-container,
.a2-shell.a2-shell--no-aside > .a2-page {
    grid-column: 2 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* ── Root container ────────────────────────────────────────────── */
.nfs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: calc(100vh - 45px);
    background: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans, inherit);
    box-sizing: border-box;
    overflow: hidden;
}

/* ── Toolbar (replaces old heavy header) ────────────────────────
   Compact one-line bar matching the Nexus page header style.    */
.nfs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    height: 48px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 20;
}

.nfs-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nfs-toolbar-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.nfs-toolbar-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
}

.nfs-toolbar-badge {
    background: var(--primary-light, rgba(59,130,246,.12));
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb, 59,130,246), .25);
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.nfs-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Thin separator between action groups */
.nfs-toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* ── Workspace (inspector left / stage right) ──────────────────── */
.nfs-workspace {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 45px - 48px); /* header=45px toolbar=48px */
    position: relative;
}

/* ══════════════════════════════════════════════════════════════
   INSPECTEUR — volet gauche
   ══════════════════════════════════════════════════════════════ */
.nfs-sidebar {
    background: var(--bg-sidebar);
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* ── Splitter Handle (Draggable Divider) ─────────────────────── */
.nfs-splitter {
    width: 10px;
    margin: 0 -5px;
    z-index: 30;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    user-select: none;
    flex-shrink: 0;
}

.nfs-splitter::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 2px;
    background: var(--border-color);
    transition: all 0.15s ease;
}

.nfs-splitter:hover::before,
.nfs-splitter.is-dragging::before {
    background: var(--primary);
    width: 3px;
    left: 3px;
    box-shadow: 0 0 8px rgba(var(--primary-rgb, 59, 130, 246), 0.5);
}

.nfs-splitter-handle {
    width: 16px;
    height: 38px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    transition: all 0.15s ease;
    opacity: 0.7;
}

.nfs-splitter:hover .nfs-splitter-handle,
.nfs-splitter.is-dragging .nfs-splitter-handle {
    opacity: 1;
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(var(--primary-rgb, 59, 130, 246), 0.35);
}

/* Frame selector row */
.nfs-selector-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.nfs-frame-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.nfs-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.nfs-chip:hover {
    background: var(--bg-hover, var(--bg-body));
    color: var(--text-main);
}
.nfs-chip.active {
    background: var(--primary-light, rgba(59,130,246,.12));
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 800;
}

/* Category filter */
.nfs-cat-bar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: none;
    flex-shrink: 0;
}

.nfs-cat-btn {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.70rem;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.12s ease;
    white-space: nowrap;
}
.nfs-cat-btn:hover { color: var(--text-main); background: var(--bg-hover, rgba(0,0,0,.04)); }
.nfs-cat-btn.active {
    background: var(--primary-light, rgba(59,130,246,.1));
    color: var(--primary);
    border-color: var(--primary);
}

/* Quick palette presets */
.nfs-palettes-bar {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 8px 10px;
    background: var(--bg-body);
    border-radius: 8px;
    margin-bottom: 10px;
    scrollbar-width: none;
}
.nfs-palette-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.69rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    white-space: nowrap;
    transition: all 0.12s ease;
}
.nfs-palette-chip:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    color: var(--primary);
}

/* Inspector section blocks */
.nfs-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}
.nfs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
}

/* Form fields */
.nfs-field { margin-bottom: 12px; }
.nfs-field-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.nfs-field-value {
    font-weight: 800;
    color: var(--primary);
    font-family: monospace;
    font-size: 0.76rem;
}

.nfs-input-text {
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.79rem;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.nfs-input-text:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light, rgba(59,130,246,.15));
}

.nfs-select {
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.79rem;
    box-sizing: border-box;
    cursor: pointer;
}
.nfs-select:focus { outline: none; border-color: var(--primary); }

/* Range sliders */
.nfs-input-slider {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: 5px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.nfs-input-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(var(--primary-rgb, 59,130,246), .45);
    transition: transform 0.1s;
}
.nfs-input-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }

/* Responsive 2-column grid inside inspector */
.nfs-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
}
.nfs-grid-2 > .nfs-field {
    min-width: 0;
    margin-bottom: 0;
}

/* GIF speed presets grid */
.nfs-gif-speed-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}
.nfs-gif-speed-grid .nfs-theme-pill {
    padding: 5px 2px !important;
    text-align: center;
    font-size: 0.70rem;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ── Corner quadrant selector ────────────────────────────────── */
.nfs-corner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}

.nfs-corner-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-sizing: border-box;
    width: 100%;
}

.nfs-corner-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
    background: var(--bg-hover, var(--bg-body));
}

.nfs-corner-btn.active {
    background: var(--primary-light, rgba(59,130,246,.15));
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 800;
    box-shadow: 0 0 0 1px var(--primary);
}

.nfs-corner-btn i {
    font-size: 0.85rem;
}

/* Flip / Mirror action button */
.nfs-flip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-body);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.nfs-flip-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.nfs-flip-btn.active {
    background: var(--primary-light, rgba(59,130,246,.12));
    border-color: var(--primary);
    border-style: solid;
    color: var(--primary);
    font-weight: 800;
}

/* Dropzone */
.nfs-dropzone {
    border: 2px dashed var(--border-color);
    background: var(--bg-body);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.nfs-dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-light, rgba(59,130,246,.06));
    transform: translateY(-1px);
}
.nfs-dropzone-icon { font-size: 1.6rem; color: var(--primary); margin-bottom: 3px; }
.nfs-dropzone-title { font-size: 0.78rem; font-weight: 800; color: var(--text-main); }
.nfs-dropzone-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* Asset mini-grid: dynamically fills row based on panel width */
.nfs-assets-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 8px;
    max-height: 170px;
    overflow-y: auto;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-body);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.nfs-asset-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 3px;
    position: relative;
    transition: all 0.15s ease;
}
.nfs-asset-thumb:hover { border-color: var(--primary); transform: scale(1.05); }
.nfs-asset-thumb.selected {
    border-color: var(--primary);
    background: var(--primary-light, rgba(59,130,246,.12));
}
.nfs-asset-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* Small delete badge on hover */
.nfs-asset-delete {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    border: 1px solid rgba(255,255,255,0.7);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.35);
    z-index: 10;
    transition: transform 0.12s ease;
}
.nfs-asset-thumb:hover .nfs-asset-delete {
    display: flex;
}
.nfs-asset-delete:hover {
    transform: scale(1.2);
    background: #dc2626;
}

/* ══════════════════════════════════════════════════════════════
   STAGE — volet droit (live preview)
   ══════════════════════════════════════════════════════════════ */
.nfs-stage {
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-width: 0;
    overflow-y: auto;
    position: relative;
    height: 100%;
}

/* Sticky theme-selector bar */
.nfs-stage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 8px;
}

.nfs-theme-pills { display: flex; gap: 5px; }
.nfs-theme-pill {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.70rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-body);
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.12s ease;
}
.nfs-theme-pill:hover { color: var(--text-main); border-color: var(--border-color); }
.nfs-theme-pill.active {
    background: var(--primary);
    color: var(--text-on-primary, #fff);
    font-weight: 900;
}

/* Preview cards content area */
.nfs-stage-content {
    padding: 20px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Individual preview context card */
.nfs-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 16px);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: visible;
}

/* Theme overrides for preview cards */
.nfs-preview-card.theme-slate  { background: #111a2d; border-color: rgba(255,255,255,.08); color: #e2e8f0; }
.nfs-preview-card.theme-oled   { background: #030508; border-color: rgba(255,255,255,.12); color: #ffffff; }
.nfs-preview-card.theme-light  { background: #ffffff; border-color: var(--border-color, #e2e8f0); color: #0f172a; box-shadow: 0 4px 16px rgba(0,0,0,.04); }
.nfs-preview-card.theme-cosmic { background: radial-gradient(circle at 50% 10%, #1e1b4b, #070913 85%); border-color: rgba(168,85,247,.3); color: #f8fafc; }

.nfs-preview-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.nfs-preview-card.theme-slate .nfs-preview-card-title,
.nfs-preview-card.theme-oled  .nfs-preview-card-title,
.nfs-preview-card.theme-cosmic .nfs-preview-card-title {
    border-bottom-color: rgba(255,255,255,.08);
    color: rgba(255,255,255,.5);
}
.nfs-preview-card.theme-light .nfs-preview-card-title {
    border-bottom-color: var(--border-color, #e2e8f0);
    color: var(--text-muted, #64748b);
}

/* Clean reset for the Game Center sidebar mock inside preview cards */
.nfs-preview-card .game-center-sidebar {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    position: static !important;
    top: auto !important;
    border: none !important;
    border-right: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
    gap: 16px !important;
}

/* Theme adaptations for the Game Center sidebar user-card inside previews */
.nfs-preview-card .gc-user-card {
    position: relative !important;
    overflow: visible !important;
}
.nfs-preview-card .gc-user-frame {
    position: relative !important;
    overflow: visible !important;
}
.nfs-preview-card.theme-light .game-center-sidebar .gc-user-card {
    background: #f8fafc !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    color: #1e293b !important;
}
.nfs-preview-card.theme-slate .game-center-sidebar .gc-user-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}
.nfs-preview-card.theme-oled .game-center-sidebar .gc-user-card {
    background: #000000 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}
.nfs-preview-card.theme-cosmic .game-center-sidebar .gc-user-card {
    background: rgba(15, 10, 35, 0.8) !important;
    border: 1px solid rgba(168, 85, 247, 0.25) !important;
    color: #f8fafc !important;
}

/* ══════════════════════════════════════════════════════════════
   PODIUM OFFICIEL GAME CENTER
   ══════════════════════════════════════════════════════════════ */
.nfs-podium-container {
    width: 100%;
    overflow-x: auto;
    padding: 10px 0;
}
.nfs-preview-card .podium-section {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    flex-shrink: 0;
}

.nfs-preview-card .podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 16px;
    position: relative;
    width: 210px;
    padding: 1.8rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    box-sizing: border-box;
}

.nfs-preview-card.theme-slate .podium-card,
.nfs-preview-card.theme-oled .podium-card,
.nfs-preview-card.theme-cosmic .podium-card {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}
.nfs-preview-card.theme-oled .podium-card {
    background: #0b0f19;
    border-color: #1e293b;
}

/* Rank 1 - GOLD (porte le cadre édité) */
.nfs-preview-card .podium-card.rank-1 {
    width: 250px;
    padding-top: 1rem;
    padding-bottom: 2.5rem;
    z-index: 10;
    transform: translateY(-24px);
}

/* Rank 2 - SILVER */
.nfs-preview-card .podium-card.rank-2 {
    min-height: 200px;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.15) 0%, rgba(255, 255, 255, 1) 100%);
    border: 1px solid #cbd5e1;
}
.nfs-preview-card.theme-slate .podium-card.rank-2,
.nfs-preview-card.theme-oled .podium-card.rank-2,
.nfs-preview-card.theme-cosmic .podium-card.rank-2 {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.1) 0%, rgba(30, 41, 59, 1) 100%);
    border-color: #334155;
}

/* Rank 3 - BRONZE */
.nfs-preview-card .podium-card.rank-3 {
    min-height: 190px;
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.1) 0%, rgba(255, 255, 255, 1) 100%);
    border: 1px solid #fed7aa;
}
.nfs-preview-card.theme-slate .podium-card.rank-3,
.nfs-preview-card.theme-oled .podium-card.rank-3,
.nfs-preview-card.theme-cosmic .podium-card.rank-3 {
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.1) 0%, rgba(30, 41, 59, 1) 100%);
    border-color: #334155;
}

.nfs-preview-card .crown-icon {
    display: block;
    color: #fbbf24;
    font-size: 2.2rem;
    filter: drop-shadow(0 4px 12px rgba(251, 191, 36, 0.5));
    margin-bottom: 0.25rem;
    animation: crownFloat 3s ease-in-out infinite;
}
@keyframes crownFloat {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
}

.nfs-preview-card .bg-rank-num {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 3.5rem;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.04);
    line-height: 1;
    pointer-events: none;
}
.nfs-preview-card.theme-slate .bg-rank-num,
.nfs-preview-card.theme-oled .bg-rank-num,
.nfs-preview-card.theme-cosmic .bg-rank-num {
    color: rgba(255, 255, 255, 0.05);
}
.nfs-preview-card .rank-1 .bg-rank-num { color: rgba(234, 179, 8, 0.15); }

.nfs-preview-card .p-avatar {
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #475569;
    overflow: hidden;
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.nfs-preview-card.theme-slate .p-avatar,
.nfs-preview-card.theme-oled .p-avatar,
.nfs-preview-card.theme-cosmic .p-avatar {
    background: #334155;
    color: #f8fafc;
    box-shadow: none;
}
.nfs-preview-card .rank-1 .p-avatar {
    background: #fbbf24;
    color: white;
    width: 4.6rem;
    height: 4.6rem;
    font-size: 1.8rem;
}
.nfs-preview-card .rank-2 .p-avatar { background: #94a3b8; color: white; }
.nfs-preview-card .rank-3 .p-avatar { background: #b45309; color: white; }

.nfs-preview-card .p-name {
    font-weight: 800;
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}
.nfs-preview-card .p-name-line {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nfs-preview-card .p-name-first {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 600;
}
.nfs-preview-card .p-hub {
    font-size: 0.72rem;
    opacity: 0.75;
    margin-bottom: 0.5rem;
}
.nfs-preview-card .p-score {
    font-weight: 950;
    font-size: 1.15rem;
    color: #38bdf8;
}

/* Ligne Horizontale (Section 3) */
.nfs-preview-card .lb-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-radius: 14px;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    box-sizing: border-box;
}
.nfs-preview-card.theme-slate .lb-row,
.nfs-preview-card.theme-oled .lb-row,
.nfs-preview-card.theme-cosmic .lb-row {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
.nfs-preview-card .row-rank {
    font-weight: 900;
    font-size: 1.05rem;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.06);
}
.nfs-preview-card.theme-slate .row-rank,
.nfs-preview-card.theme-oled .row-rank,
.nfs-preview-card.theme-cosmic .row-rank {
    background: rgba(255,255,255,0.08);
}
.nfs-preview-card .row-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    overflow: hidden;
    flex-shrink: 0;
}
.nfs-preview-card .row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.nfs-preview-card .row-name {
    font-weight: 800;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nfs-preview-card .row-score {
    font-weight: 950;
    font-size: 1.15rem;
    color: #38bdf8;
    white-space: nowrap;
}
.nfs-preview-card .score-suffix {
    font-size: 0.72rem;
    opacity: 0.65;
}

/* Frame decor images */
.frame-decor-img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }

/* Animations with dynamic duration support via CSS variables */
@keyframes decorFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes starTwinkle { 0%,100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 4px rgba(255,255,255,.6)); } 50% { transform: scale(1.12) rotate(6deg); filter: drop-shadow(0 0 12px rgba(255,255,255,.9)); } }
@keyframes pulseSoft { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.decorFloat  { animation: decorFloat  var(--anim-duration, 3.2s) ease-in-out infinite; }
.starTwinkle { animation: starTwinkle var(--anim-duration, 2.4s) ease-in-out infinite; }
.pulseSoft   { animation: pulseSoft   var(--anim-duration, 2.0s) ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.nfs-btn {
    padding: 6px 13px;
    border-radius: var(--radius-md, 8px);
    font-size: 0.79rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}
.nfs-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; filter: none !important; }

.nfs-btn-primary {
    background: var(--primary);
    color: var(--text-on-primary, #fff);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb,59,130,246),.35);
}
.nfs-btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }

.nfs-btn-secondary {
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.nfs-btn-secondary:hover:not(:disabled) { background: var(--bg-hover, var(--bg-card)); border-color: var(--primary); }

.nfs-btn-danger {
    background: rgba(239,68,68,.1);
    color: var(--danger, #ef4444);
    border: 1px solid rgba(239,68,68,.25);
}
.nfs-btn-danger:hover:not(:disabled) { background: var(--danger, #ef4444); color: #fff; }

.nfs-btn-warning {
    background: rgba(245,158,11,.1);
    color: var(--warning, #f59e0b);
    border: 1px solid rgba(245,158,11,.25);
}
.nfs-btn-warning:hover:not(:disabled) { background: var(--warning, #f59e0b); color: #fff; }

/* Inspector tab strip */
.nfs-tab-strip {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}
.nfs-tab {
    flex: 1;
    padding: 9px 4px;
    font-size: 0.71rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.nfs-tab:hover { color: var(--text-main); }
.nfs-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 800; }

/* ══════════════════════════════════════════════════════════════
   COLOUR GADGETS — visual hex+alpha pickers
   ══════════════════════════════════════════════════════════════ */
.nfs-color-gadget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    padding: 7px 9px;
    margin-top: 4px;
}

/* Circular native colour picker */
.nfs-color-picker-lg {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}
.nfs-color-picker-lg::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.nfs-color-picker-lg::-webkit-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Swatch showing rgba (with checkerboard for transparency) */
.nfs-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    background-image:
        linear-gradient(var(--swatch-color, transparent), var(--swatch-color, transparent)),
        repeating-conic-gradient(#aaa 0% 25%, #fff 0% 50%) 0 0 / 8px 8px;
    background-blend-mode: normal;
}
.nfs-color-swatch--glow { border-radius: 50%; }

.nfs-color-info { display: flex; flex-direction: column; gap: 2px; }

.nfs-color-hex {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-main);
    letter-spacing: 0.4px;
}

.nfs-color-alpha-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Highlighted field (text colour section) */
.nfs-field-highlight {
    background: var(--primary-light, rgba(59,130,246,.06));
    border: 1px solid var(--primary, rgba(59,130,246,.3));
    border-radius: var(--radius-md, 8px);
    padding: 10px 11px;
}

/* Live text preview strip */
.nfs-text-preview {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm, 6px);
    margin-top: 7px;
    border: 1px solid var(--border-color);
    font-family: inherit;
}

/* Gradient preview bar */
.nfs-gradient-preview {
    height: 10px;
    border-radius: 5px;
    margin: 5px 0 8px;
    border: 1px solid var(--border-color);
}

/* ══════════════════════════════════════════════════════════════
   NEXUS COLOUR PICKER (NexusColorPicker.js)
   ══════════════════════════════════════════════════════════════ */

/* Root wrapper - position relative so the panel expands inline */
.ncp-wrap {
    position: relative;
    width: 100%;
}

/* ── Trigger row ────────────────────────────────────────────── */
.ncp-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.ncp-trigger:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

/* Swatch in the trigger (with checkerboard transparency pattern) */
.ncp-swatch-trigger {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    /* Checkerboard */
    background-image: repeating-conic-gradient(
        #ccc 0% 25%, #fff 0% 50%
    );
    background-size: 8px 8px;
    overflow: hidden;
}
[data-theme="dark"] .ncp-swatch-trigger,
[data-skin="cyberpunk"][data-theme="dark"] .ncp-swatch-trigger {
    background-image: repeating-conic-gradient(#555 0% 25%, #333 0% 50%);
    background-size: 8px 8px;
}
.ncp-swatch-inner {
    width: 100%;
    height: 100%;
}

.ncp-trigger-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.ncp-hex-display {
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    color: var(--text-main);
    letter-spacing: 0.4px;
}

.ncp-alpha-display {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Panel ──────────────────────────────────────────────────── */
.ncp-panel {
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.15));
}

/* ── 2D Gradient box (Saturation × Value) ───────────────────── */
.ncp-gradient-box {
    width: 100%;
    height: 150px;
    border-radius: var(--radius-md, 8px);
    position: relative;
    cursor: crosshair;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    /* Prevent text selection while dragging */
    user-select: none;
}

/* Cursor dot in the gradient box */
.ncp-cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(0,0,0,.4), inset 0 0 0 1px rgba(0,0,0,.15);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: box-shadow 0.1s;
}

/* ── Slider rows ────────────────────────────────────────────── */
.ncp-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tiny colour swatch beside hue slider */
.ncp-mini-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.ncp-slider-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* Hue slider — rainbow gradient track */
.ncp-hue-slider {
    flex: 1;
    height: 10px;
    border-radius: 5px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    background: linear-gradient(
        to right,
        hsl(0,   100%, 50%),
        hsl(30,  100%, 50%),
        hsl(60,  100%, 50%),
        hsl(90,  100%, 50%),
        hsl(120, 100%, 50%),
        hsl(150, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(210, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(270, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(330, 100%, 50%),
        hsl(359, 100%, 50%)
    );
    border: 1px solid var(--border-color);
}
.ncp-hue-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(0,0,0,.3);
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    cursor: pointer;
}

/* Alpha track — checkerboard + colour fill */
.ncp-alpha-track {
    flex: 1;
    height: 10px;
    border-radius: 5px;
    position: relative;
    border: 1px solid var(--border-color);
    background-image: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%);
    background-size: 8px 8px;
    overflow: visible;
}
[data-theme="dark"] .ncp-alpha-track,
[data-skin="cyberpunk"][data-theme="dark"] .ncp-alpha-track {
    background-image: repeating-conic-gradient(#555 0% 25%, #333 0% 50%);
    background-size: 8px 8px;
}
.ncp-alpha-fill {
    position: absolute;
    inset: 0;
    border-radius: 5px;
    pointer-events: none;
}
.ncp-alpha-slider {
    position: absolute;
    inset: -4px;
    width: calc(100% + 0px);
    height: 18px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    outline: none;
}
.ncp-alpha-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(0,0,0,.3);
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    cursor: pointer;
}

/* ── Hex input row ──────────────────────────────────────────── */
.ncp-inputs-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Small circular native OS colour swatch (fallback) */
.ncp-native-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
}
.ncp-native-swatch::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.ncp-native-swatch::-webkit-color-swatch {
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

/* Hex text field */
.ncp-hex-field {
    flex: 1;
    padding: 5px 8px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    outline: none;
    transition: border-color 0.15s;
}
.ncp-hex-field:focus { border-color: var(--primary); }

/* Small square preview of the full output (including alpha) */
.ncp-output-preview {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ── Preset swatches grid ───────────────────────────────────── */
.ncp-presets {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
}

.ncp-preset-dot {
    aspect-ratio: 1;
    border-radius: var(--radius-sm, 6px);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ncp-preset-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    border-color: var(--text-muted);
    z-index: 1;
    position: relative;
}

/* ── Intelligent Text Mode & Contrast Safeguard UI ── */
.nfs-text-mode-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.nfs-text-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    background: var(--bg-card, #ffffff);
    color: var(--text, #1e293b);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nfs-text-mode-btn:hover {
    border-color: var(--primary, #3b82f6);
}

.nfs-text-mode-btn.active {
    background: var(--primary, #3b82f6);
    color: #ffffff;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

.nfs-contrast-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.70rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.nfs-contrast-badge.good {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.nfs-contrast-badge.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.nfs-contrast-badge.bad {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.nfs-quick-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.nfs-quick-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color);
    background: var(--bg-card, #ffffff);
    color: var(--text, #1e293b);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nfs-quick-btn:hover {
    background: var(--bg-hover, #f1f5f9);
    border-color: var(--primary, #3b82f6);
}

.nfs-safeguard-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.03);
    font-size: 0.70rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

[data-theme="dark"] .nfs-safeguard-toggle {
    background: rgba(255, 255, 255, 0.04);
}

/* ══════════════════════════════════════════════════════════════
   TAPISSERIE & MOTIFS DE FOND (WALLPAPERS / PATTERNS)
   ══════════════════════════════════════════════════════════════ */
.gc-user-frame,
.gc-mini-card-sample,
.podium-card,
.lb-row,
.nfs-text-preview {
    position: relative;
    isolation: isolate;
}

.gc-user-frame::before,
.gc-mini-card-sample::before,
.podium-card::before,
.lb-row::before,
.nfs-text-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: var(--frame-pattern-img, none);
    background-repeat: var(--frame-pattern-repeat, repeat);
    background-size: var(--frame-pattern-size, auto);
    background-position: var(--frame-pattern-base-x, 50%) var(--frame-pattern-base-y, 50%);
    opacity: var(--frame-pattern-opacity, 0);
    mix-blend-mode: var(--frame-pattern-blend, normal);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s ease;
    animation: var(--frame-pattern-animation, none) var(--frame-pattern-duration, 12s) linear infinite;
}

.gc-user-frame .gc-avatar,
.gc-user-frame .gc-user-identity,
.podium-card .p-avatar,
.podium-card .p-name,
.podium-card .p-hub,
.podium-card .p-score,
.podium-card .crown-icon,
.podium-card .bg-rank-num,
.lb-row .row-rank,
.lb-row .row-avatar,
.lb-row .row-info,
.lb-row .row-score {
    position: relative;
    z-index: 2;
}

/* Studio Pattern UI components */
.nfs-pattern-card {
    background: rgba(0, 0, 0, 0.20);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
}

[data-theme="light"] .nfs-pattern-card {
    background: #f8fafc;
}

.nfs-pattern-preview-box {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: rgba(0,0,0,0.06);
    isolation: isolate;
}

.nfs-pattern-preview-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--pattern-box-img, none);
    background-repeat: var(--pattern-box-repeat, repeat);
    background-size: var(--pattern-box-size, auto);
    background-position: var(--frame-pattern-base-x, 50%) var(--frame-pattern-base-y, 50%);
    opacity: var(--pattern-box-opacity, 0.5);
    mix-blend-mode: var(--pattern-box-blend, normal);
    pointer-events: none;
    z-index: 1;
    animation: var(--frame-pattern-animation, none) var(--frame-pattern-duration, 12s) linear infinite;
}

@keyframes framePatternDrift {
    from {
        background-position: var(--frame-pattern-base-x, 50%) var(--frame-pattern-base-y, 50%);
    }
    to {
        background-position:
            calc(var(--frame-pattern-base-x, 50%) + var(--frame-pattern-shift-x, 0px))
            calc(var(--frame-pattern-base-y, 50%) + var(--frame-pattern-shift-y, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .gc-user-frame::before,
    .gc-mini-card-sample::before,
    .podium-card::before,
    .lb-row::before,
    .nfs-text-preview::before,
    .nfs-pattern-preview-box::before {
        animation: none;
    }
}

/* Accueil et bibliothèque du Studio */
.nfs-home {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: var(--bg-body);
}

.nfs-home-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px;
    margin-bottom: 18px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--bg-card)), var(--bg-card));
}

.nfs-home-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nfs-home-hero h2,
.nfs-home-section-head h3 {
    margin: 0;
    color: var(--text-main);
}

.nfs-home-hero h2 { font-size: clamp(1.3rem, 2vw, 1.8rem); }
.nfs-home-hero p { margin: 7px 0 0; color: var(--text-muted); max-width: 720px; }
.nfs-home-create { min-height: 42px; white-space: nowrap; }

.nfs-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
    gap: 18px;
    align-items: start;
}

.nfs-library-panel,
.nfs-model-panel {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-card);
    padding: 18px;
}

.nfs-model-panel { position: sticky; top: 0; }

.nfs-home-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.nfs-home-section-head h3 { font-size: 1rem; }
.nfs-home-section-head h3 i { color: var(--primary); margin-right: 6px; }
.nfs-home-section-head span { display: block; color: var(--text-muted); font-size: 0.72rem; margin-top: 3px; }

.nfs-library-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 132px;
    padding: 20px;
    cursor: pointer;
    text-align: center;
    border: 1px dashed color-mix(in srgb, var(--primary) 55%, var(--border-color));
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary) 5%, var(--bg-card));
    color: var(--text-main);
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.nfs-library-dropzone > i { color: var(--primary); font-size: 2rem; }
.nfs-library-dropzone > span { color: var(--text-muted); font-size: .75rem; }
.nfs-library-dropzone.is-dragging { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--bg-card)); transform: scale(.995); }
.nfs-library-dropzone.is-uploading { cursor: wait; }
.nfs-spin { animation: nfsSpin .8s linear infinite; }
@keyframes nfsSpin { to { transform: rotate(360deg); } }

.nfs-category-manager { margin-top: 16px; }
.nfs-category-create { display: flex; gap: 8px; }
.nfs-category-create .nfs-input-text { min-width: 150px; }
.nfs-category-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.nfs-category-chip-wrap { display: inline-flex; position: relative; }
.nfs-category-chip,
.nfs-category-delete {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
}
.nfs-category-chip { border-radius: 999px; padding: 6px 10px; font-size: .72rem; font-weight: 750; }
.nfs-category-chip span { margin-left: 4px; color: var(--primary); }
.nfs-category-chip.active { color: var(--text-main); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--bg-card)); }
.nfs-category-chip-wrap .nfs-category-chip { padding-right: 28px; }
.nfs-category-delete { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; padding: 0; border: 0; border-radius: 50%; }
.nfs-category-delete:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg-card)); }

.nfs-bulk-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border-color));
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-card));
}
.nfs-bulk-bar strong { color: var(--text-main); white-space: nowrap; font-size: .78rem; }
.nfs-bulk-bar .nfs-select { min-width: 160px; }

.nfs-library-tools { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; color: var(--text-muted); font-size: .72rem; }
.nfs-library-tools button { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-weight: 750; }
.nfs-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.nfs-library-asset {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 8px;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
}
.nfs-library-asset:hover { border-color: color-mix(in srgb, var(--primary) 65%, var(--border-color)); }
.nfs-library-asset.selected { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--bg-card)); }
.nfs-library-asset img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: var(--bg-body); }
.nfs-library-name { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; font-weight: 750; }
.nfs-library-asset small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: .64rem; }
.nfs-library-check { position: absolute; z-index: 2; top: 12px; right: 12px; color: var(--primary); font-size: 1.05rem; }
.nfs-library-gif { position: absolute; top: 12px; left: 12px; padding: 2px 5px; border-radius: 5px; background: var(--primary); color: var(--text-inverse); font-size: .58rem; font-weight: 850; }
.nfs-library-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); text-align: center; gap: 5px; }
.nfs-library-empty i { color: var(--primary); font-size: 2rem; }
.nfs-library-empty strong { color: var(--text-main); }

.nfs-home-frame-list { display: flex; flex-direction: column; gap: 11px; max-height: calc(100vh - 280px); overflow: auto; }
.nfs-home-frame-group { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border-color); border-radius: 12px; background: color-mix(in srgb, var(--bg-body) 72%, var(--bg-card)); }
.nfs-home-frame-group > header { display: flex; align-items: center; gap: 6px; padding: 1px 3px 4px; color: var(--text-main); }
.nfs-home-frame-group > header i { color: var(--primary); }
.nfs-home-frame-group > header strong { min-width: 0; overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.nfs-home-frame-group > header span { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; margin-left: auto; padding: 0 5px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-size: .62rem; font-weight: 800; }
.nfs-home-frame { display: grid; grid-template-columns: auto 5px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); color: var(--text-main); text-align: left; }
.nfs-home-frame:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--bg-card)); }
.nfs-home-frame.dragging { opacity: .55; border-style: dashed; }
.nfs-frame-drag { color: var(--text-muted); cursor: grab; }
.nfs-frame-drag:active { cursor: grabbing; }
.nfs-home-frame-accent { align-self: stretch; border-radius: 99px; }
.nfs-home-frame-main { min-width: 0; padding: 2px; border: 0; background: transparent; color: var(--text-main); text-align: left; cursor: pointer; }
.nfs-home-frame strong,
.nfs-home-frame small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nfs-home-frame strong { font-size: .76rem; }
.nfs-home-frame small { margin-top: 2px; color: var(--text-muted); font-size: .65rem; }
.nfs-frame-order-actions { display: flex; flex-direction: column; gap: 2px; }
.nfs-frame-order-actions button,
.nfs-frame-category-row button { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 23px; padding: 0; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-card); color: var(--text-muted); cursor: pointer; }
.nfs-frame-order-actions button:hover:not(:disabled),
.nfs-frame-category-row button:hover { color: var(--primary); border-color: var(--primary); }
.nfs-frame-order-actions button:disabled { opacity: .35; cursor: not-allowed; }
.nfs-frame-category-row button:disabled { opacity: .3; cursor: not-allowed; }

.nfs-frame-category-manager { padding: 11px; margin-bottom: 12px; border: 1px solid var(--border-color); border-radius: 12px; background: color-mix(in srgb, var(--primary) 4%, var(--bg-card)); }
.nfs-frame-category-manager > strong { display: block; margin-bottom: 8px; color: var(--text-main); font-size: .72rem; }
.nfs-frame-category-manager .nfs-category-create .nfs-btn { min-width: 34px; padding-inline: 8px; }
.nfs-frame-category-list { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; max-height: 190px; overflow: auto; }
.nfs-frame-category-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, auto); gap: 5px; align-items: center; }
.nfs-frame-category-row > span { overflow: hidden; color: var(--text-muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.nfs-frame-category-row .nfs-input-text { min-width: 0; padding: 5px 7px; font-size: .7rem; }

.nfs-inline-asset-filter { display: flex; align-items: center; gap: 7px; margin: 7px 0; }
.nfs-inline-asset-filter > i { color: var(--primary); }
.nfs-inline-asset-filter .nfs-select { min-width: 0; padding-block: 5px; font-size: .7rem; }
.nfs-inline-assets-empty { padding: 18px 8px; color: var(--text-muted); font-size: .72rem; text-align: center; }

@media (max-width: 980px) {
    .nfs-home-grid { grid-template-columns: 1fr; }
    .nfs-model-panel { position: static; }
    .nfs-home-frame-list { max-height: none; }
}

@media (max-width: 640px) {
    .nfs-home { padding: 12px; }
    .nfs-home-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
    .nfs-bulk-bar { align-items: stretch; flex-direction: column; }
    .nfs-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nfs-pattern-presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
}

.nfs-pattern-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.nfs-pattern-preset-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.15);
}

.nfs-pattern-preset-btn.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
}

.nfs-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.nfs-pill-btn {
    padding: 4px 9px;
    font-size: 0.70rem;
    font-weight: 700;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.nfs-pill-btn:hover {
    color: var(--text-main);
    border-color: var(--primary);
}

.nfs-pill-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary, #ffffff);
}
