﻿/* 閺囧瓨鏌婇崗銊ョ湰閸欐﹢鍣?- 閸忋劌鐪ù鍛版憫妞嬪孩鐗?*/
:root {
    color-scheme: light;
    --primary-color: #1d3a6b;
    --secondary-color: #5e7aa2;
    --accent-color: #2f73d9;
    --accent-strong: #1c5cc5;
    --light-color: #f6f8ff;
    --dark-color: #162c4a;
    --text-color: #1f2a3d;
    --text-muted: #5f6f85;
    --text-on-accent: #ffffff;
    --border-color: #c9d9ee;
    --border-strong: rgba(32, 60, 110, 0.24); /* stronger for light mode legibility */
    --bg-light: #f2f6ff;
    --app-shell-bg: linear-gradient(135deg, rgba(230, 241, 255, 0.8), rgba(255, 255, 255, 0.6));
    --menu-bg: #e6f1ff;
    --menu-active-bg: #d1e4ff;
    --menu-active-text: #0b3a8c;
    --mobile-nav-shadow: rgba(27, 61, 109, 0.14);
    --sidebar-width: 256px;
    --surface-card: #ffffff;
    --surface-popover: #ffffff;
    --surface-chip: #ffffff;
    --surface-panel: rgba(255, 255, 255, 0.9);
    --surface-elevated: rgba(255, 255, 255, 0.95);
    --shadow-soft: 0 18px 40px rgba(15, 32, 72, 0.15);
    --shadow-strong: 0 34px 100px rgba(4, 10, 30, 0.6);
    --search-shell-bg: #ffffff;
    --search-shell-border: rgba(51, 58, 79, 0.55);
    --search-shell-border-strong: rgba(47, 115, 217, 0.65);
    --search-shell-shadow: 0 18px 40px rgba(15, 32, 72, 0.15);
    --search-shell-shadow-hover: 0 24px 60px rgba(25, 50, 110, 0.22);
    --search-shell-shadow-focus: 0 26px 70px rgba(25, 62, 128, 0.25);
    --search-placeholder: rgba(31, 42, 61, 0.45);
    --search-result-bg: rgba(6, 12, 32, 0.92);
    --search-result-border: rgba(96, 162, 255, 0.24);
    --search-result-title: #ffffff;
    --search-result-text: rgba(223, 233, 255, 0.9);
    --search-result-meta: rgba(177, 199, 235, 0.8);
    --search-result-pill: rgba(0, 255, 240, 0.16);
    --search-result-pill-text: #8ce0ff;
    --search-result-note: rgba(255, 255, 255, 0.85);
    --callout-bg: #fff3cd;
    --callout-border: #ffeaa7;
    --callout-text: #856404;
    --popover-bg: #ffffff;
    --popover-border: rgba(201, 217, 238, 0.7);
    --popover-shadow: 0 18px 40px rgba(27, 61, 109, 0.18);
    --popover-caret: #ffffff;
    --card-bg: #ffffff;
    --card-border: rgba(201, 217, 238, 0.6);
    --chip-bg: #ffffff;
    --chip-hover: rgba(52, 152, 219, 0.08);
    --materials-empty-bg: #ffffff;
    --theme-toggle-bg: rgba(255, 255, 255, 0.85);
    --theme-toggle-border: rgba(13, 27, 54, 0.18);
    --theme-toggle-shadow: 0 18px 32px rgba(15, 32, 72, 0.15);
    --theme-toggle-text: #1f2a3d;
    --chat-input-bg: rgba(248, 249, 254, 0.95);
    --chat-input-border: rgba(20, 30, 55, 0.12);
    --chat-input-border-strong: rgba(20, 30, 55, 0.24);
    --chat-input-shadow: 0 18px 32px rgba(12, 23, 46, 0.12);
    --chat-input-shadow-strong: 0 26px 48px rgba(12, 23, 46, 0.18);
    /* Theme transition controls */
    --theme-transition-duration: 2000ms;
    --theme-transition-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --primary-color: #d6e3ff;
        --secondary-color: #9cb6e4;
        --accent-color: #7eb6ff;
        --accent-strong: #5f9eff;
        --light-color: #1f2a3d;
        --dark-color: #0b1424;
        --text-color: #e4ecff;
        --text-muted: rgba(228, 236, 255, 0.7);
        --text-on-accent: #0a1220;
        --border-color: rgba(255, 255, 255, 0.16);
        --border-strong: rgba(126, 162, 255, 0.45);
        --bg-light: #060c18;
        --app-shell-bg: linear-gradient(135deg, rgba(8, 16, 32, 0.96), rgba(9, 20, 44, 0.9));
        --menu-bg: rgba(8, 18, 36, 0.95);
        --menu-active-bg: rgba(18, 48, 92, 0.7);
        --menu-active-text: #e8f0ff;
        --mobile-nav-shadow: rgba(2, 6, 18, 0.7);
        --surface-card: #111b2e;
        --surface-popover: rgba(15, 25, 45, 0.98);
        --surface-chip: rgba(25, 36, 57, 0.9);
        --surface-panel: rgba(13, 24, 44, 0.92);
        --surface-elevated: rgba(18, 30, 52, 0.95);
        --shadow-soft: 0 22px 44px rgba(2, 6, 18, 0.8);
        --shadow-strong: 0 32px 80px rgba(0, 0, 0, 0.65);
        --search-shell-bg: rgba(8, 14, 28, 0.95);
        --search-shell-border: rgba(143, 176, 255, 0.45);
        --search-shell-border-strong: rgba(160, 196, 255, 0.75);
        --search-shell-shadow: 0 18px 38px rgba(0, 0, 0, 0.6);
        --search-shell-shadow-hover: 0 24px 56px rgba(0, 0, 0, 0.65);
        --search-shell-shadow-focus: 0 26px 66px rgba(0, 0, 0, 0.7);
        --search-placeholder: rgba(235, 241, 255, 0.45);
        --search-result-bg: rgba(12, 22, 45, 0.95);
        --search-result-border: rgba(114, 176, 255, 0.3);
        --search-result-title: #fdfdff;
        --search-result-text: rgba(226, 235, 255, 0.85);
        --search-result-meta: rgba(200, 214, 246, 0.7);
        --search-result-pill: rgba(0, 224, 255, 0.18);
        --search-result-pill-text: #9ae7ff;
        --search-result-note: rgba(255, 255, 255, 0.82);
        --callout-bg: rgba(255, 214, 128, 0.1);
        --callout-border: rgba(255, 214, 128, 0.5);
        --callout-text: rgba(255, 231, 186, 0.9);
        --popover-bg: rgba(13, 22, 40, 0.98);
        --popover-border: rgba(126, 162, 255, 0.25);
        --popover-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
        --popover-caret: rgba(13, 22, 40, 0.98);
        --card-bg: rgba(15, 26, 46, 0.95);
        --card-border: rgba(126, 162, 255, 0.22);
        --chip-bg: rgba(25, 36, 57, 0.9);
        --chip-hover: rgba(126, 162, 255, 0.15);
        --materials-empty-bg: rgba(17, 28, 48, 0.9);
        --theme-toggle-bg: rgba(12, 20, 36, 0.95);
        --theme-toggle-border: rgba(126, 162, 255, 0.35);
        --theme-toggle-shadow: 0 18px 36px rgba(0, 0, 0, 0.65);
        --theme-toggle-text: #e6eeff;
        --chat-input-bg: rgba(13, 24, 44, 0.92);
        --chat-input-border: rgba(255, 255, 255, 0.08);
        --chat-input-border-strong: rgba(255, 255, 255, 0.2);
        --chat-input-shadow: 0 18px 32px rgba(2, 6, 18, 0.65);
        --chat-input-shadow-strong: 0 26px 46px rgba(0, 0, 0, 0.7);
    }
}

