/* 系统控件的字体与度量只有一个入口；文章、游戏画面等内容自行声明字体。 */
.window :is(button, input, select, option, textarea, label, legend),
.window :is(.menu-bar, .window-menu-bar, .status-bar) {
    font-family: var(--font-family-system);
    font-size: var(--system-font-size);
}
.window button { line-height: 15px; }
.window button:disabled { opacity: 1; }
.window button[hidden] { display: none !important; }
.window input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.window select { min-height: 23px; }
.window input[type="file"] { min-width: 0; font-size: 11px; }
.window input[type="file"]::file-selector-button {
    font: inherit;
    background: var(--win98-gray);
    border: 0;
    border-radius: 0;
    box-shadow: var(--window-frame-shadow);
    padding: 4px 8px;
    margin-right: 4px;
}

/* 属性页选项卡是面板边缘的一部分，不能同时叠加按钮与链接的默认边距。 */
.window .classic-tabs {
    display: flex;
    flex-shrink: 0;
    list-style: none;
    margin: 0 0 -1px;
    padding: 0 2px;
    position: relative;
    z-index: 1;
}
.window .classic-tabs > :is(li, button) {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 23px;
    padding: 3px 8px;
    margin: 2px -1px 0 0;
    background: var(--win98-gray);
    color: #000;
    border: 1px solid;
    border-color: #fff #000 transparent #fff;
    border-radius: 2px 2px 0 0;
    box-shadow: inset -1px 0 #808080;
    font-weight: normal;
    white-space: nowrap;
}
.window .classic-tabs > :is([aria-selected="true"], .active) {
    margin-top: 0;
    padding-top: 5px;
    border-bottom-color: var(--win98-gray);
    z-index: 1;
}
.window .classic-tabs > [aria-disabled="true"] { color: #808080; text-shadow: 1px 1px #fff; }
.window .classic-tabs a { display: block; padding: 0; margin: 0; color: inherit; text-decoration: none; }
.window .classic-tabs a:focus { outline: 1px dotted #000; outline-offset: 0; }

/* 状态栏属于窗口公共结构，不能由某个应用加载时才定义。 */
.window .status-bar { display: flex; margin: 0; background: var(--win98-gray); flex-shrink: 0; }
.window .status-bar-field { min-width: 0; padding: 2px 4px; }

/* 统一使用 98.css 的立体滑块与点阵轨道。Chromium 还会生成反向按钮，
   必须显式隐藏，避免轨道两端各出现两个箭头。 */
.window ::-webkit-scrollbar { width: 16px; height: 17px; }
.window ::-webkit-scrollbar-thumb { background-color: var(--win98-gray); }
.window ::-webkit-scrollbar-button:start:increment,
.window ::-webkit-scrollbar-button:end:decrement { display: none; }

/* 资源管理器与回收站共用工具栏、地址栏，避免由应用 CSS 的加载顺序决定外观。 */
.explorer-combined-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    gap: 2px;
    padding: 2px;
    background: var(--win98-gray);
    border-top: 1px solid #fff;
    border-bottom: 1px solid #808080;
}
.explorer-toolbar { padding-right: 5px; display: flex; flex-wrap: wrap; gap: 2px; }
.explorer-toolbar button { display: inline-flex; align-items: center; min-width: 0; height: 26px; padding: 2px 6px; box-shadow: none; white-space: nowrap; }
.explorer-toolbar button img { width: 16px; height: 16px; margin-right: 4px; }
.explorer-toolbar button.active,
.explorer-toolbar button[aria-expanded="true"] { box-shadow: inset -1px -1px #fff, inset 1px 1px #808080; padding: 3px 5px 1px 7px; }
.explorer-toolbar button:enabled:hover { box-shadow: inset -1px -1px #808080, inset 1px 1px #fff; }
.explorer-toolbar button:disabled img { filter: grayscale(1); opacity: 0.5; }
.toolbar-separator { width: 2px; height: 22px; margin: 2px 4px; border-left: 1px solid #808080; border-right: 1px solid #fff; }
/* 98.css 的按钮用透明文字加阴影绘字，图形箭头不能继承 currentColor。 */
.toolbar-dropdown-arrow { margin-left: 6px; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 4px solid var(--win98-black); }
.address-bar { display: flex; align-items: center; padding: 0 2px 2px; min-width: 0; }
.address-bar label { margin-right: 5px; flex-shrink: 0; }
.address-bar input { flex: 1; min-width: 0; font-family: var(--font-family-system); }
.explorer-address-field { display: flex; align-items: center; flex: 1; min-width: 0; padding: 0 3px; background: #fff; }
.explorer-address-field img { width: 16px; height: 16px; flex-shrink: 0; }
.window .explorer-address-field input { width: 100%; padding: 2px 4px; border: 0; box-shadow: none; background: transparent; color: var(--win98-black); }

/* 经典文件列表表头是标准控件；列宽与内容布局留给各个应用。 */
.shell-details-list { width: 100%; margin: 0; border: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; font: inherit; }
.shell-details-list th { position: sticky; top: 0; padding: 0; border: 0; background: var(--win98-gray); font-weight: normal; }
.shell-details-list th button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    width: 100%;
    min-width: 0;
    min-height: 22px;
    padding: 2px 6px;
    text-align: left;
    white-space: nowrap;
    box-shadow: inset -1px -1px #808080, inset 1px 1px #fff;
}
.shell-details-list th button:active { box-shadow: inset 1px 1px #808080; }
.shell-sort-arrow { display: none; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; flex-shrink: 0; }
.shell-details-list th[aria-sort="ascending"] .shell-sort-arrow { display: block; border-bottom: 4px solid #808080; }
.shell-details-list th[aria-sort="descending"] .shell-sort-arrow { display: block; border-top: 4px solid #808080; }

/* 文件列表与图标视图共用选中/焦点状态。 */
.shell-file-item { color: var(--win98-black); user-select: none; }
/* 自定义文件图标保持原始比例，同时沿用各视图的标准图标尺寸。 */
.shell-file-item img, .file-icon img, .properties-icon { object-fit: contain; }
.shell-file-item.selected { background: var(--win98-blue); color: var(--win98-white); }
.shell-file-item:focus { outline: 1px dotted currentColor; outline-offset: -1px; }
.window[data-active="false"] .shell-file-item.selected { background: var(--win98-gray); color: var(--win98-black); }
