/* ============================================================
   吉他指板查询（Fretboard Finder）· 样式
   全部作用域限定在 #fbq 内 —— 可直接内联进任意页面而不污染宿主样式。
   颜色优先继承宿主页面的设计变量（--bg-elevated / --text / --blue …），
   独立打开时回退到内置取值，并跟随 html[data-theme="dark"]。

   2026-09-27 版式重做：工具条分「选择 / 视图」两层、指型卡加标题栏、
   把位图两列铺开、选音面板改成「小标题 + 标签流」，窄屏整套重排。
   ============================================================ */

#fbq {
    --fbq-panel: var(--bg-elevated, #ffffff);
    --fbq-border: var(--border-strong, rgba(0, 0, 0, 0.12));
    --fbq-text: var(--text, #1d1d1f);
    --fbq-label: var(--text-2, #6e6e73);
    --fbq-field-bg: var(--bg, #ffffff);
    --fbq-field-border: var(--border-strong, rgba(0, 0, 0, 0.16));
    --fbq-tint: rgba(0, 0, 0, .045);
    --fbq-accent: var(--blue, #0071e3);
    --fbq-accent-deep: var(--blue-deep, #0066cc);
    --fbq-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .05));
    --fbq-radius: 14px;
    --fbq-h: 36px;
    --fbq-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b8b92' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

    font-family: var(--font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif);
    color: var(--fbq-text);
    font-size: 15px;
    line-height: 1.5;
    color-scheme: light;
}

html[data-theme="dark"] #fbq {
    --fbq-panel: var(--bg-elevated, #161618);
    --fbq-border: var(--border-strong, rgba(255, 255, 255, 0.14));
    --fbq-text: var(--text, #f5f5f7);
    --fbq-label: var(--text-2, #9a9aa4);
    --fbq-field-bg: var(--bg, #111114);
    --fbq-field-border: var(--border-strong, rgba(255, 255, 255, 0.18));
    --fbq-tint: rgba(255, 255, 255, .07);
    --fbq-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4));
    --fbq-arrow: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a0a0aa' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
}

#fbq *,
#fbq *::before,
#fbq *::after { box-sizing: border-box; }

/* ⚠️ 必须显式声明：.fbq-field 的 display:flex 会盖掉 UA 的 [hidden]{display:none}，
   导致「指板范围」在曲库模式下也一直露在工具条上（老版本的隐藏失效根因） */
#fbq [hidden] { display: none !important; }

/* ============================================================
   工具条：上层「根音 / 类型 / 调弦 / 范围」，下层「视图开关 + 动作」
   ============================================================ */
#fbq .fbq-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--fbq-panel);
    border: 1px solid var(--fbq-border);
    border-radius: var(--fbq-radius);
    box-shadow: var(--fbq-shadow);
    position: sticky;
    top: calc(var(--header-h, 52px) + 10px);
    z-index: 6;
}

#fbq .fbq-bar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

#fbq .fbq-bar-bot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--fbq-border);
}

#fbq .fbq-field {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    min-width: 0;
}

#fbq .fbq-field > span {
    font-size: 12.5px;
    color: var(--fbq-label);
    white-space: nowrap;
    letter-spacing: .01em;
}

#fbq select {
    font-family: inherit;
    font-size: 13.5px;
    height: var(--fbq-h);
    padding: 0 30px 0 11px;
    color: var(--fbq-text);
    background-color: var(--fbq-field-bg);
    border: 1px solid var(--fbq-field-border);
    border-radius: 10px;
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--fbq-arrow);
    background-repeat: no-repeat;
    background-position: right 11px center;
    text-overflow: ellipsis;
    transition: border-color .16s var(--ease-out, ease), box-shadow .16s var(--ease-out, ease);
}

#fbq select.fbq-root { min-width: 84px; }
#fbq select.fbq-lib { min-width: 168px; max-width: 300px; }
#fbq select.fbq-tuning { min-width: 118px; }
#fbq select.fbq-range { min-width: 148px; }

