/* API 测试页右上角：语言菜单 + 主题切换。颜色全部取 index.html 里的主题变量，深浅色自动跟随。 */
.header-tools {
    margin-left: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    min-width: 36px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.header-tool:hover,
.header-tool[aria-expanded="true"] {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface);
}
.header-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.header-tool-icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* 主题按钮显示点击后的模式：浅色时是月亮，深色时是太阳 */
.theme-toggle { width: 36px; padding: 0; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle:hover .icon-moon { transform: rotate(-18deg); }
.theme-toggle:hover .icon-sun { transform: rotate(45deg); }
.theme-toggle .header-tool-icon { transition: transform 0.3s ease; }

.lang-control { position: relative; }
.lang-toggle-code { min-width: 1.4em; text-align: left; letter-spacing: 0.02em; }
.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    min-width: 148px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
}
.lang-menu[hidden] { display: none; }
.lang-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.lang-menu button:hover,
.lang-menu button:focus-visible { background: var(--surface); color: var(--text); outline: none; }
.lang-menu button[aria-checked="true"] { color: var(--accent-ink, var(--accent)); font-weight: 600; }
.lang-menu-check { width: 16px; height: 16px; visibility: hidden; }
.lang-menu button[aria-checked="true"] .lang-menu-check { visibility: visible; }

@media (max-width: 768px) {
    .header-tools { gap: 6px; }
    .header-tool { height: 34px; min-width: 34px; }
    .theme-toggle { width: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .theme-toggle .header-tool-icon { transition: none; }
}
