/**
 * /tools/excalidraw · Excalidraw 在线白板
 *
 * 设计要点：
 *   1) 深色为默认基线，[data-theme="light"] 覆盖浅色（同 /tools/mermaid 惯例）；
 *   2) 画布高度不再用「100vh - 固定像素」硬算，而是 clamp(下限, 视口 - chrome, 上限)，
 *      小屏不溢出、超长屏不空旷；移动端用 dvh 跟随地址栏收放；
 *   3) 三档断点：桌面（>1100）、平板（761~1100）、手机（≤760），另加小屏（≤420）、
 *      横屏矮视口、触屏（pointer: coarse）三组细节；
 *   4) 色值全部走变量：画布底色与 Excalidraw 自带底色对齐，避免画布四周出现色差缝。
 */
:root {
    --exc-bg: #0f1419;
    --exc-card: #161c23;
    --exc-card-2: #1d242c;
    --exc-canvas: #121212;          /* 与 Excalidraw 深色画布默认底色一致 */
    --exc-line: #2b343f;
    --exc-line-2: #3a4652;
    --exc-fg: #e9eef4;
    --exc-fg-2: #c6cfd9;
    --exc-sub: #9aa7b6;
    --exc-faint: #8792a0;
    --exc-accent: #6965db;
    --exc-accent-2: #9a8dff;
    --exc-accent-soft: rgba(154, 141, 255, .14);
    --exc-ok: #4ec9a0;
    --exc-warn: #e3a008;
    --exc-err: #f07a7a;
    --exc-shadow: 0 10px 32px rgba(0, 0, 0, .34);
    --exc-shadow-sm: 0 2px 10px rgba(0, 0, 0, .2);
    --exc-r: 14px;
    --exc-r-sm: 9px;
    --exc-accent-fill: #5c57d6;
    --exc-on-accent: #ffffff;
    /* 页面 chrome 高度（标题卡 + 工具条 + 上下留白）实测约 248px，集中在这里便于微调 */
    --exc-chrome: 248px;
    --exc-stage-min: 380px;
}
[data-theme="light"] {
    --exc-bg: #f5f7f9;
    --exc-card: #ffffff;
    --exc-card-2: #f2f5f8;
    --exc-canvas: #ffffff;
    --exc-line: #e2e8ee;
    --exc-line-2: #cdd7e1;
    --exc-fg: #1b2632;
    --exc-fg-2: #344454;
    --exc-sub: #566575;
    --exc-faint: #61707f;
    --exc-accent: #5c57d6;
    --exc-accent-2: #6248d8;
    --exc-accent-soft: rgba(98, 72, 216, .09);
    --exc-ok: #16845f;
    --exc-warn: #9a6700;
    --exc-err: #c23b3b;
    --exc-shadow: 0 10px 30px rgba(20, 35, 55, .12);
    --exc-shadow-sm: 0 2px 8px rgba(20, 35, 55, .08);
    --exc-accent-fill: #5c57d6;
}

body.page-excalidraw-full { overflow: visible; }
body.page-excalidraw-full .app,
body.page-excalidraw-full .main-content,
body.page-excalidraw-full .page-container { max-width: 100%; width: 100%; }
body.page-excalidraw-full .main-content { border-right: 0; min-width: 0; }
body.page-excalidraw-full.exc-fullscreen-on,
body.page-excalidraw-full.exc-immersive-on { overflow: hidden !important; }

