/* style.css */
:root {
    --dos-bg: #000000;
    --dos-fg: #00ff00;
    --dos-dim: #008800;

    --ui-bg: #050710;
    --ui-fg: #e0e0e0;
    --accent: #00ffc8;
    --window-border: #1c1c32;
    --window-titlebar-bg1: #16162c;
    --window-titlebar-bg2: #262649;
    --window-shadow: rgba(0, 0, 0, 0.7);
}

/* theme variations via root class */
.theme-green {
    --dos-fg: #00ff00;
    --dos-dim: #008800;
    --accent: #00ffc8;
}

.theme-purple {
    --dos-fg: #b388ff;
    --dos-dim: #7c4dff;
    --accent: #ff80ff;
}

.theme-amber {
    --dos-fg: #ffcc66;
    --dos-dim: #ffb74d;
    --accent: #ffb300;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--dos-bg);
    color: var(--dos-fg);
    font-family: Consolas, "Courier New", monospace;
}

body {
    overflow: hidden;
}

/* generic screens */

.screen {
    display: none;
    height: 100%;
    width: 100%;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* --- DOS BOOT --- */

#boot-screen {
    position: fixed;
    inset: 0;
    background: var(--dos-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: dos-flicker 1.2s infinite steps(1, end);
}

.dos-crt {
    width: min(900px, 95vw);
    height: min(520px, 85vh);
    border: 2px solid var(--dos-fg);
    padding: 12px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 0%, #101010 0, #000 60%);
    position: relative;
    overflow: hidden;
}

.dos-crt::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 255, 0, 0.07),
        rgba(0, 255, 0, 0.07) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: screen;
    opacity: 0.5;
    pointer-events: none;
}

.dos-crt::after {
    content: "";
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at center, rgba(0, 255, 0, 0.2), transparent 65%);
    opacity: 0.3;
    pointer-events: none;
}

.dos-header,
.dos-footer {
    font-size: 13px;
    color: var(--dos-dim);
    position: relative;
    z-index: 1;
}

.dos-header {
    margin-bottom: 6px;
}

.dos-footer {
    margin-top: auto;
    padding-top: 4px;
    border-top: 1px solid var(--dos-dim);
}

.dos-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.dos-lines {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.3;
    color: var(--dos-fg);
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.5);
    overflow-y: auto;
}

.dos-progress {
    margin-top: 10px;
    height: 10px;
    border: 1px solid var(--dos-dim);
    padding: 1px;
    box-sizing: border-box;
}

.dos-progress-bar {
    height: 100%;
    width: 0;
    background: var(--dos-fg);
    animation: dos-progress-fill 4s linear forwards;
}

.dos-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--dos-dim);
}

@keyframes dos-progress-fill {
    0% { width: 0; }
    30% { width: 35%; }
    60% { width: 70%; }
    85% { width: 90%; }
    100% { width: 100%; }
}

@keyframes dos-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

/* --- LOGIN SCREEN --- */

#login-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #141426 0, #050710 55%, #000 100%);
    color: var(--ui-fg);
    padding: 16px;
}

.window {
    background: rgba(10, 10, 20, 0.95);
    border: 2px solid var(--window-border);
    box-shadow: 0 0 24px var(--window-shadow);
    color: var(--ui-fg);
    position: absolute;
    top: 80px;
    left: 140px;
    display: flex;
    flex-direction: column;
}

.window-titlebar {
    background: linear-gradient(90deg, var(--window-titlebar-bg1), var(--window-titlebar-bg2));
    color: #f0f0ff;
    padding: 4px 8px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #303060;
    cursor: move;
}

.window-title {
    font-weight: bold;
}

.window-controls {
    font-family: "Courier New", monospace;
    font-size: 12px;
    cursor: default;
}

.window-controls span {
    margin-left: 6px;
    cursor: pointer;
}

.window-content {
    padding: 16px;
    font-size: 14px;
    background: #050710;
}

/* default window sizing */
#terminal-window {
    width: 520px;
    max-width: calc(100% - 160px);
    max-height: calc(100% - 120px);
}

#notepad-window,
#media-window,
#files-window,
#profile-window,
#projects-window,
#status-window,
#music-window,
#mail-window,
#notes-window,
#ramblings-window,
#runner-window {
    width: 480px;
    max-width: calc(100% - 160px);
    max-height: calc(100% - 120px);
}

/* maximized window */
.window-max {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 32px) !important; /* leave room for taskbar */
}

/* runner window resizable */
.runner-window {
    resize: both;
    overflow: hidden;
}

/* login specifics */

.login-panel {
    position: static;
    width: 320px;
}

.login-avatar {
    font-size: 32px;
    margin-bottom: 16px;
    text-align: center;
    color: var(--accent);
}

label {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #303060;
    background: #050511;
    color: var(--ui-fg);
    font-family: inherit;
    font-size: 14px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: 1px solid var(--accent);
}

#login-btn {
    margin-top: 12px;
    width: 100%;
    padding: 8px;
    border: 1px solid #303060;
    background: #121234;
    color: var(--ui-fg);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

#login-btn:hover {
    background: #1b1b47;
}

/* --- DESKTOP --- */

#desktop-screen {
    background: radial-gradient(circle at top, #141426 0, #050710 60%, #000 100%);
    color: var(--ui-fg);
}

