/* ==========================================================================
   Minecraft 指令工具 · 统一样式表
   - 统一色板 / 圆角 / 间距 / 动效曲线
   - 折叠侧栏 + 移动端抽屉
   - 页面级交叉过渡（View Transitions）
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    color-scheme: dark;

    /* 表面 */
    --bg: #0b0e14;
    --bg-sidebar: #0d121a;
    --surface: #121820;
    --surface-2: #0f151d;
    --surface-3: #0c1118;
    --surface-hover: #16202b;
    --surface-accent: #101a16;

    /* 描边 */
    --line: #1d2632;
    --line-strong: #2b3746;
    --line-faint: #161d27;

    /* 文本 */
    --text: #ccd6e2;
    --text-strong: #e9eef5;
    --text-dim: #7e8d9e;
    --text-faint: #4d5a6a;

    /* 强调色（统一语义：绿=执行/新增，红=清除，蓝=说明，紫=层级） */
    --accent: #63c99a;
    --accent-bright: #7fe0b0;
    --accent-soft: rgba(99, 201, 154, 0.09);
    --accent-line: rgba(99, 201, 154, 0.35);
    --red: #c96a6a;
    --red-soft: rgba(201, 106, 106, 0.08);
    --red-line: rgba(201, 106, 106, 0.28);
    --blue: #5b9fc4;
    --blue-soft: rgba(91, 159, 196, 0.08);
    --blue-line: rgba(91, 159, 196, 0.28);
    --violet: #a08ac8;
    --amber: #c9a063;

    /* 圆角（统一收紧） */
    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius: 7px;
    --radius-lg: 9px;

    /* 阴影（仅浮层使用，不再是渐变卡片） */
    --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.025), 0 10px 28px rgba(0, 0, 0, 0.32);
    --shadow-2: 0 18px 48px rgba(0, 0, 0, 0.55);

    /* 动效 */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-1: 0.16s;
    --dur-2: 0.24s;
    --dur-3: 0.32s;

    /* 布局 */
    --sidebar-w: 236px;
    --sidebar-w-collapsed: 64px;

    /* 字体 */
    --font-ui: 'Segoe UI', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, ol {
    margin: 0;
}

ul, ol {
    padding-left: 1.4em;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

svg {
    display: block;
}

::selection {
    background: rgba(99, 201, 154, 0.26);
    color: #f2f8f5;
}

:focus-visible {
    outline: 2px solid var(--accent-line);
    outline-offset: 2px;
}

/* 滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: #2a3543 transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #27313e;
    background-clip: content-box;
    border: 3px solid transparent;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a4756;
    background-clip: content-box;
    border: 3px solid transparent;
}

/* 跳转链接（键盘可达） */
.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 300;
    padding: 8px 12px;
    color: var(--text-strong);
    text-decoration: none;
    background: var(--surface-3);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    transform: translateY(-200%);
    transition: transform var(--dur-2) var(--ease-out);
}

.skip-link:focus {
    transform: none;
}

/* ---------- 3. Shell & sidebar ---------- */
.shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    position: relative;
    z-index: 30;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    overflow: hidden;
    transition: width var(--dur-3) var(--ease-out);
    view-transition-name: sidebar;
}

.sidebar-head {
    display: flex;
    align-items: center;
    flex: 0 0 64px;
    height: 64px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text-strong);
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-2) ease, color var(--dur-2) ease;
}

.brand:hover .brand-mark {
    color: var(--accent-bright);
    border-color: var(--accent);
}

.brand-mark svg {
    width: 19px;
    height: 19px;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--dur-1) ease, transform var(--dur-2) var(--ease-out);
}

/* 移动端抽屉关闭按钮（桌面端隐藏） */
.drawer-close {
    display: none;
}

.brand-name {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.3;
}

.brand-sub {
    display: block;
    margin-top: 1px;
    font-size: 10.5px;
    color: var(--text-faint);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 10px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color var(--dur-1) ease, background-color var(--dur-1) ease;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 9px;
    bottom: 9px;
    width: 2px;
    background: var(--accent);
    border-radius: 2px;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform var(--dur-3) var(--ease-spring);
}

.nav-item:hover {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.is-active {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.is-active::before {
    transform: scaleY(1);
}

.nav-item.is-active .nav-icon {
    color: var(--accent);
}

.nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: var(--text-faint);
    transition: color var(--dur-1) ease;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-item:hover .nav-icon {
    color: var(--text-dim);
}

.sidebar-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    transition: opacity var(--dur-1) ease, transform var(--dur-2) var(--ease-out);
}

.sidebar-foot {
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid var(--line);
}

.collapse-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    color: var(--text-faint);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--dur-1) ease, background-color var(--dur-1) ease, border-color var(--dur-1) ease;
}

.collapse-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--line);
}

.collapse-btn .kbd {
    margin-left: auto;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-faint);
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
}

.collapse-icon {
    transition: transform var(--dur-3) var(--ease-out);
}