.exc {
    width: 100%; max-width: 100%; box-sizing: border-box;
    padding: 18px 22px 44px; margin: 0;
    color: var(--exc-fg); font-size: 14px; line-height: 1.6;
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.exc *, .exc *::before, .exc *::after { box-sizing: border-box; }
.exc [hidden] { display: none !important; }
.exc button, .exc input, .exc select, .exc textarea { font-family: inherit; }
.exc button { cursor: pointer; }
.exc button:disabled { opacity: .5; cursor: not-allowed; }
.exc :focus-visible { outline: 2px solid var(--exc-accent-2); outline-offset: 2px; }

/* ============ Hero ============ */
.exc-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    background: var(--exc-card); border: 1px solid var(--exc-line);
    border-left: 4px solid var(--exc-accent-2);
    border-radius: var(--exc-r); padding: 15px 18px; margin-bottom: 12px;
    box-shadow: var(--exc-shadow-sm);
}
.exc-hero-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.exc-hero-ic {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 13px;
    display: grid; place-items: center; font-size: 23px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #6965db, #38bdf8);
    box-shadow: 0 6px 18px rgba(105, 101, 219, .32);
}
.exc-hero h1 { font-size: 20.5px; line-height: 1.28; margin: 0 0 4px; font-weight: 700; letter-spacing: .2px; }
.exc-hero p { margin: 0; color: var(--exc-sub); font-size: 13px; line-height: 1.7; max-width: 74ch; }
.exc-hero-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.exc-tag {
    font-size: 12px; line-height: 1.5; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
    background: var(--exc-accent-soft); color: var(--exc-accent-2); border: 1px solid var(--exc-line);
}
.exc-hero-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ 按钮与工具条 ============ */
.exc-btn, .exc-mini, .exc-hero-acts button {
    appearance: none; border: 1px solid var(--exc-line-2); background: var(--exc-card-2);
    color: var(--exc-fg-2); border-radius: var(--exc-r-sm);
    padding: 7px 12px; min-height: 34px; font-size: 13px; line-height: 1.35; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .12s;
    -webkit-tap-highlight-color: transparent;   /* 触屏点击不出现蓝色高亮块 */
}
.exc-btn:hover, .exc-mini:hover, .exc-hero-acts button:hover {
    background: var(--exc-accent-soft); border-color: var(--exc-accent-2); color: var(--exc-accent-2);
}
.exc-btn:active, .exc-mini:active { transform: translateY(1px); }
.exc-btn.is-primary {
    background: var(--exc-accent-fill); border-color: var(--exc-accent-fill);
    color: var(--exc-on-accent); font-weight: 600;
}
.exc-btn.is-primary:hover { filter: brightness(1.12); color: #fff; }
.exc-btn.is-on { background: var(--exc-accent-soft); border-color: var(--exc-accent-2); color: var(--exc-accent-2); }
.exc-mini { padding: 4px 9px; min-height: 26px; font-size: 12px; }
.exc-sep { flex: 0 0 auto; width: 1px; height: 20px; background: var(--exc-line-2); margin: 0 2px; }
.exc-grow { flex: 1 1 auto; min-width: 4px; }

.exc-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--exc-card); border: 1px solid var(--exc-line);
    border-radius: var(--exc-r); padding: 8px 10px; margin-bottom: 12px;
    box-shadow: var(--exc-shadow-sm);
}
/* 操作区单独成组：手机上整组横向滚动，不会把状态区挤到看不见的第二、第三行 */
.exc-bar-acts { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.exc-bar-acts .exc-btn { flex: 0 0 auto; }
.exc-bar-meta { display: flex; align-items: center; gap: 10px; color: var(--exc-sub); font-size: 12.5px; flex-wrap: wrap; }
.exc-badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    background: var(--exc-card-2); border: 1px solid var(--exc-line); color: var(--exc-sub); font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.exc-badge.is-ok { color: var(--exc-ok); border-color: var(--exc-ok); background: rgba(78, 201, 160, .08); }
.exc-badge.is-err { color: var(--exc-err); border-color: var(--exc-err); background: rgba(240, 122, 122, .1); }
.exc-stat { color: var(--exc-faint); font-variant-numeric: tabular-nums; }

/* ============ 画布区 ============ */
.exc-stage-wrap { position: relative; }
.exc-stage {
    position: relative;
    /* 先给不支持 clamp 的环境一个兜底，再用 clamp 兜住小屏 / 超长屏 */
    height: calc(100vh - 248px);
    height: clamp(380px, calc(100vh - var(--exc-chrome)), 1200px);
    min-height: 380px;
    background: var(--exc-canvas); border: 1px solid var(--exc-line);
    border-radius: var(--exc-r); overflow: hidden;
    box-shadow: var(--exc-shadow-sm);
    /* 画布内滚轮 / 触控缩放不再把页面一起滚走 */
    overscroll-behavior: contain;
}
.exc-stage .excalidraw {
    --ui-font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.exc-stage .excalidraw, .exc-stage .excalidraw * { scrollbar-width: thin; }
/* 隔离站点全局样式对画布的渗漏 */
.exc-stage .excalidraw button { letter-spacing: normal; text-transform: none; }
.exc-stage .excalidraw img { max-width: none; }
.exc-stage .excalidraw a { text-decoration: none; }

.exc-loading {
    position: absolute; inset: 0; display: grid; place-items: center; gap: 10px;
    color: var(--exc-sub); font-size: 14px; z-index: 3; pointer-events: none;
    background: var(--exc-card); padding: 0 18px; text-align: center;
}
.exc-loading > div { text-align: center; }
.exc-loading .exc-spin {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid var(--exc-line-2); border-top-color: var(--exc-accent-2);
    animation: exc-spin .8s linear infinite; margin: 0 auto 10px;
}
/* 遮罩本身不吃事件，但「重新加载」按钮要能点（否则失败后无法重试） */
.exc-loading .exc-btn { margin-top: 12px; pointer-events: auto; }
@keyframes exc-spin { to { transform: rotate(360deg); } }

/* 引擎不可用（脚本被拦截 / 网络失败）时的兜底提示 */
.exc-noscript {
    position: absolute; inset: 0; z-index: 4;   /* 压住加载遮罩：没 JS 时不该一直转圈 */
    display: grid; place-items: center; padding: 24px; text-align: center;
    color: var(--exc-sub); font-size: 14px; background: var(--exc-card);
}

/* 拖放遮罩 */
.exc-drop {
    position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
    background: rgba(105, 101, 219, .16); border: 2px dashed var(--exc-accent-2);
    border-radius: var(--exc-r); color: var(--exc-accent-2); font-size: 16px; font-weight: 600;
    pointer-events: none; text-align: center; padding: 0 18px;
}

/* 画布底部信息 */
.exc-canvas-foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    color: var(--exc-faint); font-size: 12.5px;
    padding: 7px 4px 0;
}
.exc-canvas-foot .exc-grow { min-width: 0; }

/* ============ 说明与关于 ============ */
.exc-help, .exc-about {
    background: var(--exc-card); border: 1px solid var(--exc-line);
    border-radius: var(--exc-r); margin-top: 12px; padding: 0 18px;
    box-shadow: var(--exc-shadow-sm);
}
.exc-help summary, .exc-about summary {
    cursor: pointer; font-weight: 600; font-size: 14px; padding: 13px 0; list-style: none;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.exc-help summary::-webkit-details-marker, .exc-about summary::-webkit-details-marker { display: none; }
.exc-caret { transition: transform .15s; color: var(--exc-faint); }
.exc-help[open] .exc-caret, .exc-about[open] .exc-caret { transform: rotate(180deg); }
.exc-help-body, .exc-about-body { padding: 2px 0 16px; color: var(--exc-sub); font-size: 13px; }
.exc-help-body h3 { color: var(--exc-fg); font-size: 13.5px; margin: 14px 0 6px; }
.exc-help-body h3:first-child { margin-top: 0; }
.exc-help-body ul, .exc-about-body ul { margin: 6px 0; padding-left: 20px; }
.exc-help-body li, .exc-about-body li { margin: 5px 0; }
.exc-help-body code, .exc-about-body code {
    background: var(--exc-card-2); border: 1px solid var(--exc-line);
    border-radius: 5px; padding: 1px 6px; font-size: 12px; color: var(--exc-fg-2);
}
.exc-about-body a { color: var(--exc-accent-2); }
.exc-kbd {
    display: inline-block; min-width: 20px; text-align: center;
    background: var(--exc-card-2); border: 1px solid var(--exc-line-2); border-bottom-width: 2px;
    border-radius: 5px; padding: 0 5px; font-size: 11.5px; color: var(--exc-fg-2);
}

/* ============ 全屏画板 ============ */
/* 全屏时让画布吃掉除工具条以外的全部高度（flex 而不是硬编码 calc，避免不同字号下露出滚动条） */
body.exc-fullscreen-on { overflow: hidden !important; }
body.exc-fullscreen-on .exc {
    display: flex; flex-direction: column;
    height: 100vh; padding: 8px 10px;
}
/* 全屏时收起标题与说明，只留右上角的「退出全屏 / 深浅色」按钮（Esc 同样可退出） */
body.exc-fullscreen-on .exc-hero {
    background: transparent; border: 0; box-shadow: none;
    padding: 0 0 8px; margin-bottom: 8px;
}
body.exc-fullscreen-on .exc-hero-l { display: none; }
body.exc-fullscreen-on .exc-hero-acts { margin-left: auto; }
body.exc-fullscreen-on .exc-help,
body.exc-fullscreen-on .exc-about,
body.exc-fullscreen-on .exc-canvas-foot { display: none; }
body.exc-fullscreen-on .exc-stage-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.exc-fullscreen-on .exc-stage { flex: 1 1 auto; height: auto; min-height: 0; }

/* 沉浸画布：iOS Safari / 部分内嵌浏览器不支持元素级全屏（只有 video 可以），
   用 fixed 铺满视口 + 锁滚动，保证手机上同样能「满屏画图」 */
body.exc-immersive-on { overscroll-behavior: none; }   /* iOS 底部回弹一并关掉 */
body.exc-immersive-on .exc {
    position: fixed; inset: 0; z-index: 1002;
    display: flex; flex-direction: column;
    height: auto; padding: 6px; background: var(--exc-bg);
}
body.exc-immersive-on .exc-hero {
    background: transparent; border: 0; box-shadow: none;
    padding: 0 0 6px; margin-bottom: 6px; gap: 8px;
}
body.exc-immersive-on .exc-hero-l { display: none; }
body.exc-immersive-on .exc-hero-acts { margin-left: auto; }
body.exc-immersive-on .exc-help,
body.exc-immersive-on .exc-about,
body.exc-immersive-on .exc-canvas-foot { display: none; }
body.exc-immersive-on .exc-bar { margin-bottom: 6px; }
body.exc-immersive-on .exc-stage-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.exc-immersive-on .exc-stage { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 10px; }

/* 移动端地址栏收起 / 展开会改变 100vh，dvh 才跟得上真实可视高度 */
@supports (height: 100dvh) {
    .exc-stage {
        height: calc(100dvh - 248px);
        height: clamp(380px, calc(100dvh - var(--exc-chrome)), 1200px);
    }
    body.exc-fullscreen-on .exc { height: 100dvh; }
    body.exc-immersive-on .exc { height: 100dvh; }
}

/* ============ 历史记录弹层 ============ */
body.exc-modal-on { overflow: hidden !important; }
.exc-modal { position: fixed; inset: 0; z-index: 1003; display: grid; place-items: center; padding: 18px; }
.exc-modal-mask { position: absolute; inset: 0; background: rgba(8, 12, 18, .55); }
.exc-modal-card {
    position: relative; width: min(660px, 100%);
    max-height: min(80vh, 760px);
    display: flex; flex-direction: column;
    background: var(--exc-card); border: 1px solid var(--exc-line-2);
    border-radius: var(--exc-r); box-shadow: var(--exc-shadow); overflow: hidden;
}
.exc-modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-bottom: 1px solid var(--exc-line);
}
.exc-modal-head b { font-size: 15px; }
.exc-modal-count { color: var(--exc-faint); font-size: 12.5px; flex: 1 1 auto; min-width: 0; }
.exc-modal-close { min-height: 30px; padding: 4px 10px; }
.exc-modal-tip {
    padding: 9px 16px; color: var(--exc-faint); font-size: 12.5px; line-height: 1.6;
    background: var(--exc-card-2); border-bottom: 1px solid var(--exc-line);
}
.exc-modal-list { overflow-y: auto; padding: 6px 10px; flex: 1 1 auto; min-height: 0; }
.exc-hist-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 8px; border-radius: 10px;
}
.exc-hist-item + .exc-hist-item { border-top: 1px solid var(--exc-line); }
.exc-hist-when {
    flex: 0 0 auto; color: var(--exc-fg-2); font-size: 13px;
    font-variant-numeric: tabular-nums; min-width: 86px;
}
.exc-hist-meta {
    flex: 1 1 auto; min-width: 0; color: var(--exc-faint); font-size: 12.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exc-hist-item .exc-btn { min-height: 30px; padding: 4px 11px; font-size: 12.5px; flex: 0 0 auto; }
.exc-hist-del:hover { color: var(--exc-err); border-color: var(--exc-err); background: rgba(240, 122, 122, .1); }
.exc-hist-empty { padding: 28px 14px; text-align: center; color: var(--exc-faint); font-size: 13px; line-height: 1.7; }
.exc-modal-foot {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 14px; border-top: 1px solid var(--exc-line);
}

/* 手机端：底部抽屉，方便拇指操作 */
@media (max-width: 760px) {
    .exc-modal { padding: 0; place-items: end stretch; }
    .exc-modal-card {
        width: 100%; max-height: 86vh; max-height: 86dvh;
        border-radius: 16px 16px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    }
    .exc-hist-when { min-width: 76px; font-size: 12.5px; }
    .exc-modal-tip { font-size: 12px; padding: 8px 14px; }
}

/* ============ Toast ============ */
.exc-toast {
    position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
    background: var(--exc-card); color: var(--exc-fg); border: 1px solid var(--exc-line-2);
    border-radius: 10px; padding: 9px 18px; font-size: 13.5px; z-index: 9999;
    box-shadow: var(--exc-shadow); max-width: min(80vw, 480px); text-align: center;
    pointer-events: none;   /* 提示浮层不挡画布点击 */
}
.exc-toast.is-ok { border-color: var(--exc-ok); }
.exc-toast.is-err { border-color: var(--exc-err); }

/* ============ 平板（761 ~ 1100） ============ */
@media (max-width: 1100px) {
    :root { --exc-chrome: 262px; }
    .exc { padding: 14px 16px 38px; }
    .exc-hero { padding: 13px 15px; gap: 14px; }
    .exc-hero-ic { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; }
    .exc-hero h1 { font-size: 19px; }
    .exc-hero p { font-size: 12.8px; }
    .exc-hero-tags { gap: 5px; margin-top: 7px; }
    .exc-tag { font-size: 11.5px; padding: 2px 9px; }
    .exc-bar { gap: 8px; }
    .exc-btn { font-size: 12.8px; padding: 7px 11px; }
    .exc-stage { min-height: 440px; }
}

/* ============ 手机（≤760） ============ */
@media (max-width: 760px) {
    /* 手机上还要额外让出站点粘性顶栏（53px），所以 chrome 比桌面更大 */
    :root { --exc-chrome: 344px; }
    .exc {
        padding: 10px 10px calc(24px + env(safe-area-inset-bottom));
        font-size: 13.5px;
    }
    /* 标题卡：图标缩小、简介限高、标签单行横向滚动，把高度让给画布 */
    .exc-hero {
        padding: 11px 12px; gap: 8px; margin-bottom: 10px;
        border-left-width: 3px; border-radius: 12px;
    }
    .exc-hero-l { gap: 10px; align-items: flex-start; }
    .exc-hero-ic { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; margin-top: 2px; }
    .exc-hero h1 { font-size: 16.5px; margin-bottom: 3px; }
    .exc-hero p {
        font-size: 12.2px; line-height: 1.6;
        display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    }
    .exc-hero-tags {
        flex-wrap: nowrap; overflow-x: auto; margin-top: 7px; padding-bottom: 2px;
        scrollbar-width: none; -ms-overflow-style: none;
    }
    .exc-hero-tags::-webkit-scrollbar { display: none; }
    .exc-tag { flex: 0 0 auto; font-size: 11.5px; }
    .exc-hero-acts { width: 100%; justify-content: flex-end; gap: 6px; }
    .exc-hero-acts button { min-height: 34px; padding: 6px 11px; font-size: 12.5px; }

    /* 工具条：操作按钮单行横滑，状态另起一行，避免纵向堆成三行 */
    .exc-bar { gap: 6px; padding: 7px 8px; border-radius: 12px; margin-bottom: 10px; }
    .exc-bar-acts {
        flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px;
        scrollbar-width: none; -ms-overflow-style: none;
        /* 右端淡出，暗示可以横滑 */
        -webkit-mask-image: linear-gradient(90deg, #000 95%, transparent);
        mask-image: linear-gradient(90deg, #000 95%, transparent);
    }
    .exc-bar-acts::-webkit-scrollbar { display: none; }
    .exc-sep { display: none; }
    .exc-btn { min-height: 36px; padding: 7px 11px; font-size: 12.8px; }
    .exc-btn-long { display: none; }          /* 「保存 .excalidraw」在手机上收敛成「保存」 */
    .exc-bar-meta {
        width: 100%; justify-content: space-between; gap: 8px;
        font-size: 11.5px; padding-top: 6px; border-top: 1px solid var(--exc-line);
    }
    .exc-badge { font-size: 11.5px; padding: 2px 8px; }

    .exc-stage { height: calc(100vh - 344px); min-height: 320px; border-radius: 12px; }
    .exc-canvas-foot { font-size: 11.5px; padding-top: 6px; gap: 8px; }
    .exc-foot-hint { display: none; }        /* 手机不显示长快捷键提示，留给自动保存状态 */

    .exc-help, .exc-about { margin-top: 10px; padding: 0 13px; border-radius: 12px; }
    .exc-help summary, .exc-about summary { font-size: 13.5px; padding: 12px 0; }
    .exc-help-body, .exc-about-body { font-size: 12.6px; padding-bottom: 13px; }
    .exc-help-body ul, .exc-about-body ul { padding-left: 17px; }

    .exc-drop { font-size: 13.5px; padding: 0 16px; }
    .exc-loading { font-size: 13px; }
    .exc-toast {
        bottom: calc(18px + env(safe-area-inset-bottom));
        max-width: 92vw; font-size: 13px; padding: 8px 14px;
    }
}

/* 手机端 dvh：地址栏收放时画布高度跟随 */
@supports (height: 100dvh) {
    @media (max-width: 760px) {
        .exc-stage {
            height: calc(100dvh - 344px);
            height: clamp(320px, calc(100dvh - var(--exc-chrome)), 1000px);
        }
    }
}

/* ============ 小屏手机（≤420） ============ */
@media (max-width: 420px) {
    .exc-hero-ic { display: none; }
    .exc-hero p { -webkit-line-clamp: 2; }
    .exc-hero h1 { font-size: 16px; }
    .exc-btn { padding: 7px 10px; }
    .exc-help-body, .exc-about-body { font-size: 12.4px; }
}

/* ============ 横屏矮视口（手机横放 / 分屏） ============ */
@media (max-height: 520px) and (orientation: landscape) {
    .exc-hero { padding: 7px 10px; margin-bottom: 8px; }
    .exc-hero p, .exc-hero-tags { display: none; }   /* 高度紧张时只留标题 */
    .exc-hero-ic { width: 32px; height: 32px; font-size: 15px; }
    .exc-hero h1 { font-size: 15.5px; margin: 0; }
    .exc-bar { margin-bottom: 8px; }
    .exc-stage {
        height: calc(100vh - 150px);
        height: clamp(240px, calc(100vh - 150px), 720px);
        min-height: 240px;
    }
}

/* ============ 触屏设备：加大点击热区 ============ */
@media (pointer: coarse) {
    .exc-btn, .exc-hero-acts button { min-height: 40px; padding: 8px 13px; }
    .exc-mini { min-height: 32px; }
    .exc-help summary, .exc-about summary { padding: 15px 0; }
    .exc-btn:hover, .exc-hero-acts button:hover { background: var(--exc-card-2); color: var(--exc-fg-2); border-color: var(--exc-line-2); }
}

/* 尊重系统「减少动态效果」偏好：只留最低限度的转圈提示 */
@media (prefers-reduced-motion: reduce) {
    .exc-spin { animation-duration: 2.4s; }
    .exc-btn, .exc-mini, .exc-hero-acts button, .exc-caret { transition: none; }
}