#fbq select:hover { border-color: var(--fbq-accent); }
#fbq select:focus-visible {
    outline: 2px solid var(--fbq-accent);
    outline-offset: 1px;
}
#fbq select:disabled { opacity: .5; cursor: not-allowed; }
#fbq select:disabled:hover { border-color: var(--fbq-field-border); }

/* --- 视图开关：一格一格的胶囊（音名 / 可移动 / 同音全亮 / 清空） --- */
#fbq .fbq-seg {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: var(--fbq-tint);
    border-radius: 11px;
}

#fbq .fbq-toggle {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    height: 30px;
    padding: 0 12px;
    color: var(--fbq-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s var(--ease-out, ease), border-color .16s var(--ease-out, ease), color .16s var(--ease-out, ease);
}
#fbq .fbq-toggle:hover { background: var(--fbq-panel); border-color: var(--fbq-field-border); }
#fbq .fbq-toggle.active {
    color: #fff;
    background: var(--fbq-accent);
    border-color: var(--fbq-accent);
}
#fbq .fbq-toggle[hidden] { display: none !important; }
#fbq .fbq-toggle:disabled { opacity: .45; cursor: not-allowed; }
#fbq .fbq-toggle:disabled:hover { background: transparent; border-color: transparent; }

#fbq .fbq-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#fbq .fbq-copy {
    font-family: inherit;
    font-size: 12.5px;
    height: 32px;
    padding: 0 13px;
    color: var(--fbq-text);
    background: var(--fbq-field-bg);
    border: 1px solid var(--fbq-field-border);
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .16s var(--ease-out, ease), color .16s var(--ease-out, ease);
}
#fbq .fbq-copy:hover { border-color: var(--fbq-accent); color: var(--fbq-accent); }

#fbq .fbq-export {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    height: 32px;
    padding: 0 15px;
    color: #fff;
    background: var(--fbq-accent);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s var(--ease-out, ease), transform .16s var(--ease-out, ease);
}
#fbq .fbq-export:hover:not(:disabled) { background: var(--fbq-accent-deep); }
#fbq .fbq-export:active:not(:disabled) { transform: scale(.97); }
#fbq .fbq-export:disabled { opacity: .6; cursor: wait; }

/* ============================================================
   图纸区
   ============================================================ */
#fbq .fbq-sheet {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#fbq .fbq-box {
    background: var(--fbq-panel);
    border: 1px solid var(--fbq-border);
    border-radius: var(--fbq-radius);
    box-shadow: var(--fbq-shadow);
    padding: 14px;
}

/* 框标题：左侧一句小标题 + 右侧灰色补充说明 */
#fbq .fbq-box-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 0 2px 10px;
}
#fbq .fbq-box-title { font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
#fbq .fbq-box-sub { font-size: 12px; color: var(--fbq-label); }

/* 品位标注用 currentColor 绘制：屏幕上跟随明暗主题，导出 PNG 时按白底黑字渲染 */
#fbq .fbq-sheet svg {
    display: block;
    width: 100%;
    height: auto;
    color: var(--fbq-text);
}

/* 全指板总览：限制宽度、居中，别把 12 品拉成一条超长的黄带 */
#fbq .fbq-overview-box svg { max-width: 840px; margin: 0 auto; }

/* 把位图：宽屏两列铺开（竖排六张太长了），窄屏自动降到一列；
   每张的琴颈宽度统一封顶，指板格子不随容器宽窄变来变去 */
#fbq .fbq-shapes-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 18px 26px;
    padding: 14px;
}
#fbq .fbq-shapes-box svg { max-width: 620px; margin: 0 auto; }

#fbq .fbq-card { position: relative; padding: 0; min-width: 0; }

