/* =============================================
   HAPPY CRAYONS CLUB - CSS Design System
   A playful, colorful design for kids
   ============================================= */

/* CSS Variables */
:root {
    /* Brand Colors */
    --color-red: #B10714;
    --color-orange: #B71B1E;
    --color-yellow: #E1B505;
    --color-green: #098D58;
    --color-cyan: #098D58;
    --color-blue: #008EC7;
    --color-purple: #008EC7;
    --color-pink: #B71B1E;

    /* UI Colors */
    --color-bg: #FFF9E6;
    --color-bg-gradient: linear-gradient(135deg, #FFF9E6 0%, #E8F4FF 50%, #E8FFF2 100%);
    --color-card-bg: #FFFFFF;
    --color-text: #2D3436;
    --color-text-light: #636E72;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-rainbow: 0 8px 32px rgba(177, 7, 20, 0.2),
        0 8px 32px rgba(0, 142, 199, 0.2);

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    --radius-full: 50%;

    /* Typography */
    --font-display: 'Baloo 2', cursive;
    --font-body: 'Nunito', sans-serif;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg-gradient);
    min-height: 100vh;
    color: var(--color-text);
    overflow-x: hidden;
    position: relative;
}

/* Floating Decorations */
.floating-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.crayon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.crayon-1 {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.crayon-2 {
    top: 20%;
    right: 10%;
    animation-delay: 1s;
}

.crayon-3 {
    top: 50%;
    left: 3%;
    animation-delay: 2s;
}

.crayon-4 {
    top: 60%;
    right: 5%;
    animation-delay: 3s;
}

.crayon-5 {
    top: 80%;
    left: 8%;
    animation-delay: 4s;
}

.crayon-6 {
    top: 85%;
    right: 15%;
    animation-delay: 5s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-20px) rotate(5deg);
    }

    50% {
        transform: translateY(-10px) rotate(-5deg);
    }

    75% {
        transform: translateY(-25px) rotate(3deg);
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 50%, var(--color-blue) 100%);
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 3.5rem;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.logo-text {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.word-happy {
    color: var(--color-yellow);
    text-shadow: 3px 3px 0 var(--color-orange);
}

.word-crayons {
    color: white;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
}

.word-club {
    color: var(--color-cyan);
    text-shadow: 3px 3px 0 var(--color-green);
}

.tagline {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: white;
    opacity: 0.95;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 1;
    }
}

/* Welcome Instructions Section */
.welcome-section {
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE8F5 100%);
}

.welcome-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.welcome-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.instruction-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: var(--transition-bounce);
}

.instruction-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.instruction-step {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
    color: white;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.instruction-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.instruction-text {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text);
    margin: 0;
}

/* Filter Section */
.filter-section {
    padding: 2rem 1rem;
    background: var(--color-card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: 3px solid transparent;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: var(--shadow-sm);
}

.filter-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-purple) 100%);
    color: white;
    border-color: white;
    box-shadow: var(--shadow-rainbow);
}

.filter-btn .btn-icon {
    font-size: 1.3rem;
}

/* Gallery Section */
.gallery-section {
    padding: 2rem 1rem;
    min-height: 60vh;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Gallery Card */
.gallery-card {
    background: var(--color-card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition-bounce);
    cursor: pointer;
    position: relative;
}

.gallery-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
            var(--color-red),
            var(--color-orange),
            var(--color-yellow),
            var(--color-green),
            var(--color-blue),
            var(--color-purple));
}

.gallery-card:hover {
    transform: translateY(-8px) rotate(-1deg);
    box-shadow: var(--shadow-lg);
}

.gallery-card:nth-child(even):hover {
    transform: translateY(-8px) rotate(1deg);
}

.card-image-container {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition-normal);
}

.gallery-card:hover .card-image {
    transform: scale(1.05);
}

.card-info {
    padding: 1rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    text-transform: capitalize;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-green) 100%);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s var(--transition-bounce);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--color-red);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.modal-close:hover {
    transform: scale(1.1) rotate(90deg);
    background: #e55a5a;
}