/* 收起状态（桌面端） */
@media (min-width: 861px) {
    html[data-sidebar="collapsed"] .sidebar {
        width: var(--sidebar-w-collapsed);
    }

    html[data-sidebar="collapsed"] .sidebar-head {
        padding: 0 15px;
    }

    html[data-sidebar="collapsed"] .brand-text,
    html[data-sidebar="collapsed"] .sidebar-label,
    html[data-sidebar="collapsed"] .collapse-btn .kbd {
        opacity: 0;
        transform: translateX(-6px);
        pointer-events: none;
    }

    html[data-sidebar="collapsed"] .nav-item {
        justify-content: center;
        gap: 0;
        padding: 0;
        overflow: hidden;
    }

    html[data-sidebar="collapsed"] .nav-item::before {
        left: -8px;
    }

    html[data-sidebar="collapsed"] .collapse-btn {
        justify-content: center;
        padding: 0;
        overflow: hidden;
    }

    html[data-sidebar="collapsed"] .collapse-btn .kbd {
        display: none;
    }

    html[data-sidebar="collapsed"] .collapse-icon {
        transform: rotate(180deg);
    }

    html[data-sidebar="collapsed"] .nav-item .sidebar-label,
    html[data-sidebar="collapsed"] .collapse-btn .sidebar-label {
        flex: 0 0 0;
        width: 0;
    }
}

/* 移动端导航按钮 / 遮罩默认隐藏 */
.mobile-bar,
.scrim {
    display: none;
}

/* ---------- 4. Main ---------- */
.main {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    view-transition-name: content;
}

.main-inner {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

/* 页面不套卡片：内容直接落在背景上，靠分隔线与间距组织 */
.page {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation: page-in 0.45s var(--ease-out) backwards;
}

.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 32px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-faint);
    letter-spacing: 0.2px;
}

/* 区块小标题（构建区 / 节点 / 结果） */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.3px;
    color: var(--text-faint);
}

.section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-dim);
}

.section-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 1px;
    opacity: 0.85;
}

/* 扁平工作区：无卡片，只有间距与工具栏分隔 */
.workspace {
    padding: 2px 0 0;
}

/* 生成结果 */
.result {
    margin-top: 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.result-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    font-size: 12px;
    letter-spacing: 0.3px;
    color: var(--text-faint);
}

.result-title {
    font-weight: 600;
    color: var(--text-dim);
}

/* ---------- 5. Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.page-header--bare {
    margin-bottom: 28px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 21px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.2px;
    color: var(--text-strong);
}

.page-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex: 0 0 auto;
}

.page-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-dim);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- 6. Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 13px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--dur-1) ease,
                border-color var(--dur-1) ease,
                color var(--dur-1) ease,
                box-shadow var(--dur-2) ease,
                transform 0.1s var(--ease-out);
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn-add,
.btn-generate {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent-line);
}

.btn-add:hover,
.btn-generate:hover {
    color: var(--accent-bright);
    background: rgba(99, 201, 154, 0.14);
    border-color: var(--accent);
}

.btn-clear,
.btn-delete {
    color: var(--red);
    background: var(--red-soft);
    border-color: var(--red-line);
}

.btn-clear:hover,
.btn-delete:hover {
    color: #df8888;
    background: rgba(201, 106, 106, 0.14);
    border-color: rgba(201, 106, 106, 0.5);
}

.btn-help {
    color: var(--blue);
    background: var(--blue-soft);
    border-color: var(--blue-line);
}

.btn-help:hover {
    color: #7cb6d6;
    background: rgba(91, 159, 196, 0.14);
    border-color: rgba(91, 159, 196, 0.5);
}

.btn-ghost {
    color: var(--text-dim);
    background: transparent;
    border-color: var(--line);
}

.btn-ghost:hover {
    color: var(--text-strong);
}

/* ---------- 7. Inputs & custom select ---------- */
.custom-input {
    min-width: 60px;
    min-height: 32px;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-1) ease,
                background-color var(--dur-1) ease,
                box-shadow var(--dur-1) ease;
}

.custom-input:hover {
    border-color: var(--line-strong);
}

.custom-input:focus {
    outline: none;
    background: #0e1720;
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.custom-input::placeholder {
    color: var(--text-faint);
    font-family: var(--font-ui);
    font-style: italic;
}

.custom-input.x-small { width: 50px; }
.custom-input.small { width: 82px; }
.custom-input.medium { width: 140px; }
.custom-input.large { width: 210px; }

.custom-input.full {
    flex: 1;
    width: auto;
    min-width: 120px;
}

.custom-input.error-input {
    color: #d98a8a;
    background: rgba(201, 106, 106, 0.08);
    border-color: var(--red-line);
}

.custom-select-wrapper {
    position: relative;
    display: inline-block;
    min-width: 0;
    max-width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    min-width: 100px;
    min-height: 32px;
    padding: 6px 26px 6px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}

.custom-select-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
}

