/* 主要样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

/* 主要内容 */
.main-content {
    margin-top: 80px;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 为直接访问的独立页面添加内容包装器样式 */
.page-content-wrapper {
    margin-top: 80px;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.welcome-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #000000;
}

.info-icon {
    min-width: 24px;
    width: 24px;
    height: 24px;
    flex-shrink: 0; /* 防止图标缩小 */
    background: #1976d2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* 自定义提示框 */
.custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 300px;
    width: auto;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.custom-tooltip.show {
    opacity: 1;
}

/* 删除所有箭头样式 */

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        margin-top: 90px;
    }
    
    .page-content-wrapper {
        padding: 1rem;
        margin-top: 90px;
    }
    
    .welcome-card {
        padding: 1.2rem;
    }
}

/* 特别针对中等宽度设备 */
@media (min-width: 501px) and (max-width: 650px) {
    .main-content {
        margin-top: 100px;
    }
    
    .page-content-wrapper {
        margin-top: 100px;
    }
}

/* 动画关键帧 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* 数字滚动效果 */
.number-animation {
    display: inline-block;
    color: #4285f4;
    font-weight: bold;
}

/* 右侧浮动工具栏 */
.right-toolbar {
    position: fixed;
    top: 50%;
    right: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* 缩小按钮之间的间距 */
    z-index: 1200;
    padding: 6px 6px; /* 缩小上下两头的边距 */
    background: rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border-radius: 40px; /* 增大外部圆角弧度，避免视觉上比内圆更窄 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(255,255,255,0.4);
    transform: translateY(calc(-50% + var(--rt-lag, 0px)));
    will-change: transform;
    /* 统一按钮与间距变量，供指示器计算使用 */
    --rt-btn: 44px;
    --rt-gap: 10px;
    --rt-pad: 6px;
}

.rt-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, filter 0.12s ease;
}

/* 两态切换的蓝色指示动画（在两个按钮之间移动/缩放） */
.rt-switch-indicator {
    position: absolute;
    left: 50%;
    top: var(--rt-pad);
    width: var(--rt-btn);
    height: var(--rt-btn);
    border-radius: 50%;
    background: linear-gradient(180deg, #09c2df 0%, #09b2e0 100%);
    box-shadow: 0 10px 26px rgba(9,178,224,0.45);
    z-index: 1; /* 位于按钮下层，避免遮挡图标 */
    opacity: 0; /* 仅切换时显示 */
    transform: translateX(-50%);
    transition: top 420ms cubic-bezier(.22,1,.36,1), opacity 160ms ease;
    pointer-events: none;
}

.right-toolbar.switching .rt-switch-indicator { opacity: 1; }
.right-toolbar .rt-item { position: relative; z-index: 0; }
.right-toolbar .rt-item .rt-icon,
.right-toolbar .rt-item svg { position: relative; z-index: 3; }

/* 主区域上移淡出，用于页面切换，不再被覆盖显示 */
body.rt-main-out .main-content,
body.rt-main-out .footer {
    transform: translateY(-40px);
    opacity: 0;
    transition: transform 300ms cubic-bezier(.22,1,.36,1), opacity 220ms ease;
}

.rt-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
    background-color: rgba(9, 178, 224, 0.12);
    color: #09b2e0;
}

.rt-item:active {
    transform: translateY(0);
    background-color: rgba(9, 178, 224, 0.2); /* 点击时颜色更深 */
    color: #0994c0;
}

.rt-item.active {
    background: linear-gradient(180deg, #09c2df 0%, #09b2e0 100%);
    color: white;
    box-shadow: 0 12px 28px rgba(9, 178, 224, 0.35);
}

/* 选中态图标提高可见度 */
.right-toolbar .rt-item.active .rt-icon {
    opacity: 1;
}

/* 防止动画过程中 hover/active 状态误触发颜色变化 */
.right-toolbar.switching #rtHomeBtn,
.right-toolbar.switching #rtSearchBtn {
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08) !important;
}

/* 选中按钮在悬停/按下时有更明显的深浅变化 */
.rt-item.active:hover {
    filter: brightness(1.06);
}
.rt-item.active:active {
    filter: brightness(0.92);
}

.rt-icon {
    width: 22px;
    height: 22px;
}

