:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-tertiary: #868e96;
    --accent: #4c6ef5;
    --accent-hover: #3b5bdb;
    --accent-light: #edf2ff;
    --success: #51cf66;
    --border: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    --bg-primary: #1a1b1e;
    --bg-secondary: #25262b;
    --bg-tertiary: #2c2e33;
    --text-primary: #e9ecef;
    --text-secondary: #c1c2c5;
    --text-tertiary: #909296;
    --accent: #5c7cfa;
    --accent-hover: #748ffc;
    --accent-light: #364fc7;
    --success: #69db7c;
    --border: #373a40;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    z-index: 100;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.header {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo svg {
    color: var(--accent);
}

.logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.tagline {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

.main-content {
    position: relative;
}

.input-section,
.output-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.input-section:focus-within,
.output-section:focus-within {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-label svg {
    color: var(--accent);
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    resize: vertical;
    font-family: inherit;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

textarea::placeholder {
    color: var(--text-tertiary);
}

.char-count {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: right;
}

.button-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.simplify-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.simplify-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.simplify-btn:active:not(:disabled) {
    transform: translateY(0);
}

.simplify-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.simplify-btn svg {
    animation: none;
}

.simplify-btn:disabled svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.output-section {
    display: none;
    position: relative;
    animation: slideUp 0.4s ease;
}

.output-section.visible {
    display: block;
}

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

.output-text {
    min-height: 150px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-text.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-style: italic;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

.loading-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
}

.footer p {
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-note {
    font-size: 13px;
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .header {
        margin-bottom: 32px;
    }

    .logo h1 {
        font-size: 26px;
    }

    .tagline {
        font-size: 16px;
    }

    textarea {
        min-height: 180px;
        font-size: 15px;
    }

    .simplify-btn {
        width: 100%;
        justify-content: center;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}

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

    .logo h1 {
        font-size: 24px;
    }

    .input-section,
    .output-section {
        padding: 20px;
    }
}