/* --- Reset and Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
    background: linear-gradient(135deg, #181a20 0%, #0b0c0f 100%);
    color: #b6e1ff;
    min-height: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* --- Desktop and Top Bar --- */
#desktop-background {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #222 url('desktop-wallpaper.jpg') center center no-repeat;
    background-size: cover;
    z-index: 0;
}

#top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40px;
    background: rgba(24, 26, 27, 0.8);
    color: #f1f1f1;
    display: flex;
    align-items: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.menu {
    list-style: none;
    padding: 0 20px;
    display: flex;
    gap: 20px;
}

.menu li {
    cursor: pointer;
    padding: 0 10px;
    user-select: none;
}

/* --- Desktop Area --- */
#desktop {
    position: absolute;
    top: 40px; /* or your top bar height */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
}

/* --- Desktop Icons --- */
.icon {
    position: absolute;
    width: 80px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    cursor: default !important;
}

.icon img {
    width: 48px;
    height: 48px;
    display: block;
    margin: 0 auto 5px auto;
}

.icon span {
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    font-size: 14px;
}

.icon.selected,
.icon:hover {
    background: rgba(30, 144, 255, 0.15);
    border-radius: 6px;
    transition: background 0.15s;
}

/* --- Window Styles --- */
.window {
    position: absolute;
    background: rgba(14, 16, 19, 0.9);
    border: 1.5px solid #444950;
    border-radius: 6px;
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.35), 0 1.5px 4px 0 rgba(0,0,0,0.35);
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
}

.window.fullscreen {
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    /* Do NOT use position: fixed or vw/vh units */
}

.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 32px;
    background: #222;
    user-select: none;
}

.window-title {
    flex: 1 1 auto;
    text-align: left;
    font-weight: bold;
    color: #fff;
    font-size: 15px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.window-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.window-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    margin-top: 4px;
    line-height: 0.8;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    width: 24px;
    padding: 0;
}

.window-expand {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    margin-left: 8px;
    margin-right: 2px;
    transition: color 0.2s;
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
}

.window-close:hover {
    color: #e57373;
    background: #2d323a;
}
.window-expand:hover {
    color: #7ec699;
    background: #2d323a;
}

.window-content {
    background: rgba(18, 20, 24, 0);
    color: #b6e1ff;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 15px;
    padding: 16px;
    flex: 1;
    overflow: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #444950 #23272e;
}
.window-content::-webkit-scrollbar {
    width: 8px;
    background: #23272e;
    border-radius: 6px;
}
.window-content::-webkit-scrollbar-thumb {
    background: #444950;
    border-radius: 6px;
    border: 2px solid #23272e;
}
.window-content::-webkit-scrollbar-thumb:hover {
    background: #555a60;
}

.window-resizer {
    width: 16px;
    height: 16px;
    background: transparent;
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: se-resize;
}

/* --- Window Menubar --- */
.window-menubar {
    background: #23272e;
    border-bottom: 1px solid #444950;
    padding: 0 0 0 8px;
    height: 32px;
    display: flex;
    align-items: center;
}
.window-menubar .menu {
    display: flex;
    gap: 18px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.window-menubar .menu li {
    color: #b6e1ff;
    font-size: 15px;
    cursor: pointer;
    padding: 0 10px;
    user-select: none;
    border-radius: 4px;
    transition: background 0.2s;
}
.window-menubar .menu li:hover {
    background: #181a1b;
}

/* --- File Explorer --- */
.file-explorer-content {
    display: flex;
    height: 100%;
    padding: 0;
    background: #23272e;
    color: #b6e1ff;
    font-family: 'Fira Mono', 'Consolas', monospace;
}

.sidebar {
    background: rgba(14, 16, 19, 0.9);
    padding: 16px 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1.5px solid #444950;
}

.sidebar-section {
    padding: 8px 27px 8px 20px;
    color: #b6e1ff;
    font-size: 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.sidebar-section:hover {
    background: #23272e;
}
.sidebar-section svg {
    vertical-align: middle;
    margin-right: 0;
}

/* --- Explorer Main & Folders --- */
.explorer-main {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 24px 32px;
    padding: 32px 24px;
    background: rgba(14, 16, 19, 0.9);
    min-height: 0;
    overflow: auto;
}

.explorer-folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-radius: 6px;
    padding: 8px 0;
}

.explorer-folder.selected,
.explorer-folder:hover {
    background: rgba(30, 144, 255, 0.15);
    border-radius: 6px;
    transition: background 0.15s;
}

.explorer-folder img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}
.explorer-folder span {
    color: #b6e1ff;
    font-size: 15px;
    text-align: center;
    font-family: 'Fira Mono', 'Consolas', monospace;
    text-shadow: 1px 1px 2px #000;
    margin-top: 2px;
}