#fbq .fbq-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 2px 6px;
    min-height: 30px;
}
#fbq .fbq-card-title { font-size: 12.5px; font-weight: 700; color: var(--fbq-text); }
#fbq .fbq-card-sub { font-size: 11.5px; color: var(--fbq-label); }

/* 试听按钮：放进卡片标题栏，不再浮在指板上压住音符 */
#fbq .fbq-play {
    margin-left: auto;
    width: 30px;
    height: 30px;
    padding: 0 0 0 2px;              /* ▶ 字形视觉居中 */
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--fbq-field-border);
    background: var(--fbq-field-bg);
    color: var(--fbq-text);
    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    opacity: .78;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
#fbq .fbq-play:hover {
    opacity: 1;
    border-color: var(--fbq-accent);
    color: var(--fbq-accent);
}
#fbq .fbq-play.playing {
    opacity: 1;
    background: var(--fbq-accent);
    border-color: var(--fbq-accent);
    color: #fff;
}

/* 顺序播放时正在发声的音符圈 */
#fbq circle.fbq-hot { stroke: #ffbe2e; stroke-width: 4; }

/* 可点击切换的同音级虚线圈 */
#fbq circle[data-pick] { cursor: pointer; }
#fbq circle[data-pick]:hover { stroke-width: 3.2; }

/* ============================================================
   自定义音集（点指板选音）
   ============================================================ */
/* ----------------------------------------------
   自定义模式与库模式都按 DOM 顺序上下排：
   自定义 = 音块行 → 选音/指板卡 → 识别结果/命名卡；
   库模式 = 指板总览 →（Drop 说明）→ 按法/指型卡。
   ---------------------------------------------- */

/* ============================================================
   Drop 和弦说明：选中 Drop2 / Drop3 分类时出现的小说明版面
   ============================================================ */
#fbq .fbq-dropbox { padding: 12px 14px 11px; }
#fbq .fbq-dropbox .fbq-box-head { margin-bottom: 8px; }
#fbq .fbq-drop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 8px 26px;
}
#fbq .fbq-drop-col { font-size: 12.5px; line-height: 1.65; color: var(--fbq-text); }
#fbq .fbq-drop-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--fbq-accent);
    margin-right: 7px;
}
#fbq .fbq-drop-ex {
    margin: 5px 0 0;
    padding: 7px 11px;
    background: var(--fbq-tint);
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
    overflow-x: auto;
    font-variant-numeric: tabular-nums;
}
#fbq .fbq-drop-cd { margin: 6px 0 0; padding-left: 17px; font-size: 12px; color: var(--fbq-label); }
#fbq .fbq-drop-cd li { margin: 2px 0; }
#fbq .fbq-drop-memo {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--fbq-tint);
    font-size: 12px;
    color: var(--fbq-label);
    line-height: 1.65;
}
#fbq .fbq-drop-memo b { color: var(--fbq-text); font-weight: 700; }

/* 窄屏：例子行允许折行，不横向滚动 */
@media (max-width: 480px) {
    #fbq .fbq-drop-ex { white-space: normal; }
}

/* 自定义模式下工具条也收紧：少一个「复制链接」（面板里有），
   控件之间紧凑些，整块工具往「一屏」里让出纵向空间 */
#fbq .fbq-bar.is-custom { padding: 10px 12px; gap: 8px; margin-bottom: 12px; }
#fbq .fbq-bar.is-custom .fbq-bar-bot { padding-top: 8px; }
#fbq .fbq-bar.is-custom .fbq-toggle { height: 28px; }
#fbq .fbq-bar.is-custom select { height: 34px; }

#fbq .fbq-sheet.is-custom .fbq-pos { cursor: pointer; }
#fbq .fbq-sheet.is-custom .fbq-pos:hover { stroke: var(--fbq-accent); stroke-width: 2.4; }
/* 未选位置是透明热区（fill="none" + pointer-events:all），
   hover 才浮出一个浅圈示意「这里能点」—— 空态就該是一张干净指板，不摆一排灰点 */
