/* 基本スタイル */
body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    background-color: #f5f5f5;
}

.container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ヘッダー・ロゴ */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.logo-image {
    max-height: 60px;
    height: auto;
    width: auto;
    display: inline-block;
}

h1 {
    color: #333;
    margin: 0;
    font-size: 24px;
}

/* フォームコンテナ */
.form-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.input-section {
    flex: 1;
}

/* パラメーター設定 */
.parameter-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.parameter-label {
    flex: 0 0 25%;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.parameter-name-input {
    flex: 0 0 30%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.parameter-slider {
    flex: 0 0 40%;
    height: 6px;
    border-radius: 9999px;
    background: #cccccc;
    cursor: pointer;
}

.parameter-value-input {
    flex: 0 0 15%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

/* 入力フィールド共通 */
label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="color"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

/* レンジスライダー */
input[type="range"] {
    width: 100%;
    /* height: 40px; */
    -webkit-appearance: none;
    appearance: none;
    /* background: transparent; */
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #ddd;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    background: #ddd;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

.value-display {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
    color: #007bff;
    font-size: 16px;
}

/* キャンバス */
canvas {
    border: none;
    border-radius: 8px;
    background-color: transparent;
    max-width: 100%;
    height: auto;
}

/* ボタン */
.controls {
    text-align: center;
    margin-top: 20px;
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
    min-width: 120px;
    touch-action: manipulation;
}

button:hover {
    background-color: #0056b3;
}

button:active {
    transform: scale(0.98);
}

.export-btn {
    background-color: #28a745;
}

.export-btn:hover {
    background-color: #1e7e34;
}

/* 画像アップロード関連 */
.image-upload-section {
    margin-top: 15px;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
    background-color: #f9f9f9;
}

.image-upload-section.drag-over {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: inline-block;
    min-width: 120px;
    touch-action: manipulation;
    transition: background-color 0.2s ease;
}

.file-input-button:hover {
    background-color: #0056b3;
}

.file-input-button:active {
    transform: scale(0.98);
}

.preview-container {
    margin-top: 15px;
    text-align: center;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

.remove-image {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
    min-width: 120px;
    touch-action: manipulation;
    transition: background-color 0.2s ease;
}

.remove-image:hover {
    background-color: #c82333;
}

.remove-image:active {
    transform: scale(0.98);
}

.composite-btn {
    background-color: #17a2b8;
    margin-top: 10px;
}

.composite-btn:hover {
    background-color: #117a8b;
}

.composite-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.twitter-btn {
    background-color: #1da1f2;
    margin-top: 10px;
}

.twitter-btn:hover {
    background-color: #1991db;
}

.twitter-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* プレビューセクション */
.preview-section {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border-radius: 10px;
    position: relative;
}

.uploaded-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    margin-right: 10px;
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    margin-left: 10px;
    position: relative;
}

.canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(248, 249, 250, 0.3) 100%);
    border-radius: 8px;
    pointer-events: none;
}

.canvas-container canvas {
    position: relative;
    z-index: 1;
}

/* 中央の分割線 */
/* .preview-section::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 40px;
    bottom: 40px;
    width: 2px;
    background-color: #dee2e6;
    transform: translateX(-50%);
    z-index: 1;
} */

.uploaded-image-preview {
    max-width: 100%;
    max-height: 350px;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* ページフッター */
.page-footer {
    margin-top: 40px;
    padding: 20px 0;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
}

.footer-content p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .form-container {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 15px;
    }

    .input-section h3,
    .canvas-container h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .parameter-group {
        margin-bottom: 8px;
        gap: 4px;
    }

    .parameter-label {
        flex: 0 0 20%;
        font-size: 12px;
    }

    .parameter-name-input {
        flex: 0 0 30%;
        font-size: 12px;
        padding: 4px;
    }

    .parameter-slider {
        flex: 0 0 35%;
    }

    .parameter-value-input {
        flex: 0 0 15%;
        font-size: 12px;
        padding: 4px;
    }

    label {
        font-size: 13px;
        margin-bottom: 3px;
    }

    input[type="text"],
    input[type="number"],
    input[type="color"] {
        padding: 8px;
        font-size: 14px;
    }

    input[type="range"] {
        height: 30px;
    }

    .value-display {
        font-size: 14px;
        margin-left: 8px;
    }

    canvas {
        width: 100%;
        max-width: 280px;
        height: auto;
    }

    button {
        display: block;
        width: 100%;
        margin: 8px 0;
        padding: 12px;
        font-size: 14px;
    }

    .preview-image {
        max-width: 120px;
        max-height: 120px;
    }

    .image-upload-section {
        margin-top: 10px;
        padding: 8px;
    }

    .image-upload-section h4 {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .image-upload-section p {
        font-size: 12px;
        margin-bottom: 8px;
    }

    /* プレビューセクションのモバイル対応 */
    .preview-section {
        overflow-x: auto;
        overflow-y: hidden;
        padding: 15px;
        margin-bottom: 15px;
        /* 横スクロール用のスタイル */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #dee2e6 transparent;
    }

    .preview-section::-webkit-scrollbar {
        height: 6px;
    }

    .preview-section::-webkit-scrollbar-track {
        background: transparent;
    }

    .preview-section::-webkit-scrollbar-thumb {
        background-color: #dee2e6;
        border-radius: 3px;
    }

    .uploaded-image-container,
    .canvas-container {
        /* カードサイズを固定してはみ出しを許可 */
        min-width: 280px;
        width: 280px;
        flex-shrink: 0;
        margin-right: 8px;
        margin-left: 8px;
        padding: 15px;
    }

    .uploaded-image-container:last-child,
    .canvas-container:last-child {
        margin-right: 15px;
    }

    .uploaded-image-container:first-child,
    .canvas-container:first-child {
        margin-left: 15px;
    }

    .uploaded-image-preview {
        max-width: 250px;
        max-height: 200px;
    }

    /* 中央分割線をモバイルでは非表示 */
    .preview-section::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    h1 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .input-section h3,
    .canvas-container h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    canvas {
        max-width: 250px;
    }

    .parameter-group {
        margin-bottom: 6px;
        gap: 3px;
    }

    .parameter-label {
        flex: 0 0 18%;
        font-size: 11px;
    }

    .parameter-name-input {
        flex: 0 0 28%;
        font-size: 11px;
        padding: 3px;
    }

    .parameter-slider {
        flex: 0 0 38%;
    }

    .parameter-value-input {
        flex: 0 0 16%;
        font-size: 11px;
        padding: 3px;
    }

    label {
        font-size: 12px;
        margin-bottom: 2px;
    }

    input[type="text"],
    input[type="number"],
    input[type="color"] {
        padding: 6px;
        font-size: 14px;
    }

    .value-display {
        font-size: 13px;
    }

    .preview-image {
        max-width: 100px;
        max-height: 100px;
    }

    .uploaded-image-preview {
        max-width: 250px;
        max-height: 250px;
    }
}