/* Compact Modal Styles */
.modal-content.compact {
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-blue) 100%);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: white;
    margin: 0 0 0.25rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.modal-subtitle {
    font-family: var(--font-display);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.modal-image-container.compact {
    aspect-ratio: auto;
    max-height: 200px;
    padding: 1rem;
    background: white;
}

.modal-image-container.compact .modal-image {
    max-height: 180px;
    width: auto;
}

/* Choice Buttons */
.modal-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.choice-btn:hover {
    transform: translateX(5px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.choice-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.choice-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.choice-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
}

.choice-desc {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Choice Button Colors */
.color-choice {
    border-color: var(--color-orange);
    background: linear-gradient(135deg, #fff5eb 0%, #fff 100%);
}

.color-choice:hover {
    background: linear-gradient(135deg, var(--color-orange) 0%, var(--color-pink) 100%);
}

.color-choice:hover .choice-title,
.color-choice:hover .choice-desc {
    color: white;
}

.print-choice {
    border-color: var(--color-blue);
    background: linear-gradient(135deg, #e8f4ff 0%, #fff 100%);
}

.print-choice:hover {
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-purple) 100%);
}

.print-choice:hover .choice-title,
.print-choice:hover .choice-desc {
    color: white;
}

.download-choice {
    border-color: var(--color-green);
    background: linear-gradient(135deg, #e8fff0 0%, #fff 100%);
}

.download-choice:hover {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-cyan) 100%);
}

.download-choice:hover .choice-title,
.download-choice:hover .choice-desc {
    color: white;
}

.modal-image-container {
    width: 100%;
    aspect-ratio: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: var(--shadow-sm);
}

.print-btn {
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-purple) 100%);
    color: white;
}

.download-btn {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-cyan) 100%);
    color: white;
}

.action-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.action-btn .btn-icon {
    font-size: 1.3rem;
}

.color-btn {
    background: linear-gradient(135deg, var(--color-orange) 0%, var(--color-pink) 100%);
    color: white;
}

/* =============================================
   COLORING STUDIO
   ============================================= */

.coloring-studio {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.coloring-studio.active {
    display: block;
}

.studio-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    color: white;
}

.studio-loader.active {
    display: flex;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loader-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.studio-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

/* Main Studio Area - Canvas + Sidebar */
.studio-main {
    display: flex;
    flex: 1;
    gap: 1rem;
    min-height: 0;
}

/* Studio Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.studio-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.studio-close {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--color-red);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.studio-close:hover {
    transform: scale(1.1) rotate(90deg);
    background: #e55a5a;
}

/* Canvas Area */
.canvas-wrapper {
    flex: 1;
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

#coloringCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 2;
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.canvas-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
}

/* Toolbar - Vertical Sidebar */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    position: relative;
    z-index: 10;
}

.tool-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    position: relative;
    z-index: 11;
}

.tool-label {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: white;
    opacity: 0.9;
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    justify-content: center;
}

