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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

header .subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

main {
    flex: 1;
}

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

.text-section {
    display: flex;
    flex-direction: column;
}

.text-section label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.text-section textarea {
    flex: 1;
    min-height: 250px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.text-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.text-section textarea::placeholder {
    color: var(--text-secondary);
}

.text-section textarea[readonly] {
    background: #f1f5f9;
}

.char-count {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: right;
}

.controls {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.controls h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.option:hover {
    background: #e2e8f0;
}

.option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: var(--surface);
}

.option input[type="checkbox"]:checked ~ .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s;
}

.option input[type="checkbox"]:checked ~ .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.option-text {
    display: flex;
    flex-direction: column;
}

.option-text strong {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.option-text small {
    color: var(--text-secondary);
    font-size: 0.825rem;
    margin-top: 0.125rem;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: 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(--secondary-color);
    color: white;
}

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

.btn-outline {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--border-color);
}

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

.btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .text-areas {
        grid-template-columns: 1fr;
    }

    .text-section textarea {
        min-height: 180px;
    }

    .controls {
        padding: 1rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .option {
        padding: 0.875rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .text-section textarea {
        min-height: 150px;
        font-size: 0.875rem;
    }

    .option-text strong {
        font-size: 0.9rem;
    }

    .option-text small {
        font-size: 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }

    .text-section textarea[readonly] {
        background: #0f172a;
    }

    .option:hover {
        background: #334155;
    }

    .checkmark {
        background: var(--surface);
    }
}
