:root {
    --bg-left: #eff6ff; /* Indigo tint */
    --text-left: #0f172a;
    --bg-right: #1e1b4b; /* Deep Indigo */
    --card-bg: #312e81;
    --text-right: #e0e7ff;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --success: #10b981;
    --danger: #f43f5e;
}

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

body {
    font-family: 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
    background-color: var(--bg-left);
}

.split-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.left-panel {
    flex: 1;
    background-color: #f8fafc;
    color: var(--text-left);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
    z-index: 2;
    overflow-y: auto;
}

.content-wrapper {
    padding: 3rem;
    max-width: 650px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.6s ease-out;
}

.header-section {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--accent), #4338ca);
    padding: 2.5rem;
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.3);
}

.header-section h1 {
    font-weight: 700;
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
    letter-spacing: -0.02em;
}

.header-section .subtitle {
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: 0.95;
}

.calculator-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--accent);
}

.calculator-card h2 {
    color: #1e293b;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 1.5rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    transition: all 0.2s;
    background: #f8fafc;
    color: #0f172a;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Theory Card */
.theory-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.theory-card h2 {
    color: #1e293b;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.theory-item h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.theory-item ul {
    list-style-type: none;
}

.theory-item li {
    font-size: 0.95rem;
    color: #475569;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.theory-item li:last-child {
    border-bottom: none;
}

.theory-item .desc {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.mt { margin-top: 1.5rem; }

/* Right Panel Dashboard */
.right-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-right), #111827);
    padding: 2.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}

.dashboard {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideUp 0.8s ease-out;
}

.grid-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-display.triple {
    grid-template-columns: 1fr 1fr 0.8fr;
}

.data-card {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--accent-light);
}

.data-card.main::before { background: var(--success); }
.data-card.stat::before { background: #f59e0b; }

.data-card .label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.1em;
    margin-bottom: 0.2rem;
}

.data-card .value {
    font-family: 'Fira Code', monospace;
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.3rem;
}

.data-card .value.small { font-size: 1.4rem; }
.data-card .value.md { font-size: 1.6rem; color: #818cf8; }
.data-card .value.inverse { color: #fb7185; }
.data-card .value.highlight { color: #fcd34d; font-size: 2.5rem; }

.data-card .hint {
    font-size: 0.8rem;
    color: #cbd5e1;
    opacity: 0.7;
}

.binary-card {
    background: #020617;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
}

.binary-card .label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

.binary-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.binary-row span {
    color: #94a3b8;
    width: 50px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.binary-row pre {
    font-family: 'Fira Code', monospace;
    font-size: 1.2rem;
    color: #e2e8f0;
    letter-spacing: 0.1em;
}

.binary-row pre.red { color: #f43f5e; }
.binary-row pre.green { color: #10b981; }

.binary-row.separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.error-mode .value { color: #f43f5e !important; }
.error-mode pre { color: #f43f5e !important; }

/* Reverse Engineering Cards */
.reverse-card {
    border-top-color: var(--danger);
}

.tool-section {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.tool-section h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 0.4rem;
}

.tool-section .desc {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.row-align {
    margin-bottom: 0 !important;
}

.mini-output {
    margin-top: 1.2rem;
    background: #1e1b4b;
    color: #e0e7ff;
    padding: 1.2rem;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.highlight-text { color: #22d3ee; font-weight: 600; }
.waste-text { color: #f43f5e; font-style: italic; }

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