#desktop {
    position: relative;
    width: 100%;
    height: 100%;
}

.desktop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.desktop-icons {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1;
}

.icon {
    width: 96px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    color: #e8e8ff;
}

.icon-image {
    border: 1px solid #2a2a55;
    padding: 8px;
    margin-bottom: 4px;
    background: rgba(5, 5, 20, 0.8);
}

.icon-label {
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(90deg, #101020, #060612);
    border-top: 1px solid #303060;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 12px;
    z-index: 2;
}

.taskbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.start-btn {
    background: #161636;
    color: #f0f0ff;
    border: 1px solid #303060;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
}

.taskbar-apps {
    display: flex;
    align-items: center;
    gap: 4px;
}

.taskbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.taskbar-indicator,
.taskbar-clock {
    padding: 2px 6px;
    border: 1px solid #303060;
}

/* terminal */

.terminal {
    background: #020210;
    color: #c0ffc0;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: 260px;
}

.terminal-output {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.terminal-input-line {
    border-top: 1px solid #202040;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.terminal-input-line .prompt {
    color: var(--accent);
    white-space: nowrap;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #c0ffc0;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.accent {
    color: var(--accent);
}

/* notepad */

.notepad-area {
    width: 100%;
    height: 260px;
    background: #050515;
    border: none;
    color: var(--ui-fg);
    padding: 8px;
    font-family: Consolas, "Courier New", monospace;
    resize: none;
}

/* media */

.media-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-screen {
    border: 1px solid #303060;
    padding: 16px;
    text-align: center;
    background: #050515;
}

.media-controls button {
    background: #161636;
    color: #f0f0ff;
    border: 1px solid #303060;
    padding: 2px 6px;
    margin-right: 4px;
    cursor: pointer;
}

.media-list {
    font-size: 13px;
    color: #b0b0d8;
}

/* file browser */

.file-browser {
    background: #050710;
}

.file-tree {
    list-style: none;
    padding-left: 0;
    margin: 0 0 8px 0;
    font-size: 13px;
}

.file-tree ul {
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.file-tree li {
    margin: 2px 0;
}

.offline-note {
    font-size: 11px;
    color: #9aa0c8;
}

/* profile */

.profile-content h2 {
    margin-top: 0;
}

.theme-buttons button {
    background: #161636;
    color: #f0f0ff;
    border: 1px solid #303060;
    padding: 3px 8px;
    margin-right: 4px;
    margin-top: 4px;
    cursor: pointer;
    font-size: 12px;
}

.theme-note {
    font-size: 11px;
    color: #9aa0c8;
}

/* projects */

.projects-content h2 {
    margin-top: 0;
}

/* system status */

.status-content h2 {
    margin-top: 0;
}

.warning {
    color: #ffb74d;
    font-size: 13px;
}

.status-list {
    list-style: none;
    padding-left: 0;
    font-size: 13px;
}

.status-note {
    font-size: 11px;
    color: #9aa0c8;
}

/* music */

.music-content {
    background: #050710;
}

.music-embed {
    margin-top: 8px;
}

/* mail */

.mail-content {
    background: #050710;
}

.offline-banner {
    background: #4a1f1f;
    color: #ffb3b3;
    padding: 4px 8px;
    font-size: 12px;
    margin-bottom: 8px;
}

.mail-layout {
    display: flex;
    gap: 8px;
}

.mail-list {
    width: 40%;
    border-right: 1px solid #303060;
    max-height: 220px;
    overflow-y: auto;
}

.mail-item {
    padding: 4px 6px;
    border-bottom: 1px solid #202040;
    cursor: default;
}

.mail-from {
    font-size: 12px;
    color: #9aa0c8;
}

.mail-subject {
    font-size: 13px;
}

.mail-viewer {
    width: 60%;
    font-size: 13px;
}

/* notes */

.notes-content {
    background: #050710;
}

.note-info {
    font-size: 11px;
    color: #9aa0c8;
}

.notes-area {
    width: 100%;
    height: 220px;
    background: #050515;
    border: 1px solid #303060;
    color: var(--ui-fg);
    padding: 8px;
    font-family: Consolas, "Courier New", monospace;
    resize: none;
}

/* blog / ramblings */

.blog-content {
    max-height: 320px;
    overflow-y: auto;
    background: #050515;
    color: var(--ui-fg);
}

.blog-content h2 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 18px;
}

.blog-meta {
    font-size: 12px;
    color: #9aa0c8;
    margin-top: 0;
    margin-bottom: 12px;
}

.blog-entry {
    border-top: 1px solid #303060;
    padding-top: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.blog-entry h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.blog-entry p {
    margin: 0 0 6px 0;
    font-size: 13px;
    line-height: 1.4;
}

/* runner */

.runner-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #050710;
}

.runner-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.runner-logo {
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    background: #020210;
    color: var(--accent);
}

.runner-text {
    font-size: 12px;
    color: #b0b0d8;
}

.runner-canvas-wrap {
    border: 1px solid #303060;
    background: #020210;
    flex: 1;
    min-height: 120px;
}

#runner-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.runner-status {
    font-size: 11px;
    color: #9aa0c8;
}

/* runner window specifics */

.runner-window {
    resize: both;
    overflow: hidden;
}

/* misc */

@media (max-width: 700px) {
    .desktop-icons {
        transform: scale(0.9);
        transform-origin: top left;
    }
}
