/**
 * public/css/css_battle.css
 * Stile dedicato per CSS Battle Studio & Esercizi CSS
 */

:root {
    --cb-bg: #0b0f19;
    --cb-surface: #111827;
    --cb-surface-light: #1f2937;
    --cb-border: #374151;
    --cb-accent: #f59e0b;
    --cb-accent-hover: #d97706;
    --cb-primary: #3b82f6;
    --cb-primary-hover: #2563eb;
    --cb-emerald: #10b981;
    --cb-rose: #ef4444;
    --cb-cyan: #06b6d4;
    --cb-text: #f9fafb;
    --cb-text-muted: #9ca3af;
    --cb-font-code: "Fira Code", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

body:has(.cb-app) .app-main,
body:has(#cbApp) .app-main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

body:has(.cb-app) .main-container,
body:has(#cbApp) .main-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem 1rem 2rem !important;
}

.cb-app {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0;
    padding: 0.5rem 0.5rem 2.5rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--cb-text);
    box-sizing: border-box;
}

.cb-app [hidden] {
    display: none !important;
}

/* -------------------------------------------------------------
   Hero Header
------------------------------------------------------------- */
.cb-hero {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    border: 1px solid var(--cb-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

.cb-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cb-hero-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cb-hero-icon {
    font-size: 2.25rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.35));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cb-hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    background: linear-gradient(135deg, #ffffff, #fef08a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cb-hero-sub {
    font-size: 0.95rem;
    color: var(--cb-text-muted);
    margin: 0;
    max-width: 700px;
    line-height: 1.45;
}

.cb-hero-stats {
    display: flex;
    gap: 0.75rem;
}

.cb-stat-pill {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cb-stat-label {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cb-stat-val {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--cb-font-code);
}

.cb-text-emerald {
    color: var(--cb-emerald);
}

/* -------------------------------------------------------------
   Navigation Bar
------------------------------------------------------------- */
.cb-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    flex-wrap: wrap;
}

.cb-nav-left, .cb-nav-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.cb-challenge-selector-wrap {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    padding: 0.25rem 0.4rem;
}

.cb-current-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.cb-badge-num {
    background: var(--cb-accent);
    color: #111827;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.cb-badge-title {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-badge-diff {
    color: #facc15;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* Buttons */
.cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.2;
}

.cb-btn-secondary {
    background: rgba(31, 41, 55, 0.9);
    border-color: var(--cb-border);
    color: var(--cb-text);
}
.cb-btn-secondary:hover {
    background: rgba(55, 65, 81, 0.9);
    border-color: #6b7280;
}

.cb-btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 1.1rem;
    background: transparent;
    border: none;
    color: var(--cb-text-muted);
    cursor: pointer;
    border-radius: 6px;
}
.cb-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.cb-btn-info {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    color: #67e8f9;
}
.cb-btn-info:hover {
    background: rgba(6, 182, 212, 0.3);
}

.cb-btn-ghost {
    background: transparent;
    border-color: var(--cb-border);
    color: var(--cb-text-muted);
}
.cb-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--cb-text);
}

.cb-btn-primary {
    background: var(--cb-primary);
    color: #ffffff;
}
.cb-btn-primary:hover {
    background: var(--cb-primary-hover);
}

.cb-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.cb-btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

/* Palette swatches */
.cb-palette-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
}

.cb-palette-label {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
}

.cb-palette-list {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.cb-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.cb-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    z-index: 2;
}

/* Hint collapsible box */
.cb-hint-box {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #cffafe;
    font-size: 0.9rem;
}

.cb-hint-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.cb-hint-text {
    flex: 1;
}

.cb-hint-close {
    background: transparent;
    border: none;
    color: #67e8f9;
    font-size: 1.25rem;
    cursor: pointer;
}

/* -------------------------------------------------------------
   Main Workspace Layout
------------------------------------------------------------- */
.cb-workspace {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) minmax(880px, 1.4fr);
    gap: 1.25rem;
    align-items: stretch;
}

@media (max-width: 1360px) {
    .cb-workspace {
        grid-template-columns: 1fr;
    }
}

.cb-panel {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.cb-panel-header {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid var(--cb-border);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Editor tabs & actions */
.cb-editor-tabs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cb-editor-tab {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cb-text);
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.cb-golf-badge {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    font-family: var(--cb-font-code);
}

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

.cb-btn-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--cb-text-muted);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cb-btn-tool:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Snippets Bar */
.cb-snippets-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #0d1321;
    border-bottom: 1px solid var(--cb-border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.cb-snippets-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cb-accent);
    white-space: nowrap;
    text-transform: uppercase;
}

