:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f8fafc;
    --bg-panel: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f172a;
        --bg-panel: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
    }
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.app-header {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.app-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Layout */
.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    flex: 1;
}

@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr 250px 1fr;
    }
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

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

.panel-header label, 
.panel-header h2 {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

textarea {
    width: 100%;
    flex: 1;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-body);
    color: var(--text-main);
    font-family: monospace; /* Better for editing code/text */
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Controls */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .button-grid {
        grid-template-columns: 1fr; /* Stack buttons in center col on desktop */
    }
}

.btn {
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    background: var(--border);
    transform: translateY(-1px);
}

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

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

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

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.75rem;
}

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

/* Stats */
.stats-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    justify-content: flex-end;
}

.divider {
    color: var(--border);
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}
