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

body {
    font-family: 'Kalam', cursive;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-x: hidden;
}

/* Sticker Panels */
.sticker-panel {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    background: linear-gradient(145deg, #2c1810, #4a2c1a);
    border: 2px solid #d4af37;
    border-radius: 15px;
    padding: 1rem 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    transition: all 0.3s ease;
}

.left-panel {
    left: 20px;
}

.right-panel {
    right: 20px;
}

.sticker-panel:hover {
    width: 100px;
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.3);
}

.sticker-panel h3 {
    font-family: 'Creepster', cursive;
    color: #d4af37;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 1rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    height: 100px;
}

.sticker-collection {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sticker-item {
    font-size: 2rem;
    cursor: grab;
    padding: 0.3rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid transparent;
}

.sticker-item:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: scale(1.2);
    border-color: #d4af37;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.sticker-item:active {
    cursor: grabbing;
    transform: scale(0.9);
}

.panel-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-btn {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2c1810;
    border: none;
    padding: 0.4rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.panel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.4);
}

.toggle-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: #d4af37;
}

.toggle-switch input {
    display: none;
}

.slider {
    width: 30px;
    height: 15px;
    background: #ccc;
    border-radius: 15px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.slider::before {
    content: '';
    position: absolute;
    width: 11px;
    height: 11px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .slider {
    background: #d4af37;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(15px);
}

.toggle-label {
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Main Diary Container */
.diary-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.diary-pages-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.diary-header {
    text-align: center;
    margin-bottom: 2rem;
}

.date-display {
    font-family: 'Butcherman', cursive;
    color: #d4af37;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.diary-title {
    font-family: 'Creepster', cursive;
    color: #d4af37;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.diary-pages {
    display: flex;
    gap: 0;
    perspective: 1000px;
    justify-content: center;
    transition: transform 0.6s ease;
}

.diary-pages.turning {
    animation: pageTurn 0.6s ease-in-out;
}

@keyframes pageTurn {
    0% { transform: scale(1); }
    50% { transform: scale(0.95) rotateY(5deg); }
    100% { transform: scale(1); }
}

.page {
    width: 400px;
    height: 600px;
    background: #f4f1e8;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.left-page {
    border-radius: 15px 0 0 15px;
    transform-origin: right center;
}

.right-page {
    border-radius: 0 15px 15px 0;
    transform-origin: left center;
}

.diary-binding {
    width: 20px;
    height: 600px;
    background: linear-gradient(145deg, #2c1810, #4a2c1a);
    border-top: 2px solid #d4af37;
    border-bottom: 2px solid #d4af37;
    position: relative;
    z-index: 10;
}

.diary-binding::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 80%;
    background: repeating-linear-gradient(
        to bottom,
        #d4af37 0px,
        #d4af37 10px,
        transparent 10px,
        transparent 20px
    );
}

.page:hover {
    transform: rotateY(-2deg);
}

.page-texture {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 15% 25%, rgba(139, 69, 19, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 85% 75%, rgba(160, 82, 45, 0.08) 0%, transparent 40%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 25px,
            rgba(139, 69, 19, 0.05) 25px,
            rgba(139, 69, 19, 0.05) 26px
        );
    border-radius: inherit;
    pointer-events: none;
}

.page-number {
    position: absolute;
    top: 1rem;
    right: 2rem;
    font-family: 'Butcherman', cursive;
    color: #8B4513;
    font-size: 0.9rem;
    opacity: 0.6;
    z-index: 5;
}

.page-content {
    padding: 3rem 2rem 2rem 2rem;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Page Turn Buttons */
.page-turn-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #d4af37;
    background: linear-gradient(145deg, #2c1810, #4a2c1a);
    color: #d4af37;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.page-turn-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2c1810;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.page-turn-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #666;
}

.page-turn-btn span {
    display: block;
    font-weight: bold;
}

.prev-page:hover:not(:disabled) span {
    animation: slideLeft 0.5s ease-in-out infinite;
}

.next-page:hover:not(:disabled) span {
    animation: slideRight 0.5s ease-in-out infinite;
}

@keyframes slideLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

@keyframes slideRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

.page-content textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    font-family: 'Kalam', cursive;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2c1810;
    outline: none;
}

.page-content textarea::placeholder {
    color: #8B4513;
    opacity: 0.7;
    font-style: italic;
}

.sticker-canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
}

.placed-sticker {
    position: absolute;
    font-size: 2rem;
    cursor: move;
    pointer-events: all;
    user-select: none;
    transition: transform 0.2s ease;
    z-index: 10;
}

.placed-sticker:hover {
    transform: scale(1.1);
    z-index: 20;
}

.placed-sticker img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    pointer-events: none;
}

.ink-stains {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.left-stains {
    top: 20%;
    right: 10%;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.3) 0%, transparent 70%);
    border-radius: 50%;
}

.right-stains {
    bottom: 30%;
    left: 15%;
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.diary-footer {
    text-align: center;
}

.navigation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(145deg, #2c1810, #4a2c1a);
    color: #d4af37;
    border: 2px solid #d4af37;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: 'Butcherman', cursive;
}

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2c1810;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.save-btn {
    background: linear-gradient(145deg, #228B22, #006400);
    border-color: #228B22;
}

.save-btn:hover {
    background: linear-gradient(145deg, #32CD32, #228B22);
    border-color: #32CD32;
    color: white;
}

.locked::after {
    content: '';
}

/* Drag and Drop Effects */
.drag-over {
    background: rgba(212, 175, 55, 0.1);
    border: 2px dashed #d4af37;
}

.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Fade out animation for saved content */
.fade-out {
    animation: fadeOut 1s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0.3;
        transform: scale(0.98);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sticker-panel {
        width: 60px;
    }
    
    .sticker-panel:hover {
        width: 80px;
    }
    
    .left-panel {
        left: 10px;
    }
    
    .right-panel {
        right: 10px;
    }
}

@media (max-width: 768px) {
    .diary-pages {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .page {
        width: 350px;
        height: 500px;
    }
    
    .left-page, .right-page {
        border-radius: 15px;
    }
    
    .diary-binding {
        display: none;
    }
    
    .sticker-panel {
        position: relative;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .left-panel, .right-panel {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
    }
    
    .sticker-panel h3 {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        height: auto;
        margin-bottom: 0.5rem;
    }
    
    .sticker-collection {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .toggle-label {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
    }
    
    .navigation {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 200px;
    }
}