/* ============================================================
   Matt on Tech 95 — a Windows 95-flavored desktop environment
   ============================================================ */

:root {
    --face: #c0c0c0;
    --face-light: #dfdfdf;
    --white: #ffffff;
    --shadow: #808080;
    --dark: #000000;
    --title-a: #000080;
    --title-b: #1084d0;
    --title-off-a: #808080;
    --title-off-b: #b5b5b5;
    --desktop: #008080;
    --sel: #000080;
    /* Brighter than the wallpaper's darks and its blues, so selection reads. */
    --sel-strong: #2a6fd6;
    --sel-text: #ffffff;
    --font: Tahoma, Verdana, Geneva, "DejaVu Sans", sans-serif;
    --taskbar-h: 30px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 12px;
    color: #000;
    background: var(--desktop);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-font-smoothing: none;
}

/* ---------- Bevels ---------- */
.bevel-out {
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.bevel-in {
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--dark),
        inset -2px -2px 0 0 var(--face-light);
}

.bevel-thin-in {
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white);
}

/* ---------- Desktop ---------- */
#desktop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--taskbar-h);
    overflow: hidden;
    /* Teal stays as the fallback behind the wallpaper. */
    background-color: var(--desktop);
    background-image: url("ditheredbackground.png");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

#icons {
    position: absolute;
    top: 6px;
    left: 6px;
    bottom: 6px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 2px;
}

.d-icon {
    width: 84px;
    padding: 4px 2px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font: inherit;
    color: #fff;
    cursor: default;
    text-align: center;
    text-decoration: none;
}

.d-icon .ico {
    width: 32px;
    height: 32px;
    flex: none;
}

.d-icon .label {
    padding: 1px 3px;
    line-height: 1.25;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, .6);
    border: 1px dotted transparent;
}

.d-icon:focus {
    outline: none;
}

.d-icon.selected .ico {
    filter: brightness(1.06) drop-shadow(0 0 3px rgba(0, 0, 0, .95));
}

.d-icon.selected .label,
.d-icon:focus-visible .label {
    background: var(--sel-strong);
    border-style: solid;
    border-color: #fff;
    color: #fff;
    text-shadow: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .9);
}

/* ---------- Windows ---------- */
.win {
    position: absolute;
    display: none;
    flex-direction: column;
    min-width: 240px;
    min-height: 140px;
    background: var(--face);
    padding: 3px;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.win.open {
    display: flex;
}

.win.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.title-bar {
    flex: none;
    height: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 2px 0 3px;
    background: linear-gradient(90deg, var(--title-a), var(--title-b));
    color: #fff;
    font-weight: bold;
    cursor: default;
    touch-action: none;
}

.win:not(.active) .title-bar {
    background: linear-gradient(90deg, var(--title-off-a), var(--title-off-b));
}

.title-bar .ico {
    width: 16px;
    height: 16px;
    flex: none;
}

.title-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-btns {
    display: flex;
    gap: 2px;
    flex: none;
}

.tb-btn {
    width: 16px;
    height: 14px;
    padding: 0;
    border: none;
    background: var(--face);
    font: inherit;
    cursor: default;
    display: grid;
    place-items: center;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow);
}

.tb-btn:active {
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--shadow);
}

.tb-btn svg {
    width: 7px;
    height: 7px;
    fill: #000;
}

.tb-close {
    margin-left: 2px;
}

/* Menu bar */
.menu-bar {
    flex: none;
    display: flex;
    gap: 2px;
    padding: 2px 1px;
}

.menu-bar span {
    padding: 1px 6px;
    cursor: default;
}

.menu-bar span:hover {
    background: var(--sel);
    color: #fff;
}

.menu-bar u {
    text-decoration: underline;
}

/* Toolbars */
.toolbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 4px;
    border-top: 1px solid var(--white);
    border-bottom: 1px solid var(--shadow);
}

.toolbar label {
    color: #222;
}

.addr {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 2px 4px;
    background: #fff;
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--dark),
        inset -2px -2px 0 0 var(--face-light);
}

.addr .ico {
    width: 14px;
    height: 14px;
    flex: none;
}

.addr span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-tool {
    padding: 2px 7px;
    background: var(--face);
    border: none;
    font: inherit;
    cursor: default;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.tb-tool:active {
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--shadow);
}

/* Window body */
.win-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #fff;
    user-select: text;
    -webkit-user-select: text;
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--dark),
        inset -2px -2px 0 0 var(--face-light);
}

.pad {
    padding: 18px 22px 26px;
}

/* Status bar */
.status-bar {
    flex: none;
    display: flex;
    gap: 2px;
    margin-top: 3px;
}

