:root {
    --bg-color: #ffffff;
    --text-color: #2d3748;
    --secondary-text-color: #6c757d;
    --primary-color: #4a90e2;
    --input-bg: #f7fafc;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --hover-brightness: 0.95;
}

[data-theme="dark"] {
    --bg-color: #1a202c;
    --text-color: #e2e8f0;
    --secondary-text-color: #a0aec0;
    --input-bg: #2d3748;
    --border-color: #4a5568;
    --primary-color: #63b3ed;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #1a202c;
        --text-color: #e2e8f0;
        --secondary-text-color: #a0aec0;
        --input-bg: #2d3748;
        --border-color: #4a5568;
        --primary-color: #63b3ed;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 2rem 1rem;
    transition: background 0.3s ease;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr 1fr;
    flex: 1;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    color: var(--primary-color);
}

.tagline {
    text-align: center;
    font-size: 1.1rem;
    color: var(--secondary-text-color);
    margin: -1.5rem auto 2rem;
    max-width: 700px;
}

textarea {
    width: 100%;
    height: 300px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease;
    font-family: 'Consolas', monospace;
    margin: 1rem 0;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.3s ease;
    width: 100%;
    margin: 1rem 0;
}

button:hover {
    filter: brightness(var(--hover-brightness));
}

button:active {
    transform: scale(0.98);
}

#output {
    white-space: pre-wrap;
    font-family: 'Consolas', monospace;
    padding: 1rem;
    overflow-x: auto;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    margin: 1rem 0;
    min-height: 100px;
}

#render {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    overflow-y: auto;
    margin: 1rem 0;
    min-height: 100px;
}

.highlight {
    color: var(--primary-color);
    font-weight: bold;
}

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

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

footer a:hover {
    text-decoration: underline;
}

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 1000;
    margin: 0;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
        font-size: 1rem;
    }
}