@import url('https://fonts.googleapis.com/css2?family=Creepster&family=Fredoka+One&display=swap');

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

body {
    background: #0a0a12;
    color: #e0e0e0;
    font-family: 'Fredoka One', cursive;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Sparkle background */
#sparkle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 2s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
}

/* ===== TITLE SCREEN ===== */
#title-screen {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255,20,147,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139,0,255,0.08) 0%, transparent 50%),
        #0a0a12;
}

/* Web corners */
#title-screen::before,
#title-screen::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background:
        radial-gradient(circle at 0% 0%, transparent 30%, rgba(139,0,255,0.08) 31%, transparent 32%),
        radial-gradient(circle at 0% 0%, transparent 50%, rgba(139,0,255,0.06) 51%, transparent 52%),
        radial-gradient(circle at 0% 0%, transparent 70%, rgba(139,0,255,0.04) 71%, transparent 72%),
        radial-gradient(circle at 0% 0%, transparent 90%, rgba(139,0,255,0.03) 91%, transparent 92%);
    pointer-events: none;
}

#title-screen::before {
    top: 0;
    left: 0;
}

#title-screen::after {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.skull-logo {
    font-size: 80px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 20px rgba(255, 20, 147, 0.6));
    animation: skullFloat 3s ease-in-out infinite;
}

@keyframes skullFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#title-screen h1 {
    font-family: 'Creepster', cursive;
    font-size: 4.5rem;
    background: linear-gradient(135deg, #ff1493, #ff69b4, #8b00ff, #00ced1);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
    line-height: 1.1;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.3rem;
    color: #ff69b4;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.3);
}

.title-features {
    display: flex;
    gap: 30px;
    margin-bottom: 35px;
    flex-wrap: wrap;
    justify-content: center;
}

.title-feature {
    font-size: 0.9rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.title-feature span {
    font-size: 1.3rem;
}

#play-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    padding: 18px 55px;
    background: linear-gradient(135deg, #ff1493, #8b00ff);
    color: white;
    border: 3px solid #ff69b4;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 30px rgba(255, 20, 147, 0.3), inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

#play-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
    animation: btnShine 3s ease-in-out infinite;
}

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

#play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 50px rgba(255, 20, 147, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.15);
    border-color: #fff;
}

/* ===== GAME SCREEN ===== */
#game-screen {
    position: relative;
    z-index: 1;
    padding: 10px 15px;
}

.game-title {
    font-family: 'Creepster', cursive;
    font-size: 1.8rem;
    text-align: center;
    background: linear-gradient(135deg, #ff1493, #8b00ff, #00ced1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

#game-area {
    display: flex;
    gap: 15px;
    max-width: 1050px;
    margin: 0 auto;
    align-items: flex-start;
}

/* ===== TOOL PANEL ===== */
#tool-panel {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(30, 15, 50, 0.95), rgba(20, 10, 35, 0.95));
    border: 2px solid rgba(255, 20, 147, 0.4);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.1), inset 0 0 30px rgba(139, 0, 255, 0.05);
    max-height: 640px;
    overflow-y: auto;
}

#tool-panel h2 {
    text-align: center;
    font-size: 1.1rem;
    color: #ff69b4;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(255, 105, 180, 0.3);
}

.tool-section {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 20, 147, 0.15);
}

.tool-section:last-of-type {
    border-bottom: none;
}

.tool-section h3 {
    font-size: 0.85rem;
    color: #00ced1;
    margin-bottom: 6px;
    text-shadow: 0 0 6px rgba(0, 206, 209, 0.3);
}

.tool-btn {
    font-family: 'Fredoka One', cursive;
    display: block;
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 4px;
    background: rgba(50, 20, 70, 0.6);
    color: #d0d0d0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s;
    text-align: left;
}

.tool-btn:hover {
    background: rgba(255, 20, 147, 0.15);
    border-color: rgba(255, 20, 147, 0.4);
    color: #fff;
}