/* Smooth theme switch: apply transitions only during a brief window */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color var(--theme-transition-duration) var(--theme-transition-ease),
                color var(--theme-transition-duration) var(--theme-transition-ease),
                border-color var(--theme-transition-duration) var(--theme-transition-ease),
                box-shadow var(--theme-transition-duration) var(--theme-transition-ease),
                outline-color var(--theme-transition-duration) var(--theme-transition-ease),
                fill var(--theme-transition-duration) var(--theme-transition-ease),
                stroke var(--theme-transition-duration) var(--theme-transition-ease) !important;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-transition,
    html.theme-transition *,
    html.theme-transition *::before,
    html.theme-transition *::after {
        transition: none !important;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary-color: #d6e3ff;
    --secondary-color: #9cb6e4;
    --accent-color: #7eb6ff;
    --accent-strong: #5f9eff;
    --light-color: #1f2a3d;
    --dark-color: #0b1424;
    --text-color: #e4ecff;
    --text-muted: rgba(228, 236, 255, 0.7);
    --text-on-accent: #0a1220;
    --border-color: rgba(255, 255, 255, 0.16);
    --border-strong: rgba(126, 162, 255, 0.45);
    --bg-light: #060c18;
    --app-shell-bg: linear-gradient(135deg, rgba(8, 16, 32, 0.96), rgba(9, 20, 44, 0.9));
    --menu-bg: rgba(8, 18, 36, 0.95);
    --menu-active-bg: rgba(18, 48, 92, 0.7);
    --menu-active-text: #e8f0ff;
    --mobile-nav-shadow: rgba(2, 6, 18, 0.7);
    --surface-card: #111b2e;
    --surface-popover: rgba(15, 25, 45, 0.98);
    --surface-chip: rgba(25, 36, 57, 0.9);
    --surface-panel: rgba(13, 24, 44, 0.92);
    --surface-elevated: rgba(18, 30, 52, 0.95);
    --shadow-soft: 0 22px 44px rgba(2, 6, 18, 0.8);
    --shadow-strong: 0 32px 80px rgba(0, 0, 0, 0.65);
    --search-shell-bg: rgba(8, 14, 28, 0.95);
    --search-shell-border: rgba(143, 176, 255, 0.45);
    --search-shell-border-strong: rgba(160, 196, 255, 0.75);
    --search-shell-shadow: 0 18px 38px rgba(0, 0, 0, 0.6);
    --search-shell-shadow-hover: 0 24px 56px rgba(0, 0, 0, 0.65);
    --search-shell-shadow-focus: 0 26px 66px rgba(0, 0, 0, 0.7);
    --search-placeholder: rgba(235, 241, 255, 0.45);
    --search-result-bg: rgba(12, 22, 45, 0.95);
    --search-result-border: rgba(114, 176, 255, 0.3);
    --search-result-title: #fdfdff;
    --search-result-text: rgba(226, 235, 255, 0.85);
    --search-result-meta: rgba(200, 214, 246, 0.7);
    --search-result-pill: rgba(0, 224, 255, 0.18);
    --search-result-pill-text: #9ae7ff;
    --search-result-note: rgba(255, 255, 255, 0.82);
    --callout-bg: rgba(255, 214, 128, 0.1);
    --callout-border: rgba(255, 214, 128, 0.5);
    --callout-text: rgba(255, 231, 186, 0.9);
    --popover-bg: rgba(13, 22, 40, 0.98);
    --popover-border: rgba(126, 162, 255, 0.25);
    --popover-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
    --popover-caret: rgba(13, 22, 40, 0.98);
    --card-bg: rgba(15, 26, 46, 0.95);
    --card-border: rgba(126, 162, 255, 0.22);
    --chip-bg: rgba(25, 36, 57, 0.9);
    --chip-hover: rgba(126, 162, 255, 0.15);
    --materials-empty-bg: rgba(17, 28, 48, 0.9);
    --theme-toggle-bg: rgba(12, 20, 36, 0.95);
    --theme-toggle-border: rgba(126, 162, 255, 0.35);
    --theme-toggle-shadow: 0 18px 36px rgba(0, 0, 0, 0.65);
    --theme-toggle-text: #e6eeff;
    --chat-input-bg: rgba(13, 24, 44, 0.92);
    --chat-input-border: rgba(255, 255, 255, 0.08);
    --chat-input-border-strong: rgba(255, 255, 255, 0.2);
    --chat-input-shadow: 0 18px 32px rgba(2, 6, 18, 0.65);
    --chat-input-shadow-strong: 0 26px 46px rgba(0, 0, 0, 0.7);
}

/* 閸╄櫣顢呴弽宄扮础 */
body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.75;
    margin: 0;
    background-color: var(--bg-light);
    color: var(--text-color);
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--app-shell-bg);
}

.app-main {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 48px 64px 64px;
    box-sizing: border-box;
}

