:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 800px;
}

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

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    background-color: #f8fafc;
}

textarea:focus {
    border-color: var(--primary-color);
    background-color: #fff;
}

.output-box {
    min-height: 150px;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    font-size: 1rem;
    white-space: pre-wrap;
    color: var(--text-main);
}

.controls {
    display: flex;
    justify-content: center;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    transition: all 0.2s;
}

.text-btn {
    background: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.text-btn:hover {
    background-color: #e0e7ff;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #4338ca);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.75rem 2.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(79, 70, 229, 0.4);
}

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

.secondary-btn {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

.secondary-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}
