/* ===================================================================
   senggack.net :: thinking network :: pixel-art retro desktop
   Palette : #008080 #c0c0c0 #d0d0d0 #000080 #000000 #ffffff #ffff00 #808080
   Fonts   : Press Start 2P, VT323, Silkscreen
   Grid    : 8px snapped everywhere
   =================================================================== */

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

html, body {
    height: 100%;
    width: 100%;
}

body {
    background: #008080;
    color: #000000;
    font-family: 'VT323', 'Press Start 2P', monospace;
    font-size: 16px;
    line-height: 1.6;
    overflow: hidden;
    cursor: default;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

/* ===================================================================
   DESKTOP -- teal background + 8px dithering grid
   =================================================================== */

.desktop {
    position: relative;
    width: 100vw;
    height: calc(100vh - 32px);
    background-color: #008080;
    background-image:
        repeating-conic-gradient(#008080 0% 25%, #007878 0% 50%);
    background-size: 4px 4px;
    overflow: hidden;
}

/* ===================================================================
   DESKTOP ICONS -- column at top-left, snap to 8px
   =================================================================== */

.desktop-icons {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 80px;
    height: 80px;
    padding: 8px 0 0 0;
    background: transparent;
    border: 1px dotted transparent;
    color: #ffffff;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    text-align: center;
    user-select: none;
}

.desktop-icon:hover {
    border-color: #ffff00;
    background: rgba(0, 0, 128, 0.25);
}

.desktop-icon:active {
    border-style: dashed;
}

.icon-sprite {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 4px;
    image-rendering: pixelated;
}

/* 8-bit pixel art icons via box-shadow technique
   each "pixel" is 2x2 actual pixels, sprite is 16x16 logical = 32x32 css */

.icon-brain {
    background: transparent;
    box-shadow:
        /* row 0 */
        4px 0 0 #000, 6px 0 0 #000, 8px 0 0 #000, 10px 0 0 #000,
        /* row 2 */
        2px 4px 0 #000, 12px 4px 0 #000,
        4px 4px 0 #ffff00, 6px 4px 0 #ffff00, 8px 4px 0 #ffff00, 10px 4px 0 #ffff00,
        /* row 4 */
        0 8px 0 #000, 14px 8px 0 #000,
        2px 8px 0 #ffff00, 12px 8px 0 #ffff00,
        4px 8px 0 #fff, 6px 8px 0 #fff, 8px 8px 0 #fff, 10px 8px 0 #fff,
        /* row 6 */
        0 12px 0 #000, 14px 12px 0 #000,
        2px 12px 0 #ffff00, 12px 12px 0 #ffff00,
        4px 12px 0 #000, 6px 12px 0 #fff, 8px 12px 0 #fff, 10px 12px 0 #000,
        /* row 8 */
        0 16px 0 #000, 14px 16px 0 #000,
        2px 16px 0 #ffff00, 12px 16px 0 #ffff00,
        4px 16px 0 #fff, 6px 16px 0 #000, 8px 16px 0 #000, 10px 16px 0 #fff,
        /* row 10 */
        0 20px 0 #000, 14px 20px 0 #000,
        2px 20px 0 #ffff00, 12px 20px 0 #ffff00,
        4px 20px 0 #fff, 6px 20px 0 #fff, 8px 20px 0 #fff, 10px 20px 0 #fff,
        /* row 12 */
        2px 24px 0 #000, 12px 24px 0 #000,
        4px 24px 0 #ffff00, 6px 24px 0 #ffff00, 8px 24px 0 #ffff00, 10px 24px 0 #ffff00,
        /* row 14 */
        4px 28px 0 #000, 6px 28px 0 #000, 8px 28px 0 #000, 10px 28px 0 #000;
    width: 2px;
    height: 2px;
    margin-left: 14px;
}

.icon-map {
    background: transparent;
    box-shadow:
        14px 0 0 #ffff00,
        12px 4px 0 #ffff00, 16px 4px 0 #ffff00,
        4px 8px 0 #ffff00, 14px 8px 0 #ffff00, 24px 8px 0 #ffff00,
        2px 12px 0 #ffff00, 6px 12px 0 #ffff00, 14px 12px 0 #fff, 22px 12px 0 #ffff00, 26px 12px 0 #ffff00,
        4px 16px 0 #ffff00, 14px 16px 0 #fff, 24px 16px 0 #ffff00,
        6px 20px 0 #ffff00, 14px 20px 0 #fff, 22px 20px 0 #ffff00,
        8px 24px 0 #ffff00, 14px 24px 0 #ffff00, 20px 24px 0 #ffff00,
        10px 28px 0 #ffff00, 18px 28px 0 #ffff00, 14px 28px 0 #ffff00;
    width: 2px;
    height: 2px;
    margin-left: 14px;
}

.icon-doc {
    background: #fff;
    width: 24px;
    height: 28px;
    margin: 2px auto 6px;
    border: 2px solid #000;
    box-shadow:
        inset 0 6px 0 #c0c0c0,
        4px 4px 0 -2px #000, 8px 4px 0 -2px #000, 12px 4px 0 -2px #000, 16px 4px 0 -2px #000,
        4px 10px 0 -2px #000, 8px 10px 0 -2px #000, 12px 10px 0 -2px #000, 16px 10px 0 -2px #000,
        4px 14px 0 -2px #000, 8px 14px 0 -2px #000, 12px 14px 0 -2px #000,
        4px 18px 0 -2px #000, 8px 18px 0 -2px #000, 12px 18px 0 -2px #000, 16px 18px 0 -2px #000;
}

.icon-net {
    background: transparent;
    box-shadow:
        14px 0 0 #ffff00,
        4px 4px 0 #ffff00, 24px 4px 0 #ffff00,
        2px 8px 0 #fff, 14px 8px 0 #ffff00, 26px 8px 0 #fff,
        14px 12px 0 #fff,
        4px 16px 0 #fff, 14px 16px 0 #ffff00, 24px 16px 0 #fff,
        14px 20px 0 #fff,
        4px 24px 0 #ffff00, 14px 24px 0 #ffff00, 24px 24px 0 #ffff00,
        14px 28px 0 #ffff00;
    width: 2px;
    height: 2px;
    margin-left: 14px;
}

.icon-disk {
    background: #000;
    width: 28px;
    height: 28px;
    margin: 2px auto 4px;
    box-shadow:
        inset 4px 4px 0 #c0c0c0,
        inset -4px -4px 0 #808080,
        inset 6px 6px 0 #fff,
        inset -6px -16px 0 #fff;
}

.icon-trash {
    background: transparent;
    box-shadow:
        4px 0 0 #c0c0c0, 6px 0 0 #c0c0c0, 8px 0 0 #c0c0c0, 10px 0 0 #c0c0c0,
        2px 4px 0 #c0c0c0, 4px 4px 0 #fff, 6px 4px 0 #fff, 8px 4px 0 #fff, 10px 4px 0 #fff, 12px 4px 0 #c0c0c0,
        2px 8px 0 #000, 4px 8px 0 #c0c0c0, 6px 8px 0 #000, 8px 8px 0 #c0c0c0, 10px 8px 0 #000, 12px 8px 0 #c0c0c0,
        2px 12px 0 #000, 4px 12px 0 #c0c0c0, 6px 12px 0 #000, 8px 12px 0 #c0c0c0, 10px 12px 0 #000, 12px 12px 0 #c0c0c0,
        2px 16px 0 #000, 4px 16px 0 #c0c0c0, 6px 16px 0 #000, 8px 16px 0 #c0c0c0, 10px 16px 0 #000, 12px 16px 0 #c0c0c0,
        2px 20px 0 #000, 4px 20px 0 #c0c0c0, 6px 20px 0 #000, 8px 20px 0 #c0c0c0, 10px 20px 0 #000, 12px 20px 0 #c0c0c0,
        4px 24px 0 #000, 6px 24px 0 #000, 8px 24px 0 #000, 10px 24px 0 #000;
    width: 2px;
    height: 2px;
    margin-left: 14px;
}

.icon-label {
    display: block;
    margin-top: 4px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000000;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    line-height: 1.2;
    word-break: break-word;
}

/* ===================================================================
   WINDOWS -- beveled gray panels
   =================================================================== */

.win {
    position: absolute;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 1px 1px 0 #000000;
    width: 392px;
    color: #000000;
    user-select: none;
    z-index: 1;
}

.win::before {
    /* outer 1px black frame for crisp edge */
    content: "";
    position: absolute;
    inset: -3px;
    border: 1px solid #000000;
    pointer-events: none;
}

.win.is-focused {
    z-index: 100;
}

.win.is-hidden {
    display: none;
}

.win-small {
    width: 248px;
}

/* ---- title bar ---- */
.win-bar {
    display: flex;
    align-items: center;
    height: 24px;
    padding: 0 4px 0 4px;
    background: #000080;
    color: #ffffff;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 11px;
    cursor: move;
    user-select: none;
}

.win:not(.is-focused) .win-bar {
    background: #808080;
}

.win-bar-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    background: #ffff00;
    border: 1px solid #000;
    box-shadow:
        inset 2px 2px 0 #fff,
        inset -2px -2px 0 #808080;
    flex-shrink: 0;
}

.win-bar-title {
    flex: 1;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
}

.win-bar-buttons {
    display: flex;
    gap: 2px;
}

.win-btn {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.win-btn:active {
    border-color: #808080 #ffffff #ffffff #808080;
}

.win-btn-close {
    color: #000000;
}

/* ---- body ---- */
.win-body {
    background: #c0c0c0;
    padding: 8px;
    border-top: 2px solid;
    border-color: #ffffff;
    border-image: none;
}

.win-body-flush {
    padding: 0;
}

.win-body-pad {
    background: #ffffff;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    margin: 8px;
    padding: 8px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.4;
    color: #000000;
}

.win-heading {
    font-family: 'Press Start 2P', 'Silkscreen', monospace;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #000000;
}

.win-sub {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #000080;
    margin-bottom: 8px;
}

.win-text {
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.win-text-center {
    font-family: 'VT323', monospace;
    font-size: 18px;
    text-align: center;
    margin: 16px 0 8px;
}

.win-mini {
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    color: #000080;
    line-height: 1.6;
}

.win-mini-center {
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    color: #808080;
    text-align: center;
    margin-bottom: 8px;
}

.win-divider {
    height: 2px;
    background: linear-gradient(to bottom, #808080 0 1px, #ffffff 1px 2px);
    margin: 8px 0;
}

.win-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ---- pixel button ---- */
.pixel-btn {
    background: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    padding: 4px 12px;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 1px 1px 0 #000;
}

.pixel-btn:hover {
    background: #d0d0d0;
}

.pixel-btn:active {
    border-color: #808080 #ffffff #ffffff #808080;
    box-shadow: 0 0 0 #000;
    transform: translate(1px, 1px);
}

/* ---- status bar ---- */
.win-status {
    background: #c0c0c0;
    color: #000000;
    border-top: 2px solid;
    border-color: #808080 transparent transparent transparent;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 4px 8px;
    line-height: 1.6;
}

/* ===================================================================
   MIND MAP CANVAS
   =================================================================== */

.map-canvas {
    position: relative;
    width: 100%;
    height: 280px;
    background: #ffffff;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    margin: 8px;
    width: calc(100% - 16px);
    background-image:
        repeating-linear-gradient(0deg, transparent 0 7px, #d0d0d0 7px 8px),
        repeating-linear-gradient(90deg, transparent 0 7px, #d0d0d0 7px 8px);
    overflow: hidden;
}

.map-lines {
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: calc(100% - 24px);
    pointer-events: none;
}

.map-lines line {
    stroke: #000080;
    stroke-width: 2;
    stroke-dasharray: 2 2;
    shape-rendering: crispEdges;
}

.node {
    position: absolute;
    background: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 1px 1px 0 #000;
    padding: 4px 8px;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    min-width: 56px;
    height: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.node:hover {
    background: #ffff00;
}

.node.is-active {
    background: #ffff00;
    border-color: #000080 #000000 #000000 #000080;
    color: #000080;
}

.node-root {
    background: #000080;
    color: #ffffff;
    width: 64px;
}

.node-root:hover {
    background: #000080;
    color: #ffff00;
}

.node-root.is-active {
    background: #ffff00;
    color: #000080;
}

/* ===================================================================
   NOTEPAD LINES
   =================================================================== */

.notepad {
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.5;
}

.np-line {
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.np-num {
    display: inline-block;
    width: 32px;
    color: #808080;
}

.np-cursor::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 16px;
    background: #000000;
    vertical-align: middle;
    margin-left: 2px;
    animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
    to { visibility: hidden; }
}

/* ===================================================================
   BAR CHART (network monitor)
   =================================================================== */

.bar-chart {
    display: grid;
    grid-template-columns: 64px 1fr 40px;
    gap: 8px 8px;
    margin: 8px 0;
}

.bar-label,
.bar-pct {
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    line-height: 16px;
    color: #000000;
}

.bar-pct {
    text-align: right;
    color: #000080;
}

.bar {
    display: block;
    height: 16px;
    background: #ffffff;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    background:
        repeating-linear-gradient(90deg,
            #000080 0 6px,
            #000080 6px 6px,
            #c0c0c0 6px 8px);
    width: 0;
    transition: width 0.4s steps(8, end);
}

/* ===================================================================
   TASKBAR
   =================================================================== */

.taskbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    background: #c0c0c0;
    border-top: 2px solid;
    border-color: #ffffff;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    z-index: 1000;
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    background: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 1px 1px 0 #000;
}

.start-btn.is-active,
.start-btn:active {
    border-color: #808080 #ffffff #ffffff #808080;
    box-shadow: 0 0 0 #000;
}

.start-icon {
    width: 12px;
    height: 12px;
    background:
        repeating-conic-gradient(
            #ffff00 0deg 90deg,
            #ff8000 90deg 180deg,
            #008080 180deg 270deg,
            #000080 270deg 360deg);
    border: 1px solid #000;
}

.taskbar-tasks {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow: hidden;
    height: 24px;
}

.task-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    max-width: 144px;
    background: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
}

.task-btn.is-active {
    border-color: #808080 #ffffff #ffffff #808080;
    background: #d0d0d0;
}

.task-btn-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #ffff00;
    border: 1px solid #000;
    flex-shrink: 0;
}

.taskbar-tray {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 10px;
}

.tray-led {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00ff00;
    border: 1px solid #000;
    box-shadow: inset 1px 1px 0 #ffffff;
}

.tray-clock {
    color: #000000;
    min-width: 40px;
    text-align: center;
}

/* ===================================================================
   START MENU
   =================================================================== */

.start-menu {
    position: fixed;
    left: 4px;
    bottom: 36px;
    width: 200px;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 1px 1px 0 #000;
    display: flex;
    z-index: 2000;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
}

.start-menu[hidden] {
    display: none;
}

.start-menu-side {
    width: 24px;
    background: #000080;
    color: #ffffff;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    letter-spacing: 4px;
}

.start-menu-list {
    flex: 1;
    list-style: none;
    padding: 4px 0;
    margin: 0;
}

.start-menu-list li {
    display: block;
}

.start-menu-list button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: #000000;
    font-family: 'Silkscreen', 'Press Start 2P', monospace;
    font-size: 11px;
    padding: 6px 8px;
    cursor: pointer;
}

.start-menu-list button:hover {
    background: #000080;
    color: #ffffff;
}

.start-menu-sep {
    height: 2px;
    margin: 4px 4px;
    background: linear-gradient(to bottom, #808080 0 1px, #ffffff 1px 2px);
}

/* ===================================================================
   DRAG STATE
   =================================================================== */

.win.is-dragging {
    cursor: move;
}

.win.is-dragging .win-body,
.win.is-dragging .win-status {
    pointer-events: none;
}

/* ===================================================================
   REDUCED MOTION
   =================================================================== */

@media (prefers-reduced-motion: reduce) {
    .np-cursor::after { animation: none; }
    .bar-fill { transition: none; }
}

/* ===================================================================
   RESPONSIVE -- small viewports stack windows visibly
   =================================================================== */

@media (max-width: 720px) {
    .desktop-icons {
        flex-direction: row;
        flex-wrap: wrap;
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 4px;
    }
    .desktop-icon {
        width: 64px;
        height: 64px;
    }
    .win {
        position: relative;
        width: calc(100% - 16px) !important;
        margin: 8px;
        left: 0 !important;
        top: 0 !important;
    }
    .desktop {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 32px);
        padding-top: 80px;
        overflow-y: auto;
    }
}
