:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --success-color: #00875A;
    --danger-color: #DE350B;
    --warning-color: #FF8B00;
    --background: #FFFFFF;
    --surface: #F4F5F7;
    --border: #DFE1E6;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --added-bg: #E3FCEF;
    --added-border: #ABF5D1;
    --removed-bg: #FFEBE6;
    --removed-border: #FF8F73;
    --modified-bg: #FFF0B3;
    --modified-border: #FFE380;
    --shadow-sm: 0 1px 3px rgba(23, 43, 77, 0.12);
    --shadow-md: 0 4px 8px rgba(23, 43, 77, 0.15);
    --shadow-lg: 0 8px 16px rgba(23, 43, 77, 0.2);
    --radius: 4px;
    --radius-lg: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 60px);
}

.header {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.icon {
    width: 36px;
    height: 36px;
    color: var(--primary-color);
}

.lang-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-selector select:hover {
    border-color: var(--primary-color);
}

.lang-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.description {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    color: var(--text-secondary);
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.input-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.text-input {
    width: 100%;
    min-height: 250px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'SF Mono', Monaco, 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.controls {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.view-options {
    margin-left: auto;
    display: flex;
    gap: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.result-section {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.result-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.result-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.stat-icon {
    width: 20px;
    height: 20px;
}

.stat.added {
    color: var(--success-color);
}

.stat.removed {
    color: var(--danger-color);
}

.stat.modified {
    color: var(--warning-color);
}

.result-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.result-content {
    display: none;
}

.result-content.active {
    display: block;
}

.diff-output {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

.side-by-side-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

.diff-panel {
    background: var(--background);
    font-family: 'SF Mono', Monaco, 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9rem;
}

.inline-panel {
    background: var(--background);
}

.diff-line {
    display: flex;
    min-height: 24px;
    line-height: 24px;
    padding: 0 0.5rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line.added {
    background: var(--added-bg);
    border-left: 3px solid var(--success-color);
}

.diff-line.removed {
    background: var(--removed-bg);
    border-left: 3px solid var(--danger-color);
}

.diff-line.empty {
    background: var(--surface);
    min-height: 24px;
}

.line-number {
    display: inline-block;
    min-width: 40px;
    padding-right: 1rem;
    color: var(--text-secondary);
    text-align: right;
    user-select: none;
}

.line-content {
    flex: 1;
    overflow-wrap: break-word;
}

.diff-prefix {
    padding-right: 0.5rem;
    font-weight: 600;
    user-select: none;
}

.unified-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.unified-output {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'SF Mono', Monaco, 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre;
    max-height: 500px;
    overflow-y: auto;
}

.no-changes {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .input-section {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .view-options {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .result-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .result-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .side-by-side-wrapper {
        grid-template-columns: 1fr;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* ダークモード対応（システム設定に従う） */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1F2937;
        --surface: #374151;
        --border: #4B5563;
        --text-primary: #F9FAFB;
        --text-secondary: #D1D5DB;
        --added-bg: #064E3B;
        --added-border: #10B981;
        --removed-bg: #7F1D1D;
        --removed-border: #EF4444;
        --modified-bg: #78350F;
        --modified-border: #F59E0B;
    }
    
    .lang-selector select {
        background: var(--surface);
    }
    
    .text-input {
        background: var(--surface);
        color: var(--text-primary);
    }
    
    .unified-output {
        background: var(--surface);
        color: var(--text-primary);
    }
}