/* ============================================================
   WinUI 3 / Fluent Design 主题
   - Fluent 令牌（颜色 / 圆角 / 动效曲线）统一走 CSS 变量
   - 浅色 / 深色自动切换：在 <html> 或 <body> 上加 .dark 即可
   ============================================================ */

/* ---------- 设计令牌：浅色 ---------- */
:root {
    --accent: #00AAFF;
    --accent-hover: #33BBFF;
    --accent-pressed: #0099E6;
    --text-on-accent: #1B1B1B;    /* 深色文字，保证按钮可读 */

    --bg: #F3F3F3;
    --bg-layer: rgba(252, 252, 252, 0.7);
    --card-bg: #FFFFFF;
    --card-hover: #F9F9F9;
    --card-pressed: #F1F1F1;
    --control-bg: rgba(255, 255, 255, 0.7);
    --control-hover: rgba(0, 0, 0, 0.037);
    --control-focus-bg: #FFFFFF;
    --dialog-bg: #FCFCFC;

    --text-primary: #1B1B1B;
    --text-secondary: #5D5D5D;
    --text-tertiary: #868686;

    --stroke: rgba(0, 0, 0, 0.0578);
    --stroke-strong: rgba(0, 0, 0, 0.16);

    --danger: #C42B1C;

    /* 顶部额外偏移：zdelauncher 下由 JS 设为 44px */
    --titlebar-inset: 0px;

    --radius: 8px;
    --radius-sm: 6px;
    --radius-xs: 2px;

    --ease: cubic-bezier(0.2, 0, 0, 1);
    --dur: 150ms;
}

/* ---------- 设计令牌：深色 ---------- */
.dark {
    --accent: #005FB8;
    --accent-hover: #1A6FC4;
    --accent-pressed: #004C93;
    --text-on-accent: #FFFFFF;    /* 白字配深蓝，对比度约 6.4:1 */

    --bg: #202020;
    --bg-layer: rgba(44, 44, 44, 0.7);
    --card-bg: rgba(255, 255, 255, 0.0512);
    --card-hover: rgba(255, 255, 255, 0.0837);
    --card-pressed: rgba(255, 255, 255, 0.0326);
    --control-bg: rgba(255, 255, 255, 0.0605);
    --control-hover: rgba(255, 255, 255, 0.0837);
    --control-focus-bg: rgba(255, 255, 255, 0.0837);
    --dialog-bg: #2B2B2B;

    --text-primary: rgba(255, 255, 255, 0.85);    /* 压暗后的正文 */
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-tertiary: rgba(255, 255, 255, 0.44);

    --stroke: rgba(255, 255, 255, 0.0698);
    --stroke-strong: rgba(255, 255, 255, 0.16);

    --danger: #D97A85;           /* 深色下偏暗的红 */

    color: var(--text-primary);
    background-color: var(--bg);
    background-image: none;
}
body.dark,
.dark body {
    background-color: var(--bg);
    background-image: none;
}

/* ---------- 基础重置 ---------- */
::selection {
    background: rgba(0, 187, 255, 0.3);
    color: inherit;
}
.dark ::selection {
    background: rgba(96, 205, 255, 0.3);
}

* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    transition: filter 0.1s;
}

