/*
Theme Name: Máy Tính Online
Theme URI: https://maytinhonline.com
Author: MayTinhOnline
Author URI: https://maytinhonline.com
Description: Theme máy tính online với đầy đủ công cụ tính toán: khoa học, phần trăm, lãi suất, BMI, phương trình bậc 2 và nhiều hơn nữa.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: maytinh
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
*/

/* ===== VARIABLES ===== */
:root {
    --bg-primary: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1a1d27;
    --text-secondary: #6b7280;
    --accent: #1a73e8;
    --accent-hover: #1557b0;
    --accent-light: #e8f0fe;
    --border: #e0e0e0;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.15s ease;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* WP Admin Bar fix */
body.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .site-header { top: 46px; } }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== SITE HEADER ===== */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== HEADER SEARCH ===== */
.site-search {
    position: relative;
    flex: 1;
    max-width: 260px;
    margin-left: auto;
}
.site-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}
.site-search-input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 38px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #f3f4f6;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.site-search-input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.site-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    background: #e5e7eb;
    color: #4b5563;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.site-search-clear:hover { background: #d1d5db; color: #111827; }
.site-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    max-height: 420px;
    overflow-y: auto;
    z-index: 200;
}
.site-search-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: var(--text-primary);
}
.site-search-item:last-child { border-bottom: none; }
.site-search-item:hover { background: #f9fafb; }
.site-search-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.site-search-title mark {
    background: #fef3c7;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
.site-search-cat {
    font-size: 12px;
    color: var(--text-secondary);
}
.site-search-empty,
.site-search-loading {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    color: var(--accent);
}

.site-logo:hover { text-decoration: none; }

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav > a, .nav-dropdown-trigger {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-main);
}

.site-nav > a:hover, .nav-dropdown-trigger:hover {
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
}

.site-nav > a.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.nav-dropdown { position: relative; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.nav-dropdown-menu a:hover {
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
}

.nav-dropdown-menu a.see-all {
    color: var(--accent);
    font-weight: 600;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 10px;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .site-header-inner { gap: 8px; padding: 0 12px; }
    .mobile-menu-btn { display: flex; }
    .site-search { max-width: none; margin-left: 4px; }
    .site-search-input { height: 36px; font-size: 13px; }

    /* Hamburger → X animation */
    .mobile-menu-btn span {
        width: 22px;
        transition: transform .25s, opacity .2s, background .2s;
        transform-origin: center;
    }
    .mobile-menu-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
    .mobile-menu-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .site-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 20px rgba(0,0,0,.08);
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
        gap: 2px;
    }
    .site-nav.open { display: flex; }

    /* Đảm bảo mọi item con cấp 1 đều full width */
    .site-nav > a,
    .site-nav > .nav-dropdown {
        display: block;
        width: 100%;
        box-sizing: border-box;
        align-self: stretch;
    }
    .site-nav > .nav-dropdown .nav-dropdown-menu { width: auto; }

    /* Style các item cấp 1 đồng bộ (trigger + link thường) */
    .site-nav > a,
    .nav-dropdown-trigger {
        display: block;
        width: 100%;
        text-align: left;
        padding: 12px 14px;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 500;
        color: var(--text-primary);
        background: transparent;
        position: relative;
        box-sizing: border-box;
    }
    .site-nav > a:hover,
    .nav-dropdown-trigger:hover { background: #f3f4f6; color: var(--text-primary); }
    .site-nav > a.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

    /* Mũi tên bên phải cho dropdown trigger */
    .nav-dropdown-trigger::after {
        content: '';
        position: absolute;
        right: 16px;
        top: 50%;
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--text-secondary);
        border-bottom: 2px solid var(--text-secondary);
        transform: translateY(-75%) rotate(45deg);
        transition: transform .2s;
    }
    .nav-dropdown.open .nav-dropdown-trigger::after {
        transform: translateY(-25%) rotate(-135deg);
    }
    .nav-dropdown.open .nav-dropdown-trigger {
        background: var(--accent-light);
        color: var(--accent);
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding: 2px 0 4px 6px;
        margin: 2px 0 4px 10px;
        display: none;
        border-left: 2px solid var(--accent-light);
        border-radius: 0;
        min-width: 0;
        width: auto;
    }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown-menu a {
        padding: 9px 12px;
        font-size: 14px;
        color: var(--text-secondary);
        border-radius: 6px;
    }
    .nav-dropdown-menu a:hover { background: #f3f4f6; color: var(--text-primary); }
}

@media (max-width: 480px) {
    .logo-text { display: none; }
    .site-logo { gap: 0; }
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    max-width: 750px;
    margin: 0 auto;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* ===== PAGE LAYOUT ===== */
.page-layout {
    max-width: 750px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 16px;
    align-items: start;
}

@media (max-width: 620px) {
    .page-layout { grid-template-columns: 1fr; }
}

/* ===== CALCULATOR CARD ===== */
.calc-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.calc-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.calc-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.calc-desc { font-size: 14px; color: var(--text-secondary); }

/* Tabs */
.calc-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.calc-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.calc-tab:hover { color: var(--text-primary); background: #f8f9fa; }
.calc-tab.active { color: var(--accent); }

.calc-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20%; right: 20%;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}

/* Panels */
.calc-panel { display: none; padding: 20px 24px; }
.calc-panel.active { display: block; }

/* Fields */
.calc-fields { display: flex; flex-direction: column; gap: 16px; }

.calc-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.calc-input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-main);
    font-size: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color var(--transition);
    outline: none;
}

.calc-input:focus { border-color: var(--accent); }
.calc-hint { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.calc-radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.calc-radio { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.calc-radio input { cursor: pointer; }

.range-wrapper { display: flex; align-items: center; gap: 12px; }
.calc-range { flex: 1; -webkit-appearance: none; height: 6px; background: var(--border); border-radius: 3px; outline: none; }
.calc-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.range-value { font-weight: 600; color: var(--accent); min-width: 60px; text-align: right; }

/* Submit Button */
.calc-submit-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}

.calc-submit-btn:hover { background: var(--accent-hover); }
.calc-submit-btn:active { transform: scale(0.99); }

/* Results */
.calc-result-area { margin-top: 20px; }

.calc-results {
    background: #f8fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.result-item:last-child { border-bottom: none; }
.result-item.highlight { background: var(--accent-light); }
.result-item.highlight .result-value { color: var(--accent); font-size: 20px; }
.result-label { font-size: 14px; color: var(--text-secondary); }
.result-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text-primary); }

.result-divider {
    padding: 8px 16px;
    background: var(--border);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.result-table-wrap { overflow-x: auto; }
.result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.result-table th, .result-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--border); }
.result-table th { background: #f0f2f5; font-weight: 600; position: sticky; top: 0; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table tbody tr:hover { background: var(--accent-light); }

.calc-error {
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
}

/* Guide Section */
.calc-guide {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 24px;
    margin-top: 20px;
    line-height: 1.8;
}

.calc-guide h2 { font-size: 20px; margin: 24px 0 12px; }
.calc-guide h2:first-child { margin-top: 0; }
.calc-guide p { margin-bottom: 12px; color: var(--text-secondary); }
.calc-guide ul, .calc-guide ol { margin: 0 0 12px 24px; color: var(--text-secondary); }
.calc-guide li { margin-bottom: 4px; }
.calc-guide code { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 13px; }

/* ===== SIDEBAR ===== */
.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3 { font-size: 13px; font-weight: 700; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.sidebar-list { list-style: none; }
.sidebar-list li { margin-bottom: 1px; }
.sidebar-list a {
    display: block;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}
.sidebar-list a:hover { color: var(--accent); }

/* ===== FOOTER ===== */
.site-footer {
    background: #111827;
    margin-top: 60px;
    color: #d1d5db;
}

.footer-main {
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 52px 24px 40px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
}

/* Column shared */
.footer-col-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

/* Column 1: About */
.footer-desc {
    font-size: 14px;
    line-height: 1.75;
    color: #9ca3af;
    margin-bottom: 16px;
}

.footer-contact {
    font-size: 13.5px;
    color: #9ca3af;
    margin-bottom: 8px;
    line-height: 1.5;
}
.footer-contact strong { color: #e5e7eb; font-weight: 500; }
.footer-contact a { color: #9ca3af; text-decoration: none; }
.footer-contact a:hover { color: #60a5fa; }

/* Social icons */
.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #9ca3af;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.footer-social-link:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
    text-decoration: none;
}

/* Columns 2 & 3: Nav lists */
.footer-nav-list {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
}
.footer-nav-list li {
    margin-bottom: 9px;
}
.footer-nav-list li a {
    font-size: 14px;
    color: #9ca3af;
    text-decoration: none;
    line-height: 1.4;
    transition: color .15s;
}
.footer-nav-list li a:hover { color: #fff; text-decoration: none; }
/* Hide WP generated classes noise */
.footer-nav-list li { list-style: disc; }

/* Bottom bar */
.footer-bottom {
    background: #0f172a;
}
.footer-bottom-inner {
    max-width: 750px;
    margin: 0 auto;
    padding: 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-copyright {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

/* Legal nav */
.footer-legal-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
}
.footer-legal-list li { display: flex; align-items: center; }
.footer-legal-list li + li::before {
    content: '|';
    padding: 0 10px;
    color: #374151;
}
.footer-legal-list li a {
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
    transition: color .15s;
}
.footer-legal-list li a:hover { color: #d1d5db; }

/* Footer responsive */
@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
    .footer-inner { grid-template-columns: 1fr; gap: 28px; }
    .footer-about { grid-column: auto; }
    .footer-bottom-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ===== CASIO FX-580VN X ===== */
.casio-section {
    max-width: 460px;
    margin: 0 auto 56px;
    padding: 0 16px;
}
.casio-section-header {
    text-align: center;
    margin-bottom: 20px;
}
.casio-section-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.casio-section-header p  { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* ── Outer white frame (like real Casio) ── */
.casio-outer {
    background: #e8eaec;
    border-radius: 18px 18px 24px 24px;
    padding: 10px 10px 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 2px 0 #ccc;
    user-select: none;
}

/* ── Dark carbon-fiber body ── */
.casio-body {
    background-color: #1a1c1e;
    background-image:
        repeating-linear-gradient(45deg,  rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 0, transparent 50%),
        repeating-linear-gradient(-45deg, rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 0, transparent 50%);
    background-size: 6px 6px;
    border-radius: 10px 10px 16px 16px;
    padding: 12px 12px 16px;
    border: 1px solid #0a0a0a;
}

/* ── Brand bar ── */
.casio-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 8px;
}
.c-logo {
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: .05em;
    color: #e8e8e8;
}
.c-brand-center { text-align: center; }
.c-classwiz {
    font-size: 11px;
    font-weight: 700;
    color: #d060d0;
    letter-spacing: .12em;
}
.c-model {
    font-size: 12px;
    font-weight: 700;
    color: #c0c2c6;
    letter-spacing: .02em;
}

/* ── Display bezel ── */
.c-display-bezel {
    background: #0d0e10;
    border-radius: 6px;
    padding: 6px;
    margin-bottom: 12px;
    box-shadow: inset 0 3px 8px rgba(0,0,0,.8);
}
.c-lcd {
    background: #b0c8a8;
    border-radius: 3px;
    padding: 6px 10px 8px;
    min-height: 76px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    box-shadow: inset 0 1px 4px rgba(0,0,0,.25);
}
.c-ind-row {
    display: flex;
    gap: 7px;
    margin-bottom: 3px;
}
.ci {
    font-size: 8px;
    font-weight: 700;
    color: #b0c8a8; /* invisible by default */
    letter-spacing: .02em;
    transition: color .1s;
}
.ci.casio-ind-on { color: #1a3000; }
.ci-math, .ci-right { color: #1a3000; opacity: .35; }
.c-expr {
    font-size: 11px;
    color: #253a10;
    text-align: right;
    min-height: 16px;
    line-height: 1.4;
    opacity: .7;
    word-break: break-all;
}
.c-result {
    font-size: 24px;
    font-weight: 700;
    color: #152500;
    text-align: right;
    line-height: 1.2;
}

/* ── Keyboard container ── */
.c-kb { display: flex; flex-direction: column; gap: 4px; }

/* ── SYSTEM ROW ── */
.c-sys-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 0 2px;
}
.c-sys-left, .c-sys-right { display: flex; gap: 10px; align-items: flex-end; }
.c-mod-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.c-mod-label {
    font-size: 8px;
    font-weight: 700;
    color: #888;
    letter-spacing: .04em;
    line-height: 1;
}
.c-lbl-shift { color: #f0a020; }
.c-lbl-alpha { color: #d06060; }

/* Dome buttons (SHIFT / ALPHA / MENU / SETUP / ON) */
.c-dome {
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: radial-gradient(circle at 38% 32%, #c8ccd0, #7a7e84 55%, #3a3c40);
    box-shadow: 0 3px 6px rgba(0,0,0,.6), inset 0 1px 2px rgba(255,255,255,.35);
    transition: transform .08s, box-shadow .08s;
}
.c-dome:active { transform: translateY(2px) scale(.96); box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.c-dome-lg { width: 34px; height: 34px; }
.c-dome-sm { width: 24px; height: 24px; }
.c-dome-on  { background: radial-gradient(circle at 38% 32%, #e0e4e8, #8a8e94 55%, #3a3c40); }
.c-dome.ck-active { box-shadow: 0 1px 2px rgba(0,0,0,.6); transform: translateY(2px) scale(.96); }

/* ── D-PAD ── */
.c-dpad-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.c-dpad-mid { display: flex; align-items: center; gap: 0; }
.c-dpad-center {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #9a9ea6, #4a4e56 60%, #2a2c30);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.5), 0 1px 2px rgba(255,255,255,.1);
}
.c-dpad-btn {
    background: radial-gradient(circle at 40% 35%, #7a7e88, #404448 60%, #252628);
    border: none;
    color: #c8ccd2;
    font-size: 9px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,.5);
    transition: transform .07s;
    display: flex; align-items: center; justify-content: center;
}
.c-dpad-btn:active { transform: scale(.9); }
.c-dpad-up, .c-dpad-down {
    width: 42px; height: 18px;
    border-radius: 4px 4px 0 0;
}
.c-dpad-down { border-radius: 0 0 4px 4px; }
.c-dpad-left, .c-dpad-right {
    width: 18px; height: 28px;
    border-radius: 4px 0 0 4px;
}
.c-dpad-right { border-radius: 0 4px 4px 0; }

/* ── OPTN / CALC ROW ── */
.c-optn-row {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 2px;
}
.c-optn-gap { flex: 1; }
.ck {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2px 5px;
    position: relative;
    transition: transform .07s, box-shadow .07s;
    line-height: 1;
}
.ck:active { transform: translateY(2px); }
.ck sup, .ck sub { font-size: 7px; }
.c-above {
    position: absolute;
    top: 3px; left: 0; right: 0;
    text-align: center;
    font-size: 7.5px;
    line-height: 1;
    font-weight: 600;
}
.c-above-s  { color: #f0a020; } /* SHIFT: orange */
.c-above-p  { color: #9090e0; } /* ALPHA: purple */

.c-rect-wide {
    height: 32px;
    min-width: 48px;
    background: linear-gradient(180deg, #333538 0%, #24262a 100%);
    color: #c8cacf;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 3px 0 #0d0e10;
}
.c-rect-wide:active { box-shadow: 0 1px 0 #0d0e10; }
.c-rect-calc { color: #d8dae0; }
.fn-solve { font-size: 7px; color: #f0a020; position: absolute; top: 3px; left: 0; right: 0; text-align: center; }
.c-x-var { font-style: italic; color: #80c0f0; }

/* ── 6-KEY FUNCTION ROWS ── */
.c-row6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}
.c-fn {
    height: 34px;
    background: linear-gradient(180deg, #2e3034 0%, #1e2024 100%);
    color: #b8bcc4;
    font-size: 10.5px;
    font-weight: 600;
    box-shadow: 0 3px 0 #0a0b0d;
}
.c-fn:active { box-shadow: 0 1px 0 #0a0b0d; }
.c-key-lbl { font-size: 10.5px; font-weight: 600; }
.c-frac { font-size: 12px; }

/* ── 5-KEY NUMBER ROWS ── */
.c-row5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

/* White number keys */
.c-white {
    height: 42px;
    background: linear-gradient(180deg, #f4f5f6 0%, #dddfe2 100%);
    color: #1a1c1e;
    box-shadow: 0 4px 0 #8a8c90, inset 0 1px 0 rgba(255,255,255,.9);
}
.c-white:active { box-shadow: 0 1px 0 #8a8c90; }
.c-digit { font-size: 18px; font-weight: 700; color: #111318; }
.c-white .c-above { color: #505468; }

/* Blue DEL / AC */
.c-blue {
    height: 42px;
    box-shadow: 0 4px 0 #1a3080, inset 0 1px 0 rgba(255,255,255,.2);
}
.c-del {
    background: linear-gradient(180deg, #4070d8 0%, #2850b0 100%);
    color: #fff;
}
.c-ac {
    background: linear-gradient(180deg, #3060c8 0%, #1c40a0 100%);
    color: #fff;
}
.c-blue:active { box-shadow: 0 1px 0 #1a3080; }
.c-blue .c-digit { color: #fff; }
.c-blue .c-above { color: rgba(255,255,255,.6); }

/* Dark operators (×, ÷, +, −) */
.c-op-dark {
    height: 42px;
    background: linear-gradient(180deg, #2a2c30 0%, #1a1c20 100%);
    color: #d0d4dc;
    box-shadow: 0 4px 0 #06070a;
}
.c-op-dark:active { box-shadow: 0 1px 0 #06070a; }
.c-op-dark .c-digit { font-size: 20px; color: #e0e4ec; }
.c-op-dark .c-above { color: #9090e0; }

/* Equals key */
.c-equals .c-digit { font-size: 22px; }

/* ===== CASIO FX-880BTG ===== */
.casio880-section { margin-top: 0; }

/* ── Outer silver frame ── */
.fx880-outer {
    background: linear-gradient(160deg, #d8dde4 0%, #c8cdd4 100%);
    border-radius: 18px 18px 24px 24px;
    padding: 10px 10px 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 2px 0 #aab0b8;
    user-select: none;
}

/* ── Dark navy body ── */
.fx880-body {
    background-color: #1a2035;
    background-image:
        repeating-linear-gradient(45deg,  rgba(100,130,200,.04) 0, rgba(100,130,200,.04) 1px, transparent 0, transparent 50%),
        repeating-linear-gradient(-45deg, rgba(100,130,200,.04) 0, rgba(100,130,200,.04) 1px, transparent 0, transparent 50%);
    background-size: 6px 6px;
    border-radius: 10px 10px 16px 16px;
    padding: 12px 12px 16px;
    border: 1px solid #0a0d18;
}

/* ── Brand (FX-880BTG) ── */
.fx880-brand { padding: 2px 4px 8px; }
.fx880-classwiz { font-size: 11px; font-weight: 700; color: #60a8e0; letter-spacing: .12em; }
.fx880-model    { font-size: 12px; font-weight: 700; color: #c0c8d8; letter-spacing: .02em; }

/* ── Display bezel ── */
.fx880-display-bezel {
    background: #080c18;
    border-radius: 6px;
    padding: 6px;
    margin-bottom: 12px;
    box-shadow: inset 0 3px 8px rgba(0,0,0,.9);
}
.fx880-lcd {
    background: #a8c4b0;
    box-shadow: inset 0 1px 4px rgba(0,0,0,.25);
}

/* ── SHIFT/ALPHA labels ── */
.fx880-lbl-shift { color: #f07028; }
.fx880-lbl-alpha { color: #60a8e0; }

/* ── Dome button accent (SHIFT = orange, ALPHA = blue) ── */
.fx880-dome-shift { background: radial-gradient(circle at 38% 32%, #e0906a, #c05030 55%, #803010); }
.fx880-dome-alpha { background: radial-gradient(circle at 38% 32%, #6090e0, #3060c0 55%, #102080); }

/* ── Secondary labels ── */
.fx880-above-s { color: #f07028; } /* SHIFT: orange */
.fx880-above-p { color: #60a8e0; } /* ALPHA: blue */

/* ── Function keys (navy tint) ── */
.fx880-fn {
    height: 34px;
    background: linear-gradient(180deg, #283050 0%, #18203a 100%);
    color: #b8c4d8;
    font-size: 10.5px;
    font-weight: 600;
    box-shadow: 0 3px 0 #080c18;
    border-radius: 4px;
}
.fx880-fn:active { box-shadow: 0 1px 0 #080c18; transform: translateY(2px); }

/* ── DEL key (orange) ── */
.fx880-del {
    height: 42px;
    background: linear-gradient(180deg, #e07030 0%, #c05018 100%);
    box-shadow: 0 4px 0 #602000, inset 0 1px 0 rgba(255,255,255,.2);
    color: #fff;
    border-radius: 4px;
}
.fx880-del:active { box-shadow: 0 1px 0 #602000; transform: translateY(2px); }
.fx880-del .c-digit { color: #fff; font-size: 18px; font-weight: 700; }
.fx880-del .c-above { color: rgba(255,255,255,.65); }

/* ── AC key (red) ── */
.fx880-ac {
    height: 42px;
    background: linear-gradient(180deg, #d03828 0%, #a82818 100%);
    box-shadow: 0 4px 0 #601008, inset 0 1px 0 rgba(255,255,255,.2);
    color: #fff;
    border-radius: 4px;
}
.fx880-ac:active { box-shadow: 0 1px 0 #601008; transform: translateY(2px); }
.fx880-ac .c-digit { color: #fff; font-size: 18px; font-weight: 700; }
.fx880-ac .c-above { color: rgba(255,255,255,.65); }

/* ── Operator keys (dark navy) ── */
.fx880-op {
    height: 42px;
    background: linear-gradient(180deg, #202840 0%, #121828 100%);
    color: #d0d8f0;
    box-shadow: 0 4px 0 #04060e;
    border-radius: 4px;
}
.fx880-op:active { box-shadow: 0 1px 0 #04060e; transform: translateY(2px); }
.fx880-op .c-digit { font-size: 20px; color: #e0e8ff; }
.fx880-op .c-above { color: #60a8e0; }

/* ── Equals key ── */
.fx880-equals .c-digit { font-size: 22px; }

/* ===== CALCULATOR HUB ===== */
.calc-hub {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin: 0 0 40px;
    overflow: hidden;
}

/* ── Tab bar ── */
.hub-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-wrap: wrap;
}
.hub-tab {
    padding: 7px 16px;
    border-radius: 50px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-primary);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.hub-tab:hover:not(.active) {
    background: var(--accent-light);
    color: var(--accent);
}
.hub-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ── Panels ── */
.hub-panel { display: none; }
.hub-panel.active { display: block; }

/* ── Scientific calc inside hub: remove duplicate card chrome ── */
.calc-hub .sci-calculator {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    max-width: 100%;
    margin: 0;
}
.calc-hub .history-panel {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--border);
    max-width: 100%;
    margin: 0;
}

/* ── Casio panels: centered with padding ── */
.hub-casio-wrap {
    padding: 20px 16px;
    display: flex;
    justify-content: center;
    background: var(--bg-primary);
}

/* ===== HOME PAGE ===== */
.home-wrap {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 16px;
}
.home-hero { text-align: center; padding: 40px 0 32px; }
.home-hero h1 { font-size: 30px; font-weight: 700; line-height: 1.4; margin-bottom: 0; }
.home-hero h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.home-hero p { color: var(--text-secondary); font-size: 16px; }

/* ===== HOMEPAGE CONTENT (from page editor) ===== */
.home-content {
    margin: 32px 0;
    padding: 17px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
}
.home-content p { margin-bottom: 12px; }
.home-content p:last-child { margin-bottom: 0; }


.home-directory {
    margin: 0 0 48px;
    padding: 0;
}

.home-dir-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}

.home-dir-section {
    padding: 20px 22px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.home-dir-section:nth-child(3n) { border-right: none; }
.home-dir-section:hover { background: var(--bg-main); }

.home-dir-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}
.home-dir-title:hover { color: var(--accent); text-decoration: none; }
.home-dir-icon { font-size: 16px; line-height: 1; }

.home-dir-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.home-dir-list li {
    border-bottom: 1px solid var(--border);
}
.home-dir-list li:last-child { border-bottom: none; }
.home-dir-list li a {
    display: block;
    padding: 5px 0;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
    line-height: 1.4;
}
.home-dir-list li a:hover {
    color: var(--accent);
    text-decoration: none;
}

@media (max-width: 600px) {
    .home-dir-grid { grid-template-columns: repeat(2, 1fr); }
    .home-dir-section:nth-child(3n) { border-right: 1px solid var(--border); }
    .home-dir-section:nth-child(2n) { border-right: none; }
}
@media (max-width: 420px) {
    .home-dir-grid { grid-template-columns: 1fr; }
    .home-dir-section { border-right: none; }
    .home-dir-section:nth-child(2n) { border-right: none; }
}

/* ===== Home Guide (clean content section) ===== */
.home-guide { max-width: 880px; margin: 32px auto 0; line-height: 1.7; color: var(--text-primary); }
.home-guide-lead { font-size: 16px; line-height: 1.75; margin: 0 0 32px; color: var(--text-primary); }
.home-guide-lead strong { color: var(--text-primary); }
.home-guide-section { margin: 0 0 40px; }
.home-guide-section > h2 { font-size: 22px; font-weight: 700; line-height: 1.35; margin: 0 0 18px; color: var(--text-primary); }
.home-guide-section > p { margin: 0 0 14px; font-size: 15px; }
.home-guide-section a { color: var(--accent); text-decoration: none; }
.home-guide-section a:hover { text-decoration: underline; }

.home-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.home-guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}
.home-guide-card h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--text-primary); }
.home-guide-card p { font-size: 14px; line-height: 1.6; margin: 0 0 8px; color: var(--text-secondary); }
.home-guide-card .home-guide-card-links { line-height: 1.9; }
.home-guide-card .home-guide-card-links a { font-weight: 500; }
.home-guide-card-all {
    display: inline-block;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 600;
}

.home-guide-cta {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin: 18px 0;
}
.home-guide-cta p { margin: 0 0 8px; }
.home-guide-cta a { font-weight: 600; }

.home-guide-faq details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 0 0 10px;
}
.home-guide-faq details[open] { border-color: var(--accent); }
.home-guide-faq summary {
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    color: var(--text-primary);
    list-style: none;
    position: relative;
    padding-right: 24px;
}
.home-guide-faq summary::-webkit-details-marker { display: none; }
.home-guide-faq summary::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--accent);
    font-weight: 400;
    line-height: 1;
}
.home-guide-faq details[open] summary::after { content: '−'; }
.home-guide-faq details[open] summary { margin-bottom: 10px; }
.home-guide-faq details > p,
.home-guide-faq details > ul { margin: 0; font-size: 14.5px; color: var(--text-secondary); }
.home-guide-faq details > ul { padding-left: 20px; }
.home-guide-faq details > ul li { margin-bottom: 4px; }

@media (max-width: 600px) {
    .home-guide { margin: 24px 0 0; }
    .home-guide-section > h2 { font-size: 19px; }
    .home-guide-grid { grid-template-columns: 1fr; }
}

/* ===== Home Worked Examples (GEO/AI Overview) ===== */
.home-examples {
    margin: 36px 0 12px;
}
.home-examples-heading {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
}
.home-examples-intro {
    font-size: 14.5px;
    color: var(--text-secondary);
    margin: 0 0 18px;
    line-height: 1.6;
}
.home-examples-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}
.home-examples-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.home-examples-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.home-examples-title {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 12px;
    color: var(--text-primary);
}
.home-examples-formula {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--text-secondary);
}
.home-examples-output {
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
}
.home-examples-meaning {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 10px;
}
.home-examples-meaning strong { color: var(--text-primary); }
.home-examples-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
}
.home-examples-link:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .home-examples-heading { font-size: 19px; }
    .home-examples-list { grid-template-columns: 1fr; }
}

/* ===== Home Blog Section (latest posts) ===== */
.home-blog { margin: 48px 0 24px; }
.home-blog-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 18px;
    flex-wrap: wrap;
}
.home-blog-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}
.home-blog-all {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.home-blog-all:hover { text-decoration: underline; }
.home-blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.home-blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.home-blog-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.home-blog-card-link {
    display: block;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.home-blog-card-title {
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.home-blog-card-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.home-blog-card-date {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 600px) {
    .home-blog { margin: 32px 0 16px; }
    .home-blog-header h2 { font-size: 19px; }
    .home-blog-grid { grid-template-columns: 1fr; }
}

/* ===== App Info Table (homepage footer summary) ===== */
.app-info-section {
    margin: 48px 0 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 28px 24px;
    box-shadow: var(--shadow-sm);
}
.app-info-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 18px;
}
.app-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.6;
}
.app-info-table td {
    border: 1px solid var(--border);
    padding: 12px 16px;
    vertical-align: middle;
}
.app-info-label {
    width: 180px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-primary);
    white-space: nowrap;
}
.app-info-star {
    color: #f5b400;
    margin-right: 6px;
    font-size: 14px;
}
.app-info-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.app-info-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .app-info-section { padding: 20px 16px 16px; margin: 32px 0 16px; }
    .app-info-heading { font-size: 18px; }
    .app-info-table { font-size: 14px; }
    .app-info-table td { padding: 10px 12px; }
    .app-info-label { width: 130px; }
}
@media (max-width: 420px) {
    .app-info-label { width: 110px; font-size: 13px; }
    .app-info-table td { padding: 9px 10px; }
}

/* Legacy — giữ lại cho archive nếu cần */
.category-section { max-width: 750px; margin: 0 auto 24px; padding: 16px 16px 0; }
.category-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.calc-grid-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; text-decoration: none; color: var(--text-primary); transition: all var(--transition); display: block; }
.calc-grid-item:hover { border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-2px); }
.calc-grid-item h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.calc-grid-item p { font-size: 13px; color: var(--text-secondary); }

/* ===== SCIENTIFIC CALCULATOR (homepage) ===== */
.sci-calculator{background:var(--bg-card);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);overflow:hidden;border:1px solid var(--border);max-width:500px;margin:0 auto 40px}
.sci-topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
.sci-title{font-size:15px;font-weight:600}
.sci-controls{display:flex;align-items:center;gap:8px}
.angle-toggle{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--text-secondary)}
.toggle-switch{position:relative;width:44px;height:24px;cursor:pointer}
.toggle-switch input{opacity:0;width:0;height:0}
.toggle-slider{position:absolute;inset:0;background:var(--accent);border-radius:12px;transition:.15s ease}
.toggle-slider::before{content:'';position:absolute;width:18px;height:18px;background:#fff;border-radius:50%;top:3px;left:3px;transition:.15s ease}
.toggle-switch input:checked+.toggle-slider::before{transform:translateX(20px)}
.angle-label{font-weight:600;color:var(--accent);min-width:30px}
.sci-display{background:#1a1d27;padding:20px;min-height:110px;display:flex;flex-direction:column;justify-content:flex-end;position:relative}
.sci-display-expr{font-family:var(--font-mono);font-size:15px;color:#9aa0a6;text-align:right;word-wrap:break-word;min-height:22px;line-height:1.5;max-height:50px;overflow-y:auto;padding-right:40px}
.sci-display-result{font-family:var(--font-mono);font-size:34px;font-weight:600;color:#e8eaed;text-align:right;overflow-x:auto;white-space:nowrap}
.sci-display-result.highlight{color:#8ab4f8}
.sci-display-actions{position:absolute;top:8px;right:10px;display:flex;gap:4px}
.sci-action-btn{width:28px;height:28px;border-radius:6px;border:none;background:rgba(255,255,255,.08);color:#9aa0a6;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px;transition:.15s ease}
.sci-action-btn:hover{background:rgba(255,255,255,.15);color:#e8eaed}
.sci-tab-nav{display:flex;border-bottom:1px solid var(--border)}
.sci-tab-btn{flex:1;padding:10px;border:none;background:none;font-family:var(--font-main);font-size:13px;font-weight:600;color:var(--text-secondary);cursor:pointer;position:relative;transition:.15s ease}
.sci-tab-btn:hover{color:var(--text-primary);background:#f8f9fa}
.sci-tab-btn.active{color:var(--accent)}
.sci-tab-btn.active::after{content:'';position:absolute;bottom:0;left:20%;right:20%;height:3px;background:var(--accent);border-radius:3px 3px 0 0}
.sci-panel{display:none;padding:8px}
.sci-panel.active{display:block}
.mem-row{display:grid;grid-template-columns:repeat(6,1fr);gap:4px;padding:4px 0 8px}
.btn-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.btn-grid-5{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}
.btn{font-family:var(--font-main);font-size:16px;font-weight:500;padding:14px 8px;border:none;border-radius:var(--radius-md);cursor:pointer;transition:all .1s ease;user-select:none;-webkit-tap-highlight-color:transparent;position:relative;overflow:hidden}
.btn:active{transform:scale(.95)}
.btn-num{background:#fff;color:#1a1d27;font-size:20px;font-weight:600;border:1px solid var(--border)}
.btn-num:hover{background:#f3f4f6}
.btn-op{background:var(--accent-light);color:var(--accent);font-size:20px;font-weight:600}
.btn-op:hover{background:#d2e3fc}
.btn-sci{background:#f8f9fa;color:#3c4043;font-size:13px;font-weight:500;padding:12px 6px}
.btn-sci:hover{background:#f1f3f4}
.btn-eq{background:var(--accent);color:#fff;font-size:22px;font-weight:700}
.btn-eq:hover{background:var(--accent-hover)}
.btn-clear{background:var(--danger);color:#fff;font-weight:600}
.btn-clear:hover{background:#d93025}
.btn sup{font-size:.7em;vertical-align:super}
.mem-row .btn{padding:8px 4px;font-size:11px;font-weight:600;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--bg-card);color:#3c4043}
.mem-row .btn:hover{background:var(--warning);color:#fff;border-color:var(--warning)}
.sci-keyboard-hint{text-align:center;padding:8px;color:var(--text-secondary);font-size:11px}
.sci-keyboard-hint kbd{background:#f8f9fa;padding:2px 6px;border-radius:4px;font-family:var(--font-mono);font-size:10px;border:1px solid var(--border)}

.history-panel{background:var(--bg-card);border-radius:var(--radius-xl);box-shadow:var(--shadow-md);border:1px solid var(--border);overflow:hidden;max-width:500px;margin:0 auto 40px}
.history-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--border)}
.history-header h3{font-size:15px;font-weight:600}
.history-clear-btn{font-family:var(--font-main);font-size:12px;font-weight:600;color:var(--danger);background:none;border:none;cursor:pointer;padding:4px 10px;border-radius:6px;transition:.15s ease}
.history-clear-btn:hover{background:rgba(234,67,53,.1)}
.history-list{max-height:250px;overflow-y:auto;padding:4px 0}
.history-empty{text-align:center;padding:24px 16px;color:var(--text-secondary);font-size:13px}
.history-item{padding:10px 16px;cursor:pointer;transition:.15s ease;border-bottom:1px solid transparent}
.history-item:hover{background:#f8f9fa}
.history-item:not(:last-child){border-bottom-color:var(--border)}
.history-expression{font-family:var(--font-mono);font-size:13px;color:var(--text-secondary);margin-bottom:2px}
.history-result{font-family:var(--font-mono);font-size:18px;font-weight:600;color:var(--accent)}

@media(max-width:480px){
    .btn{padding:12px 4px;font-size:14px}
    .btn-num{font-size:18px}.btn-op{font-size:18px}
    .btn-sci{font-size:11px;padding:10px 4px}
    .sci-display-result{font-size:28px}
}

/* ===== ARCHIVE ===== */
.archive-header {
    max-width: 750px;
    margin: 0 auto;
    padding: 20px 16px 0;
}

.archive-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.archive-header p { color: var(--text-secondary); font-size: 14px; margin-bottom: 0; }

/* ===== AUTHOR ===== */
.author-header {
    max-width: 750px;
    margin: 20px auto 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.author-avatar img {
    border-radius: 50%;
    display: block;
}
.author-meta { flex: 1; }
.author-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.author-bio {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.author-bio p:last-child { margin-bottom: 0; }
.author-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.author-stats a { color: #2563eb; text-decoration: none; }
.author-stats a:hover { text-decoration: underline; }
.author-posts {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 16px;
}
.author-pagination {
    margin: 24px 0;
    text-align: center;
}
.author-pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 3px;
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
}
.author-pagination .page-numbers.current {
    background: #2563eb;
    color: #fff;
}
.no-posts {
    max-width: 750px;
    margin: 24px auto;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
}
@media (max-width: 640px) {
    .author-header { flex-direction: column; align-items: center; text-align: center; }
    .author-stats { justify-content: center; }
}

/* ===== POST ARCHIVE (category/tag) ===== */
.post-archive {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
.post-archive-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.post-archive-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.post-archive-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 6px;
}
.post-archive-count {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.post-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: box-shadow .15s, transform .15s;
}
.post-card:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.post-card-thumb {
    display: block;
    overflow: hidden;
    background: #f3f4f6;
}
.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.post-card:hover .post-card-thumb img { transform: scale(1.03); }
.post-card-body {
    padding: 18px 20px 18px 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.post-card:not(:has(.post-card-thumb)) { grid-template-columns: 1fr; }
.post-card:not(:has(.post-card-thumb)) .post-card-body { padding: 20px; }
.post-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 8px;
}
.post-card-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.post-card-title a:hover { color: var(--accent); }
.post-card-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.post-card-meta a {
    color: var(--text-secondary);
    text-decoration: none;
}
.post-card-meta a:hover { color: var(--accent); }
.post-card-sep { margin: 0 6px; opacity: .6; }
.post-card-excerpt {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    align-self: flex-start;
    margin-top: auto;
}
.post-card-more:hover { text-decoration: underline; }
.post-pagination {
    margin-top: 28px;
    text-align: center;
}
.post-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    border: 1px solid var(--border);
}
.post-pagination .page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.post-pagination .page-numbers.current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.post-pagination .page-numbers.dots { border-color: transparent; }
@media (max-width: 640px) {
    .post-card { grid-template-columns: 1fr; }
    .post-card-thumb { aspect-ratio: 16/9; }
    .post-card-body { padding: 16px; }
    .post-archive-title { font-size: 22px; }
}

/* ===== SINGLE POST ===== */
.post-single {
    max-width: 820px;
    margin: 24px auto 40px;
    padding: 36px 40px;
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.post-single-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.post-single-cats a {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(37, 99, 235, .08);
    padding: 4px 10px;
    border-radius: 999px;
    text-decoration: none;
}
.post-single-cats a:hover { background: rgba(37, 99, 235, .16); }
.post-single-title {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 800;
    margin: 0 0 16px;
    color: var(--text-primary);
}
.post-single-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.post-single-meta .meta-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
}
.post-single-meta .meta-author img { border-radius: 50%; display: block; }
.post-single-meta .meta-author:hover span { color: var(--accent); }
.post-single-meta .meta-sep { opacity: .5; }
.post-single-thumb {
    margin: 0 0 28px;
}
.post-single-thumb img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}
.post-single-thumb figcaption {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
}
.post-single-content {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-primary);
}
.post-single-content > * + * { margin-top: 1em; }
.post-single-content h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.8em 0 .6em;
}
.post-single-content h3 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.6em 0 .5em;
}
.post-single-content h4 {
    font-size: 17px;
    font-weight: 700;
    margin: 1.4em 0 .4em;
}
.post-single-content p { margin: 0 0 1em; }
.post-single-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.post-single-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    margin: 20px auto;
}
.post-single-content blockquote {
    border-left: 4px solid var(--accent);
    background: #f9fafb;
    padding: 14px 18px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
    border-radius: 0 8px 8px 0;
}
.post-single-content ul,
.post-single-content ol {
    padding-left: 24px;
    margin: 0 0 1em;
}
.post-single-content li { margin-bottom: 6px; }
.post-single-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .92em;
}
.post-single-content pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.55;
}
.post-single-content pre code { background: transparent; color: inherit; padding: 0; }
.post-single-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}
.post-single-content table th,
.post-single-content table td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
.post-single-content table th { background: #f3f4f6; font-weight: 600; }
.post-single-content iframe {
    max-width: 100%;
    border-radius: 10px;
}

.post-single-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 28px 0;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.post-single-tags a {
    font-size: 13px;
    color: var(--text-secondary);
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
}
.post-single-tags a:hover { background: #e5e7eb; color: var(--text-primary); }

.post-single-author {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin: 32px 0;
    border: 1px solid var(--border);
}
.author-box-avatar img { border-radius: 50%; display: block; }
.author-box-name { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.author-box-name a { color: var(--text-primary); text-decoration: none; }
.author-box-name a:hover { color: var(--accent); }
.author-box-bio { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin: 0; }

.post-single-related {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}
.related-heading {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 18px;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.related-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border);
    transition: border-color .15s, transform .15s, background .15s;
}
.related-card:hover { background: #fff; }
.related-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.related-thumb {
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 6px;
    background: #f3f4f6;
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-date { font-size: 12px; color: var(--text-secondary); }

.post-single-comments { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.post-single-comments .comment-reply-title { font-size: 20px; font-weight: 700; margin: 0 0 14px; }

@media (max-width: 768px) {
    .post-single { padding: 24px 20px; margin: 16px 12px; border-radius: 10px; }
    .post-single-title { font-size: 26px; }
    .related-grid { grid-template-columns: 1fr; }
}

/* ===== AUTHOR (plugin author-page override) ===== */
.author-template {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
.author-template .container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
.author-template .container.has-sidebar {
    grid-template-columns: minmax(0, 1fr) 280px;
}
.author-template .main-box {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    min-width: 0;
}
.author-template .page-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
}
.author-template .author-profile-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 18px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 24px;
}
.author-template .author-photo img {
    border-radius: 50%;
    display: block;
}
.author-template .author-des {
    flex: 1;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}
.author-template .author-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}
.author-template .author-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 12px;
}
.author-template .author-content h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 20px 0 10px;
}
.author-template .author-content p { margin: 0 0 14px; }
.author-template .author-content img { max-width: 100%; height: auto; border-radius: 8px; }
.author-template .author-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}
.author-template .author-content table th,
.author-template .author-content table td {
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
.author-template .author-content table th { background: #f3f4f6; font-weight: 600; }
.author-template .author-content ul,
.author-template .author-content ol { padding-left: 22px; margin: 0 0 14px; }
.author-template .author-content li { margin-bottom: 6px; }
.author-template .author-content a { color: #2563eb; }
@media (max-width: 768px) {
    .author-template .container.has-sidebar { grid-template-columns: 1fr; }
    .author-template .main-box { padding: 20px; }
    .author-template .author-profile-card { flex-direction: column; align-items: center; text-align: center; }
}
