/* =============================================
   CSS VARIABLES — Edit here to change theme
   ============================================= */
:root {
    --navy:        #0d2137;
    --navy2:       #1a3a6e;
    --teal:        #00c9a7;
    --teal2:       #00e5c0;
    --white:       #ffffff;
    --light:       #f0f4f8;
    --muted:       #8a9bb0;
    --card-bg:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text2:       #475569;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 4px 24px rgba(13,33,55,0.10);
    --transition:  0.2s ease;
    --container:   1200px;
    --font-main:   'Inter', system-ui, sans-serif;
    --font-mono:   'JetBrains Mono', monospace;
}

/* =============================================
   RESET
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); color: var(--text); background: var(--light); line-height: 1.6; font-size: 16px; }
img  { max-width: 100%; display: block; }
a    { color: inherit; text-decoration: none; }
button { font-family: var(--font-main); cursor: pointer; }

/* =============================================
   CONTAINER
   ============================================= */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

/* =============================================
   HEADER
   ============================================= */
.site-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #1a3a6e 100%);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.25);
}

/* =============================================
   LOGO
   ============================================= */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--teal), var(--teal2));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
}
.logo-text span { color: var(--teal); }

/* =============================================
   DESKTOP NAV
   ============================================= */
.nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    color: rgba(255,255,255,0.80);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.10); color: var(--white); }

.arrow { font-size: 10px; transition: transform var(--transition); }

/* Nav item */
.nav-item { position: relative; }
.nav-item.open > .nav-link,
.nav-item.open > .dropdown-toggle { background: rgba(255,255,255,0.12); color: var(--white); }
.nav-item.open .arrow { transform: rotate(180deg); }

/* =============================================
   MEGA MENU
   ============================================= */
.mega-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 3px solid var(--teal);
    box-shadow: 0 12px 40px rgba(0,0,0,0.13);
    z-index: 100;
    animation: megaFadeIn 0.18s ease;
    transform: none;
    will-change: opacity;
}
.mega-menu.open { display: block; }