#fbq .fbq-sheet.is-custom .fbq-hit:hover { fill: var(--fbq-accent); fill-opacity: .18; }
#fbq .fbq-sheet.is-custom .fbq-hit:focus-visible { outline: none; }

/* --- 已选音条：一行「已选」+ 音块 + 清空 --- */
#fbq .fbq-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 7px;
    padding: 6px 12px;
    background: var(--fbq-panel);
    border: 1px solid var(--fbq-border);
    border-radius: var(--fbq-radius);
    box-shadow: var(--fbq-shadow);
}
#fbq .fbq-chips-lab {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--fbq-label);
    margin-right: 2px;
}
#fbq .fbq-chips-hint { font-size: 12.5px; color: var(--fbq-label); line-height: 1.65; }
#fbq .fbq-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    background: var(--fbq-field-bg);
    border: 1px solid var(--fbq-field-border);
    color: var(--fbq-text);
    transition: border-color .16s var(--ease-out, ease), background .16s var(--ease-out, ease);
}
#fbq .fbq-chip:hover { border-color: var(--fbq-accent); }
#fbq .fbq-chip.on {
    background: #E8281E;
    border-color: #E8281E;
    color: #fff;
}
#fbq .fbq-chip.on:hover { border-color: #a31208; }
#fbq .fbq-chip-x {
    font-style: normal;
    font-size: 13px;
    line-height: 1;
    padding: 0 1px;
    color: var(--fbq-label);
}
#fbq .fbq-chip.on .fbq-chip-x { color: rgba(255, 255, 255, .8); }
#fbq .fbq-chip-x:hover { color: #e8281e; }
#fbq .fbq-chip.on .fbq-chip-x:hover { color: #fff; }
#fbq .fbq-clear {
    font-weight: 500;
    font-size: 12.5px;
    color: var(--fbq-label);
    border-style: dashed;
}
#fbq .fbq-clear:hover { color: var(--fbq-accent); border-color: var(--fbq-accent); border-style: solid; }

/* --- 选音指板那张图 --- */
#fbq .fbq-cust-box svg { max-width: 940px; margin: 0 auto; }
#fbq .fbq-cust-box .fbq-overview-cap {
    max-width: 940px;
    margin: 0 auto 6px;
    line-height: 1.6;
}
#fbq .fbq-overview-cap {
    font-size: 12.5px;
    color: var(--fbq-label);
    margin: 0 2px 6px;
    line-height: 1.6;
}
#fbq .fbq-overview-cap .fbq-cap-main { font-weight: 600; color: var(--fbq-text); }
/* 模式徽章本身是个按钮：点一下就在「精确点选 / 同音全亮」之间切
   （和工具条上的 ☍ 同音全亮 同一个开关，就近可点，不用回头找工具条） */
#fbq .fbq-cap-mode {
    font: inherit;
    display: inline-block;
    margin-left: 6px;
    padding: 1px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--fbq-accent);
    background: rgba(0, 113, 227, .1);
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}
#fbq .fbq-cap-mode:hover { background: rgba(0, 113, 227, .2); }
#fbq .fbq-cap-mode:active { transform: scale(.96); }
html[data-theme="dark"] #fbq .fbq-cap-mode {
    color: #6cb2ff;
    background: rgba(41, 151, 255, .18);
}
html[data-theme="dark"] #fbq .fbq-cap-mode:hover { background: rgba(41, 151, 255, .3); }
#fbq .fbq-overview-cap .fbq-cap-sub { display: block; margin-top: 1px; }

