/* ==================== 无障碍辅助工具条 ==================== */
/* 符合 GB/T 37668-2019 一级标准 */

/* ---------- 跳过导航链接 ---------- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-size: 16px;
    border-radius: 0 0 4px 0;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #ff0;
}

/* ---------- 辅助工具条（顶部横向布局） ---------- */
#a11y-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 8px;
    background: #fff;
    padding: 8px 16px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#a11y-toolbar.visible {
    display: flex;
}

#a11y-toolbar .a11y-btn {
    position: relative;
    min-width: 64px;
    height: auto;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    gap: 2px;
    line-height: 1.2;
    transition: all 0.2s;
    color: #333;
    flex-shrink: 0;
}

#a11y-toolbar .a11y-btn:hover,
#a11y-toolbar .a11y-btn:focus {
    background: #f0f0f0;
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

#a11y-toolbar .a11y-btn[aria-pressed="true"] {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

#a11y-toolbar .a11y-btn .a11y-icon {
    font-size: 1.5rem;
    line-height: 1;
}

#a11y-toolbar .a11y-btn .a11y-label {
    font-size: 1rem;
    white-space: nowrap;
}

/* 顶部工具条提示（悬浮时显示在下方） */
#a11y-toolbar .a11y-btn:hover::after,
#a11y-toolbar .a11y-btn:focus::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10001;
    pointer-events: none;
}

/* ---------- 大鼠标指针 ---------- */
body.a11y-big-cursor,
body.a11y-big-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="%23000" stroke="%23fff" stroke-width="1.5" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35z"/></svg>') 0 0, auto !important;
}

/* ---------- 焦点突显 ---------- */
body.a11y-focus-highlight :focus {
    outline: 4px solid #ffeb3b !important;
    outline-offset: 2px !important;
    background-color: rgba(255, 235, 59, 0.15) !important;
}

/* ---------- 十字辅助线 ---------- */
.a11y-crosshair {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    background: #f00;
    opacity: 0.7;
}

.a11y-crosshair-h {
    left: 0;
    width: 100vw;
    height: 2px;
}

.a11y-crosshair-v {
    top: 0;
    width: 2px;
    height: 100vh;
}

/* ---------- 语音朗读高亮 ---------- */
.a11y-reading {
    background: #ffeb3b !important;
    color: #000 !important;
    transition: background 0.2s;
}

/* ==================== 高对比度主题 ==================== */

