:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --success-color: #45b7d1;
    --bg-color: #f7f9fc;
    --text-color: #2d3436;
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kosugi Maru', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    text-align: center;
}

h1 {
    font-size: 2.2rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

p {
    color: #636e72;
    font-size: 1.1rem;
}

.controls-top {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 30px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    width: 100%;
}

.icon {
    font-size: 1.6rem;
}

.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #fff;
    border: 4px dashed #cbd5e1;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    display: none;
    object-fit: contain;
}

.placeholder {
    font-size: 1.5rem;
    color: #94a3b8;
    text-align: center;
    pointer-events: none;
}

.controls-bottom {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    background: #fff;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.slider-container label {
    font-size: 1.3rem;
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
    max-width: 400px;
    height: 30px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 15px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 4px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 4px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.action-buttons {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* モーダルのスタイル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-cancel {
    background-color: #cbd5e1;
    color: #475569;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .controls-top {
        flex-direction: column;
    }

    .mode-selector {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-bottom: 20px;
    }

    .mode-selector label {
        cursor: pointer;
    }

    .mode-selector input[type="radio"] {
        display: none;
    }

    .mode-selector span {
        display: inline-block;
        padding: 10px 20px;
        font-size: 1.1rem;
        font-weight: bold;
        color: var(--primary-color);
        background-color: white;
        border: 2px solid var(--primary-color);
        border-radius: 20px;
        transition: all 0.2s ease;
    }

    .mode-selector input[type="radio"]:checked+span {
        background-color: var(--primary-color);
        color: white;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
        transform: scale(1.05);
    }

    .btn {
        width: 100%;
    }
}