.site-content {
    flex: 1;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.transition-holo-flow {
    position: relative;
    opacity: 1;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

html.is-changing .transition-holo-flow {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .transition-holo-flow { transition: none; }
    html.is-changing .transition-holo-flow { opacity: 1; }
}


.theme-toolbar {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 120;
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 10px;
}

.theme-switcher {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.theme-switcher__button {
    border: 1px solid var(--theme-toggle-border);
    border-radius: 999px;
    background: var(--theme-toggle-bg);
    color: var(--theme-toggle-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--theme-toggle-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-switcher__button:focus-visible {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(47, 115, 217, 0.25);
}

.theme-switcher__button:hover {
    transform: translateY(-1px);
}

.theme-switcher__icon {
    font-size: 1.1rem;
}

.theme-switcher__chevron {
    border: solid currentColor;
    border-width: 0 1px 1px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.theme-switcher.is-open .theme-switcher__chevron {
    transform: rotate(-135deg);
}

.theme-switcher__panel {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0; /* closed by default */
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    max-height: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
}

.theme-switcher__panel::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    height: 1px;
    background: rgba(31, 42, 61, 0.08);
    pointer-events: none;
}

.theme-switcher.is-open .theme-switcher__panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    max-height: 320px;
    padding: 10px 10px 10px;
}

.theme-switcher.is-open .theme-switcher__button {
    box-shadow: none;
}

.theme-switcher__option {
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-color);
    font-size: 0.88rem;
    padding: 10px 12px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.theme-switcher__option:hover,
.theme-switcher__option:focus-visible {
    outline: none;
    background: rgba(47, 115, 217, 0.12);
    color: var(--accent-color);
}

.theme-switcher__option[aria-checked="true"] {
    background: rgba(47, 115, 217, 0.16);
    color: var(--accent-color);
    font-weight: 600;
}

.theme-switcher__option span {
    pointer-events: none;
}

.theme-switcher__option-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.theme-switcher__option[aria-checked="true"] .theme-switcher__option-hint {
    color: inherit;
}

@media (max-width: 720px) {
    .theme-toolbar {
        top: 14px;
        right: 14px;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }
}

/* Top-left utility buttons (XHS / Donate / Contact) */
.utility-actions {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 120;
    display: flex;
    gap: 8px;
}

.utility-button {
    border: 1px solid var(--theme-toggle-border);
    border-radius: 999px;
    background: var(--theme-toggle-bg);
    color: var(--theme-toggle-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.8rem;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--theme-toggle-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.utility-button:not(.utility-button--xhs):not(.utility-button--bili):not(.utility-button--totoro):not(.utility-button--qq) {
    border-radius: 16px;
    padding: 4px 16px;
    min-height: 30px;
}

.utility-button--support {\n    padding: 10px 16px; /* 与主题切换按钮一致 */\n    min-height: unset;\n    height: auto;\n    font-size: 0.9rem;\n    line-height: 1; /* 垂直居中一致 */\n    gap: 10px;\n    border-radius: 999px;\n}

.utility-button:hover,
.utility-button:focus-visible {
    outline: none;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}

.utility-button__icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.utility-button--totoro,
.utility-button--xhs,
.utility-button--bili,
.utility-button--qq {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
}

.utility-button--totoro .utility-button__icon,
.utility-button--xhs .utility-button__icon,
.utility-button--bili .utility-button__icon,
.utility-button--qq .utility-button__icon {
    width: 100%;
    height: 100%;
    background-size: cover;
}

.utility-button--totoro .utility-button__icon {
    background-image: url("/images/icons/totoro.webp");
}

.utility-button--xhs .utility-button__icon {
    background-image: url("/images/icons/xiaohongshu.webp");
}

.utility-button--bili .utility-button__icon {
    background-image: url("/images/icons/bilibili.webp");
}

.utility-button--qq .utility-button__icon {
    background-image: url("/images/icons/qq.webp");
    background-size: 110% 110%;
    background-position: center;
}

@media (max-width: 1080px) {
    .utility-actions {
        left: 14px;
        top: 14px;
        flex-direction: column;
        align-items: flex-start;
    }
}

.app-sidebar {
    width: 256px;
    background: var(--menu-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 40px 28px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 8px 0 24px rgba(15, 45, 92, 0.06);
    z-index: 20;
}

.sidebar-brand {
    margin-bottom: 36px;
    display: flex;
    justify-content: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary-color);
    margin: 0 auto; /* center the logo block horizontally */
}

.brand-link:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.brand-logo {
    width: 180px;
    height: 180px;
    display: block;
    object-fit: contain;
    background: transparent; /* only the image, no card background */
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    transition: transform 0.2s ease, filter 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.brand-link:hover .brand-logo,
.brand-link:focus-visible .brand-logo {
    transform: scale(1.04);
    /* subtle glow using drop-shadow so it hugs the logo shape */
    filter: drop-shadow(0 8px 20px rgba(47, 115, 217, 0.35))
            drop-shadow(0 0 14px rgba(126, 162, 255, 0.45));
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav__item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 500;
    color: var(--primary-color);
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-nav__item a:hover {
    background: rgba(47, 115, 217, 0.12);
    color: var(--accent-color);
    text-decoration: none;
    transform: translateX(4px);
}

.sidebar-nav__item.is-active a {
    background: var(--menu-active-bg);
    color: var(--menu-active-text);
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(47, 115, 217, 0.22);
}

.sidebar-nav__icon {
    font-size: 1.2rem;
}

.sidebar-nav__label {
    letter-spacing: 0.02em;
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-panel);
    backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 30px var(--mobile-nav-shadow);
    padding: 6px 12px;
    display: none;
    gap: 8px;
    justify-content: space-between;
    z-index: 50;
}

.mobile-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    color: var(--text-muted);
    font-size: 0.78rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.mobile-bottom-nav__item:hover {
    color: var(--accent-color);
    text-decoration: none;
    transform: translateY(-2px);
}

.mobile-bottom-nav__item.is-active {
    color: var(--accent-color);
    font-weight: 600;
}

.mobile-bottom-nav__icon {
    font-size: 1.2rem;
}

@media (max-width: 1080px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        display: none;
    }

    .app-main {
        padding: 24px 20px 92px;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    :root {
        --sidebar-width: 0px;
    }
}

.home-landing {
    position: relative;
    min-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(48px, 12vh, 128px) 24px 200px;
    overflow: visible;
    text-align: center;
    color: var(--primary-color);
}

.home-landing__backdrop {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.home-landing__backdrop img {
    width: 120vw;
    max-width: 960px;
    height: auto;
    opacity: 0.12;
    filter: blur(0px);
    transform: translateY(-10%) scale(1.05);
}

.home-landing__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: clamp(12px, 6vh, 72px);
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.home-landing__results {
    display: none;
    position: relative;
    z-index: 1;
    width: min(860px, calc(100% - 64px));
    margin-top: clamp(36px, 10vh, 128px);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
    padding: 28px 32px 34px;
    backdrop-filter: blur(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.home-landing__results-status {
    font-size: 0.98rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.home-landing__results-list {
    display: grid;
    gap: 18px;
    max-height: clamp(260px, 58vh, 520px);
    overflow-y: auto;
    padding-right: 4px;
}

.home-landing__results-list::-webkit-scrollbar {
    width: 8px;
}

.home-landing__results-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(47, 115, 217, 0.25);
}

.home-landing.has-text .home-landing__results,
.home-landing.is-searching .home-landing__results {
    display: flex;
    flex-direction: column;
}

.home-landing__title {
    margin: 0;
    font-size: clamp(2.6rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.home-landing__tagline {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.08rem;
}

.home-landing__search {
    position: sticky;
    top: clamp(350px, 150vh, 700px);
    margin-top: clamp(150px, 13vh, 180px);
    width: min(640px, calc(100% - 48px));
    display: flex;
    justify-content: center;
    z-index: 5;
}

.home-landing__search-box {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: none;
    width: 100%;
    pointer-events: auto;
}

.search-widget {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
}

.search-widget__controls {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 26px 32px;
}

.search-widget__input-shell {
    position: relative;
    width: 100%;
    flex: 1;
    border-radius: 28px;
    border: 2px solid var(--search-shell-border);
    background: var(--search-shell-bg);
    box-shadow: var(--search-shell-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-widget__input {
    width: 100%;
    border: none;
    border-radius: inherit;
    background: transparent;
    padding: 28px 30px;
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--primary-color);
}

.search-widget__input::placeholder {
    color: var(--search-placeholder);
    letter-spacing: 0.02em;
}

.search-widget__input:focus {
    outline: none;
}

.search-widget__input-shell:hover {
    border-color: var(--search-shell-border-strong);
    box-shadow: var(--search-shell-shadow-hover);
    transform: translateY(-1px);
}

.search-widget__input-shell:focus-within {
    border-color: var(--search-shell-border-strong);
    box-shadow: var(--search-shell-shadow-focus);
    transform: translateY(-2px);
}


.search-widget__results {
    max-height: 280px;
    overflow-y: auto;
    display: grid;
    gap: 12px;
    padding: 0 28px 28px;
}

.search-result {
    background: var(--search-result-bg);
    border-radius: 18px;
    border: 1px solid var(--search-result-border);
    padding: 18px 20px;
    display: grid;
    gap: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-soft);
    color: var(--search-result-text);
}

.search-result:hover,
.search-result:focus-within {
    border-color: rgba(0, 255, 240, 0.45);
    box-shadow: 0 26px 70px rgba(4, 10, 34, 0.7);
    transform: translateY(-3px);
}

.search-result__title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--search-result-title);
    margin: 0;
    text-decoration: none;
}

.search-result__excerpt {
    color: var(--search-result-text);
    font-size: 0.92rem;
    margin: 0;
}

.search-result__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--search-result-meta);
}

.search-result__tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--search-result-pill);
    color: var(--search-result-pill-text);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.search-result__note {
    color: var(--search-result-note);
    font-weight: 600;
}

.search-widget__status {
    padding: 0 28px 28px;
    font-size: 0.9rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.search-widget--home .search-widget__results,
.search-widget--home .search-widget__status {
    display: none;
}

.search-widget--page {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding-bottom: 12px;
}

.search-widget--page .search-widget__controls {
    padding: 20px 24px;
    flex-wrap: wrap;
}

.search-widget--page .search-widget__results,
.search-widget--page .search-widget__status {
    padding: 0 24px 24px;
    max-height: none;
}

.search-widget--page .search-widget__results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-widget--page .search-result {
    border-radius: 14px;
}

.home-landing.has-text .home-landing__search-box {
    box-shadow: 0 36px 80px rgba(13, 36, 86, 0.3);
    transform: translateY(-6px);
}

.home-landing.is-searching .home-landing__content {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (max-width: 720px) {
    .home-landing {
        padding: clamp(40px, 11vh, 112px) 18px 150px;
        min-height: calc(100vh - 110px);
    }

    .home-landing__backdrop img {
        width: min(92vw, 560px);
        transform: translateY(-6%) scale(1.02);
    }

    .home-landing__content {
        margin-top: clamp(12px, 8vh, 80px);
    }

    .home-landing__search {
        width: min(92vw, 540px);
        margin-top: clamp(32px, 12vh, 120px);
        top: clamp(180px, 64vh, 360px);
    }

    .home-landing__search .search-widget__controls {
        padding: 30px 24px;
    }

    .home-landing__search .search-widget__input {
        padding: 30px 24px;
    }

    .home-landing__results {
        width: min(92vw, 560px);
        margin-top: clamp(28px, 10vh, 120px);
        padding: 24px 24px 28px;
    }

    .home-landing__results-list {
        max-height: clamp(280px, 58vh, 500px);
    }

    .home-landing__search-box .search-widget__controls {
        flex-direction: column;
        align-items: stretch;
        padding: 18px 20px;
        gap: 12px;
    }

    .home-landing__search-box .search-widget__input {
        padding: 48px 20px;
    }

    .home-landing__search-box .search-widget__results,
    .home-landing__search-box .search-widget__status {
        padding: 0 20px 24px;
        max-height: 360px;
    }
}

@media (max-width: 540px) {
    .home-landing {
        padding: clamp(32px, 12vh, 96px) 16px 140px;
    }

    .home-landing__tagline {
        font-size: 0.98rem;
    }

    .home-landing__content {
        margin-top: clamp(12px, 12vh, 64px);
    }

    .home-landing__search {
        width: min(94vw, 520px);
        margin-top: clamp(28px, 14vh, 96px);
        top: clamp(300px, 68vh, 500px);
    }

    .home-landing__search .search-widget__controls {
        padding: 25px 20px;
    }

    .home-landing__search .search-widget__input {
        padding: 22px 20px;
    }

    .home-landing__results {
        width: 100%;
        margin-top: clamp(26px, 16vh, 120px);
        padding: 22px 18px 26px;
        border-radius: 20px;
    }

    .home-landing__results-status {
        margin-bottom: 12px;
        font-size: 0.95rem;
    }

    .home-landing__results-list {
        max-height: clamp(260px, 58vh, 460px);
    }

    .home-landing__search-box .search-widget__controls {
        padding: 16px 16px;
    }

    .home-landing__search-box .search-widget__input {
        padding: 44px 18px;
    }

    .home-landing__search-box .search-widget__results,
    .home-landing__search-box .search-widget__status {
        padding: 0 16px 20px;
    }

    .search-widget--page {
        padding-bottom: 10px;
    }

    .search-widget--page .search-widget__controls {
        padding: 18px;
        gap: 12px;
    }

    .search-widget--page .search-widget__results,
    .search-widget--page .search-widget__status {
        padding: 0 18px 22px;
    }
}

.study-callout {
    margin-bottom: 28px;
    padding: 24px 26px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 115, 217, 0.18), var(--surface-elevated));
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
}

.study-callout__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.study-callout__header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.study-callout__body {
    margin: 0;
    color: var(--primary-color);
    font-size: 0.96rem;
    line-height: 1.6;
}

.contact-bar {
    position: relative;
    display: inline-flex;
}

.contact-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    background: var(--accent-color);
    color: var(--text-on-accent);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 10px 22px rgba(47, 115, 217, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(47, 115, 217, 0.35);
    background: var(--accent-strong);
    color: var(--text-on-accent);
}

.contact-popover {
    position: fixed;
    left: calc(var(--sidebar-width) + 28px);
    top: 64px;
    z-index: 130;
    min-width: 260px;
    max-width: 320px;
    background: var(--surface-popover);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--popover-shadow);
    border: 1px solid var(--popover-border);
}

.contact-popover::after { display: none; }

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 12px;
}

.contact-method h4 {
    margin: 0 0 4px;
    font-size: 0.92rem;
    color: var(--accent-color);
}

.contact-note {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.qq-channel-popover {
    position: fixed;
    left: 18px;
    top: 72px;
    z-index: 130;
    width: 220px;
    background: var(--surface-popover);
    border-radius: 16px;
    padding: 16px 18px 22px;
    box-shadow: var(--popover-shadow);
    border: 1px solid var(--popover-border);
}

.qq-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.qq-channel-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--accent-color);
}

.qq-channel-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.qq-channel-tip {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--text-strong);
}

.qq-channel-qr {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface-elevated);
    box-shadow: inset 0 0 0 1px var(--popover-border);
}

.qq-channel-qr img {
    display: block;
    width: 100%;
    border-radius: 10px;
}


a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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


/* 閹兼粎鍌ㄩ幓鎰仛閺嶅嘲绱?*/
.search-notice {
    background-color: var(--callout-bg);
    border: 1px solid var(--callout-border);
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 20px;
    color: var(--callout-text);
    font-size: 0.9em;
}

.search-notice p {
    margin: 0;
    display: flex;
    align-items: center;
}

.search-notice p::before {
    content: "閳╃櫢绗?;
    margin-right: 8px;
    font-size: 1.1em;
}

/* 鏃ф悳绱㈢粨鏋滃吋瀹规牱寮?*/
#search-box {
    margin-bottom: 20px;
}

.ais-Hits-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    background: var(--surface-card);
    box-shadow: 0 8px 22px rgba(15, 32, 72, 0.08);
}