/* --- 识别结果面板 --- */
#fbq .fbq-match {
    padding: 11px 13px 9px;
    background: var(--fbq-panel);
    border: 1px solid var(--fbq-border);
    border-radius: var(--fbq-radius);
    box-shadow: var(--fbq-shadow);
}
#fbq .fbq-match-head {
    font-size: 13.5px;
    font-weight: 700;
    margin: 0 0 12px;
}
#fbq .fbq-mrow {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px 6px;
    margin: 0 0 8px;
}
#fbq .fbq-mrow:last-of-type { margin-bottom: 4px; }
/* 小标题同排内联（不再独占一行）：自然宽度 + 灰色小字，
   一行装得下标签 + 若干结果胶囊，四条结果行省下近 80px 纵向空间 */
#fbq .fbq-mlabel {
    flex: 0 0 auto;
    margin: 0 6px 0 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--fbq-label);
}
#fbq .fbq-tag {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--fbq-field-bg);
    border: 1px solid var(--fbq-field-border);
    color: var(--fbq-text);
}
#fbq .fbq-tag i { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--fbq-label); }
#fbq .fbq-tag-hot { background: rgba(232, 40, 30, .07); border-color: rgba(232, 40, 30, .42); color: #c11e15; }
#fbq .fbq-tag-hot i { color: #c11e15; }
html[data-theme="dark"] #fbq .fbq-tag-hot { background: rgba(232, 40, 30, .18); border-color: rgba(255, 138, 128, .42); color: #ff8a80; }
html[data-theme="dark"] #fbq .fbq-tag-hot i { color: #ffb3ad; }
#fbq .fbq-none { font-size: 12.5px; color: var(--fbq-label); }

/* --- 空态一行：最短引导 + 示例音集胶囊（原来那一整段教程文字已下线） --- */
#fbq .fbq-emptyrow { align-items: center; margin-bottom: 0; }
#fbq .fbq-empty-hint { font-size: 12.5px; color: var(--fbq-label); }
#fbq .fbq-exlab {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--fbq-label);
    margin-left: 6px;
}

/* --- 根音切换行（一点即换，不用去够音块） --- */
#fbq .fbq-rootrow { align-items: center; margin-bottom: 10px; }
#fbq .fbq-rootrow .fbq-mlabel { flex: 0 0 auto; margin: 0 2px 0 0; }
#fbq .fbq-rootbtn {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    min-width: 38px;
    height: 30px;
    padding: 0 11px;
    cursor: pointer;
    border-radius: 999px;
    background: var(--fbq-field-bg);
    color: var(--fbq-text);
    border: 1px solid var(--fbq-field-border);
    transition: border-color .16s var(--ease-out, ease), background .16s var(--ease-out, ease);
}
#fbq .fbq-rootbtn:hover { border-color: var(--fbq-accent); }
#fbq .fbq-rootbtn.on { background: #E8281E; border-color: #E8281E; color: #fff; }
#fbq .fbq-rootbtn.on:hover { border-color: #a31208; }
#fbq .fbq-roothint { font-size: 11.5px; color: var(--fbq-label); margin-left: 2px; }

/* --- 一键试试：常见音集小胶囊（同一行跟着引导文字走，不再单占一行标题） --- */
#fbq .fbq-ex {
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    height: 28px;
    padding: 0 12px;
    cursor: pointer;
    border-radius: 999px;
    background: var(--fbq-field-bg);
    color: var(--fbq-text);
    border: 1px dashed var(--fbq-field-border);
    transition: border-color .16s var(--ease-out, ease), color .16s var(--ease-out, ease);
}
#fbq .fbq-ex:hover { border-color: var(--fbq-accent); color: var(--fbq-accent); border-style: solid; }