.explorer-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-radius: 6px;
    padding: 8px 0;
}

.explorer-file.selected,
.explorer-file:hover {
    background: rgba(30, 144, 255, 0.15);
    border-radius: 6px;
    transition: background 0.15s;
}

.explorer-file img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}
.explorer-file span {
    color: #b6e1ff;
    font-size: 15px;
    text-align: center;
    font-family: 'Fira Mono', 'Consolas', monospace;
    text-shadow: 1px 1px 2px #000;
    margin-top: 2px;
}

/* --- Folder Entry (if used elsewhere) --- */
.folder-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 15px;
    color: #b6e1ff;
    cursor: pointer;
}
.folder-entry img {
    width: 20px;
    height: 20px;
}

.breadcrumbs-bar {
    display: flex;
    align-items: center;
    background: #23272e;
    border-bottom: 1px solid #444950
}
.breadcrumbs-back {
    font-size: 1.5em;
    margin: 0 8px 0 4px;
    cursor: default;
    user-select: none;
    transition: opacity 0.2s;
}
.breadcrumbs-back:hover {
    color: #7ec699;
}
.breadcrumbs-back.disabled {
    opacity: 0.25;
    pointer-events: none;
    cursor: default;
}
.breadcrumbs {
    display: flex;
    align-items: center;
    font-size: 1em;
    color: #b6e1ff;
}
.breadcrumb-link {
    cursor: default;
    color: #fff;
    transition: text-decoration 0.2s;
}
.breadcrumb-link:hover {
    text-decoration: none;
    color: #7ec699;
}

/* --- Terminal Styles --- */
.terminal-input-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    margin-top: 8px;
    width: 100%;
    line-height: 1.4;
}

.terminal-input {
    outline: none;
    min-width: 2ch;
    color: #b6e1ff;
    background: transparent;
    border: none;
    font-family: 'Fira Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.5px;
    white-space: pre-wrap;
    word-break: break-all;
    flex: 1 1 auto;
    position: relative;
    caret-color: transparent;
    overflow-wrap: anywhere;
    line-height: 1.4;
    padding: 0;
    margin: 0;
    margin-top: -1px;
    align-self: flex-start;
}

.terminal-input::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background: #b6e1ff;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s steps(1) infinite;
    opacity: 0;
    transition: opacity 0.1s;
    margin-top: -5px;
}

.terminal-input:focus::after {
    opacity: 1;
}
.terminal-input.hide-caret::after {
    opacity: 0 !important;
    animation: none !important;
}

#terminal-output {
    /* white-space: pre-wrap; */
    word-break: break-all;
    min-height: 0;
    display: block;
    margin: 0;
    padding: 0;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.5px;
    line-height: 1.3;
}
#terminal-output div {
    margin-top: 8px;
}

.terminal-font {
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.prompt,
.output-prompt {
    color: #7ec699;
    margin-right: 6px;
    margin-left: 0;
    user-select: none;
    white-space: pre;
    line-height: 1.3;
    align-self: flex-start;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.5px;
}

.prompt-highlight {
    color: #efffb6;
    font-weight: bold;
}

.exam-qnum {
    color: #b6ffe9;
    font-family: 'Fira Mono', 'Consolas', monospace;
    margin-bottom: 2px;
    font-size: 1em;
    font-weight: bold;
}

.exam-question {
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 1.1em;
    margin-bottom: 8px;
    white-space: pre-wrap;
    margin-top: 0;
    margin-bottom: 8px;
    line-height: 1.3;
}

.exam-results pre.exam-question {
    margin-bottom: 8px;
    margin-top: 0;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 1em;
    background: none;
    border: none;
    padding: 0;
}
.exam-score {
    color: #b6ffe9;
    font-weight: bold;
    margin-top: 8px;
}

.exam-results-title {
    color: #b6ffe9;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 1em;
    font-weight: bold;
    margin: 0;
    padding: 0;
    line-height: 1.3;
}
.exam-separator {
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 1em;
    white-space: pre-wrap;
    margin-top: 0;
    line-height: 1.3;
}
.exam-correct {
    color: #b6ffe9;
    font-weight: bold;
}
.exam-correct-answer {
    color: #b6ffe9;
    font-weight: bold;
}
.exam-wrong-answer {
    color: #ff6b6b;
    font-weight: bold;
}

/* --- Context Menus --- */
#custom-context-menu,
#icon-context-menu,
#folder-context-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    background: rgba(14, 16, 19, 0.9);
    color: #b6e1ff;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    min-width: 160px;
    list-style: none;
    border: 1.5px solid #444950;
}
#custom-context-menu li:hover,
#icon-context-menu li:hover,
#folder-context-menu li:hover {
    background: rgba(30,144,255,0.15);
}

