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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: #666;
    font-size: 1.2em;
}

/* ツールコンテナ */
.tool-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* セクション共通スタイル */
.controls-panel,
.preview-panel,
.usage-section,
.ad-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
}

.control-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f1f5f9;
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 20px;
}

.icon {
    width: 20px;
    height: 20px;
    color: #3b82f6;
}

/* グラデーションタイプ */
.gradient-type-buttons {
    display: flex;
    gap: 15px;
}

.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.type-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.type-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.type-preview {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.linear-preview {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
}

.radial-preview {
    background: radial-gradient(circle, #ff6b6b, #4ecdc4);
}

/* 角度・方向設定 */
.direction-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.angle-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.angle-control label {
    font-weight: 600;
    color: #374151;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.angle-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    appearance: none;
    cursor: pointer;
}

.angle-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.angle-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 600;
    color: #1f2937;
    min-width: 40px;
}

.presets-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 10px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.preset-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* カラーポイント */
.color-point {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.color-point:last-child {
    margin-bottom: 0;
}

.color-point-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.color-point-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.remove-color-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.remove-color-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

.color-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.position-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    appearance: none;
    cursor: pointer;
}

.position-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 1px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.position-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 1px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.position-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    color: #6b7280;
    min-width: 35px;
}

.add-color-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #f1f5f9;
    color: #475569;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.add-color-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* プリセットグラデーション */
.preset-gradients {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.preset-gradient {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-gradient:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

.preset-preview {
    width: 60px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.preset-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
}

/* プレビューパネル */
.preview-section {
    margin-bottom: 30px;
}

.gradient-preview {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: linear-gradient(90deg, #ff6b6b 0%, #4ecdc4 100%);
    transition: all 0.3s ease;
}

/* コードセクション */
.code-output {
    position: relative;
    background: #1f2937;
    border-radius: 8px;
    overflow: hidden;
}

#cssCode {
    color: #e5e7eb;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    padding: 20px;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #374151;
    color: #e5e7eb;
    border: 1px solid #4b5563;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.copy-code-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
}

/* 使い方セクション */
.usage-section {
    margin-bottom: 30px;
}

/* トーストメッセージ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .tool-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .controls-panel,
    .preview-panel,
    .usage-section,
    .ad-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .gradient-type-buttons {
        flex-direction: column;
    }

    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .preset-gradients {
        grid-template-columns: 1fr;
    }

    .color-controls {
        flex-wrap: wrap;
    }

    .position-slider {
        min-width: 120px;
    }

    .toast {
        left: 15px;
        right: 15px;
        transform: translateY(-100%);
        max-width: none;
    }

    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .slider-container {
        flex-direction: column;
        gap: 8px;
    }

    .color-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .color-picker {
        width: 100%;
        height: 35px;
    }

    .direction-controls {
        gap: 15px;
    }

    .preset-buttons {
        gap: 6px;
    }

    .preset-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}