.ais-Highlight-highlighted {
    background-color: rgba(255, 238, 184, 0.6);
}

.hit-title {
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.hit-summary {
    margin: 0;
    color: var(--text-muted);
}

/* 澶撮儴 / 娆㈣繋鍖猴紙鏃ч〉闈㈠吋瀹癸級 */
.site-header {
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-soft);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo,
.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-image {
    height: 72px;
    width: auto;
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(15, 32, 72, 0.18);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.05);
    opacity: 0.92;
}

.inspirational-quote {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.92rem;
    flex: 1;
    text-align: center;
    margin: 0;
}

.main-nav {
    display: flex;
    gap: 12px;
}

.nav-search-button {
    background-color: var(--accent-color);
    color: var(--text-on-accent);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-search-button:hover {
    background: var(--accent-strong);
    box-shadow: 0 10px 24px rgba(47, 115, 217, 0.3);
    text-decoration: none;
}

.welcome-section {
    text-align: center;
    background: var(--surface-card);
    color: var(--text-color);
    padding: 30px 24px;
    border-radius: 18px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-soft);
    border-left: 4px solid var(--accent-color);
}

.welcome-section h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.welcome-section p {
    font-size: 1rem;
    max-width: 720px;
    margin: 0 auto;
    color: var(--text-muted);
}