/* --- 保存 / 分享 / 引用（纯图标按钮，说明走 title） --- */
#fbq .fbq-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--fbq-border);
}
#fbq .fbq-name {
    font: inherit;
    font-size: 13px;
    height: 32px;
    padding: 0 11px;
    flex: 1 1 120px;
    min-width: 0;
    max-width: none;
    border: 1px solid var(--fbq-field-border);
    border-radius: 9px;
    background: var(--fbq-field-bg);
    color: inherit;
}
#fbq .fbq-name:focus-visible { outline: 2px solid var(--fbq-accent); outline-offset: 1px; }
#fbq .fbq-btn {
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    height: 32px;
    padding: 0 13px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--fbq-field-border);
    border-radius: 9px;
    background: var(--fbq-field-bg);
    color: inherit;
    transition: border-color .16s var(--ease-out, ease), color .16s var(--ease-out, ease);
}
#fbq .fbq-btn:hover { border-color: var(--fbq-accent); color: var(--fbq-accent); }
/* 图标按钮：正方形 + 居中字形 */
#fbq .fbq-tools .fbq-btn {
    flex: 0 0 auto;
    width: 34px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
}
#fbq .fbq-save { background: var(--fbq-accent); border-color: var(--fbq-accent); color: #fff; }
#fbq .fbq-save:hover { color: #fff; filter: brightness(1.08); }
#fbq .fbq-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    font-size: 12px;
    color: var(--fbq-label);
}
#fbq .fbq-preset {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 3px 7px 3px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    background: var(--fbq-field-bg);
    border: 1px solid var(--fbq-field-border);
    color: var(--fbq-text);
}
#fbq .fbq-preset:hover { border-color: var(--fbq-accent); }
#fbq .fbq-preset-x { font-style: normal; font-size: 13px; line-height: 1; padding: 0 2px; color: var(--fbq-label); }
#fbq .fbq-preset-x:hover { color: #e8281e; }
/* 提示条：平时零高（不占版面），弹出时才撑开一行 */
#fbq .fbq-toast {
    height: 0;
    margin: 0;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 600;
    color: #12924a;
    opacity: 0;
    transition: opacity .18s ease;
}
#fbq .fbq-toast.on { height: auto; min-height: 18px; margin-top: 8px; opacity: 1; }
html[data-theme="dark"] #fbq .fbq-toast { color: #4ade80; }

/* ============================================================
   中屏（平板竖屏 / 窄窗口）：自定义模式退回单栏，指板在上、结果在下
   ============================================================ */


/* ============================================================
   窄屏：选择框两列、类型占满、工具条不再吸顶（省出纵向空间）
   ============================================================ */
@media (max-width: 720px) {
    #fbq { font-size: 14px; }
    #fbq .fbq-bar {
        position: static;
        padding: 11px 12px;
        gap: 9px;
        margin-bottom: 12px;
    }
    #fbq .fbq-bar-top {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        align-items: center;
    }
    #fbq .fbq-field { grid-column: span 1; gap: 6px; }
    /* 「音阶 / 和弦 / 琶音」是主控件：窄屏第一行独占 */
    #fbq .fbq-field-wide { grid-column: 1 / -1; order: -1; }
    #fbq .fbq-range-field { grid-column: 1 / -1; }
    /* 自定义选音（吉他练习室里内嵌的就是它）：「音阶/和弦/琶音」独占一行之后，
       「调弦」和「指板范围」正好凑成一对并排，不会留「半个空行」 */
    #fbq .fbq-bar.is-custom .fbq-range-field { grid-column: span 1; }
    /* 下拉一律占满所在网格单元（.fbq-lib 桌面有 max-width，这里必须一并放开，
       否则窄屏下「音阶 / 和弦 / 琶音」只占 300px、右边留一条空） */
    #fbq select,
    #fbq select.fbq-root,
    #fbq select.fbq-lib,
    #fbq select.fbq-tuning,
    #fbq select.fbq-range {
        width: 100%;
        min-width: 0;
        max-width: none;
        font-size: 16px;   /* iOS 上 <16px 聚焦会触发页面缩放 */
        height: 38px;
    }
    #fbq .fbq-bar-bot { padding-top: 9px; }
    #fbq .fbq-seg { flex: 1 1 100%; }
    #fbq .fbq-toggle { flex: 1 1 auto; padding: 0 9px; height: 32px; font-size: 12px; }
    #fbq .fbq-bar-actions { margin-left: 0; width: 100%; }
    #fbq .fbq-copy, #fbq .fbq-export { flex: 1 1 auto; height: 36px; font-size: 13px; }
    #fbq .fbq-box { padding: 11px 10px; }
    #fbq .fbq-shapes-box {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 10px 10px 12px;
    }
    #fbq .fbq-overview-box svg,
    #fbq .fbq-cust-box svg,
    #fbq .fbq-shapes-box svg { max-width: none; }
    #fbq .fbq-chips { padding: 8px 10px; }
    #fbq .fbq-match { padding: 12px 11px 10px; }
    #fbq .fbq-roothint { display: none; }
    #fbq .fbq-name { flex: 1 1 140px; }
    #fbq .fbq-tools .fbq-btn { width: 38px; height: 34px; }
    #fbq .fbq-exlab { margin-left: 0; }
}

