:root {
    color-scheme: light;
    --bg-canvas: #ffefe3;
    --bg-panel: rgba(255, 255, 255, 0.88);
    --bg-panel-strong: #ffffff;
    --bg-soft: #f6f8fb;
    --bg-hover: #f7f9fc;
    --line-soft: rgba(18, 31, 53, 0.1);
    --line-strong: rgba(18, 31, 53, 0.18);
    --text-primary: #172033;
    --text-secondary: rgba(23, 32, 51, 0.74);
    --text-muted: rgba(23, 32, 51, 0.54);
    --accent: #0a6fe8;
    --warning: #a36105;
    --shadow-panel: 0 14px 34px rgba(52, 67, 92, 0.1);
    --shadow-card: 0 8px 22px rgba(30, 42, 64, 0.07);
    --shadow-soft: 0 2px 8px rgba(41, 57, 82, 0.08);
    --shadow-focus: 0 0 0 4px rgba(88, 156, 255, 0.2);
    --stack-gap: 10px;
    --card-gap: 8px;
    --page-gutter: clamp(1rem, 3vw, 2rem);
    --radius-panel: 18px;
    --radius-card: 14px;
    --radius-pill: 999px;
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "PingFang TC", "Hiragino Sans CNS",
        "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei UI",
        "Microsoft JhengHei", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-primary);
    background: var(--bg-canvas);
    font-family: var(--font-sans);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

a {
    color: inherit;
}

img,
svg {
    display: block;
}

.site-navbar {
    min-height: 38px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.site-navbar-inner {
    width: min(1080px, calc(100% - var(--page-gutter)));
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 3px 0;
}

.site-breadcrumb {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.38rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-breadcrumb-item {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 2px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
}

.site-brand:hover {
    color: var(--accent);
}

.site-brand:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.home-shell {
    width: min(1080px, calc(100% - var(--page-gutter)));
    margin: 0 auto;
    padding: 12px 0;
}

.home-hero {
    display: flex;
    justify-content: center;
    min-width: 0;
    padding: 8px 4px 10px;
}

.home-hero-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
}

.section-kicker {
    margin: 0;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 760;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-transform: uppercase;
}

.home-hero h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 820;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.home-summary {
    max-width: 32rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.45;
}

.calculator-directory {
    margin-top: var(--stack-gap);
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--card-gap);
}

.calculator-card {
    position: relative;
    min-width: 0;
    min-height: 9.5rem;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: var(--radius-card);
    background: var(--bg-panel-strong);
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.calculator-card:hover {
    border-color: rgba(10, 111, 232, 0.18);
    background: var(--bg-hover);
}

.calculator-card:active {
    transform: scale(0.99);
}

.calculator-card:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus), var(--shadow-card);
}

.card-status {
    justify-self: start;
    max-width: 100%;
    padding: 3px 8px;
    border: 1px solid rgba(10, 111, 232, 0.16);
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 720;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-text {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 3px;
}

.card-title,
.card-subtitle,
.card-description {
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 760;
    line-height: 1.24;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 660;
    line-height: 1.25;
}

.card-description {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.card-glyph {
    justify-self: end;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-soft);
    border-radius: 50%;
    color: var(--accent);
    background: var(--bg-soft);
}

.card-glyph svg {
    width: 15px;
    height: 15px;
}

html[data-theme="dark"] .calculator-card {
    border-color: var(--line-soft);
}

html[data-theme="dark"] .card-status,
html[data-theme="dark"] .card-glyph {
    background: var(--bg-soft);
    border-color: var(--line-soft);
}

@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .home-shell {
        width: min(100% - 20px, 1080px);
    }

    .home-hero {
        padding: 8px 0 10px;
    }

    .home-hero h1 {
        font-size: 1.75rem;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .calculator-card {
        min-height: auto;
    }
}

@media print {
    :root,
    html[data-theme="dark"] {
        color-scheme: light;
        --bg-canvas: #ffffff;
        --bg-panel: #ffffff;
        --bg-panel-strong: #ffffff;
        --bg-soft: #ffffff;
        --bg-hover: #ffffff;
        --line-soft: #d8dde6;
        --line-strong: #c8ced8;
        --text-primary: #111827;
        --text-secondary: #374151;
        --text-muted: #4b5563;
        --accent: #111827;
        --warning: #111827;
        --shadow-panel: none;
        --shadow-card: none;
        --shadow-soft: none;
        --shadow-focus: none;
    }

    body {
        background: #ffffff;
    }

    .site-navbar,
    .theme-switcher {
        display: none !important;
    }

    .home-shell {
        width: 100%;
        padding: 0;
    }

    .calculator-card {
        break-inside: avoid;
        border-color: var(--line-soft);
        box-shadow: none;
        backdrop-filter: none;
    }

    .home-hero {
        margin-top: 10px;
        padding: 0;
    }

    .calculator-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