.custom-select-trigger.open {
    background: #0e1720;
    border-color: var(--accent-line);
}

.custom-select-trigger::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    width: 0;
    height: 0;
    margin-top: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-faint);
    transform: translateY(-50%);
    transition: transform var(--dur-2) var(--ease-out), border-top-color var(--dur-1) ease;
}

.custom-select-trigger.open::after {
    border-top-color: var(--accent);
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: fixed;
    z-index: 100;
    min-width: 120px;
    max-height: 260px;
    padding: 4px;
    overflow-y: auto;
    background: #141c26;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity 0.14s ease, transform var(--dur-2) var(--ease-out);
}

.custom-select-dropdown.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.custom-select-dropdown .dropdown-item {
    padding: 7px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.custom-select-dropdown .dropdown-item:hover {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.05);
}

.custom-select-dropdown .dropdown-item.selected {
    color: var(--accent);
    background: var(--accent-soft);
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 8px;
}

/* ---------- 8. Panels / output / misc ---------- */
.output-area {
    min-height: 44px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0 4px 12px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    color: #86d8ab;
    word-break: break-all;
    background: transparent;
    border: 0;
    border-left: 2px solid var(--line-strong);
    border-radius: 0;
    transition: border-color var(--dur-1) ease;
}

.output-area:focus-within {
    border-left-color: var(--accent-line);
}

.output-placeholder {
    font-family: var(--font-ui);
    font-size: 13px;
    font-style: italic;
    color: var(--text-faint);
}

.divider {
    margin: 18px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.bottom-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.empty-hint {
    padding: 22px 0;
    font-family: var(--font-ui);
    font-size: 13px;
    font-style: italic;
    color: var(--text-faint);
    text-align: left;
}

.param-label {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
}

.level-badge {
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
}

.popup-menu {
    position: absolute;
    z-index: 90;
    display: none;
    min-width: 150px;
    padding: 4px;
    background: #141c26;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
}

.popup-menu.active {
    display: block;
    animation: fade-in 0.16s var(--ease-out) both;
}

.popup-menu .menu-item {
    display: block;
    width: 100%;
    padding: 7px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    text-align: left;
    background: none;
    border: 0;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.popup-menu .menu-item:hover {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.05);
}

/* ---------- 9. Motion utilities ---------- */
@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* JS 动态插入的模块：播放入场一次 */
.fade-in {
    animation: fade-in 0.22s var(--ease-out) both;
}

/* 首屏元素错峰入场（一次性） */
.enter {
    animation: rise-in 0.5s var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 45ms);
}

/* 滚动显现（一次性，由 app.js 加 is-in） */
[data-reveal] {
    transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.js-ready [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
}

.js-ready [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

/* ---------- 10. 页面间过渡（View Transitions） ---------- */
@view-transition {
    navigation: auto;
}

::view-transition-group(sidebar),
::view-transition-group(content) {
    animation-duration: 0.34s;
    animation-timing-function: var(--ease-out);
}

::view-transition-old(content) {
    animation: vt-out 0.16s ease both;
}

::view-transition-new(content) {
    animation: vt-in 0.32s var(--ease-out) both;
}

::view-transition-old(sidebar),
::view-transition-new(sidebar) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
}

@keyframes vt-out {
    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

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

/* ---------- 11. Mobile ---------- */
@media (max-width: 860px) {
    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 40;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        background: rgba(11, 14, 20, 0.9);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .mobile-title {
        font-size: 13px;
        font-weight: 600;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .icon-btn {
        display: grid;
        place-items: center;
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        color: var(--text-dim);
        background: var(--surface-2);
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: color var(--dur-1) ease, border-color var(--dur-1) ease, background-color var(--dur-1) ease;
    }

    .icon-btn:hover {
        color: var(--text-strong);
        background: var(--surface-hover);
        border-color: var(--line-strong);
    }

    .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: 272px;
        max-width: 84vw;
        transform: translateX(-100%);
        transition: transform var(--dur-3) var(--ease-out);
        box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
    }

    .sidebar-head {
        gap: 8px;
    }

    .sidebar-head .drawer-close {
        display: grid;
        margin-left: auto;
    }

    html[data-drawer="open"] .sidebar {
        transform: translateX(0);
    }

    .scrim {
        position: fixed;
        inset: 0;
        z-index: 60;
        display: block;
        background: rgba(4, 7, 11, 0.62);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--dur-2) ease;
    }

    html[data-drawer="open"] .scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-foot {
        display: none;
    }

    .main-inner {
        padding: 16px 14px 40px;
    }

    .page {
        padding: 0;
    }

    .page-title {
        font-size: 18px;
    }

    .page-sub {
        font-size: 12.5px;
    }

    .section-head {
        font-size: 11.5px;
    }
}

/* ---------- 12. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .js-ready [data-reveal] {
        opacity: 1;
        transform: none;
    }

    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation-duration: 0.01ms !important;
    }
}