.color-btn-swatch {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-btn-swatch:hover {
    transform: scale(1.2);
}

.color-btn-swatch.active {
    border-color: white;
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Brush Sizes */
.brush-sizes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.brush-btn {
    width: 44px;
    height: 44px;
    border: 3px solid transparent;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.brush-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.brush-btn.active {
    border-color: var(--color-cyan);
    background: rgba(99, 230, 190, 0.3);
}

.brush-preview {
    background: white;
    border-radius: var(--radius-full);
    min-width: 12px !important;
    min-height: 12px !important;
}

/* Tool Buttons */
.tool-buttons {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tool-btn.active {
    border-color: var(--color-yellow);
    background: rgba(255, 224, 102, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn-small {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.action-btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.action-btn-small.save {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-cyan) 100%);
}

.action-btn-small.save:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(105, 219, 124, 0.4);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-level {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    min-width: 50px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
}

.zoom-reset-btn {
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    transition: var(--transition-bounce);
}

.zoom-reset-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

/* Canvas zoom transform origin */
#coloringCanvas {
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

.canvas-image {
    transition: transform 0.15s ease-out;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-blue) 100%);
    padding: 2rem 1rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-text {
    font-family: var(--font-display);
    font-size: 1rem;
    color: white;
    margin-bottom: 1rem;
}

.footer-icons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 1.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Loading State */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-left: 1rem;
    border: 4px solid var(--color-purple);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-text-light);
}

/* Responsive */
/* Scroll Hint */
.scroll-hint {
    display: none;
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-display);
    pointer-events: none;
    z-index: 100;
    animation: bounceHint 2s infinite;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

@keyframes bounceHint {

    0%,
    100% {
        transform: translate(-50%, 0);
        opacity: 0.8;
    }

    50% {
        transform: translate(-50%, -5px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .logo-section {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-icon {
        font-size: 2.5rem;
    }

    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .modal-content {
        margin: 1rem;
    }

    .action-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Mobile Studio Layout Optimization */
    .studio-container {
        padding: 0.5rem;
        position: relative;
        /* Context for scroll hint */
    }

    .studio-header {
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }

    .studio-title {
        font-size: 1.4rem;
    }

    .studio-close {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .studio-main {
        flex-direction: column;
        gap: 0.5rem;
        overflow: hidden;
        /* Prevent body scroll */
        position: relative;
        /* Context for children */
    }

    /* Canvas takes priority space */
    /* Canvas takes priority space */
    .canvas-wrapper {
        width: 100%;
        flex: none;
        /* Disable flex scaling */
        height: 65vh;
        /* Rigid height */
        min-height: 0;
        /* Override previous min-height */
        border-radius: var(--radius-sm);
        position: relative;
        /* Ensure overlapping context */
    }

    #coloringCanvas,
    #overlayCanvas {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        touch-action: none;
    }

    #overlayCanvas {
        pointer-events: none;
        /* Let clicks pass through to drawing canvas */
        z-index: 20;
        /* Above line art (if line art was separate) but here line art is img */
    }

    /* Note: canvasImage (line art) is visually on top via z-index or stacking if we move it?
       Currently canvasImage is just an <img>. Let's ensure proper stacking.
       We want: 
       1. coloringCanvas (Bottom)
       2. canvasImage (Middle - Transparent PNG) - Wait, if this covers the canvas, we can't draw?
          Actually, existing CSS might have canvasImage using pointer-events: none?
          Let's check. If not, the current app relies on canvas being on top? 
          Ah, checked previous view_file: canvasImage has class "canvas-image". 
          Usually line art is on top. If line art is an <img> on top, touches might be blocked unless pointer-events: none.
    */

    .canvas-image {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        /* Centering logic from app.js */
        max-width: 95%;
        max-height: 95%;
        pointer-events: none;
        /* Click through lines */
        z-index: 10;
        opacity: 0.8;
        /* Slight check */
    }

    #overlayCanvas {
        z-index: 15;
        /* Above line art image? Or below? 
           If line art is black lines, we want highlight BELOW lines but ABOVE color.
           So z-index: 5 (above color), Image is 10.
        */
        z-index: 100;
        /* Actually, for a highlight "Marquee", seeing it ON TOP of lines is clearer so user knows they are selecting THAT area. */
    }

    /* Toolbar moves to bottom and becomes horizontal */
    .toolbar {
        width: 100%;
        height: 35vh;
        /* Rigid height */
        flex: none;
        max-height: none;
        /* Remove constraints */

        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        /* Center items */
        align-items: flex-start;
        padding: 0.5rem;
        padding-bottom: 5rem;
        /* Generous space for scrolling */
        gap: 0.5rem;
        row-gap: 0.8rem;
        /* Space between rows */

        overflow-y: auto;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .tool-section {
        padding: 0.3rem;
        gap: 0.2rem;
        /* Make sections more compact */
    }

    .tool-label {
        font-size: 0.7rem;
        display: none;
        /* Hide labels to save space if needed */
    }

    /* Adjust specific tool groupings for horizontal layout */
    .tool-buttons,
    .action-buttons,
    .zoom-controls {
        gap: 0.3rem;
    }

    .tool-btn,
    .action-btn-small {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    /* Make color palette horizontal scrollable single row or compact grid */
    .color-palette {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        max-width: 100%;
        gap: 0.2rem;
        justify-content: flex-start;
    }

    .color-btn-swatch {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
    }

    /* Ensure specific sections don't grow too wide */
    .brush-sizes {
        display: flex;
    }

    .brush-btn {
        width: 36px;
        height: 36px;
    }

    /* Show scroll hint */
    .scroll-hint {
        display: block;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        grid-template-columns: 1fr;
    }

    .filter-container {
        gap: 0.5rem;
    }

    .filter-btn .btn-text {
        display: none;
    }

    .filter-btn .btn-icon {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
    }

    .header,
    .filter-section,
    .footer,
    .floating-decorations {
        display: none !important;
    }

    .modal-content {
        box-shadow: none !important;
    }

    .modal-actions {
        display: none !important;
    }

    .modal-close {
        display: none !important;
    }

    .modal-image-container {
        padding: 0 !important;
    }

    .modal-image {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* =========================================
   Share Features
   ========================================= */

/* Footer QR */
.footer-qr {
    margin: 15px 0;
    text-align: center;
}

.qr-code-footer {
    width: 80px;
    height: 80px;
    border: 4px solid white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.qr-code-footer:hover {
    transform: scale(1.1);
}

.footer-qr p {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    font-weight: bold;
}

/* Share Modal Specifics */
.share-modal-content {
    max-width: 400px;
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #fff5f8 100%);
    border: 4px solid #FF1493;
}

.share-qr-wrapper {
    margin: 20px 0;
    padding: 10px;
    background: white;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.2);
}

.qr-code-large {
    width: 200px;
    height: 200px;
    display: block;
}

.share-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

#shareLinkInput {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 60%;
    font-family: inherit;
    color: #555;
    background: #f9f9f9;
}

#copyLinkBtn {
    background: #FF1493;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

#copyLinkBtn:hover {
    background: #d10d7a;
}

/* Share Button in Header */
#shareBtn {
    background: #FF69B4;
    color: white;
    border: 2px solid white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

#shareBtn:hover {
    background: #FF1493;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}