.sci-calc-wrap {
    font-family: 'Inter', sans-serif;
    max-width: 860px;
    margin: 0 auto;
    padding: 16px;
}

/* MODE TOGGLE */
.sci-mode-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 4px;
    width: fit-content;
    margin: 0 auto 20px;
    gap: 4px;
}

.sci-mode-btn {
    padding: 8px 28px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.sci-mode-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

/* CONTAINER */
.sci-calc-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

/* DISPLAY */
.sci-display {
    background: #1a1a2e;
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.sci-display-mode {
    display: flex;
    gap: 12px;
}

.sci-display-mode span {
    font-size: 11px;
    color: #667eea;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(102,126,234,0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.sci-display-expression {
    font-size: 22px;
    color: #ffffff;
    text-align: right;
    word-break: break-all;
    line-height: 1.4;
    min-height: 32px;
    font-family: 'Courier New', monospace;
}

.sci-display-result {
    font-size: 14px;
    color: #a0a0c0;
    text-align: right;
    font-family: 'Courier New', monospace;
    min-height: 20px;
}

.sci-display-sub {
    font-size: 11px;
    color: #667eea;
    text-align: right;
    min-height: 16px;
}

/* CLEAR ROW */
.sci-clear-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

/* BUTTON ROWS */
.sci-btn-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.sci-normal-rows .sci-btn-row {
    grid-template-columns: repeat(5, 1fr);
}

.sci-normal-rows .sci-btn-row:last-child {
    grid-template-columns: 2fr 1fr 1fr;
}

/* BUTTONS */
.sci-btn {
    border: none;
    border-radius: 10px;
    padding: 14px 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 48px;
}

.sci-btn:active {
    transform: scale(0.94);
}

.sci-btn-num {
    background: #f8f9ff;
    color: #2d2d4e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.sci-btn-num:hover {
    background: #eef0ff;
}

.sci-btn-op {
    background: #e8ecff;
    color: #4a4aff;
    box-shadow: 0 2px 4px rgba(74,74,255,0.1);
}

.sci-btn-op:hover {
    background: #d8dcff;
}

.sci-btn-fn {
    background: #f0f4ff;
    color: #5a3d9e;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(90,61,158,0.1);
}

.sci-btn-fn:hover {
    background: #e0e8ff;
}

.sci-btn-clear {
    background: #fff0f0;
    color: #e53e3e;
    font-weight: 700;
}

.sci-btn-clear:hover {
    background: #ffe0e0;
}

.sci-btn-equals {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.sci-btn-equals:hover {
    opacity: 0.9;
}

.sci-btn-zero {
    grid-column: span 1;
}

/* SCIENTIFIC ROWS */
#sciScientificRows {
    display: none;
    margin-bottom: 8px;
}

#sciScientificRows.visible {
    display: block;
}

/* RIGHT PANEL */
.sci-result-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sci-result-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px;
    padding: 24px 20px;
    color: #fff;
    text-align: center;
}

.sci-result-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0.8;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.sci-result-big {
    font-size: 36px;
    font-weight: 700;
    word-break: break-all;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
}

.sci-result-extra {
    font-size: 13px;
    opacity: 0.75;
    margin-top: 8px;
    min-height: 18px;
}

.sci-memory-display {
    margin-top: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
}

/* HISTORY */
.sci-history-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    flex: 1;
}

.sci-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sci-history-header span {
    font-size: 14px;
    font-weight: 700;
    color: #2d2d4e;
}

.sci-history-header button {
    background: none;
    border: 1px solid #e0e0f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #e53e3e;
    cursor: pointer;
}

.sci-history-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sci-history-empty {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    padding: 20px;
}

.sci-history-item {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.sci-history-item:hover {
    background: #eef0ff;
}

.sci-history-expr {
    font-size: 12px;
    color: #888;
    margin-bottom: 2px;
}

.sci-history-val {
    font-size: 16px;
    font-weight: 700;
    color: #2d2d4e;
}

/* RESPONSIVE */
@media (max-width: 700px) {
    .sci-calc-container {
        grid-template-columns: 1fr;
    }
    .sci-result-section {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sci-result-card, .sci-history-card {
        flex: 1;
        min-width: 200px;
    }
}
