/* static/place.css */

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.place-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 24px;
    padding: 0 20px;
    width: 100%; /* ★追加：親要素の幅を100%に */
    box-sizing: border-box; /* ★追加：paddingを幅の計算に含める */
}

.place-container > p {
    font-size: 1.2em;
    font-weight: 500;
    color: #374151;
    text-align: center;
    margin: 0;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#place-canvas {
    border-radius: 16px;
    cursor: crosshair;
    image-rendering: pixelated;
    background-color: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    
    /* ▼▼▼【ここから修正】▼▼▼ */
    width: 100%; /* 親要素に合わせて幅を100%に */
    max-width: 500px; /* ただし、最大でも500pxまで */
    height: auto; /* 縦横比を維持する */
    /* ▲▲▲【ここまで修正】▲▲▲ */
}

#place-canvas:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-box {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.color-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-box:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.color-box:hover::before {
    opacity: 1;
}

.color-box.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3), 0 8px 20px rgba(79, 70, 229, 0.2);
    transform: scale(1.1);
}

#cooldown-timer {
    font-size: 1.2em;
    font-weight: 600;
    color: #ef4444;
    height: auto;
    min-height: 1.5em;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(10px);
    text-align: center;
}

/* Animation for timer */
#cooldown-timer:not(:empty) {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .place-container > p {
        color: #e5e7eb;
        background: rgba(30, 30, 30, 0.8);
    }
    
    .color-palette {
        background: rgba(30, 30, 30, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .color-box {
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    #cooldown-timer {
        color: #f87171;
        background: linear-gradient(135deg, rgba(248, 113, 113, 0.1) 0%, rgba(248, 113, 113, 0.05) 100%);
        border-color: rgba(248, 113, 113, 0.2);
    }
}