body {
    margin: 0 auto;
    height: 100vh;
    font-family: "Segoe UI Variable Text", "Segoe UI",
                 "Microsoft YaHei UI", "Microsoft YaHei",
                 "PingFang SC", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 50% 0,
            rgba(0, 187, 255, 0.07), rgba(0, 187, 255, 0) 70.71%),
        radial-gradient(circle at 6.7% 75%,
            rgba(0, 187, 255, 0.06), rgba(0, 187, 255, 0) 70.71%),
        radial-gradient(circle at 93.3% 75%,
            rgba(135, 100, 255, 0.05), rgba(135, 100, 255, 0) 70.71%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body::-webkit-scrollbar,
body::-webkit-scrollbar-thumb {
    display: none;
}

/* 像素字体定义（路径按实际部署调整） */
@font-face {
    font-family: "fusion-pixel";
    src: url("/assets/FusionPixelMonoPatched.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ---------- 链接 ---------- */
a, a:link, a:active, a:visited, a:hover, a:focus {
    color: var(--accent);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    outline: none;
    border: none;
    background: none;
    text-decoration: none;
}

div {
    margin: 0;
    padding: 0;
}

a:focus-visible,
summary:focus-visible,
.corner_button:focus-visible,
.switchbar a:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* ---------- 深色遮罩（保留结构，不再叠加变暗） ---------- */
.dark::after {
    content: '';
    position: fixed;
    z-index: 99999;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    pointer-events: none;
}

/* ---------- 顶部导航（NavigationView Top 模式） ---------- */
.switchbar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    width: 100%;
    height: calc(48px + var(--titlebar-inset));
    padding-top: var(--titlebar-inset);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-layer);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    backdrop-filter: blur(30px) saturate(160%);
    border-bottom: 1px solid var(--stroke);
}
.switchbar a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(20% - 8px);
    max-width: 200px;
    height: 40px;
    line-height: 40px;
    white-space: nowrap;
    padding: 0 8px;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--dur) var(--ease),
                color var(--dur) var(--ease);
}
/* 标签里的计数：比文字小一号、颜色淡一些，避免和标签名糊在一起 */
.switchbar a span {
    font-size: 11px;
    font-weight: 400;
    opacity: .72;
    margin-left: 2px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 44px;
}

.switchbar a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 3px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
    transform: translateX(-50%);
    transition: width var(--dur) var(--ease);
}
.switchbar .active {
    color: var(--accent);
    font-weight: 600;
    background: transparent;
    box-shadow: none;
}
.switchbar .active::after {
    width: 55%;
}
.switchbar a:active {
    background-color: var(--control-hover);
}
.switchbar .active:active {
    box-shadow: none;
}

/* ---------- 搜索区（AutoSuggestBox） ---------- */
.search_box {
    z-index: 999;
    position: fixed;
    top: calc(56px + var(--titlebar-inset));
    left: 0;
    width: 100%;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}
.search_form {
    display: flex;
    align-items: center;
    width: calc(100% - 20px);
    max-width: 420px;
    height: 46px;
    box-sizing: border-box;
    background-color: var(--control-bg);
    border: 1px solid var(--stroke);
    border-bottom-color: var(--stroke-strong);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    backdrop-filter: blur(30px) saturate(150%);
    transform: translateZ(0);
    transition: background-color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.search_form:focus-within {
    background-color: var(--control-focus-bg);
    border-bottom-color: var(--accent);
    box-shadow: inset 0 -1px 0 0 var(--accent),
                0 2px 8px rgba(0, 0, 0, 0.06);
}
.search_form input {
    outline: none;
    border: none;
    height: 100%;
    vertical-align: middle;
    pointer-events: auto;
}
#kw {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 4px 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background-color: transparent;
}
#kw::placeholder {
    color: var(--text-tertiary);
}
#btn {
    flex: 0 0 48px;
    width: 48px;
    height: 100%;
    padding: 0;
    border: none;
    outline: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background-color: transparent;
    background-image: url(../assets/img/ic_search.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 16px;
    cursor: pointer;
    opacity: 0.85;
    transition: background-color var(--dur) var(--ease),
                background-size 0.1s;
}
.dark #btn {
    filter: invert(1.0);
}
#btn:active {
    background-size: 14px;
    background-color: var(--card-pressed);
}

