:root {
    --desktop-bg: #008080;
    /* Classic Teal */
    --win-gray: #c0c0c0;
    --win-gray-light: #dfdfdf;
    --win-gray-dark: #808080;
    --win-text: #000000;
    --win-blue: #000080;
    --win-white: #ffffff;
    --radar-green: #00ff00;
    --term-bg: #000000;
    --term-text: #00ff00;
    --chat-bg: #36393f;
    --chat-sidebar: #2f3136;
    --chat-text: #dcddde;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'VT323', monospace;
    background-color: var(--desktop-bg);
    overflow: hidden;
    height: 100vh;
    user-select: none;
}

/* Desktop Icons */
.desktop {
    height: calc(100vh - 40px);
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px;
}

.icon {
    width: 80px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.icon:hover .icon-img {
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.5));
}

.icon-img {
    font-size: 40px;
    margin-bottom: 5px;
}

.icon-label {
    color: white;
    text-shadow: 1px 1px 0 #000;
    font-size: 18px;
    padding: 2px 4px;
    text-align: center;
}

.icon.selected .icon-label {
    background-color: var(--win-blue);
    border: 1px dotted white;
}

/* Windows */
.window {
    position: absolute;
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-light);
    border-left: 2px solid var(--win-gray-light);
    border-right: 2px solid var(--win-gray-dark);
    border-bottom: 2px solid var(--win-gray-dark);
    box-shadow: 2px 2px 0 #000;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.title-bar {
    background: linear-gradient(90deg, var(--win-blue), #1084d0);
    padding: 3px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.title-bar-text {
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-left: 2px;
}

.title-bar-controls button {
    width: 20px;
    height: 20px;
    background-color: var(--win-gray);
    border-top: 1px solid var(--win-gray-light);
    border-left: 1px solid var(--win-gray-light);
    border-right: 1px solid var(--win-gray-dark);
    border-bottom: 1px solid var(--win-gray-dark);
    font-family: 'VT323', monospace;
    font-weight: bold;
    font-size: 14px;
    line-height: 14px;
    padding: 0;
    cursor: pointer;
}

.title-bar-controls button:active {
    border-top: 1px solid var(--win-gray-dark);
    border-left: 1px solid var(--win-gray-dark);
    border-right: 1px solid var(--win-gray-light);
    border-bottom: 1px solid var(--win-gray-light);
    padding-top: 2px;
    padding-left: 2px;
}

.window-body {
    padding: 15px;
    font-size: 18px;
    overflow: auto;
    max-height: 400px;
    flex-grow: 1;
}

/* Buttons (Generic) */
.btn {
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-light);
    border-left: 2px solid var(--win-gray-light);
    border-right: 2px solid var(--win-gray-dark);
    border-bottom: 2px solid var(--win-gray-dark);
    box-shadow: 1px 1px 0 #000;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 5px 15px;
    cursor: pointer;
}

.btn:active {
    border-top: 2px solid var(--win-gray-dark);
    border-left: 2px solid var(--win-gray-dark);
    border-right: 2px solid var(--win-gray-light);
    border-bottom: 2px solid var(--win-gray-light);
    box-shadow: none;
    transform: translate(1px, 1px);
}

/* Taskbar */
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-light);
    display: flex;
    align-items: center;
    padding: 3px;
    z-index: 10000;
}

.start-btn {
    height: 30px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 20px;
    padding: 0 10px;
    margin-right: 5px;
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-light);
    border-left: 2px solid var(--win-gray-light);
    border-right: 2px solid var(--win-gray-dark);
    border-bottom: 2px solid var(--win-gray-dark);
    box-shadow: 1px 1px 0 #000;
    cursor: pointer;
}

.start-btn:active {
    border-top: 2px solid var(--win-gray-dark);
    border-left: 2px solid var(--win-gray-dark);
    border-right: 2px solid var(--win-gray-light);
    border-bottom: 2px solid var(--win-gray-light);
    box-shadow: none;
}

