:root {
    color-scheme: dark;
    --bg: #0e1219;
    --surface: #151a23;
    --surface-raised: #1c232e;
    --hover: #1a222e;
    --text: #e8edf5;
    --muted: #9aa7b9;
    --subtle: #8b98ac;
    --border: #28313e;
    --accent: #8cdec4;
    --accent-soft: #8cdec411;
    --accent-border: #8cdec434;
    --code: #bbddce;
    --script: #8cdec4;
    --config: #b6adf2;
    --key: #edc58e;
    --shadow: 0 12px 36px #00000022;
    --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-raised: #eff3f5;
    --hover: #f4f8f7;
    --text: #222e3d;
    --muted: #5f6e7e;
    --subtle: #687787;
    --border: #dce3e8;
    --accent: #16775c;
    --accent-soft: #16775c0b;
    --accent-border: #16775c32;
    --code: #245e49;
    --script: #16775c;
    --config: #7150b5;
    --key: #9c6618;
    --shadow: 0 12px 36px #27364908;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-decoration: none; }
button, input { color: inherit; }
button { border: 0; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent-border); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); }
.skip-link { position: fixed; top: 12px; left: 12px; padding: 10px 16px; background: var(--accent); color: var(--bg); border-radius: 6px; z-index: 20; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1320px; padding: 0 48px; margin: auto; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-name { font-size: 20px; font-weight: 650; letter-spacing: -.4px; line-height: 1; }
.brand img { display: block; flex-shrink: 0; }
.brand-context { margin-left: 8px; padding-left: 18px; border-left: 1px solid var(--border); color: var(--muted); font-size: 13px; line-height: 20px; }
.header-actions { display: flex; align-items: center; gap: 22px; }
.source-link { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.source-link:hover { color: var(--accent); }
.source-link .icon { width: 15px; height: 15px; }
.header-divider { width: 1px; height: 18px; background: var(--border); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 7px; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-button:hover { background: var(--surface-raised); color: var(--text); }
.icon-button.copied { color: var(--accent); background: var(--accent-soft); }
.page-shell { max-width: 1320px; margin: auto; padding: 0 48px; }
.workspace { display: grid; grid-template-columns: 216px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 36px; row-gap: 20px; align-items: start; padding-top: 32px; }
.sidebar { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 28px; padding-top: 4px; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 12px 16px; font-size: 12px; color: var(--muted); }
.directory-count { font-size: 11px; color: var(--subtle); }
.directory-count strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.nav-button { display: flex; align-items: center; gap: 11px; padding: 11px 12px; width: 100%; min-height: 44px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; margin: 4px 0; color: var(--muted); }
.nav-button:hover { background: var(--surface); color: var(--text); }
.nav-button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.nav-button .nav-label { flex: 1; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.nav-button:first-child .nav-label { font-family: var(--sans); }
.nav-count { font: 11px/1.4 var(--mono); opacity: .8; }
.nav-button.nested { padding-left: 30px; font-size: 12px; }
.nav-button.nested .icon { width: 15px; height: 15px; }
.nav-button.nested .nav-label { font-size: 11px; }
.nav-divider { height: 1px; background: var(--border); margin: 14px 12px; }
.sidebar-note { display: flex; gap: 10px; margin: 35px 12px 0; padding-top: 24px; border-top: 1px solid var(--border); color: var(--subtle); }
.sidebar-note .icon { margin-top: 2px; }
.sidebar-note p { margin: 0; font-size: 11px; line-height: 1.9; }
.shortcut-note { display: flex; align-items: center; gap: 10px; margin: 22px 12px; font-size: 11px; color: var(--subtle); }
kbd { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font: 12px var(--mono); border: 1px solid var(--border); border-radius: 4px; color: var(--subtle); }
.browser-toolbar { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 24px; min-width: 0; }
.browser-heading { flex: 1; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 9px; min-width: 0; }
.breadcrumb > .icon { color: var(--accent); width: 17px; height: 17px; }
h1 { font-size: 22px; line-height: 1.4; margin: 0; font-weight: 600; letter-spacing: -.4px; overflow-wrap: anywhere; }
.result-count { display: block; margin: 4px 0 0 26px; color: var(--subtle); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.search-box { display: flex; flex: 0 1 420px; width: 420px; max-width: 52%; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 15px; height: 46px; color: var(--subtle); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 100%; font-size: 13px; }
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder { color: var(--subtle); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .clear-search { width: 30px; height: 30px; }
.resource-browser { grid-column: 2; grid-row: 2; min-width: 0; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 18px; min-height: 32px; }
.type-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter-button { background: transparent; color: var(--muted); font-size: 12px; padding: 5px 13px; border-radius: 6px; border: 1px solid transparent; min-height: 32px; }
.filter-button:hover { color: var(--text); background: var(--surface); }
.filter-button.active { background: var(--surface-raised); color: var(--text); border-color: var(--border); }
.filter-hint { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--subtle); white-space: nowrap; }
.filter-hint .icon { width: 12px; height: 12px; }
.folder-group { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.folder-heading { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 18px; color: var(--muted); background: var(--surface-raised); text-align: left; min-height: 48px; }
.folder-heading:hover { color: var(--text); }
.folder-heading > .icon:first-child { width: 16px; height: 16px; }
.folder-title { flex: 1; font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.folder-title .path-prefix { color: var(--subtle); }
.folder-total { font: 10px/1.5 var(--mono); color: var(--subtle); }
.folder-heading .chevron { width: 13px; height: 13px; transform: rotate(90deg); transition: transform .15s; }
.folder-heading[aria-expanded="false"] .chevron { transform: rotate(0); }
.resource + .resource { border-top: 1px solid var(--border); }
.file-row { display: flex; align-items: center; gap: 14px; padding: 17px 18px; min-height: 82px; }
.file-row:hover { background: var(--hover); }
.file-type-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 40px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--config); flex-shrink: 0; }
.file-type-icon[data-kind="script"] { color: var(--script); }
.file-type-icon[data-kind="key"] { color: var(--key); }
.file-type-icon[data-kind="other"] { color: var(--muted); }
.file-type-icon .icon { width: 19px; height: 19px; }
.file-info { flex: 1; min-width: 0; }
.file-name-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.file-name { font: 13px/1.6 var(--mono); padding: 0; background: none; text-align: left; overflow-wrap: anywhere; color: var(--text); }
.file-name:hover { color: var(--accent); }
.file-name[aria-expanded="true"] { color: var(--accent); }
.type-badge { font: 9px/1.6 var(--mono); border: 1px solid var(--border); color: var(--subtle); padding: 0 5px; border-radius: 4px; letter-spacing: .3px; flex-shrink: 0; }
.file-description { margin: 4px 0 0; font-size: 11px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.copy-link-button { width: 32px; height: 32px; }
.copy-link-button .icon { width: 15px; height: 15px; }
.view-file { display: inline-flex; align-items: center; gap: 3px; padding: 6px 9px; font-size: 11px; color: var(--muted); border-radius: 6px; min-height: 32px; }
.view-file:hover { background: var(--surface-raised); color: var(--text); }
.view-file .icon { width: 13px; height: 13px; }
.usage-button { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 6px 10px; border-radius: 6px; background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.usage-button:hover, .usage-button[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.usage-button .icon { width: 11px; height: 11px; transition: transform .15s; }
.usage-button[aria-expanded="true"] .icon { transform: rotate(90deg); }
.usage-info { padding: 0 18px 18px 68px; }
.usage-label { font: 9px/1.5 var(--mono); color: var(--subtle); letter-spacing: 1.5px; margin: 0 0 9px; }
.usage-command { display: flex; align-items: flex-start; gap: 16px; padding: 14px 14px 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.command-text { flex: 1; min-width: 0; font: 12px/1.85 var(--mono); color: var(--code); overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; padding-top: 2px; }
.copy-command-button { display: flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--accent-border); background: var(--accent-soft); border-radius: 5px; color: var(--accent); font-size: 11px; flex-shrink: 0; min-height: 30px; }
.copy-command-button .icon { width: 13px; height: 13px; }
.copy-command-button:hover { background: var(--accent-border); }
.usage-description { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.browser-footer { display: flex; align-items: center; gap: 7px; margin: 22px 0 0; color: var(--subtle); font-size: 11px; }
.browser-footer strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.footer-format { margin-left: auto; font-size: 11px; }
.site-footer { max-width: 1224px; margin: 50px auto 0; padding: 22px 0 28px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 15px; font-size: 11px; color: var(--subtle); }
.footer-slash { margin: 0 8px; color: var(--border); }
.state-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 250px; padding: 36px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); }
.state-panel .state-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-raised); display: flex; align-items: center; justify-content: center; color: var(--subtle); }
.state-panel h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 500; }
.state-panel p { margin: 0; font-size: 12px; }
.reset-button { padding: 8px 15px; border-radius: 6px; font-size: 12px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); margin-top: 4px; }
.loading-indicator { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.nav-placeholder { color: var(--subtle); font-size: 12px; padding: 12px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 9px; box-shadow: var(--shadow); background: var(--surface-raised); border: 1px solid var(--accent-border); color: var(--text); font-size: 12px; z-index: 10; transition: opacity .18s, transform .18s; max-width: calc(100% - 32px); width: max-content; }
.toast .icon { color: var(--accent); width: 16px; height: 16px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1320px) {
    .site-footer { margin-left: 48px; margin-right: 48px; }
}
@media (max-width: 1080px) {
    .header-inner, .page-shell { padding-left: 32px; padding-right: 32px; }
    .workspace { grid-template-columns: 180px minmax(0, 1fr); column-gap: 24px; }
    .site-footer { margin-left: 32px; margin-right: 32px; }
    .filter-hint { display: none; }
    .file-row { gap: 11px; padding: 16px 14px; }
    .file-actions { gap: 2px; }
    .usage-info { padding-left: 61px; padding-right: 14px; }
}
@media (max-width: 760px) {
    .header-inner { height: 64px; padding: 0 22px; }
    .page-shell { padding: 0 22px; }
    .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; row-gap: 16px; padding-top: 24px; }
    .browser-toolbar { grid-column: 1; grid-row: 1; flex-direction: column; align-items: stretch; gap: 16px; }
    .browser-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
    h1 { font-size: 20px; }
    .result-count { margin: 0; }
    .search-box { flex: none; width: 100%; max-width: none; }
    .sidebar { grid-column: 1; grid-row: 2; position: static; padding: 0; min-width: 0; }
    .resource-browser { grid-column: 1; grid-row: 3; }
    .sidebar-heading, .sidebar-note, .shortcut-note, .nav-divider { display: none; }
    #folder-nav { display: flex; gap: 7px; overflow-x: auto; padding: 4px 2px 7px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
    .nav-button { width: auto; margin: 0; padding: 9px 12px; flex: 0 0 auto; gap: 8px; border-color: var(--border); background: var(--surface); min-height: 40px; }
    .nav-button .nav-label { font-size: 12px; }
    .nav-button.nested { padding-left: 12px; }
    .nav-button.nested .nav-label { font-size: 11px; }
    .nav-count { font-size: 10px; }
    .site-footer { margin: 32px 22px 0; }
}
@media (max-width: 480px) {
    .header-inner, .page-shell { padding-left: 16px; padding-right: 16px; }
    .brand { gap: 9px; }
    .brand img { width: 28px; height: 28px; }
    .brand-name { font-size: 19px; }
    .brand-context { margin-left: 3px; padding-left: 12px; font-size: 12px; }
    .header-actions { gap: 12px; }
    .header-divider { display: none; }
    .source-link { font-size: 11px; }
    .workspace { padding-top: 22px; }
    .search-shortcut { display: none; }
    .filter-bar { margin-bottom: 17px; }
    .filter-button { padding: 6px 12px; min-height: 36px; }
    .folder-heading { padding: 12px 14px; }
    .file-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 11px; row-gap: 8px; padding: 14px; }
    .file-type-icon { width: 32px; height: 36px; }
    .file-name { font-size: 12px; }
    .file-name-line { gap: 6px; }
    .type-badge { font-size: 8px; }
    .file-actions { grid-column: 2; justify-content: flex-start; gap: 9px; }
    .copy-link-button, .view-file, .usage-button { min-height: 36px; }
    .copy-link-button { width: 36px; }
    .file-description { font-size: 11px; }
    .usage-info { padding: 0 14px 16px; }
    .usage-command { gap: 10px; padding: 12px; flex-wrap: wrap; }
    .command-text { flex-basis: 100%; font-size: 11px; }
    .copy-command-button { min-height: 36px; }
    .footer-format { display: none; }
    .site-footer { margin-left: 16px; margin-right: 16px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
