@font-face {
    font-family: 'MS Sans';
    src: local('MS Sans Serif'), local('Microsoft Sans Serif');
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #000;
    color: #000;
    font-family: "MS Sans Serif", "Tahoma", "Arial", sans-serif;
    font-size: 11px;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

/* ─── Starfield ─── */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #000;
}
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ─── Desktop Icons ─── */
.desktop-icon {
    position: absolute;
    text-align: center;
    color: #fff;
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
    cursor: pointer;
    z-index: 1;
    width: 64px;
}
.desktop-icon:hover { color: #000080; background: rgba(255,255,255,0.1); }

/* ─── Win9x Window ─── */
.window {
    position: absolute;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #000 #000 #dfdfdf;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.title-bar {
    background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
    color: #fff;
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 11px;
    cursor: move;
}
.title-bar.inactive {
    background: linear-gradient(90deg, #808080, #a0a0a0);
}    
.window-controls {
    display: flex;
    gap: 2px;
}
.win-btn {
    width: 16px;
    height: 14px;
    background: #c0c0c0;
    border: 1px solid;
    border-color: #fff #000 #000 #fff;
    color: #000;
    font-size: 9px;
    line-height: 12px;
    text-align: center;
    cursor: pointer;
    font-family: "Marlett", "Tahoma", sans-serif;
}
.win-btn:active {
    border-color: #000 #fff #fff #000;
}

/* ─── Menu Bar ─── */
.menu-bar {
    display: flex;
    gap: 16px;
    padding: 1px 8px;
    background: #c0c0c0;
    border-bottom: 1px solid #808080;
}
.menu-item {
    cursor: pointer;
    padding: 1px 4px;
}
.menu-item:hover {
    background: #000080;
    color: #fff;
}
.menu-item::first-letter { text-decoration: underline; }

/* ─── Window Content / Panes ─── */
.window-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 4px;
    gap: 4px;
}

.pane {
    border: 2px solid;
    border-color: #808080 #fff #fff #808080;
    background: #fff;
    overflow: auto;
}

.index-pane {
    width: 240px;
    min-width: 180px;
    resize: horizontal;
}
.viewer-pane {
    flex: 1;
    padding: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "Courier New", "Consolas", monospace;
    font-size: 12px;
    line-height: 1.6;
    background: #fff;
    color: #000;
}

/* ─── File Tree ─── */
.tree-header {
    background: #000080;
    color: #fff;
    padding: 4px 6px;
    font-weight: bold;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tree-list { padding: 2px 0; }
.tree-item {
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}
.tree-item:hover { background: #000080; color: #fff; }
.tree-item.active { background: #000080; color: #fff; }
.tree-item::before { content: "[~]"; font-family: monospace; color: #808080; }
.tree-item.active::before { color: #fff; }
.tree-date { font-weight: bold; }
.tree-title { opacity: 0.7; font-size: 10px; margin-left: 4px; }

/* ─── Status Bar ─── */
.status-bar {
    display: flex;
    gap: 2px;
    padding: 2px 4px;
    background: #c0c0c0;
    border-top: 1px solid #808080;
}
.status-panel {
    border: 1px inset #c0c0c0;
    padding: 2px 6px;
    flex: 1;
    font-size: 11px;
    overflow: hidden;
    white-space: nowrap;
}
.status-panel:last-child { flex: 0 0 auto; min-width: 100px; text-align: center; }

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 16px; height: 16px; background: #dfdfdf; }
::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
}
::-webkit-scrollbar-button {
    background: #c0c0c0;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
    width: 16px; height: 16px;
}
::-webkit-scrollbar-corner { background: #c0c0c0; }

/* ─── Empty State ─── */
.empty-state {
    color: #808080;
    font-style: italic;
    text-align: center;
    margin-top: 40px;
    font-family: "MS Sans Serif", sans-serif;
}

.error-box {
    color: #800000;
    padding: 12px;
    font-family: "MS Sans Serif", sans-serif;
    font-size: 11px;
    line-height: 1.5;
}
.error-box code {
    background: #fff;
    border: 1px inset #c0c0c0;
    padding: 2px 4px;
    font-family: monospace;
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
    #diary-win { top: 0 !important; left: 0 !important; width: 100vw !important; height: calc(100vh - 28px) !important; }
    .index-pane { width: 140px !important; }
}