.cb-snippets-list {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.cb-snippet-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-family: var(--cb-font-code);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.cb-snippet-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--cb-accent);
    color: #fef08a;
}

/* Autocomplete Suggestion Popup */
.cb-autocomplete-menu {
    position: absolute;
    z-index: 1000;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    max-height: 240px;
    width: 280px;
    overflow-y: auto;
    font-family: var(--cb-font-code);
    font-size: 0.85rem;
}

.cb-ac-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.1s ease;
}
.cb-ac-item:last-child {
    border-bottom: none;
}
.cb-ac-item:hover,
.cb-ac-item.is-selected {
    background: #1e3a8a;
    color: #ffffff;
}

.cb-ac-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-ac-match {
    color: #f59e0b;
    font-weight: 700;
}
.cb-ac-item.is-selected .cb-ac-match {
    color: #fde047;
}

.cb-ac-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.cb-ac-type-prop {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}
.cb-ac-type-val {
    background: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Editor Body with Line Numbers */
.cb-editor-body {
    display: flex;
    flex: 1;
    min-height: 480px;
    max-height: 600px;
    background: #0a0e17;
    position: relative;
    overflow: hidden;
}

.cb-line-numbers {
    width: 44px;
    padding: 1rem 0.5rem;
    background: #0f1422;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #4b5563;
    font-family: var(--cb-font-code);
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: right;
    user-select: none;
    overflow: hidden;
    white-space: pre-line;
}

.cb-textarea {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: var(--cb-font-code);
    font-size: 0.875rem;
    line-height: 1.5;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 2;
}

.cb-panel-footer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--cb-border);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cb-keyboard-hint {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
}

.cb-btn-submit {
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 700;
}

/* -------------------------------------------------------------
   Arena Modes & Viewers
------------------------------------------------------------- */
.cb-modes-group {
    display: flex;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    padding: 0.2rem;
    gap: 0.2rem;
}

.cb-mode-btn {
    background: transparent;
    border: none;
    color: var(--cb-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cb-mode-btn.is-active {
    background: var(--cb-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}
.cb-mode-btn:hover:not(.is-active) {
    color: var(--cb-text);
    background: rgba(255, 255, 255, 0.05);
}

.cb-zoom-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cb-arena-dim {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    font-family: var(--cb-font-code);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.cb-zoom-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--cb-text-muted);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}
.cb-zoom-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* Score Bar */
.cb-score-bar {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.8));
    border-bottom: 1px solid var(--cb-border);
    padding: 0.85rem 1.25rem;
}

.cb-score-meter-wrap {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.cb-score-ring-wrap {
    position: relative;
    width: 58px;
    height: 58px;
    flex-shrink: 0;
}

.cb-score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.cb-score-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3.5;
}

.cb-score-circle {
    fill: none;
    stroke: var(--cb-accent);
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

.cb-score-val {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: var(--cb-font-code);
}

.cb-score-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.2rem;
    color: var(--cb-text);
}

.cb-score-sub {
    font-size: 0.8rem;
    color: var(--cb-text-muted);
    line-height: 1.35;
}

/* Arena View Wrap */
.cb-arena-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: #070a12;
    min-height: 400px;
    position: relative;
    overflow-x: auto;
}

/* Split View: 2 Boxes side by side */
.cb-view-split {
    display: flex;
    flex-direction: row;
    gap: 1.25rem;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
}

.cb-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 400px;
}

@media (max-width: 860px) {
    .cb-view-split {
        flex-direction: column;
        flex-wrap: wrap;
    }
    .cb-preview-box {
        flex: 0 0 auto;
    }
}

.cb-box-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cb-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cb-canvas-frame {
    width: 400px;
    height: 300px;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--cb-border);
    position: relative;
    transform-origin: center center;
    transition: transform 0.2s ease;
}

