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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    user-select: none;
    background: #0a0a1a;
}

.boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a1a;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
    visibility: visible;
    opacity: 1;
}

.boot-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.boot-logo {
    width: 150px;
    height: 150px;
    margin-bottom: 40px;
    animation: spin 5s linear infinite;
}

.boot-progress-bar-container {
    width: 250px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

.boot-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3498DB, #2980B9, #9B59B6);
    border-radius: 4px;
    animation: boot-progress 3.5s ease-out forwards;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes boot-progress {
    from { width: 0%; }
    to { width: 100%; }
}

.desktop {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.wallpaper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('frutiger_wallpaper.png');
    background-size: cover;
    z-index: 1;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 32px;
    background: rgba(210, 225, 255, 0.6);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    color: #1a1a1a;
    font-size: 14px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.os-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.os-name {
    font-weight: 600;
}

.current-time {
    font-weight: 500;
}

.system-indicators {
    display: flex;
    gap: 8px;
}

.indicator {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

.wifi {
    background: linear-gradient(45deg, #00ff88, #00aaff);
}

.battery {
    background: linear-gradient(45deg, #88ff00, #00aaff);
}

.desktop-icons {
    position: absolute;
    top: 50px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0 16px;
    height: calc(100vh - 120px); /* Adjust height to prevent overflow and leave space for dock */
    max-width: 100vw;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    width: 100px;
    text-align: center;
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transform: scale(1.05);
}

.desktop-icon img {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.desktop-icon span {
    font-size: 12px;
    font-weight: 500;
}

.dock {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 8px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 100;
}

.dock-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    -webkit-box-reflect: below 2px linear-gradient(transparent, transparent 70%, rgba(255,255,255,0.3));
}

.dock-icon:hover {
    transform: translateY(-10px) scale(1.1);
}

.app-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.finder-icon {
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    position: relative;
}

.finder-icon::after {
    content: '📁';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.terminal-icon {
    background: linear-gradient(135deg, #2C3E50, #34495E);
    position: relative;
}

.terminal-icon::after {
    content: '💻';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.calculator-icon {
    background: linear-gradient(135deg, #FF6B6B, #E74C3C);
    position: relative;
}

.calculator-icon::after {
    content: '🧮';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.notes-icon {
    background: linear-gradient(135deg, #F39C12, #E67E22);
    position: relative;
}

.notes-icon::after {
    content: '📝';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.browser-icon {
    background: linear-gradient(135deg, #3498DB, #2980B9);
    position: relative;
}

.browser-icon::after {
    content: '🌐';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.music-icon {
    background: linear-gradient(135deg, #9B59B6, #8E44AD);
    position: relative;
}

.music-icon::after {
    content: '🎵';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.settings-icon {
    background: linear-gradient(135deg, #95A5A6, #7F8C8D);
    position: relative;
}

.settings-icon::after {
    content: '⚙️';
    font-size: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.window {
    position: absolute;
    background: rgba(240, 245, 255, 0.7);
    backdrop-filter: blur(30px);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    min-width: 400px;
    min-height: 300px;
    z-index: 50;
    overflow: hidden;
    resize: none;
}

.window.active {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    z-index: 60;
}

.window-header {
    height: 40px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.6), rgba(200,210,230,0.6));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    cursor: move;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

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

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.window-control:hover {
    opacity: 0.7;
}

.close { background: #FF5F57; }
.minimize { background: #FFBD2E; }
.maximize { background: #28CA42; }

.window-title {
    font-weight: 600;
    font-size: 14px;
    color: #222;
    text-shadow: 0 1px 1px rgba(255,255,255,0.7);
}

.window-content {
    padding: 10px;
    height: calc(100% - 40px);
    overflow: auto;
    background-color: rgba(255, 255, 255, 0.2);
}

.window[data-app="websim"] .window-content {
    padding: 0;
}

.window[data-app="ai_chat"] .window-content {
    padding: 0;
    overflow: hidden;
}

.window[data-app="drawing_pad"] .window-content,
.window[data-app="snake_game"] .window-content {
    padding: 10px;
    overflow: hidden;
}

.ai-chat-app {
    display: flex;
    height: 100%;
    width: 100%;
}

.chat-sidebar {
    width: 200px;
    background: rgba(220, 225, 235, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.4);
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #007aff;
    background: linear-gradient(to bottom, #007fff, #006ae0);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: linear-gradient(to bottom, #108aff, #0075f0);
}

.chat-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}

.chat-list-item {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.chat-list-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.chat-list-item.active {
    background: #007aff;
    color: white;
}

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

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

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.5;
}

.user-message {
    background: #007aff;
    color: white;
    border-top-right-radius: 4px;
    align-self: flex-end;
}

.ai-message {
    background: #e5e5ea;
    color: #000;
    border-top-left-radius: 4px;
    align-self: flex-start;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex-grow: 1;
    padding: 10px;
    border-radius: 15px;
    border: 1px solid #ccc;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

.chat-send-btn {
    padding: 8px 15px;
    border-radius: 15px;
    border: none;
    background: #007aff;
    color: white;
    font-weight: 500;
    cursor: pointer;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.welcome-message {
    text-align: center;
    margin: auto;
    color: #666;
}

.welcome-message h2 {
    margin-bottom: 10px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    align-self: flex-start;
}

.loading-indicator .dot-pulse {
    position: relative;
    left: -9999px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #999;
    color: #999;
    box-shadow: 9999px 0 0 -5px;
    animation: dot-pulse 1.5s infinite linear;
    animation-delay: .25s;
}

.loading-indicator .dot-pulse::before, .loading-indicator .dot-pulse::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #999;
    color: #999;
}

.loading-indicator .dot-pulse::before {
    box-shadow: 9984px 0 0 -5px;
    animation: dot-pulse-before 1.5s infinite linear;
    animation-delay: 0s;
}

.loading-indicator .dot-pulse::after {
    box-shadow: 10014px 0 0 -5px;
    animation: dot-pulse-after 1.5s infinite linear;
    animation-delay: .5s;
}

@keyframes dot-pulse-before {
    0% { box-shadow: 9984px 0 0 -5px; }
    30% { box-shadow: 9984px 0 0 2px; }
    60%, 100% { box-shadow: 9984px 0 0 -5px; }
}

@keyframes dot-pulse {
    0% { box-shadow: 9999px 0 0 -5px; }
    30% { box-shadow: 9999px 0 0 2px; }
    60%, 100% { box-shadow: 9999px 0 0 -5px; }
}

@keyframes dot-pulse-after {
    0% { box-shadow: 10014px 0 0 -5px; }
    30% { box-shadow: 10014px 0 0 2px; }
    60%, 100% { box-shadow: 10014px 0 0 -5px; }
}

@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.window {
    animation: windowOpen 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(0, 123, 255, 0.2);
}

.resize-n {
    top: -3px;
    left: 6px;
    right: 6px;
    height: 6px;
    cursor: n-resize;
}

.resize-s {
    bottom: -3px;
    left: 6px;
    right: 6px;
    height: 6px;
    cursor: s-resize;
}

.resize-e {
    top: 6px;
    right: -3px;
    bottom: 6px;
    width: 6px;
    cursor: e-resize;
}

.resize-w {
    top: 6px;
    left: -3px;
    bottom: 6px;
    width: 6px;
    cursor: w-resize;
}

.resize-ne {
    top: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    cursor: ne-resize;
}

.resize-nw {
    top: -3px;
    left: -3px;
    width: 12px;
    height: 12px;
    cursor: nw-resize;
}

.resize-se {
    bottom: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    cursor: se-resize;
}

.resize-sw {
    bottom: -3px;
    left: -3px;
    width: 12px;
    height: 12px;
    cursor: sw-resize;
}

.sound-setting-item, .privacy-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    color: #333;
}

.sound-setting-item:last-child, .privacy-setting-item:last-child {
    border-bottom: none;
}

.sound-setting-item input[type="range"] {
    width: 150px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #28CA42;
}

input:focus + .slider {
    box-shadow: 0 0 1px #28CA42;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    color: #333;
    transition: opacity 0.3s ease;
}

.setting-item:last-of-type {
     border-bottom: none;
}

.writing-assist-toolbar {
    position: fixed !important;
    display: none;
    flex-direction: row;
    background: rgba(40, 40, 40, 0.95) !important;
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 10000 !important;
    gap: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    pointer-events: auto;
}

.writing-assist-toolbar button {
    background: rgba(70, 70, 70, 0.8) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: white !important;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    pointer-events: auto;
}

.writing-assist-toolbar button:hover {
    background: rgba(90, 90, 90, 0.9) !important;
}

.writing-assist-toolbar button:active {
    background: rgba(110, 110, 110, 0.9) !important;
}

.wplace-header-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: #007aff;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.wplace-header-btn:hover {
    background: #006ae0;
}

.wplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.wplace-app-card {
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.wplace-app-card img {
    width: 64px;
    height: 64px;
    border-radius: 12px;
}

.wplace-app-card h4 {
    color: #333;
    font-size: 16px;
    margin: 0;
}

.wplace-app-card p {
    color: #555;
    font-size: 13px;
    flex-grow: 1;
}

.wplace-get-btn {
    padding: 6px 14px;
    border-radius: 15px;
    border: none;
    background: #e0e0e0;
    color: #333;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.wplace-get-btn:hover {
    background: #d0d0d0;
}

.wplace-get-btn.installed {
    background: #4CAF50;
    color: white;
    cursor: default;
}

.wplace-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin: 20px auto;
}

.wplace-form label {
    font-weight: 500;
    color: #444;
}

.wplace-form input, .wplace-form textarea, .wplace-form select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 14px;
}

@media (max-width: 768px) {
    .dock {
        bottom: 10px;
        padding: 8px 12px;
    }
    
    .dock-icon {
        width: 48px;
        height: 48px;
    }
    
    .app-icon {
        width: 40px;
        height: 40px;
    }
    
    .desktop-icon img {
        width: 48px;
        height: 48px;
    }
}