/* 让图标在两种主题下观感更柔和，并区分 <img> 与 <svg> 的处理 */
.right-toolbar .rt-item .rt-icon { opacity: 0.8; transition: opacity 160ms ease, filter 160ms ease; }
.right-toolbar .rt-item:hover .rt-icon { opacity: 0.92; }
.right-toolbar .rt-item:active .rt-icon { opacity: 1; }

/* 深色主题下，仅对位图图标(<img>)做反色增亮，避免影响 SVG */
html.theme-dark .right-toolbar .rt-item img.rt-icon {
    filter: invert(1) brightness(0.96) saturate(0.75);
}
html.theme-dark .right-toolbar .rt-item:hover img.rt-icon { filter: invert(1) brightness(1) saturate(0.9); }
html.theme-dark .right-toolbar .rt-item:active img.rt-icon { filter: invert(1) brightness(1.06) saturate(1); }

/* 确保 SVG 图标跟随按钮文字颜色渲染（避免被错误滤镜影响） */
.right-toolbar .rt-item svg { color: inherit; }
.right-toolbar .rt-item svg path, 
.right-toolbar .rt-item svg circle, 
.right-toolbar .rt-item svg line, 
.right-toolbar .rt-item svg polyline { stroke: currentColor; }

/* 右侧设置面板（抽屉/卡片） */
.rt-settings-sheet {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    width: 420px;
    max-width: 90vw;
    background: #ffffff;
    color: #111827;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 22px 60px rgba(0,0,0,0.22);
    z-index: 2060;
    padding: 16px;
    display: none;
    will-change: transform, opacity;
    opacity: 0;
}

