/* ===========================================
   ぬりえ - Coloring Book
   =========================================== */
/* Mobile Responsive Fixes */
@media (max-width: 480px) {
    .game-header {
        padding: 60px 10px 10px;
    }
    .level-badge {
        font-size: 0.9rem;
        padding: 5px 10px;
    }
    .home-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 10px;
        left: 10px;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Zen Maru Gothic', sans-serif;
    touch-action: pan-y;
    user-select: none;
}

body {
    background: linear-gradient(180deg, #FCE4EC 0%, #F8BBD9 50%, #F48FB1 100%);
}

.home-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    border: 3px solid #EC407A;
}

#game-container {
    max-width: 500px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.game-header {
    padding: 55px 15px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.title-badge {
    background: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 0 #BDBDBD;
}

.reset-btn {
    width: 45px;
    height: 45px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 3px 0 #BDBDBD;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

.screen.hidden {
    display: none;
}

/* Select Screen */
#select-screen {
    overflow-y: auto;
}

#select-screen h2 {
    font-size: 1.3rem;
    color: #5D4037;
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding-bottom: 20px;
}

.picture-btn {
    background: white;
    border: 3px solid #F8BBD9;
    border-radius: 15px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.picture-btn:active {
    transform: scale(0.95);
    border-color: #EC407A;
}

.pic-icon {
    font-size: 2rem;
}

.pic-name {
    font-size: 0.65rem;
    font-weight: bold;
    color: #5D4037;
}

/* Coloring Screen */
#color-screen {
    justify-content: flex-start;
}

.canvas-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 15px;
    min-height: 200px;
}

#coloring-canvas {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 400px;
    object-fit: contain;
    touch-action: none;
}

.coloring-region {
    fill: white;
    stroke: #333;
    stroke-width: 3;
    cursor: pointer;
    transition: fill 0.2s;
}

.coloring-region:hover {
    opacity: 0.9;
}

/* Palette */
.palette-area {
    background: white;
    border-radius: 15px;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.palette-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #5D4037;
    text-align: center;
    margin-bottom: 8px;
}

.color-palette {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.color-btn:active {
    transform: scale(0.9);
}

.color-btn.selected {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.selected-color {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #666;
}

.color-preview {
    width: 25px;
    height: 25px;
    border-radius: 6px;
    border: 2px solid #333;
}

.done-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #EC407A 0%, #D81B60 100%);
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 0 #AD1457;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}

.done-button:active {
    transform: translateY(5px);
    box-shadow: none;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.overlay.hidden {
    display: none;
}

.complete-modal {
    background: white;
    border-radius: 30px;
    padding: 25px;
    text-align: center;
    animation: modalPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 320px;
    width: 90%;
}

@keyframes modalPop {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

.clear-banner {
    width: 150px;
    margin-bottom: 10px;
}

.complete-modal h2 {
    font-size: 1.2rem;
    color: #EC407A;
    margin-bottom: 15px;
}

.artwork-display {
    background: #FFF8E1;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
}

.artwork-display svg {
    width: 120px;
    height: auto;
}

.btn-primary {
    background: linear-gradient(135deg, #EC407A 0%, #D81B60 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 0 #AD1457;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: none;
}