#boot-screen {
    position: fixed;
    z-index: 99999;
    inset: 0;
    background: #000;
    color: #b6e1ff;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 1.1rem;
    display: block;
    transition: opacity 0.8s;
}
#boot-text {
    font-family: 'Fira Mono', monospace;
    margin: 0;
    position: absolute;
    top: 24px;
    left: 32px;
    text-align: left;
}
#welcome-screen {
    position: fixed;
    z-index: 99998;
    inset: 0;
    background: linear-gradient(135deg, #181a20 0%, #0b0c0f 100%);
    color: #7ec6ff;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s;
}
#welcome-text {
    color: #7ec6ff;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-weight: 900;
    font-size: 2.2rem;
    text-align: center;
    letter-spacing: 0.03em;
}

body:not(.booted) #main-content {
    opacity: 0;
    pointer-events: none;
}
body.booted #main-content {
    opacity: 1;
    transition: opacity 1s;
    pointer-events: auto;
}

#skip-boot-btn {
    display: none;
    position: fixed;         /* Use fixed for viewport placement */
    top: 24px;
    right: 32px;
    z-index: 10001;
    background: #23272e;
    color: #7ec6ff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.85;
    transition: background 0.2s, opacity 0.2s;
}
#skip-boot-btn:hover {
    background: #1a2027;
    opacity: 1;
}

/* Document Editor Styles */
.window-document .window-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: visible;
}

.window-document .explorer-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    overflow: visible;
}

.document-editor {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    padding: 16px 20px;
    font-family: 'Liberation Sans', 'DejaVu Sans', Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #fafdff 0%, #f3f7fa 100%);
    color: #205081;
    white-space: pre-wrap;
    text-align: left;
    display: block;
    margin: 0;
    border: 1.5px solid #e3e8f0;
    font-size: 1.08rem;
    box-shadow: 0 4px 24px 0 rgba(32,80,129,0.06), 0 1.5px 4px 0 rgba(32,80,129,0.04);
    transition: box-shadow 0.2s, border 0.2s;
    overflow: auto;
    line-height: 1.4;
}

/* --- Compact Document Editor Styles --- */

.document-editor h1 {
    font-size: 2em;
    margin: 0.7em 0 0.3em 0;
    font-weight: 700;
    color: #17406a;
    letter-spacing: -1px;
}
.document-editor h2 {
    font-size: 1.3em;
    margin: 0.6em 0 0.3em 0;
    font-weight: 600;
    color: #205081;
}
.document-editor h3 {
    font-size: 1.1em;
    margin: 0.5em 0 0.2em 0;
    font-weight: 600;
    color: #2563a6;
}
.document-editor h4 {
    font-size: 1.1em;
    margin: 0.5em 0 0.2em 0;
    font-weight: 600;
    color: #2563a6;
}
.document-editor ul,
.document-editor ol {
    margin-left: 1.5em;
    margin-bottom: 0.5em;
    margin-top: 0.5em;
    padding-left: 1em;
}
.document-editor li {
    margin-bottom: 0.2em;
    line-height: 1.5;
}
.document-editor hr {
    border: none;
    border-top: 1px solid #e3e8f0;
    margin: 1em 0;
}
.document-editor blockquote {
    margin: 0.7em 0;
    padding: 0.5em 1em;
}
.document-editor code {
    background: #eaf6ff;
    color: #205081;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 0.98em;
}

/* Optional: subtle scrollbar styling for the editor */
.document-editor::-webkit-scrollbar {
    width: 10px;
    background: #23272e; /* Match your window/toolbar background */
    border-radius: 8px;
}
.document-editor::-webkit-scrollbar-thumb {
    background: #444950;
    border-radius: 8px;
    border: 2px solid #23272e; /* Optional: adds padding effect */
}

/* Toolbar for Document Editor */
.document-toolbar {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    background: #23272e;
    border-bottom: 1.5px solid #444950;
    height: 40px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.document-toolbar button {
    background: #181a1b;
    border: 1px solid #444950;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 1rem;
    cursor: pointer;
    color: #b6e1ff;
    transition: background 0.18s, border 0.18s, color 0.18s;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    margin: 0;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.document-toolbar button:hover,
.document-toolbar button:focus {
    background: #2d323a;
    border-color: #7ec6ff;
    color: #7ec6ff;
}

/* --- Blinking caret animation --- */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}