@media (max-width: 400px) {
    #fbq .fbq-toggle { font-size: 11.5px; padding: 0 7px; }
    /* 太窄了（iPhone SE 一类）：并排会把下拉挤成 130px，改回各占一行 */
    #fbq .fbq-bar.is-custom .fbq-range-field { grid-column: 1 / -1; }
}

/* ============================================================
   文章嵌入（.fbq-embed）—— Hugo shortcode {{< fbq >}} 输出
   ============================================================ */
.fbq-embed {
    max-width: 620px;
    margin: 20px auto;
    font-family: var(--font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif);
    color: var(--text, #1d1d1f);
}

.fbq-embed .fbq-cap {
    font-size: 12.5px;
    color: var(--text-2, #6e6e73);
    text-align: center;
    margin-bottom: 2px;
}

.fbq-embed svg {
    display: block;
    width: 100%;
    height: auto;
    color: var(--text, #1d1d1f);      /* 品位标注 currentColor：跟随明暗主题 */
}

.fbq-embed .fbq-embed-set {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 10px;
}

/* 一个条目 = 一张图：多个把位（CAGED 五种指型）横向排成一排，共用一条图注 */
.fbq-embed.fbq-rowmode {
    max-width: none;                 /* 一排五张需要整栏宽度，不受 620px 限制 */
    width: 100%;
}

.fbq-embed .fbq-frames {
    display: flex;
    align-items: flex-start;
    justify-content: center;         /* 不足五张时整排居中，与上方居中的图注对齐 */
    gap: 8px;
    margin-top: 2px;
    overflow-x: auto;                /* 窄屏放不下时左右滚动，不挤压变形 */
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: thin;
}
.fbq-embed .fbq-frames::-webkit-scrollbar { height: 6px; }
.fbq-embed .fbq-frames::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, .38);
    border-radius: 999px;
}
.fbq-embed .fbq-frames::-webkit-scrollbar-track { background: transparent; }

/* 每张最多占整栏的 1/5 —— 全文所有指板图同一比例：5 张正好铺满一栏，
   4/3/2/1 张居中留白不放大；超过 5 张（如 Cmaj7 的 6 个按法）自动缩到能放下。
   flex-basis 为 0 才能让 flex-grow 把 ≤5 张的那一排撑到各自的最大宽度 */
.fbq-embed .fbq-frame {
    flex: 1 1 0;
    min-width: 0;
    max-width: calc((100% - 32px) / 5);
}

.fbq-embed .fbq-sub {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1;
    color: var(--text, #1d1d1f);
    text-align: center;
    margin: 0 0 5px;
    letter-spacing: .04em;
}

@media (max-width: 640px) {
    .fbq-embed .fbq-embed-set { grid-template-columns: 1fr; }
    /* 窄屏不缩到看不清：每张固定 104px，放不下就左右滚动 */
    .fbq-embed .fbq-frames { justify-content: flex-start; }
    .fbq-embed .fbq-frame { flex: 0 0 104px; min-width: 104px; max-width: none; }
}
