:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --bg-color: #f8f9fa;
    --text-main: #333;
    --text-secondary: #666;
    --grid-gap: 8px;
    --slot-bg: #e9ecef;
    --slot-border: #dee2e6;
    --max-width: 600px;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.app-container {
    width: 100%;
    max-width: var(--max-width);
    text-align: center;
}

header {
    margin-bottom: 24px;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #4a90e2 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 3ステップ説明 */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 4px;
}

.step {
    background: #fff;
    border-radius: 10px;
    padding: 14px 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a90e2 0%, #a29bfe 100%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--grid-gap);
    aspect-ratio: 1 / 1;
    background-color: #fff;
    padding: var(--grid-gap);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 32px;
}

.grid-slot {
    position: relative;
    background-color: var(--slot-bg);
    border: 2px dashed var(--slot-border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.grid-slot:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.grid-slot.has-image {
    border-style: solid;
    border-color: transparent;
}

.file-input {
    display: none;
}

.slot-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
}

.plus-icon {
    font-size: 2rem;
    color: #adb5bd;
    transition: transform 0.3s ease;
}

.grid-slot:hover .plus-icon {
    transform: scale(1.2);
    color: var(--primary-color);
}

.grid-slot.has-image .slot-label {
    opacity: 0;
    pointer-events: none;
}

.grid-slot.has-image:hover .slot-label {
    pointer-events: none;
}

.grid-slot.has-image:hover .plus-icon {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.slot-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.grid-slot.has-image .slot-canvas {
    display: block;
    cursor: grab;
}

.grid-slot.has-image .slot-canvas:active {
    cursor: grabbing;
}

.action-area {
    margin-top: 20px;
}

.btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #4a90e2 0%, #6c5ce7 100%);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

footer {
    margin-top: 48px;
    font-size: 0.8rem;
    color: #999;
}

.privacy-note {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 8px;
}

.copyright {
    font-size: 0.75rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 20px;
    max-width: 90%;
    width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 12px;
    color: var(--primary-color);
}

.modal-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.result-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: 20px;
    border: 1px solid #eee;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image-container img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #eee;
    color: #333;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #e0e0e0;
}