/* 付羽老黄历 - 前台统一 UI 基座 (toast / loading / empty / error)
 * 与 style.css 主题变量对齐：朱砂 #c93b2e / 鎏金 #d8b36a / 月白 #e8e3d5 / 深底
 * 任何页面引入 fy-ui.js 后即可使用 window.FyUI.{toast, loading, empty, error, formGuard}
 */

/* ==================== Toast 浮层 ==================== */
.fy-toast-stack {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 32px);
    width: min(420px, 100%);
}

.fy-toast {
    pointer-events: auto;
    background: linear-gradient(145deg, rgba(18, 23, 34, 0.96), rgba(14, 20, 32, 0.96));
    color: var(--ink-strong, #f5f7ff);
    border: 1px solid rgba(216, 179, 106, 0.35);
    border-left: 3px solid var(--secondary-color, #d8b36a);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fy-toast-in 0.22s ease-out;
}

.fy-toast.is-leaving {
    animation: fy-toast-out 0.18s ease-in forwards;
}

.fy-toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.fy-toast-body {
    flex: 1;
    min-width: 0;
}

.fy-toast-title {
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--accent-gold, #ecd9a8);
}

.fy-toast-text {
    color: var(--ink-soft, rgba(245, 247, 255, 0.82));
    word-break: break-word;
}

.fy-toast-action {
    margin-left: 8px;
    color: var(--secondary-color, #d8b36a);
    background: transparent;
    border: 1px solid rgba(216, 179, 106, 0.5);
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.fy-toast-action:hover,
.fy-toast-action:focus-visible {
    background: rgba(216, 179, 106, 0.12);
}

.fy-toast.fy-toast-success {
    border-left-color: #7fc88a;
}

.fy-toast.fy-toast-success .fy-toast-icon {
    color: #7fc88a;
}

.fy-toast.fy-toast-error {
    border-left-color: var(--primary-color, #c93b2e);
}

.fy-toast.fy-toast-error .fy-toast-icon {
    color: var(--primary-color, #c93b2e);
}

.fy-toast.fy-toast-warn {
    border-left-color: #f0a85a;
}

.fy-toast.fy-toast-warn .fy-toast-icon {
    color: #f0a85a;
}

.fy-toast.fy-toast-info .fy-toast-icon {
    color: var(--secondary-color, #d8b36a);
}

@keyframes fy-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fy-toast-out {
    to { opacity: 0; transform: translateY(-6px); }
}

/* ==================== 全局 loading 遮罩 ==================== */
.fy-loading-mask {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(11, 14, 19, 0.72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    color: var(--ink-strong, #f5f7ff);
    pointer-events: auto;
    animation: fy-fade-in 0.18s ease-out;
}

.fy-loading-mask[hidden] { display: none; }

.fy-loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(216, 179, 106, 0.18);
    border-top-color: var(--secondary-color, #d8b36a);
    animation: fy-spin 0.9s linear infinite;
}

.fy-loading-text {
    font-size: 14px;
    color: var(--ink-soft, rgba(245, 247, 255, 0.82));
    letter-spacing: 0.5px;
}

@keyframes fy-spin {
    to { transform: rotate(360deg); }
}

@keyframes fy-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ==================== 按钮 loading 态 ==================== */
button.fy-btn-loading,
input[type="submit"].fy-btn-loading,
input[type="button"].fy-btn-loading,
a.fy-btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

button.fy-btn-loading::after,
input[type="submit"].fy-btn-loading::after,
input[type="button"].fy-btn-loading::after,
a.fy-btn-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: fy-spin 0.9s linear infinite;
}

/* ==================== 空态 ==================== */
.fy-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--ink-faint, rgba(245, 247, 255, 0.62));
}

.fy-empty-icon {
    font-size: 38px;
    margin-bottom: 12px;
    opacity: 0.5;
    line-height: 1;
}

.fy-empty-title {
    font-size: 15px;
    color: var(--ink-soft, rgba(245, 247, 255, 0.82));
    margin-bottom: 6px;
}

.fy-empty-text {
    font-size: 13px;
    line-height: 1.6;
}

/* ==================== 行内错误提示 ==================== */
.fy-field-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #f5a89a;
    line-height: 1.4;
}

input.fy-input-error,
select.fy-input-error,
textarea.fy-input-error {
    border-color: rgba(245, 168, 154, 0.65) !important;
    box-shadow: 0 0 0 2px rgba(245, 168, 154, 0.18) !important;
}

/* ==================== 移动端 ==================== */
@media (max-width: 640px) {
    .fy-toast-stack { top: 12px; width: calc(100vw - 24px); }
    .fy-toast { font-size: 13px; padding: 10px 12px; }
    .fy-empty { padding: 32px 16px; }
    .fy-empty-icon { font-size: 30px; }
}

/* ==================== 返回顶部 FAB (Wave 5: 2026-09-26) ==================== */
.fy-back-top {
    position: fixed;
    right: 18px;
    bottom: 24px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(216, 179, 106, 0.44);
    border-radius: 50%;
    background: rgba(8, 18, 40, 0.88);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    color: #d8b36a;
    cursor: pointer;
    font: 800 18px/1 "Helvetica Neue", Arial, sans-serif;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, background .2s ease;
}
.fy-back-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.fy-back-top:hover { background: rgba(29, 54, 92, 0.96); }
.fy-back-top:focus-visible {
    outline: 2px solid rgba(216, 179, 106, 0.85);
    outline-offset: 3px;
}
.fy-back-top:active { transform: translateY(-2px); }
@media (max-width: 640px) {
    .fy-back-top { right: 14px; bottom: 16px; width: 40px; height: 40px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .fy-back-top { transition: opacity .15s ease; }
    .fy-back-top:active { transform: none; }
}

/* ==================== 顶部滚动进度条 (Wave 6: 2026-09-26) ==================== */
/* 跨 14 前台页统一, 3px 朱砂鎏金渐变 + 0.12s 线性过渡 + reduced-motion 收敛 */
.fy-scroll-progress {
    position: fixed;
    inset: 0 auto auto 0;
    z-index: 1000;
    width: 100%;
    height: 3px;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.08);
    /* 长页能滚到 100% 的可视反馈, 但 z-index 1000 仍低于 fy-select 弹层 (9999) */
}
.fy-scroll-progress > span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--fy-gold, #d8b36a), var(--fy-vermilion, #c93b2e));
    box-shadow: 0 0 8px rgba(216, 179, 106, 0.5);
    transition: width .12s linear;
}
@media (prefers-reduced-motion: reduce) {
    .fy-scroll-progress > span { transition: none; }
}

/* ==================== Wave 9: 主题切换按钮 ==================== */
.fy-theme-toggle {
    /* 复用 .fy-back-top 体系: 44x44 圆, 鎏金边, 玄墨半透底 (light 主题自动跟着 var 切) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fy-card-bg, rgba(255,255,255,0.08));
    color: var(--ink-strong, #f5f7ff);
    border: 1px solid var(--fy-border, rgba(216, 179, 106, 0.4));
    cursor: pointer;
    font: inherit;
    line-height: 1;
    padding: 0;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
}
.fy-theme-toggle:hover {
    background: var(--fy-card-bg-hover, rgba(216, 179, 106, 0.18));
    transform: translateY(-1px);
}
.fy-theme-toggle:active { transform: translateY(0); }
.fy-theme-toggle:focus-visible {
    outline: 2px solid var(--secondary-color, #d8b36a);
    outline-offset: 2px;
}
.fy-theme-toggle[data-theme="light"] {
    /* 浅色主题下显示 ☀ (太阳), 深色主题下显示 🌙 (月亮) */
}
.fy-theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
@media (prefers-reduced-motion: reduce) {
    .fy-theme-toggle { transition: none; }
    .fy-theme-toggle:hover { transform: none; }
}
@media (max-width: 640px) {
    .fy-theme-toggle { width: 36px; height: 36px; }
    .fy-theme-toggle svg { width: 18px; height: 18px; }
}

/* 浅色主题下的 fy-toast 背景 (避免半透黑色) */
:root[data-theme="light"] .fy-toast {
    background: linear-gradient(145deg, rgba(255, 253, 247, 0.96), rgba(243, 236, 217, 0.96));
    color: var(--ink-strong, #1a1d24);
    border-color: rgba(168, 122, 50, 0.35);
}
:root[data-theme="light"] .fy-toast .fy-toast-icon { color: var(--primary-color, #c93b2e); }

/* 浅色主题下, fy-scroll-progress 容器底色 (避免与浅底冲突) */
:root[data-theme="light"] .fy-scroll-progress {
    background: rgba(26, 29, 36, 0.08);
}
:root[data-theme="light"] .fy-scroll-progress > span {
    box-shadow: 0 0 8px rgba(168, 122, 50, 0.4);
}

/* 浅色主题下, fy-loading-mask 遮罩 (避免黑屏感) */
:root[data-theme="light"] .fy-loading-mask {
    background: rgba(243, 236, 217, 0.78);
    color: var(--ink-strong, #1a1d24);
}

/* 浅色主题下, 通用 button/卡片悬浮变体 */
:root[data-theme="light"] .fy-back-top {
    background: rgba(255, 253, 247, 0.85);
    color: var(--ink-strong, #1a1d24);
    border-color: rgba(168, 122, 50, 0.4);
    box-shadow: 0 4px 12px rgba(88, 70, 40, 0.18);
}
:root[data-theme="light"] .fy-back-top:hover {
    background: rgba(255, 253, 247, 0.95);
    border-color: rgba(168, 122, 50, 0.7);
}

/* ==================== Wave 10: 字号 + 动效偏好 ==================== */

/* 字号缩放: 通过 --fy-font-scale 驱动关键 em/calc, 其它页用 1rem = 16px 链路自适配 */
:root {
    --fy-font-scale: 1;
}
/* 全局: 用 calc 包裹, 让所有 rem 链路自然缩放. 因为根 font-size 没变, 用 transform 不合适
   改用: 对各页可调字号 (h1/h2/h3) 乘以 scale, 整体行高微调 */
html[data-fs="0.875"] { --fy-font-scale: 0.875; }
html[data-fs="1"]     { --fy-font-scale: 1; }
html[data-fs="1.125"] { --fy-font-scale: 1.125; }
html[data-fs="1.25"]  { --fy-font-scale: 1.25; }

/* 动效开关: data-rm=reduce 时全局收尾 */
html[data-rm="reduce"] *,
html[data-rm="reduce"] *::before,
html[data-rm="reduce"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}
/* auto + full 都不动, 让 prefers-reduced-motion 系统偏好生效 */
@media (prefers-reduced-motion: reduce) {
    html[data-rm="auto"] *,
    html[data-rm="auto"] *::before,
    html[data-rm="auto"] *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 切换按钮: 放主题按钮旁, 齿轮图标 */
.fy-a11y-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.28));
    border-radius: 50%;
    background: var(--fy-card, rgba(20, 24, 32, 0.6));
    color: var(--fy-ink, #e8e3d5);
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
    padding: 0;
    flex-shrink: 0;
}
.fy-a11y-toggle:hover {
    background: var(--fy-card-hi, rgba(28, 34, 46, 0.85));
    border-color: var(--fy-gold, #d8b36a);
    transform: translateY(-1px);
}
.fy-a11y-toggle:focus-visible {
    outline: 2px solid var(--fy-gold, #d8b36a);
    outline-offset: 2px;
}
.fy-a11y-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
:root[data-theme="light"] .fy-a11y-toggle {
    background: rgba(255, 253, 247, 0.7);
    border-color: rgba(168, 122, 50, 0.35);
    color: #1a1d24;
}
:root[data-theme="light"] .fy-a11y-toggle:hover {
    background: rgba(255, 253, 247, 0.95);
    border-color: rgba(168, 122, 50, 0.7);
}

/* 面板: 弹层, 齿轮下方 */
.fy-a11y-panel {
    position: fixed;
    top: 64px;
    right: 12px;
    z-index: 9998;
    min-width: 240px;
    padding: 14px 16px;
    background: var(--fy-card, rgba(14, 20, 32, 0.95));
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.28));
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    color: var(--fy-ink, #e8e3d5);
    font-size: 14px;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.fy-a11y-panel[hidden] { display: none; }
.fy-a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
}
.fy-a11y-row + .fy-a11y-row {
    border-top: 1px solid var(--fy-line, rgba(216, 179, 106, 0.18));
    margin-top: 6px;
    padding-top: 12px;
}
.fy-a11y-label {
    font-weight: 600;
    color: var(--fy-gold, #d8b36a);
    font-size: 13px;
    flex-shrink: 0;
}
.fy-a11y-btns {
    display: flex;
    gap: 4px;
}
.fy-a11y-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.28));
    border-radius: 6px;
    background: transparent;
    color: var(--fy-ink, #e8e3d5);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease;
}
.fy-a11y-btn:hover {
    background: var(--fy-card-hi, rgba(28, 34, 46, 0.85));
    border-color: var(--fy-gold, #d8b36a);
}
.fy-a11y-btn.is-active {
    background: var(--fy-gold, #d8b36a);
    color: #0b0e13;
    border-color: var(--fy-gold, #d8b36a);
}
.fy-a11y-btn:focus-visible {
    outline: 2px solid var(--fy-gold, #d8b36a);
    outline-offset: 2px;
}
:root[data-theme="light"] .fy-a11y-panel {
    background: rgba(255, 253, 247, 0.96);
    border-color: rgba(168, 122, 50, 0.35);
    color: #1a1d24;
    box-shadow: 0 12px 36px rgba(88, 70, 40, 0.2);
}
:root[data-theme="light"] .fy-a11y-btn {
    color: #1a1d24;
    border-color: rgba(168, 122, 50, 0.3);
}
:root[data-theme="light"] .fy-a11y-btn:hover {
    background: rgba(168, 122, 50, 0.08);
}
:root[data-theme="light"] .fy-a11y-btn.is-active {
    background: #a87a32;
    color: #f3ecd9;
    border-color: #a87a32;
}

/* 移动端: 按钮缩 36, 面板贴右 */
@media (max-width: 640px) {
    .fy-a11y-toggle {
        width: 36px;
        height: 36px;
    }
    .fy-a11y-panel {
        right: 8px;
        top: 56px;
        min-width: 200px;
        font-size: 13px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .fy-a11y-toggle,
    .fy-a11y-btn {
        transition: none !important;
    }
}

/* ==================== Wave 11.2: Cookie 偏好横幅 ==================== */

/* 横幅 (底部弹出) */
.fy-consent {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 9997;
    max-width: 720px;
    margin: 0 auto;
    background: var(--fy-card, rgba(14, 20, 32, 0.96));
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.32));
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    color: var(--fy-ink, #e8e3d5);
    font-size: 14px;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fyConsentSlide .35s ease-out;
}
.fy-consent[hidden] { display: none; }
@keyframes fyConsentSlide {
    from { transform: translateY(120%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.fy-consent-inner {
    padding: 16px 18px;
    display: grid;
    gap: 12px;
}
.fy-consent-text { display: grid; gap: 4px; }
.fy-consent-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--fy-gold, #d8b36a);
}
.fy-consent-desc {
    margin: 0;
    color: var(--fy-ink, #e8e3d5);
    font-size: 13px;
    line-height: 1.55;
}
.fy-consent-desc a.fy-consent-detail {
    color: var(--fy-gold, #d8b36a);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.fy-consent-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.fy-consent-btn {
    flex: 1 1 auto;
    min-width: 90px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.32));
    border-radius: 7px;
    background: transparent;
    color: var(--fy-ink, #e8e3d5);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.fy-consent-btn:hover {
    background: var(--fy-card-hi, rgba(28, 34, 46, 0.85));
    border-color: var(--fy-gold, #d8b36a);
}
.fy-consent-btn:focus-visible {
    outline: 2px solid var(--fy-gold, #d8b36a);
    outline-offset: 2px;
}
.fy-consent-btn:active { transform: translateY(1px); }
.fy-consent-btn-accept {
    background: var(--fy-gold, #d8b36a);
    color: #0b0e13;
    border-color: var(--fy-gold, #d8b36a);
    font-weight: 600;
}
.fy-consent-btn-accept:hover {
    background: #c9a055;
    border-color: #c9a055;
    color: #0b0e13;
}
.fy-consent-btn-reject { /* 默认行为, 透明底 */ }

/* Customize 详情面板 */
.fy-consent-detail-panel {
    border-top: 1px solid var(--fy-line, rgba(216, 179, 106, 0.18));
    padding-top: 12px;
    display: grid;
    gap: 10px;
}
.fy-consent-detail-panel[hidden] { display: none; }
.fy-consent-category {
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.18));
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
}
.fy-consent-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.fy-consent-cat-head strong {
    color: var(--fy-gold, #d8b36a);
    font-size: 14px;
}
.fy-consent-cat-required {
    color: var(--fy-faint, rgba(232, 227, 213, 0.55));
    font-size: 11px;
}
.fy-consent-cat-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--fy-ink-soft, rgba(232, 227, 213, 0.78));
}

/* Switch (toggle) */
.fy-consent-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.fy-consent-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.fy-consent-switch span {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 11px;
    transition: background .2s ease;
}
.fy-consent-switch span::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
}
.fy-consent-switch input:checked + span {
    background: var(--fy-gold, #d8b36a);
}
.fy-consent-switch input:checked + span::before {
    transform: translateX(16px);
}
.fy-consent-switch input:focus-visible + span {
    outline: 2px solid var(--fy-gold, #d8b36a);
    outline-offset: 2px;
}

.fy-consent-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* Indicator (已同意后, 小齿轮按钮) */
.fy-consent-indicator {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 9996;
    width: 36px;
    height: 36px;
    border: 1px solid var(--fy-line, rgba(216, 179, 106, 0.32));
    border-radius: 50%;
    background: var(--fy-card, rgba(14, 20, 32, 0.85));
    color: var(--fy-ink, #e8e3d5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .2s ease, border-color .2s ease;
}
.fy-consent-indicator:hover {
    background: var(--fy-card-hi, rgba(28, 34, 46, 0.95));
    border-color: var(--fy-gold, #d8b36a);
}
.fy-consent-indicator:focus-visible {
    outline: 2px solid var(--fy-gold, #d8b36a);
    outline-offset: 2px;
}
.fy-consent-indicator svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 浅色主题覆盖 */
:root[data-theme="light"] .fy-consent {
    background: rgba(255, 253, 247, 0.97);
    border-color: rgba(168, 122, 50, 0.4);
    color: #1a1d24;
    box-shadow: 0 12px 40px rgba(88, 70, 40, 0.22);
}
:root[data-theme="light"] .fy-consent-title { color: #8a6228; }
:root[data-theme="light"] .fy-consent-desc,
:root[data-theme="light"] .fy-consent-desc a.fy-consent-detail { color: #1a1d24; }
:root[data-theme="light"] .fy-consent-desc a.fy-consent-detail { color: #8a6228; }
:root[data-theme="light"] .fy-consent-btn {
    color: #1a1d24;
    border-color: rgba(168, 122, 50, 0.3);
}
:root[data-theme="light"] .fy-consent-btn:hover {
    background: rgba(168, 122, 50, 0.08);
    border-color: rgba(168, 122, 50, 0.7);
}
:root[data-theme="light"] .fy-consent-btn-accept {
    background: #a87a32;
    color: #f3ecd9;
    border-color: #a87a32;
}
:root[data-theme="light"] .fy-consent-btn-accept:hover {
    background: #8a6228;
    border-color: #8a6228;
}
:root[data-theme="light"] .fy-consent-category {
    border-color: rgba(168, 122, 50, 0.22);
    background: rgba(168, 122, 50, 0.03);
}
:root[data-theme="light"] .fy-consent-cat-head strong { color: #8a6228; }
:root[data-theme="light"] .fy-consent-cat-required { color: rgba(26, 29, 36, 0.55); }
:root[data-theme="light"] .fy-consent-cat-desc { color: rgba(26, 29, 36, 0.78); }
:root[data-theme="light"] .fy-consent-switch span { background: rgba(0, 0, 0, 0.18); }
:root[data-theme="light"] .fy-consent-switch input:checked + span { background: #a87a32; }
:root[data-theme="light"] .fy-consent-indicator {
    background: rgba(255, 253, 247, 0.92);
    border-color: rgba(168, 122, 50, 0.4);
    color: #1a1d24;
}

/* 移动端 */
@media (max-width: 640px) {
    .fy-consent {
        left: 8px;
        right: 8px;
        bottom: 8px;
        font-size: 13px;
    }
    .fy-consent-inner { padding: 12px 14px; }
    .fy-consent-actions { flex-direction: column; }
    .fy-consent-btn { width: 100%; }
    .fy-consent-indicator { left: 8px; bottom: 8px; width: 32px; height: 32px; }
    .fy-consent-indicator svg { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .fy-consent { animation: none; }
    .fy-consent-btn,
    .fy-consent-switch span,
    .fy-consent-switch span::before { transition: none !important; }
}

/* ====== Wave 12: 离线提示条 (顶部 fixed, 离线/恢复切换) ====== */
.fy-offline-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998; /* 低于 indicator 9999, 高于 consent 9997 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 18px;
    min-height: 40px;
    background: linear-gradient(135deg, rgba(201, 59, 46, 0.96), rgba(163, 44, 34, 0.96));
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.32s ease-out, opacity 0.32s ease-out;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
}
.fy-offline-bar.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.fy-offline-bar.fy-offline-bar-online {
    background: linear-gradient(135deg, rgba(125, 168, 117, 0.96), rgba(94, 130, 89, 0.96));
}
.fy-offline-bar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor;
}
.fy-offline-bar-text {
    font-weight: 500;
    letter-spacing: 0.3px;
}
.fy-offline-bar-retry {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
    min-height: 28px;
}
.fy-offline-bar-retry:hover, .fy-offline-bar-retry:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.85);
    outline: none;
}
.fy-offline-bar-retry:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}
@media (max-width: 640px) {
    .fy-offline-bar {
        padding: 8px 12px;
        font-size: 13px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .fy-offline-bar-text { flex: 1 1 auto; min-width: 0; }
    .fy-offline-bar-retry { font-size: 11px; padding: 4px 10px; min-height: 26px; }
}
:root[data-theme="light"] .fy-offline-bar {
    background: linear-gradient(135deg, rgba(168, 61, 36, 0.97), rgba(138, 53, 37, 0.97));
    color: #fff;
    border-bottom-color: rgba(0, 0, 0, 0.15);
}
:root[data-theme="light"] .fy-offline-bar.fy-offline-bar-online {
    background: linear-gradient(135deg, rgba(61, 107, 70, 0.97), rgba(51, 90, 60, 0.97));
}
@media (prefers-reduced-motion: reduce) {
    .fy-offline-bar { transition: none; }
    .fy-offline-bar-retry { transition: none; }
}

/* ====== Wave 13: 键盘快捷键面板 (弹层, 复用 a11y 视觉) ====== */
.fy-shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000; /* 最高, 离线/同意/a11y 都覆盖 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease-out;
    pointer-events: none;
}
.fy-shortcuts-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.fy-shortcuts-overlay[hidden] { display: none; }
.fy-shortcuts-panel {
    max-width: 480px;
    width: 100%;
    background: var(--card-gradient, linear-gradient(145deg, rgba(20,25,35,0.96) 0%, rgba(15,20,30,0.96) 100%));
    border: 1px solid rgba(216, 179, 106, 0.4);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    color: var(--ink-strong, #f5f7ff);
    transform: scale(0.95);
    transition: transform 0.18s ease-out;
}
.fy-shortcuts-overlay.is-visible .fy-shortcuts-panel {
    transform: scale(1);
}
.fy-shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(216, 179, 106, 0.2);
}
.fy-shortcuts-title {
    font-family: "Noto Serif SC","Songti SC","STSong","SimSun",serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--ink-strong, #f5f7ff);
    letter-spacing: 1px;
    margin: 0;
}
.fy-shortcuts-close {
    appearance: none;
    background: transparent;
    border: 1px solid rgba(216, 179, 106, 0.3);
    color: var(--ink-soft, rgba(245, 247, 255, 0.72));
    font-family: inherit;
    font-size: 22px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.fy-shortcuts-close:hover, .fy-shortcuts-close:focus-visible {
    background: rgba(216, 179, 106, 0.15);
    border-color: var(--secondary-color, #d8b36a);
    color: var(--accent-gold, #ecd9a8);
    outline: none;
}
.fy-shortcuts-close:focus-visible {
    box-shadow: 0 0 0 2px var(--secondary-color, #d8b36a);
}
.fy-shortcuts-body {
    padding: 16px 20px 20px;
}
.fy-shortcuts-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 16px;
    row-gap: 10px;
    align-items: center;
    margin: 0;
}
.fy-shortcuts-list dt { display: flex; gap: 4px; align-items: center; }
.fy-shortcuts-list dd {
    color: var(--ink-soft, rgba(245, 247, 255, 0.82));
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}
.fy-shortcuts-list kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-strong, #f5f7ff);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(216, 179, 106, 0.35);
    border-bottom-width: 2px;
    border-radius: 6px;
    line-height: 1;
}
.fy-shortcuts-hint {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed rgba(216, 179, 106, 0.18);
    color: var(--ink-faint, rgba(245, 247, 255, 0.55));
    font-size: 12px;
    line-height: 1.6;
}
.fy-shortcuts-hint kbd {
    font-size: 11px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
}
@media (max-width: 640px) {
    .fy-shortcuts-overlay { padding: 0; align-items: flex-end; }
    .fy-shortcuts-panel {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        transform: translateY(20px);
    }
    .fy-shortcuts-overlay.is-visible .fy-shortcuts-panel {
        transform: translateY(0);
    }
}
:root[data-theme="light"] .fy-shortcuts-overlay {
    background: rgba(26, 29, 36, 0.45);
}
:root[data-theme="light"] .fy-shortcuts-panel {
    background: var(--card-gradient, linear-gradient(145deg, rgba(255,255,255,0.98) 0%, rgba(248,243,232,0.98) 100%));
    border-color: rgba(168, 122, 50, 0.4);
    color: var(--ink-strong, #1a1d24);
}
:root[data-theme="light"] .fy-shortcuts-title { color: var(--ink-strong, #1a1d24); }
:root[data-theme="light"] .fy-shortcuts-close { color: var(--ink-soft, #3a3f4a); }
:root[data-theme="light"] .fy-shortcuts-list dd { color: var(--ink-soft, #3a3f4a); }
:root[data-theme="light"] .fy-shortcuts-list kbd {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(168, 122, 50, 0.4);
    color: var(--ink-strong, #1a1d24);
}
:root[data-theme="light"] .fy-shortcuts-hint { color: var(--ink-faint, #6a6a6a); }
@media (prefers-reduced-motion: reduce) {
    .fy-shortcuts-overlay,
    .fy-shortcuts-panel { transition: none; }
}

/* ===== Wave 16: 会员升级引导卡 (.member-gate) — 工具页公开壳的结果区软门禁 ===== */
.member-gate {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin: 20px auto;
    padding: 40px 28px 34px;
    border: 1px solid rgba(216, 179, 106, 0.32);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 0%, rgba(216, 179, 106, 0.10), transparent 46%),
        linear-gradient(160deg, rgba(15, 20, 30, 0.92), rgba(9, 14, 22, 0.96));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    max-width: 640px;
}
.member-gate-seal {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(160deg, #c93b2e, #8f2a20);
    color: #fdf6e3;
    font: 700 28px/1 "Noto Serif SC", "STSong", "SimSun", serif;
    box-shadow: 0 6px 18px rgba(201, 59, 46, 0.35);
}
.member-gate-title {
    margin: 4px 0 0;
    font-size: 20px;
    color: #ecd9a8;
    letter-spacing: 0.06em;
}
.member-gate-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255, 248, 234, 0.78);
    max-width: 46ch;
}
.member-gate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 30px;
    margin-top: 6px;
    border-radius: 12px;
    border: 1px solid rgba(236, 217, 168, 0.4);
    background: linear-gradient(160deg, #d8b36a, #a87a32);
    color: #241505;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 24px rgba(168, 122, 50, 0.32);
}
.member-gate-btn:hover,
.member-gate-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(168, 122, 50, 0.42);
    outline: none;
}
.member-gate-sub {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 248, 234, 0.5);
}
/* Wave 17: 权益清单 + 价格锚点 */
.member-gate-benefits {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 13.5px;
    color: rgba(255, 248, 234, 0.88);
}
.member-gate-benefits li {
    display: flex;
    align-items: center;
    gap: 8px;
}
.member-gate-benefits li::before {
    content: "✓";
    color: #d8b36a;
    font-weight: 700;
}
.member-gate-prices {
    display: flex;
    gap: 10px;
    margin: 4px 0 2px;
}
.member-gate-price {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 7px 14px;
    border: 1px dashed rgba(216, 179, 106, 0.5);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 800;
    color: #ecd9a8;
    font-variant-numeric: tabular-nums;
}
.member-gate-price i {
    font-style: normal;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 248, 234, 0.62);
}
:root[data-theme="light"] .member-gate {
    border-color: rgba(168, 122, 50, 0.4);
    background:
        radial-gradient(circle at 50% 0%, rgba(168, 122, 50, 0.08), transparent 46%),
        linear-gradient(160deg, #fbf5e6, #f5eedb);
    box-shadow: 0 18px 44px rgba(120, 96, 52, 0.14);
}
:root[data-theme="light"] .member-gate-title { color: #7a5a1e; }
:root[data-theme="light"] .member-gate-text { color: #3a3f4a; }
:root[data-theme="light"] .member-gate-sub { color: rgba(26, 29, 36, 0.55); }
:root[data-theme="light"] .member-gate-benefits { color: #2a2d36; }
:root[data-theme="light"] .member-gate-benefits li::before { color: #7a5a1e; }
:root[data-theme="light"] .member-gate-price { color: #7a5a1e; border-color: rgba(168, 122, 50, 0.5); background: rgba(168, 122, 50, 0.10); }
:root[data-theme="light"] .member-gate-price i { color: rgba(26, 29, 36, 0.62); }
:root[data-theme="light"] .member-gate-btn { color: #fdf6e3; background: linear-gradient(160deg, #a83d24, #7d1f16); border-color: rgba(26, 29, 36, 0.12); box-shadow: 0 10px 24px rgba(168, 61, 36, 0.28); }
@media (max-width: 640px) {
    .member-gate { padding: 32px 18px 26px; margin: 16px 0; }
    .member-gate-title { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .member-gate-btn { transition: none; }
    .member-gate-btn:hover,
    .member-gate-btn:focus-visible { transform: none; }
}
