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

:root {
    --bg-blue: #0000AA;
    --title-blue: #0000FF;
    --white: #FFFFFF;
    --black: #000000;
    --cyan: #00FFFF;
    --magenta: #FF00FF;
    --green: #00FF00;
    --yellow: #FFFF00;
}

body {
    font-family: 'VT323', 'IBM Plex Mono', monospace;
    background: var(--bg-blue);
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

.berrryos {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: var(--bg-blue);
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.1) 2px,
            rgba(0,0,0,0.1) 4px
        );
}

.desktop {
    width: 100%;
    height: calc(100% - 40px);
    position: relative;
    overflow: hidden;
}

/* Window Styles */
.window {
    position: absolute;
    background: var(--white);
    border: 3px solid var(--black);
    box-shadow: 
        4px 4px 0 var(--black),
        inset -2px -2px 0 #808080,
        inset 2px 2px 0 #DFDFDF;
    display: flex;
    flex-direction: column;
    min-width: 150px;
    min-height: 100px;
}

.window.maximized {
    border: none;
    box-shadow: none;
}

.window-titlebar {
    background: var(--title-blue);
    color: var(--white);
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--black);
}

.window-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.window-controls {
    display: flex;
    gap: 2px;
}

.window-btn {
    width: 18px;
    height: 16px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--black);
    font-family: inherit;
}

.window-btn:active {
    border-style: inset;
}

.window-menubar {
    background: var(--white);
    border-bottom: 1px solid var(--black);
    display: flex;
    padding: 2px;
}

.menu-item {
    position: relative;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 14px;
}

.menu-item:hover {
    background: var(--title-blue);
    color: var(--white);
}

.menu-label {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border: 2px solid var(--black);
    box-shadow: 2px 2px 0 var(--black);
    z-index: 1000;
    min-width: 120px;
}

.menu-dropdown-item {
    padding: 4px 16px;
    font-size: 14px;
    cursor: pointer;
}

.menu-dropdown-item:hover {
    background: var(--title-blue);
    color: var(--white);
}

.window-content {
    flex: 1;
    overflow: auto;
    background: var(--white);
}

.window-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: 
        linear-gradient(135deg, transparent 50%, #808080 50%, #808080 60%, transparent 60%),
        linear-gradient(135deg, transparent 70%, #808080 70%, #808080 80%, transparent 80%);
}

/* File Manager */
.file-manager {
    padding: 4px;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.drive-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-bottom: 1px solid var(--black);
    margin-bottom: 4px;
}

.drive-btn {
    background: var(--white);
    border: 2px outset #DFDFDF;
    padding: 2px 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}

.drive-btn.active {
    background: var(--title-blue);
    color: var(--white);
    border-style: inset;
}

.path {
    font-size: 12px;
    color: #666;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    border: 2px inset #808080;
    background: var(--white);
}

.file-item {
    padding: 2px 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'IBM Plex Mono', monospace;
}

.file-item:hover {
    background: var(--title-blue);
    color: var(--white);
}

/* Notepad */
.notepad {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.notepad-textarea {
    flex: 1;
    width: 100%;
    border: none;
    padding: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    background: var(--white);
}

/* Calculator */
.calculator {
    padding: 8px;
    background: #C0C0C0;
    height: 100%;
}

.calc-display {
    background: #9EBE8E;
    border: 2px inset #808080;
    padding: 8px;
    font-size: 20px;
    text-align: right;
    margin-bottom: 8px;
    font-family: 'IBM Plex Mono', monospace;
    min-height: 36px;
}

.calc-btn.clear {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px;
    background: #FF6B6B;
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

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

.calc-btn {
    padding: 12px;
    font-size: 16px;
    border: 2px outset #DFDFDF;
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
}

.calc-btn:active {
    border-style: inset;
}

.calc-btn.operator {
    background: #FFE4B5;
}

.calc-btn.equals {
    background: var(--cyan);
}

/* Clock */
.clock-app {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg-blue);
}

.digital-clock {
    text-align: center;
}

.clock-time {
    font-size: 48px;
    color: var(--green);
    text-shadow: 0 0 10px var(--green);
    font-family: 'IBM Plex Mono', monospace;
}

.clock-date {
    font-size: 14px;
    color: var(--cyan);
    margin-top: 8px;
}

.analog-clock {
    width: 160px;
    height: 160px;
}

.clock-face {
    width: 100%;
    height: 100%;
    background: var(--white);
    border-radius: 50%;
    border: 4px solid var(--black);
    position: relative;
}

.clock-number {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
}

.n12 { top: 8px; left: 50%; transform: translateX(-50%); }
.n3 { top: 50%; right: 8px; transform: translateY(-50%); }
.n6 { bottom: 8px; left: 50%; transform: translateX(-50%); }
.n9 { top: 50%; left: 8px; transform: translateY(-50%); }

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    background: var(--black);
}

.hour-hand {
    width: 4px;
    height: 40px;
    margin-left: -2px;
}

.minute-hand {
    width: 3px;
    height: 55px;
    margin-left: -1.5px;
}

.second-hand {
    width: 1px;
    height: 60px;
    background: red;
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--black);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.clock-toggle {
    margin-top: 16px;
    padding: 8px 16px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
}

/* Paint */
.paint-app {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #C0C0C0;
}

.paint-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    border-bottom: 2px solid var(--black);
}

