:root {
    --primary: #ff4081;
    --primary-hover: #f50057;
    --primary-light: #fce4ec;
    --accent: #7c4dff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-page: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-title, .tool-name, .cat-pill, .btn-studio-action {
    font-family: 'Fredoka', cursive, sans-serif;
    letter-spacing: 0.3px;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

/* ========================================================= */
/* HEADER                                                    */
/* ========================================================= */
.site-header {
    background: #ffffff;
    border-bottom: 2px solid #eef2f6;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.brand-icon {
    font-size: 28px;
    background: #fce4ec;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(255,64,129,0.15);
}

.brand-title {
    font-size: 22px;
    font-weight: 700;
    color: #c2185b;
    line-height: 1.1;
}

.brand-sub {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Search Box */
.header-search {
    flex: 1;
    max-width: 420px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 15px;
    color: #94a3b8;
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: 10px 38px 10px 40px;
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 25px;
    font-size: 14px;
    color: #334155;
    outline: none;
    transition: all 0.2s ease;
}

.header-search input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,64,129,0.15);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
}

/* Link to Steps in Header */
.nav-pill-steps {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #009688, #00796b);
    color: #ffffff !important;
    padding: 9px 18px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,150,136,0.25);
    transition: all 0.2s ease;
}

.nav-pill-steps:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,150,136,0.35);
}

/* ========================================================= */
/* HERO BANNER                                               */
/* ========================================================= */
.hero-banner {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: #ffffff;
    padding: 40px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--bg-page);
    border-radius: 50% 50% 0 0;
}

.hero-title {
    font-size: 34px;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.hero-title .highlight {
    color: #fef08a;
}

.hero-desc {
    font-size: 16px;
    color: #fdf2f8;
    max-width: 620px;
    margin: 0 auto;
}

/* ========================================================= */
/* CATEGORIES / APPS FILTER TABS                             */
/* ========================================================= */
.category-filter-bar {
    max-width: 1300px;
    margin: 25px auto 10px;
    padding: 0 20px;
}

.category-pills {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.cat-pill {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    color: #475569;
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.cat-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(255,64,129,0.25);
}

/* ========================================================= */
/* DRAWINGS GRID                                             */
/* ========================================================= */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.section-title {
    font-size: 24px;
    color: var(--text-main);
}

.items-count-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.drawings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}

/* Drawing Card */
.drawing-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.drawing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.card-img-wrap {
    height: 190px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

.card-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.drawing-card:hover .card-img {
    transform: scale(1.06);
}

.card-ref-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    overflow: hidden;
    background: #ffffff;
}

.card-ref-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
    text-transform: capitalize;
    margin-bottom: 8px;
}

.card-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
}

/* Skeleton Loading */
.skeleton-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    height: 260px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    animation: skeletonShimmer 1.4s infinite;
}

@keyframes skeletonShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

/* ========================================================= */
/* VIEW 2: INTERACTIVE COLORING STUDIO                       */
/* ========================================================= */
.studio-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 15px 20px 40px;
}

.studio-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.studio-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-back:hover {
    background: #e2e8f0;
}

.studio-drawing-title {
    font-size: 22px;
    color: var(--text-main);
    text-transform: capitalize;
}

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

.btn-studio-action {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.btn-studio-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-download {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-download:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-steps-link {
    background: #e0f2f1;
    border-color: #b2dfdb;
    color: #00796b;
}

.btn-steps-link:hover {
    background: #b2dfdb;
    color: #004d40;
}

/* Studio Workspace Grid */
.studio-workspace {
    display: grid;
    grid-template-columns: 160px 1fr 280px;
    gap: 18px;
    align-items: start;
}

/* Left Toolbox */
.studio-toolbox {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.toolbox-group {
    margin-bottom: 20px;
}

.toolbox-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    transition: all 0.15s ease;
}

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

.tool-btn.active {
    background: #fce4ec;
    border-color: var(--primary);
    color: #c2185b;
    box-shadow: 0 2px 6px rgba(255,64,129,0.2);
}

.tool-icon {
    font-size: 18px;
}

.brush-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--primary);
}

.btn-toggle-ref {
    width: 100%;
    background: #fff7ed;
    border: 1px solid #ffedd5;
    color: #c2410c;
    padding: 9px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Center Canvas Card */
.studio-canvas-area {
    position: relative;
    display: flex;
    justify-content: center;
}

.canvas-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 624px;
    width: 100%;
    position: relative;
}

#colorCanvas {
    max-width: 100%;
    height: auto;
    background: #ffffff;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
    box-shadow: 0 0 0 1px #f1f5f9;
}

.canvas-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    border-radius: var(--radius-md);
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid #f1f5f9;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Floating Reference Card */
.reference-card {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 170px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 2px solid #fce4ec;
    overflow: hidden;
    z-index: 50;
    animation: fadeInDown 0.2s ease;
}

.ref-header {
    background: #fce4ec;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #c2185b;
}

.ref-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #c2185b;
}

.ref-img-wrap {
    height: 140px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Right Palette Box */
.studio-palette-box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.palette-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
}

.pal-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
}

.pal-tab.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.swatches-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.swatch-btn {
    height: 42px;
    border-radius: 10px;
    border: 3px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.swatch-btn:hover {
    transform: scale(1.1);
}

.swatch-btn.active {
    transform: scale(1.12);
    box-shadow: 0 0 0 3px #1e293b;
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.color-preview-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.custom-color-info {
    flex: 1;
}

.custom-color-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}

#customColorPicker {
    width: 100%;
    height: 28px;
    border: none;
    cursor: pointer;
    background: none;
}

/* ========================================================= */
/* FOOTER                                                    */
/* ========================================================= */
.site-footer {
    background: #ffffff;
    border-top: 1px solid #eef2f6;
    margin-top: 60px;
    padding: 30px 20px;
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand .footer-logo {
    font-size: 18px;
    font-weight: 700;
    color: #c2185b;
    font-family: 'Fredoka', cursive, sans-serif;
}

.footer-brand p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.footer-links {
    display: flex;
    gap: 20px;
    font-size: 14px;
    font-weight: 600;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copy {
    font-size: 12px;
    color: #94a3b8;
    width: 100%;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
    margin-top: 10px;
}

/* ========================================================= */
/* RESPONSIVE DESIGN                                         */
/* ========================================================= */
@media (max-width: 992px) {
    .studio-workspace {
        grid-template-columns: 1fr;
    }
    .studio-toolbox {
        order: 2;
    }
    .tools-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .tool-btn {
        flex: 1;
        justify-content: center;
    }
    .studio-palette-box {
        order: 3;
    }
    .swatches-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-title { font-size: 26px; }
    .header-container { flex-wrap: wrap; }
    .header-search { order: 3; max-width: 100%; margin-top: 6px; }
    .drawings-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .studio-topbar { flex-direction: column; align-items: stretch; }
    .studio-actions { justify-content: space-between; }
    .btn-studio-action { flex: 1; justify-content: center; }
    .swatches-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 480px) {
    .drawings-grid { grid-template-columns: 1fr; }
    .swatches-grid { grid-template-columns: repeat(5, 1fr); }
}