/* ---------- 主内容区 ---------- */
#main {
    max-width: 1200px;
    height: calc(100% - 114px - var(--titlebar-inset));
    margin: auto;
    padding-top: calc(114px + var(--titlebar-inset));
    overflow-y: auto;
}
.details {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

summary {
    margin: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}
summary::marker {
    color: var(--text-secondary);
}

hr {
    border: none;
    height: 1px;
    margin: 8px 0;
    background-color: var(--stroke);
}

/* ---------- 列表卡片 ---------- */
.list, .middle {
    width: calc(100% - 20px);
    max-width: 960px;
    margin: 0 auto 8px;
    padding: 12px 16px;
    box-sizing: border-box;
    line-height: 1.6;
    font-size: 14px;
    border-radius: var(--radius);
}
.list {
    background-color: var(--card-bg);
    border: 1px solid var(--stroke);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: background-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.list:active {
    background-color: var(--card-pressed);
}
.list .title {
    height: 32px;
    line-height: 32px;
    overflow: hidden;
}
.list .title .logo {
    height: 32px;
    vertical-align: top;
    border-radius: var(--radius-xs);
}
.list .title strong {
    color: var(--accent);
    font-weight: 600;
}

.version {
    font-size: 16px;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

/* ---------- 展开内容 ---------- */
.content {
    list-style-type: none;
    counter-reset: sectioncounter;
    margin: 0;
    padding: 0 0 0 22px;
    display: none;
    font-size: 14px;
    max-height: calc(100vh - 166px - var(--titlebar-inset));
    overflow-y: auto;
}
.content li:before {
    content: counter(sectioncounter) ".";
    counter-increment: sectioncounter;
}
.content li {
    text-indent: -1rem;
}
.content li div,
.content li details {
    color: var(--text-secondary);
    text-indent: 0;
    font-size: 13px;
}
.content li details {
    display: inline;
}
.content li summary {
    display: inline;
    color: var(--accent);
    font-weight: 400;
    font-size: 14px;
    margin: 0;
}

.right-box {
    float: right;
}
.sharepic {
    width: 20px;
    height: 20px;
    margin: 6px 0 6px 6px;
    vertical-align: top;
}
.date {
    color: var(--text-tertiary);
}
.arrow {
    color: var(--accent);
    margin-right: 5px;
}

/* ---------- 搜索高亮 ---------- */
.highlight {
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    background: rgba(0, 187, 255, 0.15);
    color: #0077A8;              /* 深青文字，避免亮青字+亮青底看不清 */
}
.dark .highlight {
    background: rgba(96, 205, 255, 0.16);
    color: #7BD7FF;
}

/* ---------- 加载层 ---------- */
#loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
}
#loading img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25%;
    max-width: 195px;
}

/* ---------- 悬浮按钮 ---------- */
.corner_button {
    z-index: 999;
    position: fixed;
    right: 16px;
    bottom: 64px;
    width: 36px;
    height: 36px;
    line-height: 34px;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--stroke-strong);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: background-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
}
#toLogout {
    bottom: 150px;
    display: none;
}
#theme {
    bottom: 105px;
}
#theme img {
    width: 60%;
    margin: 20%;
}
.dark #theme img {
    filter: invert(1);
}
.corner_button:active {
    transform: scale(0.92);
    background-color: var(--card-pressed);
}

/* ---------- 页脚 ---------- */
#copyright {
    padding: 24px 30px;
    line-height: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border-top: 1px solid var(--stroke);
    text-align: center;
}
#toLogin {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

/* ---------- 对话框（ContentDialog） ---------- */
.shadow {
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.login_box {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 60px);
    max-width: 420px;
    margin: 0;
    padding: 24px;
    box-sizing: border-box;
    border-radius: var(--radius);
    background-color: var(--dialog-bg);
    border: 1px solid var(--stroke-strong);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14),
                0 0 2px rgba(0, 0, 0, 0.06);
    text-align: center;
    color: var(--text-primary);
}
.login_box .close {
    position: absolute;
    z-index: 1999;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    line-height: 30px;
    text-align: center;
    font-size: 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    background-color: transparent;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease);
}
.login_box .close:active {
    background-color: var(--card-pressed);
}
.login_box .title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#form div {
    margin: 16px 0;
}
label {
    width: 80px;
    display: inline-block;
    text-align: right;
    font-size: 14px;
    color: var(--text-secondary);
}
input {
    outline: none;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

/* 文本框（TextBox） */
.input {
    height: 32px;
    width: 65%;
    box-sizing: border-box;
    padding: 0 11px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--control-bg);
    border: 1px solid var(--stroke);
    border-bottom-color: var(--stroke-strong);
    transition: background-color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.input:focus {
    background-color: var(--control-focus-bg);
    border-bottom-color: var(--accent);
    box-shadow: inset 0 -1px 0 0 var(--accent);
}

/* 强调按钮（AccentButton） */
input[type=button] {
    height: 32px;
    width: 90%;
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease),
                opacity var(--dur) var(--ease);
}
input[type=button]:active {
    background: var(--accent-pressed);
    color: var(--text-on-accent);
    opacity: 0.9;
}

