:root {
    /* 亮色主题 */
    --primary: #6750A4;
    --on-primary: #FFFFFF;
    --surface: #FEF7FF;
    --surface-container: #EADDFF;
    --outline: #79747E;
    --background: #FFFFFF;
    --text: #1D1B20;
    --link: #065ac9;
    --code-background: #bdbdbd;
    --background-image-opacity: 100%;

    /* 暗色主题 */
    --primary-dark: #D0BCFF;
    --on-primary-dark: #381E72;
    --surface-dark: #1D1B20;
    --surface-container-dark: #2D2A36;
    --outline-dark: #938F99;
    --background-dark: #141218;
    --text-dark: #E8DEF8;
    --link-dark: #a5b100;
    --code-background-dark: #5f5f5f;

    --radius: 16px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 初始禁用所有过渡效果 */
body.preload,
body.preload *,
body.preload *::before,
body.preload *::after {
    transition: none !important;
}

/* 统一过渡效果 */
body,
a,
b,
p,
h1,
h2,
h3,
h4,
hr,
table,
th,
td,
ul li,
ol li
.app-bar,
.nav-card,
.article-card,
.theme-toggle,
.toc-link,
.nav-button,
.bordered-img, 
.copyleft,
.custom-tooltip,
.toc-card,
.toc-list,
.responsive-text,
.background-dark,
.background-light {
    transition: background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans SC', 'Source Han Sans', '思源黑体';
}

.background-light {
    background-image: url("background_light.png");
    display: flex;
    min-width: 100%;
    min-height: 100%;
    opacity: 1;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.background-dark {
    background-image: url("background_dark.png");
    display: flex;
    min-width: 100%;
    min-height: 100%;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
}

body.dark-mode .background-light {
    opacity: 0;
}

body.dark-mode .background-dark {
    opacity: 1;
}

body {
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

body.dark-mode {
    --primary: var(--primary-dark);
    --on-primary: var(--on-primary-dark);
    --surface: var(--surface-dark);
    --surface-container: var(--surface-container-dark);
    --outline: var(--outline-dark);
    --background: var(--background-dark);
    --text: var(--text-dark);
    --link: var(--link-dark);
    --background-image-opacity: 0%;
    --code-background: var(--code-background-dark);
}

h1 {
    font-size: clamp(32px, 2vw, 64px);
}

h2 {
    font-size: clamp(24px, 1.5vw, 48px);
    padding-top: 0.15vw;
    border-bottom: 2px solid var(--text);
}

h3 {
    font-size: clamp(20px, 1.25vw, 40px);
    padding-top: 0.1vw;
}

h4 {
    font-size: clamp(16px, 1vw, 32px);
    padding-top: 0.05vw;
}
/* 链接 */
a, b, p, summary, th, td {
    text-decoration: none;
    color: var(--text);
    font-size: clamp(12px, 0.8vw, 24px);
}

a {
    display: inline-block;
    color: var(--link);
}

a:hover {
    transform: translateY(-2px);
}


img {
    max-width: 100%;
    max-height: 100%;
    align-items: center;
}

ul li, ol li {
    margin-left: clamp(8px, 1.25vw, 40px);
    font-size: clamp(16px, 1vw, 32px);
}

code {
    background: var(--code-background);
    padding: 2px;
    border-radius: 5px;
}

table, th, td
{
    border: 1px solid var(--text);
    padding: 2px;
}

hr 
{
    margin-top: 20px;
    color: var(--text);
}

/* 顶部应用栏 */
.app-bar {
    background: var(--surface-container);
    color: var(--text);
    padding: 12px 24px;
    position: static;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.app-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    position: relative;
}

.logo-icon {
    float: left;
    margin-right: 10px;
}

.logo-text {
    display: flex;
    margin: auto;
    margin-left: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: bold;
    font-size: clamp(16px, 1vw, 32px);
}

.nav-buttons {
    display: flex;
    gap: 16px;
}

.nav-button {
    text-decoration: none;
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: clamp(16px, 1vw, 32px);
}

/* 主容器 */
.container {
    max-width: 95%;
    margin: auto;
}

/* 内容区域 */
.article-card {
    max-width: 80%;;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    margin-top: 1vw;
    border: 1px solid var(--outline);
    box-shadow: -4px 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    margin-left: 15%;
}

/* 固定目录 */
.toc-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1%;
    margin-bottom: 1vw;
    border: 1px solid var(--outline);

    width: 15%;
    flex-shrink: 0;
    position: fixed;
    left: 1%;
    z-index: 100;
    box-shadow: -4px 4px 6px rgba(0, 0, 0, 0.1);
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 26px;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
}

@media (max-width: 1024px) {
    .container {
        padding: 0 24px;
        margin-top: 10vw;
    }

    .nav-card {
        position: static;
        width: 100%;
        margin: 20px 0;
        max-height: none;
    }
}

.toc-item {
    margin: 12px 0;
    line-height: 1.4;
}

.toc-link {
    text-decoration: none;
    color: var(--text);
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
    font-size: clamp(16px, 0.9vw, 28px);
}

.toc-link:hover,
.toc-link.active {
    background: var(--surface-container);
    color: var(--primary);
}

.bordered-img {
    margin-top: 1px;
    border: 2px solid var(--text);
}

.copyleft {
    position: static;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    color: var(--text);
    font-size: 0.14vw;
    z-index: 1000;
}

.img-container {
    position: relative;
    display: inline-block;
}

.custom-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, -50%) ;
    background-color: var(--text);
    color: var(--background);
    padding: 5px;
    border-radius: 4px;
    text-align: center;
    transition: opacity 0.3s, visibility 0.3s;
    white-space: nowrap;
}

.img-container:hover .custom-tooltip {
    visibility: visible;
    opacity: 1;
}

blockquote {
    margin: 1em 0;
    padding: 0 1em;
    border-left: 4px solid #ddd; /* 左边引用条 */
    background-color: var(--surface); /* GitHub 式浅灰背景 */
    border-radius: 4px;
    position: relative;
}

.toc-card a {
    font-weight: bold;
    font-size: clamp(10px, 1vw, 32px);
    text-decoration: none;
    color: var(--link);
}

.toc-card ul, .toc-card ol, .toc-card li{
    list-style: none
}