.divider {
    flex-grow: 1;
    border-left: 2px solid var(--win-gray-dark);
    border-right: 2px solid var(--win-gray-light);
    height: 28px;
    margin: 0 5px;
}

.time-display {
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-dark);
    border-left: 2px solid var(--win-gray-dark);
    border-right: 2px solid var(--win-gray-light);
    border-bottom: 2px solid var(--win-gray-light);
    padding: 5px 15px;
    font-size: 18px;
    margin-right: 5px;
}

/* App Specific Styles */
.cow-logo {
    font-size: 60px;
    text-align: center;
}

/* Mail App */
.email-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
}

.email-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
    border: 2px solid var(--win-gray-dark);
    height: 150px;
    overflow-y: auto;
}

.email-item {
    padding: 2px 5px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    border-bottom: 1px dotted #ccc;
}

.email-item:hover {
    background-color: #eee;
}

.email-item.selected {
    background-color: var(--win-blue);
    color: white;
}

.email-item.unread {
    font-weight: bold;
}

.email-preview {
    background: white;
    border: 2px solid var(--win-gray-dark);
    padding: 10px;
    height: 200px;
    overflow-y: auto;
}

/* Cowculator */
.calc-display {
    width: 100%;
    margin-bottom: 10px;
    text-align: right;
    font-family: 'VT323', monospace;
    font-size: 24px;
    padding: 5px;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.calc-buttons button {
    height: 40px;
    font-size: 20px;
    background-color: var(--win-gray);
    border-top: 2px solid var(--win-gray-light);
    border-left: 2px solid var(--win-gray-light);
    border-right: 2px solid var(--win-gray-dark);
    border-bottom: 2px solid var(--win-gray-dark);
    cursor: pointer;
}

.calc-buttons button:active {
    border-top: 2px solid var(--win-gray-dark);
    border-left: 2px solid var(--win-gray-dark);
    border-right: 2px solid var(--win-gray-light);
    border-bottom: 2px solid var(--win-gray-light);
}

/* Sensors App */
.radar-screen {
    width: 300px;
    height: 300px;
    background-color: #000;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 4px solid var(--win-gray-dark);
    margin: 0 auto;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, rgba(0, 255, 0, 0), rgba(0, 255, 0, 1));
    transform-origin: 0 0;
    animation: sweep 4s linear infinite;
}

.radar-blip {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--radar-green);
    border-radius: 50%;
    animation: blip 2s infinite;
}

@keyframes sweep {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes blip {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Folder View */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 5px;
}

.folder-item:hover {
    background-color: rgba(0, 0, 128, 0.1);
}

.folder-icon {
    font-size: 30px;
}

.folder-name {
    font-size: 16px;
    word-break: break-word;
}

/* Terminal (Moo-DOS) */
.terminal {
    background-color: var(--term-bg);
    color: var(--term-text);
    font-family: 'VT323', monospace;
    padding: 10px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.terminal-output {
    white-space: pre-wrap;
    margin-bottom: 10px;
}

.terminal-input-line {
    display: flex;
    align-items: center;
}

.prompt {
    margin-right: 5px;
}

.terminal-input {
    background: transparent;
    border: none;
    color: var(--term-text);
    font-family: 'VT323', monospace;
    font-size: 18px;
    flex-grow: 1;
    outline: none;
}

/* Cud-Chat */
.chat-layout {
    display: flex;
    height: 100%;
    background-color: var(--chat-bg);
    color: var(--chat-text);
}

.chat-sidebar {
    width: 120px;
    background-color: var(--chat-sidebar);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.channel {
    padding: 5px;
    cursor: pointer;
    border-radius: 4px;
}

.channel:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.channel.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    display: flex;
    flex-direction: column;
}

.message-header {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.username {
    font-weight: bold;
    color: white;
}

.timestamp {
    font-size: 0.8em;
    color: #72767d;
}

.message-body {
    margin-top: 2px;
}