:root {
    --primary-color: #FF6E40;
    --secondary-color: #448AFF;
    --bg-color: #F0F4F8;
    --card-bg: #FFFFFF;
    --text-color: #37474F;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius: 20px;
}

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

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%, #FECFEF 100%);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.main-header h1 {
    font-size: 2.5rem;
    color: #D81B60;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0px #FFF;
}

.main-header p {
    font-size: 1.2rem;
    color: #880E4F;
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* AdSense Styles */
.ad-container {
    width: 100%;
    max-width: 728px;
    background-color: #fff;
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.ad-label {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder {
    min-height: 90px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

/* Coloring Interface */
.coloring-interface {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.canvas-wrapper {
    position: relative;
    border: 4px solid #333;
    border-radius: 10px;
    overflow: hidden;
    background-color: #fff;
    cursor: crosshair;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    /* Ensure wrapper fits content */
    display: inline-block;
}

canvas {
    display: block;
    /* Canvas size will be set by JS, but max-width ensures responsiveness */
    max-width: 100%;
    height: auto;
}

#coloringImage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas */
    mix-blend-mode: multiply;
    /* White becomes transparent */
    user-select: none;
}

.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

.color-swatch.active {
    border-color: #333;
    transform: scale(1.1);
}

.tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tool-group label {
    font-weight: 600;
    color: var(--text-color);
}

input[type="range"] {
    width: 150px;
    accent-color: var(--secondary-color);
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary {
    background-color: #FF5252;
    color: white;
}

.main-footer {
    margin-top: auto;
    padding: 1rem;
    text-align: center;
    background-color: #37474F;
    color: #CFD8DC;
}

@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2rem;
    }

    .tools {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        justify-content: center;
    }

    .tool-group {
        justify-content: center;
    }
}

/* Print Styles */
@media print {

    .main-header,
    .ad-container,
    .controls,
    .main-footer {
        display: none !important;
    }

    .container {
        margin: 0;
        padding: 0;
        max-width: none;
    }

    .coloring-interface {
        box-shadow: none;
        padding: 0;
    }

    .canvas-wrapper {
        border: none;
        box-shadow: none;
    }

    body {
        background-color: white;
    }
}