/* Scientific Calculator — style.css v1.0 */

.sci-wrap {
    max-width: 520px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
}

/* Header */
.sci-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sci-hicon  { font-size: 30px; }
.sci-htitle {
    font-size: 20px !important; font-weight: 600 !important;
    margin: 0 0 2px !important; padding: 0 !important; border: none !important; color: #1a1a1a !important;
}
.sci-hsub { font-size: 12px; color: #888; margin: 0; }

/* Calculator body */
.sci-calculator {
    background: #1c1c1e;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    outline: none;
    user-select: none;
}

/* History panel */
.sci-history-panel {
    background: #2c2c2e;
    max-height: 180px;
    overflow-y: auto;
    border-bottom: 1px solid #3a3a3c;
}
.sci-history-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; font-size: 12px; color: #888;
    position: sticky; top: 0; background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
}
.sci-hist-clear {
    font-size: 11px; color: #FF453A; background: none;
    border: none; cursor: pointer; padding: 2px 6px;
}
.sci-hist-item {
    padding: 6px 14px; font-size: 13px; color: #e5e5e7;
    border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer;
    transition: background .1s;
}
.sci-hist-item:hover { background: rgba(255,255,255,.06); }
.sci-hist-expr { font-size: 11px; color: #888; }
.sci-hist-result { font-weight: 600; }

/* Display */
.sci-display {
    background: #1c1c1e;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sci-mode-row {
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.sci-mode-btn {
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 4px; cursor: pointer;
    background: rgba(255,255,255,.08); color: #888;
    border: 1px solid rgba(255,255,255,.1);
    transition: background .13s, color .13s;
}
.sci-mode-btn.active { background: #0A84FF; color: #fff; border-color: #0A84FF; }
.sci-mem-indicator {
    font-size: 11px; font-weight: 700; color: #30D158;
    background: rgba(48,209,88,.15); padding: 2px 6px; border-radius: 4px;
}
.sci-inv-badge {
    font-size: 11px; font-weight: 700; color: #FF9F0A;
    background: rgba(255,159,10,.15); padding: 2px 6px; border-radius: 4px;
}
.sci-hist-btn {
    margin-left: auto; background: none; border: none;
    color: #888; font-size: 14px; cursor: pointer; padding: 2px 5px;
    transition: color .13s;
}
.sci-hist-btn:hover { color: #e5e5e7; }
.sci-expression {
    font-size: 13px; color: #888; min-height: 18px;
    text-align: right; margin-bottom: 4px; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
}
.sci-display-main {
    font-size: 40px; font-weight: 300; color: #f5f5f7;
    text-align: right; min-height: 50px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    line-height: 1.2; letter-spacing: -1px;
}
.sci-display-main.small-text { font-size: 24px; }
.sci-display-main.error { font-size: 18px; color: #FF453A; }

/* Buttons grid */
.sci-buttons {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    background: #3a3a3c;
}

.sci-btn {
    background: #2c2c2e;
    border: none;
    color: #f5f5f7;
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    height: 46px;
    cursor: pointer;
    transition: background .1s, transform .05s;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 1px;
    line-height: 1;
    font-family: inherit;
    position: relative;
}
.sci-btn:hover { background: #3a3a3c; }
.sci-btn:active { background: #48484a; transform: scale(.97); }

/* Secondary labels (2nd function) */
.sci-btn .pri { display: block; }
.sci-btn .sec { display: none; font-size: 10px; color: #FF9F0A; }
.sci-inv-active .sec { display: block; }
.sci-inv-active .pri { display: none; }

/* Color variants */
.sci-num   { background: #3a3a3c; font-size: 17px; font-weight: 400; }
.sci-num:hover { background: #48484a; }
.sci-zero  { }
.sci-op    { background: #0A84FF; color: #fff; font-size: 17px; }
.sci-op:hover { background: #2090ff; }
.sci-op:active { background: #0070d9; }
.sci-eq    { background: #0A84FF; color: #fff; font-size: 19px; font-weight: 600; grid-column: span 1; }
.sci-eq:hover { background: #2090ff; }
.sci-clear { background: #FF453A; color: #fff; }
.sci-clear:hover { background: #ff6058; }
.sci-del   { background: #636366; color: #fff; }
.sci-del:hover { background: #7c7c80; }
.sci-fn    { background: #2c2c2e; color: #98d8ff; font-size: 12px; }
.sci-fn:hover { background: #3a3a3c; }
.sci-trig  { background: #2c2c2e; color: #98d8ff; font-size: 12px; }
.sci-trig:hover { background: #3a3a3c; }
.sci-inv-toggle { }
.sci-inv-toggle.active { background: #FF9F0A !important; color: #fff !important; }
.sci-pi, .sci-e { color: #30D158; }

/* 2nd function active state */
body.sci-inv-on .sci-btn .sec { display: block; }
body.sci-inv-on .sci-btn .pri { display: none; }

/* Responsive */
@media (max-width: 480px) {
    .sci-btn { height: 40px; font-size: 12px; }
    .sci-display-main { font-size: 32px; }
    .sci-num { font-size: 15px; }
    .sci-fn  { font-size: 11px; }
    .sci-op, .sci-eq { font-size: 15px; }
}
@media (max-width: 360px) {
    .sci-btn { height: 36px; font-size: 10px; }
    .sci-display-main { font-size: 26px; }
}

/* Keyboard hint */
.sci-keyboard-hint {
    font-size: 11px; color: #aaa; text-align: center;
    margin-top: 8px;
}