/* 鍐呭鍒嗗尯 / 鍗＄墖甯冨眬 */
.content-section {
    background: var(--surface-panel);
    border-radius: 24px;
    padding: 32px 36px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 26px;
    gap: 16px;
}

.section-header h3,
.section-header h1 {
    margin: 0;
    color: var(--primary-color);
}

.section-header h1 {
    font-size: clamp(1.8rem, 2.6vw, 2.2rem);
    letter-spacing: 0.01em;
}

.content-section article {
    display: flex;
    flex-direction: column;
    gap: 18px;
    line-height: 1.85;
    color: var(--text-color);
}

.content-section article h2,
.content-section article h3,
.content-section article h4 {
    margin-bottom: 8px;
    color: var(--primary-color);
}

.content-section article p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Back link bar */
.back-bar {
    margin: 0 0 12px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--chip-bg);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
    text-decoration: none;
}

.back-link__icon { font-size: 1rem; }

/* Store actions under title */
.store-actions {
    margin: 8px 0 16px;
}

.content-section article ul,
.content-section article ol {
    margin: 0;
    padding-left: 1.4rem;
    color: var(--text-muted);
}

.content-section .tags {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.content-section .tags strong {
    color: var(--primary-color);
    font-weight: 600;
}

.content-section .tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--chip-bg);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-color);
}

.section-intro {
    margin-bottom: 26px;
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.7;
}

.view-all {
    font-weight: 500;
    color: var(--accent-color);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 20px 22px;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
    box-shadow: var(--shadow-soft);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
    border-color: var(--accent-color);
}

.card h4 {
    margin: 0 0 12px 0;
    color: var(--primary-color);
    font-size: 1.08rem;
}

.card p {
    margin: 0 0 14px 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.card .meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card a {
    color: inherit;
    text-decoration: none;
}

.featured-card {
    background: var(--surface-elevated);
    grid-column: 1 / -1;
}

.site-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }

    .card-container {
        grid-template-columns: 1fr;
    }
}

/* 瀛︿範璧勬枡椤?& 鏍囩 */
.materials-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.materials-header,
.subject-terms-header {
    background: var(--surface-panel);
    padding: 28px 24px;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

/* light separation between header card and subjects below */
.materials-header {
    margin-bottom: 18px;
}

.materials-header h1,
.subject-terms-header h1 {
    margin: 0 0 12px 0;
    font-size: clamp(1.6rem, 2.4vw, 1.9rem);
    color: var(--primary-color);
}

.materials-intro,
.subject-terms-intro {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.materials-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.materials-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(360px, 100%);
}

.materials-search__label {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

.materials-search__input {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    background: var(--surface-card);
}

.materials-search__input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(47, 115, 217, 0.15);
}

.materials-subjects {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.subject-directory {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: none; /* allow full page height */
    overflow: visible; /* use page scroll, not inner scroll */
    padding-right: 0;
}

.subject-directory::-webkit-scrollbar {
    width: 6px;
}

.subject-directory::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.15);
    border-radius: 999px;
}

.subject-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
}

.subject-letter {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    min-width: 28px;
    text-align: center;
    position: sticky;
    left: 0;
}

.subject-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.subject-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 14px;
    background: var(--chip-bg);
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease, border 0.3s ease;
    min-height: 32px;
}

.subject-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.12);
    background: var(--chip-hover);
}

.subject-chip.is-active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--text-on-accent);
    box-shadow: 0 6px 18px rgba(47, 115, 217, 0.2);
}

.subject-chip--all {
    align-self: flex-start;
    padding-inline: 14px;
    font-weight: 600;
}

