/* 紫とライムグリーンの配色 */
:root {
    --primary-color: #7c3aed;      /* 紫 */
    --secondary-color: #84cc16;     /* ライムグリーン */
    --accent-color: #a855f7;        /* 明るい紫 */
    --background: #faf5ff;          /* 薄い紫の背景 */
    --card-bg: #ffffff;             /* 白 */
    --text-color: #1f2937;          /* ダークグレー */
    --border-color: #e9d5ff;        /* 薄い紫の境界 */
    --success-color: #10b981;       /* 緑 */
    --warning-color: #f59e0b;       /* 警告色 */
    --error-color: #ef4444;         /* エラー色 */
    --highlight-bg: #f3e8ff;        /* ハイライト背景 */
    --code-bg: #f8fafc;             /* コード背景 */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    flex: 1;
}

.tool-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.input-section {
    margin-bottom: 30px;
}

.input-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.input-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.file-btn, .sample-btn, .clear-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.file-btn {
    background: var(--primary-color);
    color: white;
}

.file-btn:hover {
    background: var(--accent-color);
}

.sample-btn {
    background: var(--secondary-color);
    color: white;
}

.sample-btn:hover {
    background: #65a30d;
}

.clear-btn {
    background: var(--error-color);
    color: white;
}

.clear-btn:hover {
    background: #dc2626;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
    font-family: 'Courier New', monospace;
    background: var(--code-bg);
    line-height: 1.4;
}

textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.1);
}

.optimization-controls {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--highlight-bg);
    border-radius: 12px;
}

.optimization-controls h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.option-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.option-item:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.option-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--secondary-color);
}

.checkmark {
    font-size: 0.9rem;
    color: var(--text-color);
}

.optimize-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.3);
}

.optimize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.results-section {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--code-bg);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.stat-item.highlight {
    background: var(--highlight-bg);
    border-color: var(--secondary-color);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.output-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.output-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.output-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background: #65a30d;
}

.preview-section {
    margin-top: 30px;
    padding: 25px;
    background: var(--code-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.preview-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.preview-item h4 {
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: center;
}

.preview-container {
    min-height: 200px;
    max-height: 400px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}

.preview-container svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.info-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.info-section h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.4rem;
    text-align: center;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.benefit-item {
    text-align: center;
    padding: 25px;
    background: var(--highlight-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
}

.benefit-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.1);
}

.benefit-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.benefit-item h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.benefit-item p {
    color: #666;
    line-height: 1.6;
}

.optimization-tips {
    background: var(--code-bg);
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--secondary-color);
}

.optimization-tips h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.optimization-tips ul {
    list-style: none;
    padding: 0;
}

.optimization-tips li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

.optimization-tips li::before {
    content: "⚡";
    color: var(--secondary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.optimization-tips strong {
    color: var(--primary-color);
}

footer {
    margin-top: 50px;
    text-align: center;
    color: #666;
}

.ad-space {
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px dashed #c084fc;
}

.ad-space p {
    color: var(--primary-color);
    font-style: italic;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tool-section {
        padding: 20px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .benefits-grid {
        grid-template-columns: 1fr;
    }
    
    .output-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .output-actions {
        justify-content: center;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
    }
    
    .input-options {
        justify-content: center;
    }
}