* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 800px;
    width: 100%;
}

.intro {
    margin-bottom: 30px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* デバッグ通知 */
.debug-notice {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: center;
}

.debug-notice p {
    margin: 0;
    color: #856404;
    font-weight: 500;
    font-size: 0.95em;
}

/* アップロードセクション */
.upload-section {
    margin-bottom: 30px;
}

.file-input-wrapper {
    margin-bottom: 25px;
}

.file-label {
    display: block;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 3px dashed #667eea;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    background: #e9ecef;
    border-color: #764ba2;
}

#fileText {
    color: #667eea;
    font-size: 1.1em;
    font-weight: 500;
}

input[type="file"] {
    display: none;
}

/* ラジオボタンセクション */
.conversion-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.radio-option {
    display: block;
    padding: 15px 20px;
    margin: 10px 0;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.radio-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.radio-option span {
    font-size: 1em;
    color: #333;
}

/* サブオプション */
.sub-option {
    margin-top: 15px;
    padding-left: 10px;
    border-left: 3px solid #667eea;
}

.checkbox-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f0f4ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-option:hover {
    background: #e3ecff;
}

.checkbox-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-option span {
    font-size: 0.95em;
    color: #444;
}

/* カラーピッカー */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

#backgroundColor {
    width: 60px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
}

.color-label {
    flex: 1;
    font-size: 1em;
    color: #333;
}

.reset-color-btn {
    padding: 8px 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.reset-color-btn:hover {
    background: #5a6268;
}

/* 貼り付け情報 */
.paste-info {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.paste-info p {
    margin: 0;
    font-weight: 500;
}

/* ボタンスタイル */
.convert-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #667eea;
    font-size: 1.2em;
    font-weight: 500;
}

/* プレビューセクション */
.preview-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.preview-wrapper {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    max-height: 700px;
    overflow: auto;
}

.preview-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.preview-info {
    text-align: center;
    margin-bottom: 20px;
}

.preview-info p {
    color: #666;
    font-size: 0.95em;
}

.download-btn {
    width: 100%;
    padding: 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: #5a6268;
}

/* その他部分 */
.other-link {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #ccc;
}

.tenso {
    text-align: center;
}

.tenso p {
    font-weight: 700;
}

.tenso a {
    color: #000;
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
    display: block;
    margin-top: 10px;
    padding: 15px 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: color 0.2s ease;
}

.tenso a:hover {
    color: #666;
}

.gift {
    background: linear-gradient(135deg, #fff5f7 0%, #ffe4ec 100%);
    margin-top: 20px;
    padding: 25px;
    border: 2px solid #ffb3d1;
    border-radius: 12px;
    text-align: center;
}

.gift div {
    display: inline-block;
    text-decoration: none;
}

/* トリミングプレビューセクション */
.crop-preview-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.crop-canvas-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: move;
    user-select: none;
    max-width: 100%;
}

#cropCanvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 700px;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-frame {
    position: absolute;
    border: 3px solid #667eea;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.crop-hint {
    text-align: center;
    color: #667eea;
    font-size: 0.95em;
    margin-top: 15px;
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    .file-label {
        padding: 30px 15px;
    }
}