.status-panel {
    padding: 2px 5px;
    background: var(--face);
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-panel:first-child {
    flex: 1;
}

/* Resize grip */
.grip {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    touch-action: none;
    background:
        linear-gradient(135deg, transparent 0 48%, var(--white) 48% 58%, var(--shadow) 58% 68%, transparent 68%),
        linear-gradient(135deg, transparent 0 68%, var(--white) 68% 78%, var(--shadow) 78% 88%, transparent 88%);
}

.win.maximized .grip {
    display: none;
}

/* ---------- Page content inside the "browser" ---------- */
.page {
    font-size: 13px;
    line-height: 1.6;
    color: #000;
}

.page a {
    color: #0000ee;
}

.page a:visited {
    color: #551a8b;
}

.hero {
    text-align: center;
    margin-bottom: 18px;
}

.hero img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 14px;
    border: 1px solid #000;
    outline: 2px solid #000;
    outline-offset: 3px;
}

.hero h1 {
    font-size: 24px;
    margin: 0 0 4px;
}

.hero .kicker {
    font-size: 13px;
    color: #333;
    margin: 0;
}

.rule {
    height: 2px;
    margin: 16px 0;
    background: none;
    border: none;
    box-shadow: inset 0 1px 0 0 var(--shadow), inset 0 -1px 0 0 var(--white);
}

.page p {
    margin: 0 0 14px;
}

.page h2 {
    font-size: 15px;
    margin: 20px 0 8px;
}

.linkrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 4px;
}

.linkrow a {
    padding: 4px 12px;
    background: var(--face);
    color: #000;
    text-decoration: none;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.linkrow a:active {
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--shadow);
}

.retro-note {
    margin-top: 22px;
    text-align: center;
    color: #666;
    font-size: 11px;
}

/* Book page */
.book-head {
    display: flex;
    align-items: center;
    gap: 20px;
}

.book-cover {
    flex: none;
    width: 175px;
    height: auto;
    display: block;
    border: 1px solid #000;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, .35);
}

@media (max-width: 760px) {
    .book-head {
        gap: 14px;
    }

    .book-cover {
        width: 118px;
    }
}

/* Notepad */
.notepad {
    /* Courier New is thin and small on screen; these render far better. */
    font-family: "Lucida Console", Menlo, Monaco, Consolas, "DejaVu Sans Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.75;
    color: #000;
    padding: 16px 20px 22px;
}

.notepad p {
    margin: 0 0 1.25em;
}

.notepad p:last-child {
    margin-bottom: 0;
}

.notepad h2 {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin: 2em 0 .7em;
    padding-bottom: .45em;
    border-bottom: 1px dashed #999;
}

/* ---------- Folder / file list ---------- */
.file-list {
    list-style: none;
    margin: 0;
    padding: 4px;
}

.file-list li + li {
    margin-top: 1px;
}

.file-list a {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 5px 7px;
    text-decoration: none;
    color: #000;
    border: 1px dotted transparent;
}

.file-list a:hover,
.file-list a:focus-visible {
    background: var(--sel);
    color: var(--sel-text);
    border-color: #fff;
    outline: none;
}

.file-list .ico {
    width: 24px;
    height: 24px;
    flex: none;
    margin-top: 1px;
}

.file-text {
    min-width: 0;
}

.file-name {
    display: block;
}

.file-meta {
    display: block;
    font-size: 11px;
    color: #444;
}

.file-list a:hover .file-meta,
.file-list a:focus-visible .file-meta {
    color: #cfd8ff;
}

/* Info box (Win95 message style) */
.infobox {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 10px;
    padding: 14px;
    background: var(--face);
    box-shadow:
        inset -1px -1px 0 0 var(--shadow),
        inset 1px 1px 0 0 var(--white);
}

.infobox .ico {
    width: 32px;
    height: 32px;
    flex: none;
}

.infobox p {
    margin: 0 0 8px;
    line-height: 1.55;
}

.infobox p:last-child {
    margin-bottom: 0;
}

/* ---------- Games ---------- */
.game-body {
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 7px;
    background: var(--face);
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--dark),
        inset -2px -2px 0 0 var(--face-light);
}

.game-body canvas {
    display: block;
    max-width: 100%;
    height: auto;
    background: #0b1020;
    box-shadow: 0 0 0 2px #000;
}

/* Minesweeper */
.ms-panel {
    padding: 6px;
    background: var(--face);
    box-shadow:
        inset -1px -1px 0 0 var(--shadow),
        inset 1px 1px 0 0 var(--white);
}

.ms-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px;
    margin-bottom: 6px;
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white);
}

.ms-lcd {
    font-family: "Lucida Console", Menlo, Consolas, monospace;
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #ff2d2d;
    background: #000;
    padding: 1px 5px;
}

.ms-face {
    width: 27px;
    height: 27px;
    padding: 0;
    border: none;
    font-size: 15px;
    line-height: 1;
    background: var(--face);
    cursor: default;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.ms-face:active {
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white);
}