.below {
    height: 36px;
    padding: 0 25px;
    line-height: 36px;
}

/* ---------- 全屏预览 ---------- */
.fullview {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    height: 100%;
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.fullview .tip {
    position: fixed;
    top: 50px;
    left: 0;
    width: 100%;
    text-align: center;
    text-shadow: 0 0 8px #666;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}
.fullview_img {
    width: 100%;
    height: 100%;
}
.fullview_img img {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
}

/* ============================================================
   悬停态（仅指针设备生效，避免触屏“粘滞”）
   ============================================================ */
@media (any-hover: hover) {
    #main::-webkit-scrollbar,
    .content::-webkit-scrollbar {
        width: 12px;
        background-color: transparent;
    }
    #main::-webkit-scrollbar-thumb,
    .content::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border: 4px solid transparent;
        background-clip: padding-box;
        border-radius: 8px;
        transition: background 0.1s;
    }
    #main:hover::-webkit-scrollbar-thumb,
    .content:hover::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.35);
        background-clip: padding-box;
        border-width: 3px;
    }
    .dark #main::-webkit-scrollbar-thumb,
    .dark .content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        background-clip: padding-box;
    }
    .dark #main:hover::-webkit-scrollbar-thumb,
    .dark .content:hover::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.35);
        background-clip: padding-box;
    }

    .switchbar a:hover {
        background-color: var(--control-hover);
    }
    .switchbar .active:hover {
        background-color: transparent;
    }

    #btn:hover {
        background-color: var(--control-hover);
        transition: background-color 0.2s var(--ease);
    }

    .list:hover {
        background-color: var(--card-hover);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }

    .corner_button:hover {
        background-color: var(--card-hover);
    }

    .login_box .close:hover,
    .frame .close:hover {
        background-color: var(--control-hover);
    }

    input[type=button]:hover {
        background: var(--accent-hover);
    }

    summary:hover {
        color: var(--accent);
    }
    .content li summary:hover {
        text-decoration: underline;
    }
}
/* ============================================================
   Mica 背景层  — DSH 2026-10-23 追加
   替代原来的纯色 / 彩色光晕，贴合 WinUI 3 的窗口底
   ============================================================ */
:root{
    --mica-tint: rgba(0, 120, 212, 0.035);
    --mica-vignette: rgba(0, 0, 0, 0.022);
}
.dark{
    --mica-tint: rgba(96, 205, 255, 0.035);
    --mica-vignette: rgba(0, 0, 0, 0.22);
}
body, body.dark, .dark body{
    background-image:
        url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='3'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='saturate'%20values='0'/%3E%3C/filter%3E%3Crect%20width='160'%20height='160'%20filter='url(%23n)'%20opacity='0.05'/%3E%3C/svg%3E"),
        radial-gradient(1100px 620px at 50% -18%, var(--mica-tint), transparent 72%),
        radial-gradient(140% 120% at 50% 50%, transparent 52%, var(--mica-vignette) 100%);
    background-attachment: fixed;
}


/* 每条更新日志卡片：不透明度与 wiki 正文卡片一致 */
.list {
    background-color: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    backdrop-filter: blur(30px) saturate(150%);
}
.dark .list,
body.dark .list {
    background-color: rgba(255, 255, 255, 0.084);
}
.list:hover {
    background-color: rgba(255, 255, 255, 0.88);
}
.dark .list:hover,
body.dark .list:hover {
    background-color: rgba(255, 255, 255, 0.12);
}