@keyframes megaFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mega-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    width: 100%;
    box-sizing: border-box;
}
.mega-inner[data-cols="1"] { grid-template-columns: repeat(1, 1fr); }
.mega-inner[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.mega-inner[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.mega-inner[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.mega-inner[data-cols="5"] { grid-template-columns: repeat(5, 1fr); }

/* Each column */
.mega-col {
    padding: 12px 16px 16px;
    border-right: 1px solid var(--border);
    transition: opacity 0.2s;
    border-radius: 0;
    margin: 0;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}
.mega-col:last-child { border-right: none; }

/* Default state — all visible equally */
.mega-col .mega-col-header { color: var(--muted); }
.mega-col ul li a          { color: #222; }

/* Active column — highlighted with border */
.mega-col.active {
    border: 1.5px solid var(--teal);
    background: #f0fdf9;
    padding: 11px 15px 15px;
    margin: 0;
}
.mega-col.active .mega-col-header {
    color: var(--teal);
    border-bottom-color: var(--teal);
}
.mega-col.active ul li a { color: #111; font-weight: 500; }

/* Dimmed columns — fully visible, black text */
.mega-col.dimmed { opacity: 1; }
.mega-col.dimmed .mega-col-header { color: var(--muted); }
.mega-col.dimmed ul li a { color: #222; font-weight: 400; }

.mega-col-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    transition: color 0.2s;
}
.mega-col.active .mega-col-header {
    color: var(--teal);
    border-bottom-color: var(--teal);
}

.mega-col ul { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.mega-col ul li a {
    display: block;
    padding: 5px 8px;
    font-size: 13px;
    color: var(--text2);
    border-radius: 5px;
    transition: background 0.15s, color 0.15s, padding-left 0.15s;
}
.mega-col ul li a:hover {
    background: var(--light);
    color: var(--navy);
    padding-left: 12px;
}
.mega-col.active ul li a:hover { color: var(--navy); }


/* =============================================
   HAMBURGER
   ============================================= */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.nav-toggle:hover { background: rgba(255,255,255,0.10); }
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =============================================
   MOBILE NAV
   ============================================= */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--navy);
    border-top: 1px solid rgba(255,255,255,0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.mobile-nav.open {
    display: flex;
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-nav-link {
    display: block;
    padding: 13px 20px;
    color: rgba(255,255,255,0.80);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background var(--transition);
}
.mobile-nav-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }

/* Mobile accordion */
.mobile-nav-item { border-bottom: 1px solid rgba(255,255,255,0.06); }

.mobile-nav-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.80);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background var(--transition);
}
.mobile-nav-toggle:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.mobile-nav-toggle.open { color: var(--teal); }
.mobile-nav-toggle.open .arrow { transform: rotate(180deg); }

.mobile-dropdown {
    display: none;
    flex-direction: column;
    background: rgba(0,0,0,0.2);
    padding: 4px 0;
}
.mobile-dropdown.open { display: flex; }

.mobile-dropdown a {
    padding: 9px 20px 9px 36px;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    transition: background var(--transition), color var(--transition);
    border: none;
}
.mobile-dropdown a:hover { background: rgba(255,255,255,0.06); color: var(--white); }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #1a3a6e 100%);
    color: var(--white);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}
.site-footer .container {
    display: block;
    height: auto;
    padding: 0 1.25rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}
.site-footer .logo-icon { width: 36px; height: 36px; font-size: 18px; }
.site-footer .logo-text { font-size: 22px; }
.footer-brand p { color: rgba(255,255,255,0.6); margin-top: 0.75rem; font-size: 0.875rem; max-width: 220px; }
.footer-links { display: flex; flex-direction: column; gap: 0.4rem; }
.footer-links h4 { color: var(--teal); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.footer-links a { color: rgba(255,255,255,0.65); font-size: 0.875rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--white); }
.footer-bottom { padding-top: 1.5rem; text-align: center; color: rgba(255,255,255,0.4); font-size: 0.8rem; }
.footer-bottom span { color: var(--teal); }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-block;
    padding: 0.7rem 1.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn-primary { background: var(--teal); color: var(--navy); font-weight: 700; }

/* =============================================
   HERO
   ============================================= */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #1a3a6e 100%);
    padding: 40px 24px 60px;
    text-align: center;
}
.hero .container { display: block; height: auto; }
.hero h1 {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    color: var(--white);
    letter-spacing: -1px;
    margin-bottom: 10px;
}
.hero h1 span { color: var(--teal); }
.hero p { color: rgba(255,255,255,0.65); font-size: 16px; max-width: 500px; margin: 0 auto 24px; }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content { min-height: calc(100vh - 64px - 300px); }

/* =============================================
   ERROR PAGE
   ============================================= */
.error-page { text-align: center; padding: 6rem 0; }
.error-page h1 { font-size: 6rem; font-weight: 800; color: var(--navy); }
.error-page p  { color: var(--muted); font-size: 1.15rem; margin: 1rem 0 2rem; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .nav         { display: none; }
    .nav-toggle  { display: flex; }
    .mega-menu   { display: none !important; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
}

/* =============================================
   HERO
   ============================================= */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #1a3a6e 100%);
    padding: 28px 20px 50px;
    text-align: center;
}
.hero-inner { max-width: var(--container); margin: 0 auto; }
.hero h1 {
    font-size: clamp(22px, 3.5vw, 34px);
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.hero h1 span { color: var(--teal); }
.hero p { color: rgba(255,255,255,0.65); font-size: 14px; max-width: 480px; margin: 0 auto; }

/* =============================================
   MAIN WRAP
   ============================================= */
.main-wrap {
    max-width: var(--container);
    margin: -20px auto 0;
    padding: 0 20px 60px;
}

/* =============================================
   HOME LAYOUT — Calculator always centered, Ad on right
   ============================================= */
.home-layout {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: start;
    margin-bottom: 40px;
    min-height: 400px;
}

.home-calc-col {
    position: relative;
    flex-shrink: 0;
    z-index: 1;
}

/* Ad sits absolutely on the right — doesn't affect calculator centering */
.home-ad-col {
    position: absolute;
    right: 0;
    top: 0;
    width: 300px;
}
.ad-sticky { position: sticky; top: 80px; }

/* =============================================
   CALCULATOR CARD
   ============================================= */
.calc-card {
    width: 340px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13);
    overflow: hidden;
}
#tab-sci .calc-card,
.calc-card:has(#tab-sci.active) {
    width: 360px;
}

/* =============================================
   THEME TOGGLE — inside tabs bar, aligned
   ============================================= */
.calc-theme-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.toggle-label       { display: none; }
.toggle-switch-wrap { display: flex; align-items: center; gap: 5px; }
.toggle-icon {
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: #334155; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* =============================================
   CALCULATOR DISPLAY — COPY BUTTON
   ============================================= */
.calc-expression { font-family: var(--font-mono); font-size: 12px; word-break: break-all; width: 100%; text-align: right; line-height: 1.4; display: block; visibility: hidden; }

.copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font-main);
    background: #f1f5f9;
    color: #475569;
}
.copy-btn:hover { background: #e2e8f0; color: var(--navy); }
.copy-btn.copied { border-color: var(--teal) !important; }

/* =============================================
   LIGHT THEME (default)
   ============================================= */
.calc-card.theme-light .calc-tabs      { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.calc-card.theme-light .tab-btn        { background: transparent; color: #94a3b8; }
.calc-card.theme-light .tab-btn.active { color: var(--navy); border-bottom-color: var(--teal); background: #fff; }
.calc-card.theme-light .tab-btn:hover:not(.active) { color: #475569; background: #f1f5f9; }

.calc-card.theme-light .calc-display   { background: #fff; border-bottom: 1px solid #f1f5f9; }
.calc-card.theme-light .calc-expression{ color: #94a3b8; }
.calc-card.theme-light .calc-result    { color: var(--navy); }
.calc-card.theme-light .copy-btn       { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.calc-card.theme-light .copy-btn:hover { background: #e2e8f0; color: var(--navy); }

.calc-card.theme-light .calc-body      { background: #f8fafc; }
.calc-card.theme-light .btn-num        { background: #fff; color: #1e293b; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.calc-card.theme-light .btn-num:hover  { background: #f1f5f9; }
.calc-card.theme-light .btn-op         { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.calc-card.theme-light .btn-op:hover   { background: #bae6fd; }
.calc-card.theme-light .btn-fn         { background: #f3f0ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.calc-card.theme-light .btn-fn:hover   { background: #ede9fe; }
.calc-card.theme-light .btn-clear      { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.calc-card.theme-light .btn-clear:hover{ background: #ffe4e6; }
.calc-card.theme-light .btn-eq         { background: var(--teal); color: #fff; font-weight: 700; border: none; box-shadow: 0 4px 12px rgba(0,201,167,0.30); }
.calc-card.theme-light .btn-eq:hover   { background: var(--teal2); }

/* =============================================
   DARK THEME
   ============================================= */
.calc-card.theme-dark .calc-tabs       { background: #1a1a1a; }
.calc-card.theme-dark .tab-btn         { background: transparent; color: rgba(255,255,255,0.45); }
.calc-card.theme-dark .tab-btn.active  { color: var(--teal); border-bottom-color: var(--teal); background: rgba(0,201,167,0.06); }
.calc-card.theme-dark .tab-btn:hover:not(.active) { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.05); }

.calc-card.theme-dark .calc-display    { background: #0a0a0a; border-bottom: none; }
.calc-card.theme-dark .calc-expression { color: #4a5568; }
.calc-card.theme-dark .calc-result     { color: #fff; }
.calc-card.theme-dark .copy-btn        { background: #1c1c1c; color: #718096; border-color: #2d2d2d; }
.calc-card.theme-dark .copy-btn:hover  { background: #2a2a2a; color: #fff; }

.calc-card.theme-dark .calc-body       { background: #1a1a1a; }
.calc-card.theme-dark .btn-num         { background: #2c2c2c; color: #fff; border: none; }
.calc-card.theme-dark .btn-num:hover   { background: #3a3a3a; }
.calc-card.theme-dark .btn-op          { background: #162d4a; color: var(--teal); border: none; }
.calc-card.theme-dark .btn-op:hover    { background: #1e3d63; }
.calc-card.theme-dark .btn-fn          { background: #111827; color: #a78bfa; border: none; }
.calc-card.theme-dark .btn-fn:hover    { background: #1f2937; }
.calc-card.theme-dark .btn-clear       { background: #3a1212; color: #ff6b6b; border: none; }
.calc-card.theme-dark .btn-clear:hover { background: #4d1818; }
.calc-card.theme-dark .btn-eq          { background: var(--teal); color: var(--navy); font-weight: 700; border: none; }
.calc-card.theme-dark .btn-eq:hover    { background: var(--teal2); }

/* Tabs */
.calc-tabs {
    display: flex;
    align-items: center;
    height: 44px;
}

.tab-btn {
    flex: 1;
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tab-btn.active { border-bottom-color: var(--teal); }
.tab-content        { display: none; }
.tab-content.active { display: block; }

/* Calculator body */
.calc-body   { padding: 10px; }
.calc-display {
    padding: 10px 14px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
}
.calc-result { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1; word-break: break-all; text-align: right; width: 100%; }

/* External result panel — shown to the right of the calculator card */
.calc-result-panel {
    position: absolute;
    left: calc(100% + 16px);
    top: 69px;
    height: 80px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.calc-result-panel-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: #111;
    line-height: 1;
}

/* Button grid */
.calc-grid              { display: grid; gap: 6px; }
.calc-grid-normal       { grid-template-columns: repeat(4, 1fr); }
.calc-grid-sci          { grid-template-columns: repeat(6, 1fr); }

.calc-btn {
    border: none;
    border-radius: 6px;
    padding: 11px 4px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
}
.calc-btn:active { transform: scale(0.94); }
.btn-zero  { grid-column: span 2; }
.btn-zero2 { grid-column: span 2; }
.btn-sci-sm { font-size: 10px; padding: 7px 2px; }
.btn-sci-eq { grid-column: span 3; }

/* =============================================
   CATEGORIES SECTION
   ============================================= */
.categories-section { margin-top: 10px; }

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.section-sub {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 24px;
}
/* Remove any unwanted link style in section-sub */
.section-sub a { color: inherit; text-decoration: none; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.2s;
}
.category-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}

.category-header {
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.category-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.icon-finance { background: #eff6ff; }
.icon-health  { background: #f0fdf4; }
.icon-math    { background: #faf5ff; }
.icon-other   { background: #fff7ed; }

.category-title { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.2; }
.category-count { font-size: 11px; color: var(--muted); margin-top: 2px; }

.category-links {
    padding: 12px 20px 16px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.category-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text2);
    text-decoration: none;
    transition: all 0.15s;
}
.category-links li a:hover {
    background: var(--light);
    color: var(--navy);
    padding-left: 12px;
}
.category-links li a::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    flex-shrink: 0;
    opacity: 0.7;
}
.category-links li a:hover::before { opacity: 1; }

/* =============================================
   RESPONSIVE — CALCULATOR
   ============================================= */
@media (max-width: 900px) {
    .home-layout   { min-height: auto; }
    .home-ad-col   { display: none; }
    .calc-result-panel { display: none !important; }
}
@media (max-width: 480px) {
    .home-calc-col { width: 100%; }
    .calc-card     { width: 100% !important; border-radius: 0; }
    #tab-sci .calc-card,
    .calc-card:has(#tab-sci.active),
    .calc-card.sci-wide { width: 100% !important; }
    .calc-grid-sci { grid-template-columns: repeat(6, 1fr); }
    /* Compact sci buttons on mobile to fit full calc in viewport */
    .calc-grid-sci .calc-btn { padding: 6px 1px; font-size: 11px; }
    .btn-sci-sm    { font-size: 8px !important; padding: 5px 1px !important; }
    .btn-sci-eq    { grid-column: span 3; }
    .calc-btn      { padding: 8px 2px; font-size: 12px; }
    .calc-result   { font-size: 22px; }
    .calc-display  { height: 64px; }
    .category-grid { grid-template-columns: 1fr; }
    .main-wrap     { margin-top: -15px; padding: 0 0 40px; }
}
@media (max-width: 360px) {
    .calc-grid-sci { grid-template-columns: repeat(6, 1fr); }
    .calc-grid-sci .calc-btn { padding: 5px 0px; font-size: 10px; }
    .btn-sci-sm    { font-size: 7px !important; padding: 4px 0px !important; }
    .btn-sci-eq    { grid-column: span 3; }
}

/* =============================================
   CALCULATOR PAGE LAYOUT
   ============================================= */
.calc-page-wrap {
    max-width: var(--container);
    margin: 0 auto;
    padding: 30px 20px 60px;
    display: flex;
    gap: 24px;
    align-items: start;
}

.calc-page-main { flex: 1; min-width: 0; }

.calc-page-header { margin-bottom: 24px; }
.calc-page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.calc-page-desc {
    color: var(--text2);
    font-size: 14px;
    line-height: 1.7;
    max-width: 680px;
}

.calc-tool-box {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 32px;
}

.calc-page-bottom {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px 28px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text2);
}
.calc-page-bottom h2,
.calc-page-bottom h3 { color: var(--navy); margin: 16px 0 8px; }

/* Ad column */
.calc-page-ad { width: 300px; flex-shrink: 0; }

@media (max-width: 900px) {
    .calc-page-ad  { display: none; }
    .calc-page-wrap { padding: 20px 16px 40px; }
}
/* =============================================
   TOOL PAGE — TOP DESCRIPTION
   ============================================= */
.calc-page-top-desc {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 18px 24px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text2);
    margin-bottom: 20px;
}

/* =============================================
   TOOL PAGE — SIDEBAR
   ============================================= */
.calc-page-wrap {
    max-width: var(--container);
    margin: 0 auto;
    padding: 30px 20px 60px;
    display: flex;
    gap: 24px;
    align-items: start;
}

.calc-page-main   { flex: 1; min-width: 0; }
.calc-page-sidebar { width: 300px; flex-shrink: 0; }

/* Ad box placeholder */
.sidebar-ad {
    width: 300px;
    height: 250px;
    background: var(--light);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}

/* Sidebar category list */
.sidebar-category {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.sidebar-category-title {
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-links {
    list-style: none;
    padding: 8px 0;
}

.sidebar-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 13px;
    color: var(--text2);
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-links li a::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    flex-shrink: 0;
    opacity: 0.5;
}
.sidebar-links li a:hover {
    background: var(--light);
    color: var(--navy);
    border-left-color: var(--teal);
    padding-left: 22px;
}
.sidebar-links li a:hover::before { opacity: 1; }

/* Active current page link */
.sidebar-links li a.active {
    background: transparent;
    color: var(--teal);
    font-weight: 600;
    border-left-color: var(--teal);
}
.sidebar-links li a.active::before { opacity: 1; background: var(--teal); width: 8px; height: 8px; }

/* =============================================
   RESPONSIVE — TOOL PAGE
   ============================================= */
@media (max-width: 900px) {
    .calc-page-sidebar { display: none; }
    .calc-page-wrap    { padding: 20px 16px 40px; }
}
/* Scientific tab wider card */
.calc-card.sci-wide { width: 360px; }
/* sci-wide handled by calc-card directly */
/* =============================================
   NAV CURRENCY SELECTOR
   ============================================= */
.nav-currency-wrap {
    position: relative;
}
.nav-currency-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-currency-btn:hover { background: rgba(255,255,255,0.2); }
.nav-currency-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    z-index: 9999;
}
.nav-currency-search {
    padding: 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.nav-currency-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    font-family: var(--font-main);
}
.nav-currency-search input:focus { border-color: var(--teal); }
.currency-list {
    max-height: 260px;
    overflow-y: auto;
}
.currency-list::-webkit-scrollbar { width: 4px; }
.currency-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.currency-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.currency-option:hover { background: #f0fdf9; }
.currency-option img { width: 20px; height: 15px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.currency-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.currency-name { font-size: 13px; font-weight: 600; color: #0d2137; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.currency-sub { font-size: 11px; color: #94a3b8; }
.currency-code { font-size: 12px; font-weight: 700; color: #00c9a7; white-space: nowrap; background: #f0fdf9; padding: 2px 6px; border-radius: 4px; border: 1px solid #b2f0e3; }
.currency-no-result { padding: 16px; text-align: center; color: #94a3b8; font-size: 13px; }