.tool-btn.active {
    background: linear-gradient(135deg, rgba(255, 20, 147, 0.25), rgba(139, 0, 255, 0.25));
    border-color: #ff1493;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.2);
    color: #fff;
}

.color-row {
    margin: 6px 0;
}

.color-row span {
    font-size: 0.7rem;
    color: #888;
    display: block;
    margin-bottom: 3px;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #888;
}

.color-btn:hover {
    transform: scale(1.2);
    border-color: #ff69b4;
}

.color-btn.selected {
    border-color: #ff1493;
    box-shadow: 0 0 8px rgba(255, 20, 147, 0.6);
    transform: scale(1.15);
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    margin: 5px 0;
}

.sticker-btn {
    padding: 5px;
    font-size: 1.2rem;
    background: rgba(50, 20, 70, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sticker-btn:hover {
    background: rgba(255, 20, 147, 0.2);
    transform: scale(1.1);
}

.sticker-btn.selected {
    border-color: #ff1493;
    background: rgba(255, 20, 147, 0.2);
}

/* Accessory buttons */
.accessory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin: 5px 0;
}

.accessory-btn {
    font-family: 'Fredoka One', cursive;
    padding: 6px 4px;
    font-size: 0.72rem;
    background: rgba(50, 20, 70, 0.5);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.accessory-btn:hover {
    background: rgba(255, 20, 147, 0.2);
    border-color: rgba(255, 20, 147, 0.4);
}

.accessory-btn.active {
    background: rgba(255, 20, 147, 0.25);
    border-color: #ff1493;
    color: #fff;
}

#reset-btn {
    font-family: 'Fredoka One', cursive;
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: rgba(220, 20, 60, 0.15);
    color: #ff6b6b;
    border: 2px solid rgba(220, 20, 60, 0.4);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

#reset-btn:hover {
    background: rgba(220, 20, 60, 0.3);
    border-color: #dc143c;
}

/* ===== CANVAS ===== */
#canvas-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
}

#character-canvas {
    background: linear-gradient(180deg, #12091f 0%, #1a0e30 30%, #0f0a1a 100%);
    border: 3px solid rgba(255, 20, 147, 0.5);
    border-radius: 15px;
    cursor: crosshair;
    box-shadow:
        0 0 30px rgba(255, 20, 147, 0.15),
        0 0 60px rgba(139, 0, 255, 0.1),
        inset 0 0 40px rgba(139, 0, 255, 0.05);
}

#stickers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sticker {
    position: absolute;
    font-size: 24px;
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s;
    filter: drop-shadow(0 0 4px rgba(255, 20, 147, 0.5));
}

.sticker:hover {
    transform: scale(1.2);
}

/* ===== RIGHT PANEL (Accessories) ===== */
#accessory-panel {
    width: 220px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(30, 15, 50, 0.95), rgba(20, 10, 35, 0.95));
    border: 2px solid rgba(0, 206, 209, 0.4);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 0 20px rgba(0, 206, 209, 0.1), inset 0 0 30px rgba(139, 0, 255, 0.05);
    max-height: 640px;
    overflow-y: auto;
}

#accessory-panel h2 {
    text-align: center;
    font-size: 1.1rem;
    color: #00ced1;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(0, 206, 209, 0.3);
}

.hidden {
    display: none !important;
}

/* Scrollbar styling */
#tool-panel::-webkit-scrollbar,
#accessory-panel::-webkit-scrollbar {
    width: 5px;
}

#tool-panel::-webkit-scrollbar-track,
#accessory-panel::-webkit-scrollbar-track {
    background: transparent;
}

#tool-panel::-webkit-scrollbar-thumb,
#accessory-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 20, 147, 0.3);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 900px) {
    #title-screen h1 {
        font-size: 3rem;
    }

    #game-area {
        flex-direction: column;
        align-items: center;
    }

    #tool-panel,
    #accessory-panel {
        width: 100%;
        max-width: 500px;
        max-height: none;
    }

    #tool-panel { order: 2; }
    #canvas-container { order: 1; }
    #accessory-panel { order: 3; }

    #character-canvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
}