.cb-render-frame {
    width: 400px;
    height: 300px;
    border: none;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* Stacked View: Slider, Onion Skin & DiffMap */
.cb-view-stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cb-stacked-frame {
    width: 400px;
    height: 300px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--cb-border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    background: #000000;
    user-select: none;
}

.cb-layer {
    position: absolute;
    inset: 0;
    width: 400px;
    height: 300px;
}

.cb-layer-target {
    z-index: 1;
}

.cb-layer-user {
    z-index: 2;
    overflow: hidden;
}

.cb-diff-canvas {
    position: absolute;
    inset: 0;
    width: 400px;
    height: 300px;
    z-index: 3;
    pointer-events: none;
}

/* Slider Handle */
.cb-slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    margin-left: -20px;
    z-index: 10;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8), 0 0 12px var(--cb-primary);
}

.cb-handle-knob {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Onion control slider */
.cb-onion-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--cb-border);
    border-radius: 20px;
    padding: 0.4rem 1rem;
}

.cb-onion-label {
    font-size: 0.8rem;
    color: var(--cb-text-muted);
}

#cbOnionSlider {
    width: 180px;
    cursor: pointer;
    accent-color: var(--cb-accent);
}

/* -------------------------------------------------------------
   Modal / Dialog Styles
------------------------------------------------------------- */
.cb-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: cbFadeIn 0.2s ease;
}

.cb-modal-dialog {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 16px;
    width: 100%;
    max-width: 980px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.cb-dialog-sm {
    max-width: 600px;
}

.cb-modal-header {
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--cb-border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cb-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.cb-modal-close {
    background: transparent;
    border: none;
    color: var(--cb-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
}
.cb-modal-close:hover {
    color: #ffffff;
}

.cb-modal-filters {
    padding: 1rem 1.5rem;
    background: rgba(17, 24, 39, 0.6);
    border-bottom: 1px solid var(--cb-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cb-search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: #0f172a;
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    color: var(--cb-text);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}
.cb-search-input:focus {
    border-color: var(--cb-primary);
}

.cb-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cb-filter-group {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.cb-filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cb-border);
    color: var(--cb-text-muted);
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cb-filter-chip.is-active {
    background: var(--cb-primary);
    border-color: var(--cb-primary);
    color: #ffffff;
}
.cb-filter-chip:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.cb-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cb-modal-footer {
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--cb-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Challenges Grid */
.cb-challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.cb-challenge-card {
    background: #0f172a;
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}
.cb-challenge-card:hover {
    transform: translateY(-3px);
    border-color: var(--cb-accent);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.cb-challenge-card.is-completed {
    border-color: var(--cb-emerald);
}
.cb-challenge-card.is-active {
    outline: 2px solid var(--cb-primary);
}

.cb-card-thumb-wrap {
    height: 120px;
    background: #000000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cb-card-iframe {
    width: 400px;
    height: 300px;
    transform: scale(0.38);
    transform-origin: center center;
    border: none;
    pointer-events: none;
}

.cb-card-badge-status {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(16, 185, 129, 0.9);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.cb-card-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.cb-card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cb-card-num {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--cb-accent);
}

.cb-card-stars {
    color: #facc15;
    font-size: 0.75rem;
}

.cb-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-card-score {
    font-size: 0.75rem;
    color: var(--cb-text-muted);
    font-family: var(--cb-font-code);
}

/* Solution Modal styling */
.cb-sol-intro {
    font-size: 0.9rem;
    color: var(--cb-text-muted);
    margin-top: 0;
}

.cb-sol-code {
    background: #070a12;
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--cb-font-code);
    font-size: 0.85rem;
    color: #a5f3fc;
    overflow-x: auto;
    max-height: 350px;
}

/* Celebration Toast */
.cb-celebration-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff;
    border-radius: 14px;
    padding: 1rem 1.75rem;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.6);
    z-index: 10000;
    animation: cbBounce 0.5s ease;
}

.cb-celeb-badge {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.cb-celeb-text {
    font-size: 0.9rem;
}

/* Toast for color copy */
.cb-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--cb-border);
    color: #ffffff;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: cbSlideUp 0.25s ease;
}

/* SEO Content */
.cb-seo-section {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .cb-seo-section {
        grid-template-columns: 1fr;
    }
}

.cb-seo-card {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.cb-seo-card h2 {
    font-size: 1.25rem;
    color: #f8fafc;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.cb-seo-card p {
    font-size: 0.925rem;
    color: var(--cb-text-muted);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

/* Animations */
@keyframes cbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cbBounce {
    0% { transform: translate(-50%, -20px) scale(0.9); opacity: 0; }
    50% { transform: translate(-50%, 5px) scale(1.03); }
    100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

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