.ms-grid {
    display: grid;
    grid-template-columns: repeat(9, 22px);
    grid-auto-rows: 22px;
    padding: 3px;
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--dark);
}

.ms-cell {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    display: grid;
    place-items: center;
    font: bold 13px/1 "Lucida Console", Menlo, Consolas, monospace;
    background: var(--face);
    color: #000;
    cursor: default;
    box-shadow:
        inset -1px -1px 0 0 var(--shadow),
        inset 1px 1px 0 0 var(--white);
}

.ms-cell.open {
    background: #bdbdbd;
    box-shadow: inset 1px 1px 0 0 #9a9a9a;
}

.ms-cell.mine {
    background: #d94f4f;
    color: #000;
}

.ms-cell.flag {
    color: #c40000;
}

.ms-n1 { color: #0000ff; }
.ms-n2 { color: #007b00; }
.ms-n3 { color: #ff0000; }
.ms-n4 { color: #000084; }
.ms-n5 { color: #840000; }
.ms-n6 { color: #007b7b; }
.ms-n7 { color: #000000; }
.ms-n8 { color: #808080; }

/* ---------- Taskbar ---------- */
#taskbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--taskbar-h);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 3px;
    background: var(--face);
    box-shadow: inset 0 1px 0 0 var(--white), inset 0 2px 0 0 var(--face-light);
    z-index: 9000;
}

#start-btn {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 23px;
    padding: 0 7px 0 4px;
    background: var(--face);
    border: none;
    font: inherit;
    font-weight: bold;
    cursor: default;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

#start-btn .ico {
    width: 17px;
    height: 17px;
}

#start-btn.on {
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--shadow);
}

.tb-sep {
    flex: none;
    width: 2px;
    height: 20px;
    box-shadow: inset 1px 0 0 0 var(--shadow), inset -1px 0 0 0 var(--white);
}

#tasks {
    flex: 1;
    display: flex;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

.task-btn {
    flex: 0 1 158px;
    min-width: 0;
    height: 23px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 6px;
    background: var(--face);
    border: none;
    font: inherit;
    text-align: left;
    cursor: default;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

.task-btn .ico {
    width: 15px;
    height: 15px;
    flex: none;
}

.task-btn span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.task-btn.active {
    font-weight: bold;
    box-shadow:
        inset 1px 1px 0 0 var(--dark),
        inset -1px -1px 0 0 var(--white),
        inset 2px 2px 0 0 var(--shadow);
}

#tray {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 23px;
    padding: 0 8px;
    box-shadow:
        inset 1px 1px 0 0 var(--shadow),
        inset -1px -1px 0 0 var(--white);
}

#clock {
    font-variant-numeric: tabular-nums;
}

/* ---------- Start menu ---------- */
#start-menu {
    position: absolute;
    left: 3px;
    bottom: var(--taskbar-h);
    width: 218px;
    display: none;
    background: var(--face);
    padding: 3px;
    z-index: 9500;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

#start-menu.open {
    display: flex;
}

.sm-banner {
    flex: none;
    width: 24px;
    background: linear-gradient(0deg, var(--title-b), var(--title-a));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 9px;
    overflow: hidden;
}

.sm-banner b {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    color: #fff;
    font-size: 15px;
    letter-spacing: .5px;
    line-height: 1;
}

.sm-items {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sm-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 16px 5px 6px;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    color: #000;
    cursor: default;
    text-decoration: none;
}

.sm-item .ico {
    width: 24px;
    height: 24px;
    flex: none;
}

.sm-item:hover,
.sm-item:focus-visible {
    background: var(--sel);
    color: #fff;
    outline: none;
}

.sm-rule {
    height: 2px;
    margin: 3px 2px;
    box-shadow: inset 0 1px 0 0 var(--shadow), inset 0 -1px 0 0 var(--white);
}

/* ---------- Shutdown screen ---------- */
#shutdown {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    background: #000;
    color: #ffa500;
    font-size: 20px;
    text-align: center;
    padding: 20px;
    z-index: 10000;
}

#shutdown.on {
    display: flex;
}

#shutdown button {
    font: inherit;
    font-size: 13px;
    padding: 6px 16px;
    background: var(--face);
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow:
        inset -1px -1px 0 0 var(--dark),
        inset 1px 1px 0 0 var(--white),
        inset -2px -2px 0 0 var(--shadow),
        inset 2px 2px 0 0 var(--face-light);
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
    #icons {
        bottom: auto;
        max-height: none;
    }

    .d-icon {
        width: 76px;
    }

    .pad {
        padding: 14px 15px 20px;
    }

    .hero img {
        width: 120px;
        height: 120px;
    }

    .task-btn {
        flex: 1 1 0;
    }
}