.subject-term__intro {
    margin: 4px 0 16px 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.subject-material-list {
    list-style: none;
    margin: 12px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subject-material-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
}

.subject-material-item:last-child {
    border-bottom: none;
}

.subject-material-link {
    flex: 1;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.subject-material-link:hover {
    text-decoration: underline;
}

.subject-material-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.subject-material-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.subject-material-tags {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 320px;
}

.materials-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.materials-summary strong {
    color: var(--primary-color);
    font-weight: 500;
}

.materials-reset {
    font-size: 0.85rem;
    color: var(--accent-color);
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.material-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    background: var(--surface-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.material-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.material-card__title {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.material-card__title a {
    color: var(--primary-color);
    text-decoration: none;
}

.material-card__title a:hover {
    text-decoration: underline;
}

.material-card__meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-label {
    display: inline-block;
    min-width: 48px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 4px;
}

.meta-value {
    font-size: 0.9rem;
    color: var(--text-color);
}

.material-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.material-card__type,
.material-card__size {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-light);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.material-card__link,
.material-card__detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.material-card__link {
    background: var(--accent-color);
    color: var(--text-on-accent);
}

.material-card__link:hover {
    background: var(--accent-strong);
    color: var(--text-on-accent);
    text-decoration: none;
    transform: translateY(-1px);
}

.material-card__detail {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.material-card__detail:hover {
    background: rgba(47, 115, 217, 0.1);
    text-decoration: none;
}

.materials-empty {
    background: var(--materials-empty-bg);
    border: 1px dashed rgba(44, 62, 80, 0.2);
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.materials-empty-note {
    margin: 24px auto 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 720px) {
    .materials-header,
    .subject-terms-header {
        padding: 24px 18px;
    }

    .materials-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .materials-summary {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .subject-directory {
        max-height: none;
        padding-right: 0;
    }
}

@media (max-width: 540px) {
    .subject-group {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .subject-letter {
        text-align: left;
        position: static;
        margin-bottom: 2px;
    }

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

@media (max-width: 640px) {
    .subject-material-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .subject-material-meta {
        width: 100%;
        justify-content: flex-start;
    }

    .subject-material-tags {
        max-width: 100%;
        white-space: normal;
    }
}

/* Additions: Sci?fi minimal link + button styles */
/* ------------------------------------------------------------- */
/* Article content layout */
.article-body {
    display: grid;
    gap: 1rem;
}

.article-body h2,
.article-body h3,
.article-body h4 {
    margin: 0.6rem 0 0.25rem;
    color: var(--primary-color);
}

/* Futuristic inline links (minimal neon underline) */
.article-body a:not(.service-button):not(.material-card__link):not(.material-card__detail) {
    position: relative;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-body a:not(.service-button):not(.material-card__link):not(.material-card__detail)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: currentColor; /* solid underline; no gradient */
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.25s ease;
}

.article-body a:hover:not(.service-button):not(.material-card__link):not(.material-card__detail),
.article-body a:focus-visible:not(.service-button):not(.material-card__link):not(.material-card__detail) {
    color: var(--accent-color);
    text-decoration: none;
}

.article-body a:hover:not(.service-button):not(.material-card__link):not(.material-card__detail)::after,
.article-body a:focus-visible:not(.service-button):not(.material-card__link):not(.material-card__detail)::after {
    transform: scaleX(1);
}

.article-body a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 115, 217, 0.25);
    border-radius: 3px;
}

/* Quick entry tool buttons */
.tool-button-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 14px;
    margin: 14px 0 6px;
}

.service-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: var(--surface-elevated);
    color: var(--text-color);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 32, 72, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.service-button:hover,
.service-button:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 12px 32px rgba(47, 115, 217, 0.32);
    text-decoration: none;
}

.service-button.tool-button {
    min-width: 220px;
    text-align: center;
}

/* Light-mode readability tweaks: subtle tint and darker label */
/* Apply only when not in explicit dark theme */
:root:not([data-theme="dark"]) .service-button {
    background: var(--surface-elevated);
    border-color: rgba(32, 60, 110, 0.28);
    color: var(--primary-color);
}

:root[data-theme="light"] .service-button {
    background: var(--surface-elevated);
    border-color: rgba(32, 60, 110, 0.28);
    color: var(--primary-color);
}

:root:not([data-theme="dark"]) .service-button:hover,
:root[data-theme="light"] .service-button:hover {
    border-color: rgba(47, 115, 217, 0.45);
}

:root:not([data-theme="dark"]) .service-button--portal,
:root[data-theme="light"] .service-button--portal {
    background: var(--accent-color);
    color: var(--text-on-accent);
    border-color: var(--accent-color);
}

/* Stronger accent variant for portals */
.service-button--portal {
    background: var(--accent-color);
    color: var(--text-on-accent);
    border-color: var(--accent-color);
}

.service-button--portal:hover,
.service-button--portal:focus-visible {
    box-shadow: 0 14px 36px rgba(47, 115, 217, 0.4);
    color: var(--text-on-accent);
}

/* Card-style link collection (official links pages) */
.link-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin: 18px 0 6px;
}

.link-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    background: var(--surface-card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    color: inherit;
    text-decoration: none;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.link-card:hover,
.link-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-strong);
    text-decoration: none;
}

.link-card__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.link-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
}

.link-card__desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
/* ------------------------------------------------------------- */

/* Floating actions and modal 鈥?sci?fi minimal */
/* removed floating donation button: handled by top-left utility */

.donation-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(2, 6, 18, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.donation-modal-content {
    background: var(--surface-popover);
    border: 1px solid var(--popover-border);
    border-radius: 16px;
    box-shadow: var(--popover-shadow);
    width: min(400px, calc(100% - 40px));
    margin: 10% auto;
    padding: 20px 22px 22px;
    position: relative;
}

.donation-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}

.donation-close:hover {
    color: var(--accent-color);
}

.donation-codes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin: 16px 0;
}

.donation-code img {
    max-width: 160px;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 22px rgba(15, 32, 72, 0.12);
}

.donation-note {
    text-align: center;
    color: var(--text-muted);
    margin-top: 10px;
}

/* removed floating social button */

.social-tip {
    display: none;
    position: fixed;
    left: calc(var(--sidebar-width) + 28px);
    top: 64px;
    width: min(280px, 88vw);
    background: var(--popover-bg);
    border: 1px solid var(--popover-border);
    border-radius: 14px;
    box-shadow: var(--popover-shadow);
    padding: 16px 18px;
    z-index: 130;
}

.social-tip-content h4 {
    margin: 0 0 6px 0;
    color: var(--primary-color);
}

.social-tip-content p {
    margin: 4px 0;
    color: var(--text-muted);
}

.social-tip-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.social-tip-close:hover {
    color: var(--accent-color);
}

@media (max-width: 1080px) {
    .social-tip { left: 14px; top: 60px; }
    .contact-popover { left: 14px; top: 60px; }
}

/* ------------------------------------------------------------- */
/* Theme switcher: unified dropdown (button extends downward) */
.theme-switcher.is-open {
    gap: 0;
    align-items: stretch;
    background: var(--theme-toggle-bg);
    border: 1px solid var(--theme-toggle-border);
    border-radius: 28px;
    box-shadow: var(--theme-toggle-shadow);
    overflow: hidden;
    padding: 0 10px 10px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.theme-switcher.is-open .theme-switcher__button {
    background: transparent;
    border: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: none !important;
    width: 100%;
}

.theme-switcher.is-open .theme-switcher__panel {
    position: static;
    top: auto;
    right: auto;
    min-width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: none;
    padding: 10px 10px 10px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.theme-switcher.is-open .theme-switcher__panel::before {
    top: 8px;
    left: 10px;
    right: 10px;
    background: rgba(31, 42, 61, 0.10);
}

/* Announcement page ------------------------------------------------- */
.announcement-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 48px) 120px;
    position: relative;
}

.announcement-page::before {
    content: "";
    position: absolute;
    inset: clamp(6px, 2vw, 16px);
    background: url("/images/logo.png") center/120% no-repeat;
    opacity: 0.06;
    filter: saturate(0.4);
    pointer-events: none;
    z-index: 0;
}

.announcement-header__eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.announcement-header__title {
    margin: 0 0 12px;
    font-size: clamp(2.2rem, 4vw, 3rem);
    color: var(--primary-color);
}

.announcement-columns {
    display: grid;
    gap: clamp(16px, 3vw, 24px);
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.announcement-board {
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: clamp(20px, 4vw, 30px);
}

.announcement-board__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.announcement-board__eyebrow {
    margin: 0;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.announcement-board__title {
    margin: 0;
    font-size: 1.3rem;
    color: var(--primary-color);
}

.announcement-board__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(47, 115, 217, 0.12);
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.announcement-board__body {
    border-radius: 16px;
    border: 1px dashed var(--border-strong);
    background: var(--surface-card);
    padding: clamp(16px, 4vw, 24px);
}

.announcement-board__content {
    margin: 0;
    color: var(--text-color);
    line-height: 1.8;
}

.announcement-board__content .announcement-list {
    margin: 0;
    padding-left: 20px;
}

.announcement-board__content .announcement-list li {
    margin-bottom: 6px;
}

.announcement-board__empty {
    margin: 0;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .announcement-page {
        padding: 28px 14px 100px;
    }
}

/* Chat landing ----------------------------------------------------- */
.chat-landing {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 48px) 140px;
}

.chat-landing__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(16px, 3vw, 32px);
}

.chat-landing__hero {
    text-align: center;
    max-width: min(640px, 100%);
    margin: clamp(18px, 4vw, 42px) auto clamp(12px, 3vw, 22px);
    color: var(--text-color);
    transition: opacity 0.25s ease;
}

.chat-landing__banner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(660px, 100%);
    margin: 0 auto 14px;
    padding: 14px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

html[data-theme="light"] .chat-landing__banner {
    border-color: rgba(15, 23, 42, 0.12);
    background: rgba(15, 23, 42, 0.04);
}

.chat-landing__banner-dot {
    font-size: 1.2rem;
    color: var(--accent-color);
    line-height: 1;
}

.chat-landing__hero-title {
    margin: 0;
    font-size: clamp(2.2rem, 4.6vw, 3rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.chat-landing__hero-subtitle {
    margin: 8px 0 0;
    font-size: 1rem;
    color: var(--text-muted);
}

.chat-landing__hero.is-hidden,
.chat-landing__banner.is-hidden {
    display: none;
}

.chat-column {
    position: relative;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 36px;
    box-shadow: var(--shadow-soft);
    padding: 56px 0 130px;
    min-height: min(90vh, 880px);
    overflow: visible;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 clamp(18px, 4vw, 36px);
    padding-bottom: 140px;
}

.chat-message {
    max-width: 88%;
    border-radius: 20px;
    padding: 16px 18px;
    line-height: 1.6;
    font-size: 0.98rem;
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    box-shadow: 0 14px 40px rgba(15, 32, 72, 0.08);
}

.chat-message--system {
    align-self: flex-start;
}

.chat-message--user {
    align-self: flex-end;
    background: linear-gradient(140deg, var(--accent-color), var(--accent-strong));
    color: var(--text-on-accent);
    border: none;
    box-shadow: 0 18px 36px rgba(47, 115, 217, 0.35);
}

.chat-message__hint {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chat-message--thinking::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: chat-pulse 0.8s ease-in-out infinite alternate;
}

.chat-message--error {
    border-color: #ff8585;
    color: #b40c0c;
}

.chat-message--ghost {
    position: fixed;
    pointer-events: none;
    z-index: 120;
    opacity: 1;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

@keyframes chat-pulse {
    from { opacity: 0.25; transform: scale(0.8); }
    to { opacity: 0.9; transform: scale(1); }
}

.chat-input {
    position: sticky;
    bottom: 24px;
    width: min(840px, calc(100% - 48px));
    margin: 32px auto 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 18px;
    border-radius: 999px;
    border: 1px solid var(--chat-input-border);
    background: var(--chat-input-bg);
    box-shadow: var(--chat-input-shadow);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.chat-input:hover {
    transform: translateY(-1px);
    border-color: var(--chat-input-border-strong);
    box-shadow: var(--chat-input-shadow-strong);
}

.chat-column.is-busy .chat-send {
    opacity: 0.55;
    pointer-events: none;
}

.chat-input:focus-within {
    border-color: var(--chat-input-border-strong);
    box-shadow: var(--chat-input-shadow-strong), 0 0 10px rgba(255, 255, 255, 0.12) inset;
}

.chat-input__field {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    color: var(--text-color);
    font-size: 1rem;
    line-height: 32px;
    min-height: 32px;
    max-height: 220px;
    overflow-y: auto;
    padding: 0 10px;
}

.chat-input__field::placeholder {
    color: var(--text-muted);
}

.chat-input__field:focus {
    outline: none;
}


.chat-send {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(140deg, var(--accent-color), var(--accent-strong));
    color: var(--text-on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 32px rgba(47, 115, 217, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 24px 44px rgba(47, 115, 217, 0.55);
}

.chat-send svg {
    width: 22px;
    height: 22px;
}

.chat-result__typed {
    margin-bottom: 14px;
}

.chat-result__typed p {
    margin: 0 0 8px;
}

.chat-result__typed h4 {
    margin: 16px 0 4px;
    font-size: 1rem;
    color: var(--primary-color);
}

.chat-result__note {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chat-result__block {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(201, 217, 238, 0.5);
}

.chat-result__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.chat-col h4 {
    margin: 0 0 6px;
    font-size: clamp(12px, 2.8vw, 14px);
    color: var(--text-muted);
}

.chat-col__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.chat-col__empty {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.chat-card {
    display: block;
    border-radius: 16px;
    border: 1px solid rgba(201, 217, 238, 0.7);
    background: var(--surface-card);
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 16px 30px rgba(15, 32, 72, 0.2);
}

.chat-card__title {
    margin: 0;
    font-size: clamp(13px, 3.2vw, 15px);
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-card__meta {
    margin-top: 6px;
    font-size: clamp(12px, 2.8vw, 13px);
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.chat-card__chip {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(47, 115, 217, 0.12);
    color: var(--accent-color);
    font-size: 0.78rem;
}

.chat-card__excerpt {
    margin: 8px 0 0;
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-col__more,
.chat-tools__more {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--accent-color);
    text-decoration: none;
    gap: 4px;
}

.chat-tools__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.chat-tools__list .chat-card {
    border-color: rgba(201, 217, 238, 0.8);
}

.chat-column .empty-state {
    margin: 12px 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

@media (max-width: 1080px) {
    .chat-column {
        min-height: 70vh;
    }

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

@media (max-width: 760px) {
    .chat-landing {
        padding: 32px 14px 120px;
    }

    .chat-result__grid {
        gap: 10px;
        grid-template-columns: minmax(0, 1fr);
    }

    .chat-thread {
        padding: 0 18px calc(160px + env(safe-area-inset-bottom));
    }

    .chat-input {
        position: sticky;
        bottom: calc(72px + env(safe-area-inset-bottom));
        width: calc(100% - 32px);
        margin: 20px auto 0;
        padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    }

    .chat-message {
        max-width: 100%;
    }

    .chat-column {
        padding-bottom: calc(160px + env(safe-area-inset-bottom));
    }
}

/* Search page ------------------------------------------------------ */
.search-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(32px, 5vw, 64px) clamp(16px, 5vw, 32px) 120px;
}

.search-page__header {
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: clamp(24px, 4vw, 38px);
    box-shadow: var(--shadow-soft);
}

.search-page__back {
    border: none;
    background: transparent;
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 6px 0;
}

.search-page__back:hover {
    color: var(--accent-strong);
}

.search-page__back-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(47, 115, 217, 0.14);
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.search-page__eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-page__header h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--primary-color);
}

.search-page__intro {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.search-page__form {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.search-page__input {
    flex: 1;
    border-radius: 18px;
    border: 2px solid var(--border-color);
    padding: 18px 22px;
    font-size: 1rem;
    background: var(--surface-card);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-page__input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 18px 40px rgba(47, 115, 217, 0.25);
    outline: none;
}

.search-page__submit {
    border: none;
    border-radius: 16px;
    padding: 0 24px;
    background: linear-gradient(140deg, var(--accent-color), var(--accent-strong));
    color: var(--text-on-accent);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 16px 28px rgba(47, 115, 217, 0.35);
}

.search-page__submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 36px rgba(47, 115, 217, 0.45);
}

.search-page__tabs {
    margin: 28px 0 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.search-page__tabs button {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 8px 20px;
    background: var(--surface-card);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.search-page__tabs button.is-active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 12px 24px rgba(47, 115, 217, 0.2);
}

.search-page__status {
    margin-bottom: 18px;
    color: var(--text-muted);
}

.search-page__results {
    display: grid;
    gap: 16px;
}

.search-page__results .chat-card {
    width: 100%;
}

@media (max-width: 720px) {
    .search-page__form {
        flex-direction: column;
    }

    .search-page__submit {
        width: 100%;
        padding: 14px;
    }
}

/* Starfire floating entry */
.starfire-fab {
    display: none;
}

.starfire-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(255, 122, 24, 0.4);
}

.starfire-fab__icon {
    font-size: 1rem;
}

.starfire-fab__label {
    white-space: nowrap;
}

@media (max-width: 640px) {
    .starfire-fab {
        bottom: 88px;
        padding: 10px 12px;
    }
    .starfire-fab__label {
        display: none;
    }
}

/* Starfire page */
.starfire-page {
    padding: 28px 22px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.starfire-hero {
    background: linear-gradient(135deg, rgba(255, 122, 24, 0.08), rgba(47, 115, 217, 0.1));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.starfire-kicker {
    margin: 0;
    color: var(--accent-color);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.starfire-hero h1 {
    margin: 8px 0 6px 0;
    font-size: clamp(1.6rem, 2vw, 2rem);
}

.starfire-subtitle {
    margin: 0 0 12px 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.starfire-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.starfire-tag {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.starfire-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.starfire-meta__title {
    margin: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.starfire-meta__desc {
    margin: 2px 0 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.starfire-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.starfire-card {
    background: var(--surface-card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.starfire-card h2 {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
}

.starfire-slider {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.starfire-slider__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.slider-tab {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.slider-tab.is-active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 10px 24px rgba(47, 115, 217, 0.18);
}

.starfire-slider__track {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
}

.starfire-slide {
    flex: 0 0 100%;
    min-width: 100%;
    padding: 6px 4px;
}

.starfire-slide__header h2 {
    margin: 4px 0 8px 0;
    font-size: 1.35rem;
}

.starfire-slider__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

.slider-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--primary-color);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.slider-dots {
    display: flex;
    gap: 6px;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: none;
    background: var(--border-color);
    cursor: pointer;
}

.slider-dot.is-active {
    background: var(--accent-color);
}

.starfire-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
}

.input-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.input {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text-color);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(47, 115, 217, 0.18);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-light);
    font-weight: 500;
}

.pill-option input {
    accent-color: var(--accent-color);
}

.subject-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subject-select select {
    width: 100%;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--text-color);
}

.inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-color);
}

.input-inline {
    min-width: 220px;
    flex: 1;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.form-note {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cta-button {
    padding: 10px 18px;
    border-radius: 12px;
    background: var(--accent-color);
    color: var(--text-on-accent);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-strong);
}

.starfire-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.board-kicker {
    margin: 0;
    color: var(--accent-color);
    font-weight: 700;
}

.board-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.board-item {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.board-rank {
    font-weight: 700;
    color: var(--accent-color);
}

.board-name {
    font-weight: 600;
}

.board-count {
    text-align: right;
    color: var(--text-muted);
}

.board-note {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ghost-button {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
}

.starfire-callout {
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    background: var(--bg-light);
    color: var(--text-color);
}

.starfire-callout ol {
    padding-left: 18px;
    margin: 6px 0;
    color: var(--text-muted);
}

.starfire-callout code {
    background: var(--surface-muted);
    padding: 2px 6px;
    border-radius: 6px;
}

.starfire-hint {
    align-self: center;
    justify-self: end;
    font-weight: 600;
    color: var(--accent-color);
}

@media (max-width: 960px) {
    .starfire-layout {
        grid-template-columns: 1fr;
    }
    .board-item {
        grid-template-columns: 32px 1fr 70px;
    }
    .starfire-callout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .starfire-page {
        padding: 18px 14px 80px;
    }
    .form-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .starfire-meta {
        grid-template-columns: 1fr;
    }
}

/* Toast */
.toast {
    position: fixed;
    right: 16px;
    top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    box-shadow: var(--shadow-soft);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--success {
    border-color: #3ecf8e;
}

.toast--warn {
    border-color: #ffb347;
}

.toast--error {
    border-color: #ff6b6b;
}