.rt-settings-sheet.open { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); animation: rt-modal-in-bounce 220ms cubic-bezier(.22,1,.36,1) forwards; pointer-events: auto; }
.rt-settings-sheet.closing { animation: rt-modal-out-bounce 180ms ease forwards; }
.rt-settings-sheet h3 { font-size: 16px; margin-bottom: 10px; }
.rt-settings-sheet .rt-field { margin: 10px 0 12px; }
.rt-settings-sheet .rt-field label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 6px; }
.rt-settings-sheet .rt-row { position: relative; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px; border-radius: 9999px; }
.rt-settings-sheet .rt-row .rt-pill-indicator { position: absolute; left: 0; top: 0; width: 0; height: 0; border-radius: 9999px; background: linear-gradient(180deg, #09c2df 0%, #09b2e0 100%); box-shadow: 0 12px 28px rgba(9,178,224,0.35); z-index: 0; transition: left 420ms cubic-bezier(.22,1,.36,1), top 420ms cubic-bezier(.22,1,.36,1), width 420ms cubic-bezier(.22,1,.36,1), height 420ms cubic-bezier(.22,1,.36,1); }
.rt-settings-sheet .rt-pill { position: relative; padding: 8px 12px; border-radius: 9999px; font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 28px; border: 1px solid #e5e7eb; cursor: pointer; background: #fff; color: #374151; transition: transform .18s ease, box-shadow .2s ease, color .2s ease, border-color .2s ease, background .2s ease; overflow: hidden; z-index: 1; }
.rt-settings-sheet .rt-pill:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.rt-settings-sheet .rt-pill:active { transform: translateY(0); }
.rt-settings-sheet .rt-pill::before { content: ''; position: absolute; top: 0; bottom: 0; left: -120%; width: 120%; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(16,198,235,.25) 50%, rgba(255,255,255,0) 100%); transform: translateX(0); pointer-events: none; }
.rt-settings-sheet .rt-pill:hover::before { animation: rt-pill-sweep 900ms ease; }
.rt-settings-sheet .rt-pill.active { color: #fff; border-color: transparent; background: transparent; box-shadow: none; }
.rt-settings-sheet .rt-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #374151; cursor: pointer; }
.rt-settings-sheet .rt-switch input { width: 34px; height: 18px; }

/* 顶部栏与关闭按钮 */
.rt-settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rt-settings-title { font-size: 16px; font-weight: 600; }
.rt-settings-close { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(0,0,0,0.06); background: transparent; color: #6b7280; cursor: pointer; }
.rt-settings-close:hover { background: rgba(0,0,0,0.04); }

html.theme-dark .rt-settings-sheet { background: rgba(24,26,31,0.96); color: #e8e8e8; border-color: rgba(255,255,255,0.08); box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
html.theme-dark .rt-settings-sheet .rt-field label { color: #aab4bf; }
html.theme-dark .rt-settings-sheet .rt-pill { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); color: #cbd5e1; }
html.theme-dark .rt-settings-sheet .rt-pill:hover { box-shadow: 0 10px 26px rgba(0,0,0,0.4); }
html.theme-dark .rt-settings-sheet .rt-pill.active { color: #0b1220; border-color: transparent; background: transparent; box-shadow: none; }

/* 设置面板遮罩 */
.rt-settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease, visibility 160ms ease;
}
.rt-settings-backdrop.open { opacity: 1; visibility: visible; }
.rt-settings-backdrop.closing { opacity: 0; visibility: hidden; }

@keyframes rt-modal-in-bounce { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.96); } 60% { opacity: 1; transform: translate(-50%, -50%) scale(1.02); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes rt-modal-out-bounce { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.02); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.96); } }

/* 按钮彩色移动动画 */
@keyframes rt-pill-gradient { 0% { background-position: 0 0; } 100% { background-position: 200% 0; } }
@keyframes rt-pill-sweep { 0% { left: -120%; } 100% { left: 120%; } }

/* 移除旧的右侧悬浮搜索面板相关样式（已废弃） */
/* 搜索页面相关样式已移至 assets/css/search.css */

/* 黑白模式（整个页面灰度） */
/* grayscale 模式已删除 */

/* 主题模式：暗色与浅色 */
:root {
    color-scheme: light dark;
}

/* 跟随系统默认由浏览器处理；当强制主题时设置根变量 */
html.theme-light {
    color-scheme: light;
}
html.theme-dark {
    color-scheme: dark;
}

.rt-divider {
    width: 22px;
    height: 4px;
    border-radius: 10px;
    background: rgba(0,0,0,0.08);
}

/* 右侧工具栏悬浮标签（显示在工具栏左侧，白色卡片） */
.rt-label {
    position: fixed;
    left: 0; /* 将由脚本计算具体位置 */
    top: 0;  /* 将由脚本计算具体位置 */
    transform: translateX(8px) translateY(var(--rt-label-lag, 0px));
    opacity: 0;
    pointer-events: none;
    background: #fff;
    color: #111827;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.06);
    transition: opacity 0.16s ease, transform 0.24s cubic-bezier(.22,1,.36,1);
    will-change: transform;
    z-index: 1300;
    white-space: nowrap;
}

.rt-label.show {
    opacity: 1;
    transform: translateX(0) translateY(var(--rt-label-lag, 0px));
}

/* 暗色主题下的右侧悬停卡片 */
html.theme-dark .rt-label {
    background: rgba(30,33,39,0.94);
    color: #e8e8e8;
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 10px 28px rgba(0,0,0,0.6);
}

/* 简化主题过渡：复杂覆盖与骨架动画已移除，改由JS控制轻量渐隐渐显 */

/* 基础暗色主题覆盖（最小可用） */
html.theme-dark body {
    background: #0f1115;
    color: #e8e8e8;
}
html.theme-dark .welcome-info { color: #e8e8e8; }
html.theme-dark .welcome-card {
    background: rgba(22, 24, 28, 0.85);
    border-color: rgba(255,255,255,0.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
html.theme-dark .chart-title,
html.theme-dark .api-list h2 { color: #e8e8e8; }
html.theme-dark .right-toolbar {
    background: rgba(24, 26, 31, 0.55);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.06);
}
html.theme-dark .rt-item { background: rgba(255,255,255,0.06); color: #e6f6ff; }
html.theme-dark .rt-item:hover { background-color: rgba(9, 178, 224, 0.18); color: #66d8f2; }
html.theme-dark .rt-item:active { background-color: rgba(9, 178, 224, 0.28); color: #9ae8ff; }

/* 暗色主题下，选中态更醒目 */
html.theme-dark .rt-item.active {
    background: linear-gradient(180deg, #11c8ee 0%, #0daee0 100%);
    color: #ffffff;
    box-shadow: 0 14px 36px rgba(9,178,224,0.55), inset 0 0 0 2px rgba(9,178,224,0.35);
    border: 1px solid rgba(255,255,255,0.06);
}
html.theme-dark .right-toolbar .rt-item.active img.rt-icon {
    filter: invert(1) brightness(1.15) saturate(1.1);
}

/* 小屏幕上靠内侧一点，避免与系统手势冲突 */
@media (max-width: 768px) {
    .right-toolbar { display: none; border-radius: 44px; }
}