/* =========================
   Scientific Calculator
   Final clean version
========================= */

.scicalc,
.scicalc * {
    box-sizing: border-box;
}

.scicalc {
    --cc-card: #fff;
    --cc-text: #222;
    --cc-muted: #6b7280;
    --cc-brand: #283b69;
    --cc-brand2: #1f2f55;
    --cc-border: #e6e8ef;
    --cc-shadow: 0 10px 25px rgba(16, 24, 40, 0.08);
    --cc-radius: 16px;

    font-family: Arial, Helvetica, sans-serif;
    color: var(--cc-text);
}

.scicalc .ccalc__wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 0 40px;
}

.scicalc .ccalc__titlebar {
    background: linear-gradient(180deg, var(--cc-brand), var(--cc-brand2));
    color: #fff;
    border-radius: var(--cc-radius);
    padding: 16px;
    box-shadow: var(--cc-shadow);
    margin-bottom: 14px;
}

.scicalc .ccalc__h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.scicalc .ccalc__p {
    margin: 6px 0 0;
    opacity: 0.92;
    font-size: 13px;
}

.scicalc .ccalc__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 14px;
    align-items: start;
}

@media (max-width: 980px) {
    .scicalc .ccalc__grid {
        grid-template-columns: 1fr;
    }
}

.scicalc .ccalc__card {
    background: var(--cc-card);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    padding: 14px;
    min-width: 0;
}

.scicalc .ccalc__sectionTitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--cc-border);
}

.scicalc .ccalc__h2 {
    font-size: 15px;
    margin: 0;
    font-weight: 800;
    color: var(--cc-brand2);
}

.scicalc .ccalc__badge {
    font-size: 12px;
    color: #fff;
    background: rgba(40, 59, 105, 0.9);
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.scicalc .ccalc__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scicalc .ccalc__btn {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #d4d7de;
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    color: #1f2f55;
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.scicalc .ccalc__btn:hover {
    background: #f6f7fb;
    border-color: #b9c2da;
    box-shadow: 0 4px 12px rgba(31, 47, 85, 0.08);
    transform: translateY(-1px);
}

.scicalc .ccalc__mt10 {
    margin-top: 10px;
}

.scicalc .ccalc__toast {
    margin-top: 10px;
    font-size: 12px;
    color: var(--cc-muted);
    min-height: 16px;
}

/* =========================
   Top mode switch
========================= */

.scicalc-topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.scicalc-mode {
    display: inline-flex;
    border: 1px solid rgba(40, 59, 105, 0.14);
    border-radius: 999px;
    padding: 4px;
    background: #f8fafc;
    gap: 4px;
}

.scicalc-mode__btn {
    min-width: 64px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #1f2f55;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s ease;
}

.scicalc-mode__btn.is-active {
    background: #283b69;
    color: #fff;
    box-shadow: 0 4px 12px rgba(31, 47, 85, 0.14);
}

/* =========================
   Screen
========================= */

.scicalc-screen {
    background: linear-gradient(180deg, #0f172a, #111827);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    min-height: 112px;
}

.scicalc-expression {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
    min-height: 24px;
    text-align: right;
    word-break: break-word;
}

.scicalc-result {
    margin-top: 10px;
    font-size: 28px;
    line-height: 1.2;
    color: #fff;
    font-weight: 900;
    text-align: right;
    word-break: break-word;
}

/* =========================
   Top action buttons
========================= */

.scicalc-actions-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.scicalc-actions-top .ccalc__btn {
    min-width: 0;
    width: 100%;
}

/* =========================
   Function block
========================= */

.scicalc-funcs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

/* =========================
   Number pad
========================= */

.scicalc-numpad {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

/* =========================
   Calculator keys
========================= */

.scicalc-key {
    height: 52px;
    border: 1px solid #d4d7de;
    border-radius: 14px;
    background: #fff;
    color: #1f2937;
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.scicalc-key:hover {
    background: #f7f8fc;
    border-color: #b9c2da;
    box-shadow: 0 4px 12px rgba(31, 47, 85, 0.08);
    transform: translateY(-1px);
}

.scicalc-key--func {
    background: #f8fafc;
    color: #283b69;
}

.scicalc-key--op {
    background: rgba(40, 59, 105, 0.08);
    color: #1f2f55;
}

.scicalc-key--zero {
    grid-column: span 2;
}

.scicalc-key--full {
    grid-column: 1 / -1;
}

.scicalc-key--eq {
    background: linear-gradient(180deg, #283b69, #1f2f55);
    color: #fff;
}

.scicalc-key--eq:hover {
    background: linear-gradient(180deg, #314779, #243561);
    border-color: #314779;
}

/* =========================
   History
========================= */

.scicalc-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
}

.scicalc-history__empty {
    color: #6b7280;
    font-size: 14px;
}

.scicalc-history-item {
    border: 1px solid rgba(40, 59, 105, 0.12);
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.scicalc-history-item:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.scicalc-history-item__expr {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
    word-break: break-word;
}

.scicalc-history-item__res {
    font-size: 18px;
    font-weight: 900;
    color: #1f2f55;
    word-break: break-word;
}

/* =========================
   Divider / SEO / FAQ
========================= */

.cc-divider {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    border-top: 2px dashed rgba(40, 59, 105, 0.35);
}

.cc-seo,
.cc-faq {
    max-width: 900px;
    margin: 20px auto 0;
    padding: 0 16px;
}

.cc-seo h2,
.cc-faq h2 {
    font-size: 22px;
    color: #283b69;
    margin-bottom: 14px;
}

.cc-seo p {
    margin-bottom: 14px;
    line-height: 1.6;
    font-size: 15px;
    color: #222;
}

.cc-seo ul {
    margin: 0 0 14px 18px;
    padding: 0;
}

.cc-seo li {
    margin: 6px 0;
    font-size: 15px;
    color: #222;
}

.cc-faq-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(40, 59, 105, 0.1);
}

.cc-faq-item h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: #283b69;
    font-weight: 900;
}

.cc-faq-item p {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
}

/* =========================
   Responsive
========================= */

@media (max-width: 760px) {
    .scicalc-funcs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .scicalc-actions-top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .scicalc-key {
        height: 48px;
        font-size: 15px;
    }

    .scicalc-result {
        font-size: 24px;
    }

    .cc-seo h2,
    .cc-faq h2 {
        font-size: 18px;
    }

    .cc-seo p,
    .cc-seo li {
        font-size: 14px;
    }

    .cc-faq-item {
        padding: 14px;
    }
}