/* 1. 黑底白字 */
body.high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast * {
    background: transparent !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.high-contrast a,
body.high-contrast a:hover,
body.high-contrast a:focus {
    color: #0ff !important;
    text-decoration: underline !important;
}

body.high-contrast button,
body.high-contrast .btn {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.high-contrast button:hover,
body.high-contrast .btn:hover {
    background: #fff !important;
    color: #000 !important;
}

body.high-contrast img {
    filter: contrast(150%) brightness(1.2) !important;
    opacity: 1 !important;
}

body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.high-contrast *:focus {
    outline: 3px solid #ff0 !important;
    outline-offset: 2px !important;
}

/* 2. 黑底黄字 */
body.high-contrast-yellow {
    background: #000 !important;
    color: #ff0 !important;
}

body.high-contrast-yellow * {
    background: transparent !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.high-contrast-yellow a,
body.high-contrast-yellow a:hover,
body.high-contrast-yellow a:focus {
    color: #0ff !important;
    text-decoration: underline !important;
}

body.high-contrast-yellow button,
body.high-contrast-yellow .btn {
    background: #000 !important;
    color: #ff0 !important;
    border: 2px solid #ff0 !important;
}

body.high-contrast-yellow button:hover,
body.high-contrast-yellow .btn:hover {
    background: #ff0 !important;
    color: #000 !important;
}

body.high-contrast-yellow img {
    filter: contrast(150%) brightness(1.2) !important;
    opacity: 1 !important;
}

body.high-contrast-yellow input,
body.high-contrast-yellow textarea,
body.high-contrast-yellow select {
    background: #000 !important;
    color: #ff0 !important;
    border: 2px solid #ff0 !important;
}

body.high-contrast-yellow *:focus {
    outline: 3px solid #ff0 !important;
    outline-offset: 2px !important;
}

/* 3. 蓝底白字 */
body.high-contrast-blue {
    background: #000080 !important;
    color: #fff !important;
}

body.high-contrast-blue * {
    background: transparent !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.high-contrast-blue a,
body.high-contrast-blue a:hover,
body.high-contrast-blue a:focus {
    color: #ff0 !important;
    text-decoration: underline !important;
}

body.high-contrast-blue button,
body.high-contrast-blue .btn {
    background: #000080 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.high-contrast-blue button:hover,
body.high-contrast-blue .btn:hover {
    background: #fff !important;
    color: #000080 !important;
}

body.high-contrast-blue img {
    filter: contrast(150%) brightness(1.2) !important;
    opacity: 1 !important;
}

body.high-contrast-blue input,
body.high-contrast-blue textarea,
body.high-contrast-blue select {
    background: #000080 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.high-contrast-blue *:focus {
    outline: 3px solid #ff0 !important;
    outline-offset: 2px !important;
}

/* 4. 白底黑字 */
body.high-contrast-white {
    background: #fff !important;
    color: #000 !important;
}

body.high-contrast-white * {
    background: transparent !important;
    color: #000 !important;
    border-color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.high-contrast-white a,
body.high-contrast-white a:hover,
body.high-contrast-white a:focus {
    color: #00f !important;
    text-decoration: underline !important;
}

body.high-contrast-white button,
body.high-contrast-white .btn {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
}

body.high-contrast-white button:hover,
body.high-contrast-white .btn:hover {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast-white img {
    filter: contrast(150%) !important;
    opacity: 1 !important;
}

body.high-contrast-white input,
body.high-contrast-white textarea,
body.high-contrast-white select {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
}

body.high-contrast-white *:focus {
    outline: 3px solid #f00 !important;
    outline-offset: 2px !important;
}

/* 高对比度下工具条反色 */
body.high-contrast #a11y-toolbar,
body.high-contrast-yellow #a11y-toolbar,
body.high-contrast-blue #a11y-toolbar {
    background: #000 !important;
    border-color: #fff !important;
}

body.high-contrast-white #a11y-toolbar {
    background: #fff !important;
    border-color: #000 !important;
}

body.high-contrast #a11y-toolbar .a11y-btn,
body.high-contrast-yellow #a11y-toolbar .a11y-btn,
body.high-contrast-blue #a11y-toolbar .a11y-btn {
    background: transparent !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.high-contrast-white #a11y-toolbar .a11y-btn {
    background: transparent !important;
    color: #000 !important;
    border-color: #000 !important;
}

body.high-contrast #a11y-toolbar .a11y-btn[aria-pressed="true"],
body.high-contrast-yellow #a11y-toolbar .a11y-btn[aria-pressed="true"],
body.high-contrast-blue #a11y-toolbar .a11y-btn[aria-pressed="true"] {
    background: #ff0 !important;
    color: #000 !important;
    border-color: #ff0 !important;
}

body.high-contrast-white #a11y-toolbar .a11y-btn[aria-pressed="true"] {
    background: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

body.high-contrast #a11y-toolbar .a11y-btn:hover::after,
body.high-contrast-yellow #a11y-toolbar .a11y-btn:hover::after,
body.high-contrast-blue #a11y-toolbar .a11y-btn:hover::after {
    background: #fff !important;
    color: #000 !important;
}

body.high-contrast-white #a11y-toolbar .a11y-btn:hover::after {
    background: #000 !important;
    color: #fff !important;
}

/* ==================== 大字版 & 无障碍模式 ==================== */

/* 长辈版（大字版）- PC端 32px（200%放大），符合工信部 ≥28pt / WCAG 200% 要求 */
/* 通过 html 控制 font-size，使 rem 单位元素同步放大 */
html.a11y-large-mode {
    font-size: 24px;
}

body.a11y-large-mode {
    line-height: 1.5;
    font-size: 24px;
}

body.a11y-large-mode p,
body.a11y-large-mode li {
    margin-bottom: 0.75em;
}

/* 移动端大字版 - H5 端 20px（125%放大），兼顾移动端可读性与布局 */
@media (max-width: 768px) {
    html.a11y-large-mode {
        font-size: 20px;
    }

    body.a11y-large-mode {
        line-height: 1.5;
    }

    body.a11y-large-mode .container,
    body.a11y-large-mode .container-fluid {
        max-width: 100% !important;
        min-width: auto !important;
    }
}

/* 无障碍模式 - 对比度 4.5:1 以上，符合 GB/T 37668-2019 */
body.a11y-mode {
    filter: contrast(150%) grayscale(40%);
}

body.a11y-mode a,
body.a11y-mode a:hover {
    text-decoration: underline !important;
}

body.a11y-mode *:focus {
    outline: 3px solid #0056b3 !important;
    outline-offset: 2px !important;
}

body.a11y-mode button,
body.a11y-mode .btn {
    border-width: 2px !important;
}

body.a11y-mode img {
    filter: contrast(110%);
}

/* 按钮激活状态 */
body.a11y-large-mode .a11y-large-mode-toggle {
    font-weight: bold;
    color: #0d6efd !important;
}

body.a11y-mode .a11y-mode-toggle {
    font-weight: bold;
    color: #0d6efd !important;
}

/* 退出按钮 */
#a11y-toolbar .a11y-btn-exit {
    color: #dc3545;
    border-color: #dc3545;
}

#a11y-toolbar .a11y-btn-exit:hover,
#a11y-toolbar .a11y-btn-exit:focus {
    background: #dc3545;
    color: #fff;
}

body.high-contrast #a11y-toolbar .a11y-btn-exit,
body.high-contrast-yellow #a11y-toolbar .a11y-btn-exit,
body.high-contrast-blue #a11y-toolbar .a11y-btn-exit {
    color: #ff6b6b !important;
    border-color: #ff6b6b !important;
}

body.high-contrast #a11y-toolbar .a11y-btn-exit:hover,
body.high-contrast-yellow #a11y-toolbar .a11y-btn-exit:hover,
body.high-contrast-blue #a11y-toolbar .a11y-btn-exit:hover {
    background: #ff6b6b !important;
    color: #000 !important;
}

body.high-contrast-white #a11y-toolbar .a11y-btn-exit {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

body.high-contrast-white #a11y-toolbar .a11y-btn-exit:hover {
    background: #dc3545 !important;
    color: #fff !important;
}