.color-btn {
    width: 24px;
    height: 24px;
    border: 2px outset #DFDFDF;
    cursor: pointer;
}

.color-btn.active {
    border-style: inset;
}

.tool-btn {
    padding: 4px 8px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}

.paint-canvas {
    flex: 1;
    display: block;
    margin: 4px;
    border: 2px inset #808080;
    cursor: crosshair;
}

/* Reversi */
.reversi-app {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: #2E7D32;
}

.reversi-status {
    color: var(--white);
    margin-bottom: 8px;
    font-size: 14px;
}

.reversi-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    background: var(--black);
    border: 2px solid var(--black);
    width: fit-content;
}

.reversi-cell {
    width: 28px;
    height: 28px;
    background: #388E3C;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.reversi-cell:hover {
    background: #4CAF50;
}

.reversi-piece {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3);
}

.reversi-piece.black {
    background: var(--black);
}

.reversi-piece.white {
    background: var(--white);
}

.reversi-reset {
    margin-top: 8px;
    padding: 8px 16px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
}

/* AI App Generator */
.ai-app-generator {
    height: 100%;
    padding: 8px;
    font-size: 12px;
    background: var(--black);
    color: var(--green);
    font-family: 'IBM Plex Mono', monospace;
}

.ai-status {
    margin-bottom: 8px;
    color: var(--cyan);
}

.ai-code {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 10px;
    max-height: calc(100% - 30px);
    overflow-y: auto;
}

.ai-loading {
    font-family: 'IBM Plex Mono', monospace;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Taskbar */
.taskbar {
    height: 40px;
    background: #C0C0C0;
    border-top: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
}

.taskbar-apps {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
}

.taskbar-btn {
    padding: 4px 12px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    white-space: nowrap;
}

.taskbar-btn.active {
    border-style: inset;
    background: #E0E0E0;
}

.taskbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.taskbar-clock {
    background: #E0E0E0;
    border: 2px inset #808080;
    padding: 4px 8px;
    font-size: 14px;
    font-family: 'IBM Plex Mono', monospace;
}

/* Boot Screen */
.boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black);
    color: #AAAAAA;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    padding: 20px;
    overflow: hidden;
}

.boot-line {
    margin-bottom: 2px;
    white-space: pre;
}

.boot-cursor {
    animation: blink 0.5s infinite;
    color: #AAAAAA;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* About Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.about-dialog {
    background: var(--white);
    border: 3px solid var(--black);
    box-shadow: 4px 4px 0 var(--black);
    padding: 16px;
    width: 300px;
    text-align: center;
}

.about-header {
    background: var(--title-blue);
    color: var(--white);
    margin: -16px -16px 16px -16px;
    padding: 8px;
    font-size: 14px;
}

.about-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.about-content {
    font-size: 12px;
    text-align: left;
    margin-bottom: 16px;
}

.about-content p {
    margin-bottom: 4px;
}

.about-credits {
    color: #666;
    font-style: italic;
}

.about-ok {
    padding: 8px 32px;
    background: var(--white);
    border: 2px outset #DFDFDF;
    cursor: pointer;
    font-family: inherit;
}

/* Footer */
.berrry-footer {
    position: fixed;
    bottom: 44px;
    right: 8px;
    z-index: 9999;
}

.berrry-footer a {
    color: var(--cyan);
    text-decoration: none;
    font-size: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.berrry-footer a:hover {
    opacity: 1;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .window {
        border-width: 2px;
    }
    
    .window-titlebar {
        padding: 4px 8px;
    }
    
    .taskbar {
        height: 50px;
    }
    
    .taskbar-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .berrry-footer {
        bottom: 54px;
    }
    
    .reversi-cell {
        width: 36px;
        height: 36px;
    }
    
    .reversi-piece {
        width: 28px;
        height: 28px;
    }
    
    .calc-btn {
        padding: 16px;
        font-size: 18px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: #C0C0C0;
    border: 1px solid var(--black);
}

::-webkit-scrollbar-thumb {
    background: var(--white);
    border: 2px outset #DFDFDF;
}

::-webkit-scrollbar-button {
    background: var(--white);
    border: 2px outset #DFDFDF;
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-corner {
    background: #C0C0C0;
}