:root {
    --bg-color: #0f172a;
    --taskbar-bg: rgba(30, 41, 59, 0.8);
    --text-color: #f8fafc;
    --accent-color: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    background-image: url('image/Wallpaper.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#desktop {
    width: 100%;
    height: 100%;
    position: relative;
    padding: 20px;
}

.desktop-icons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-wrap: wrap;
    max-height: calc(100% - 60px);
}

.icon {
    width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.icon-img {
    font-size: 40px;
    margin-bottom: 5px;
}

.icon-label {
    font-size: 12px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: var(--taskbar-bg);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
}

.start-btn {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}

.start-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.clock {
    font-size: 14px;
    font-weight: 500;
}

/* Window Styles */
.window {
    position: absolute;
    top: 50px;
    left: 100px;
    width: 600px;
    height: 400px;
    background-color: #1e293b;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    /* Base z-index above widgets */
}

.window-header {
    height: 30px;
    background-color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    cursor: move;
}

.window-title {
    font-size: 12px;
}

.window-controls div {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 5px;
    cursor: pointer;
}

.close-btn {
    background-color: #ef4444;
}

.min-btn {
    background-color: #f59e0b;
}

.max-btn {
    background-color: #22c55e;
}

.window-content {
    flex: 1;
    padding: 20px;
    color: #cbd5e1;
    overflow: auto;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    border-bottom-right-radius: 8px;
}

/* Launch Modal */
.launch-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.launch-modal {
    background-color: #1e293b;
    padding: 24px;
    border-radius: 12px;
    width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.launch-modal h3 {
    margin-bottom: 20px;
    color: #f8fafc;
    font-size: 18px;
}

.launch-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: background-color 0.2s;
    text-decoration: none;
    color: white;
}

.launch-btn.primary {
    background-color: #3b82f6;
}

.launch-btn.primary:hover {
    background-color: #2563eb;
}

.launch-btn.secondary {
    background-color: #334155;
}

.launch-btn.secondary:hover {
    background-color: #475569;
}

.recommended-tag {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 5px;
    font-style: italic;
}

/* Start Menu */
#start-menu {
    position: absolute;
    bottom: 60px;
    /* Just above taskbar */
    left: 10px;
    width: 320px;
    background-color: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: slideUp 0.2s ease-out;
}

#start-menu.show {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-section {
    display: flex;
    align-items: center;
    padding-bottom: 15px;
}

.profile-img-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-placeholder {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
}

.profile-job {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.profile-email {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.separator {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 5px 0 15px 0;
}

.start-menu-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.start-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #e2e8f0;
    font-size: 14px;
}

.start-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.start-icon {
    font-size: 18px;
    margin-right: 10px;
    width: 24px;
    text-align: center;
}

/* Pet Widget */
#pet-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    cursor: pointer;
    text-align: center;
}

.pet-image {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s;
    animation: bounce 3s infinite ease-in-out;
}

.pet-image:hover {
    transform: scale(1.05);
}

.pet-fallback {
    font-size: 100px;
    animation: bounce 3s infinite ease-in-out;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.pet-bubble {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    border-bottom-right-radius: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 180px;
    color: #333;
    animation: fadeUp 0.2s ease-out;
}

.pet-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    border-left: 10px solid transparent;
    border-top: 10px solid white;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pet-hunger-mini {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
}

.pet-bar-bg {
    width: 100%;
    height: 100%;
}

#pet-bar-fill {
    height: 100%;
    width: 80%;
    background: #22c55e;
    transition: width 0.3s;
}

#pet-feeder-mini {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 5px;
}

/* App Launch Toast Notification */
.app-toast {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    color: #f8fafc;
    z-index: 2000;
    max-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

.app-toast.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.app-toast-content {
    flex: 1;
}

.app-toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.app-toast-link {
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
    cursor: pointer;
}

.app-toast-link:hover {
    text-decoration: underline;
}

.app-toast-close {
    cursor: pointer;
    font-size: 18px;
    color: #94a3b8;
}

.app-toast-close:hover {
    color: #f8fafc;
}

/* New Tab Button in Window Header */
.new-tab-btn {
    background-color: #3b82f6;
    color: white;
    font-size: 10px;
    font-weight: bold;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    /* Extra space before traffic lights */
    text-decoration: none;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50%;
    /* Circle like others */
    transition: background-color 0.2s;
}

.new-tab-btn:hover {
    background-color: #2563eb;
}

/* --- Mobile Responsiveness --- */
@media screen and (max-width: 768px) {

    /* Desktop Icons */
    .desktop-icons {
        flex-direction: row;
        /* Horizontal layout on mobile often better */
        align-content: flex-start;
        gap: 10px;
    }

    .icon {
        width: 70px;
        height: 80px;
    }

    .icon-img {
        font-size: 32px;
    }

    .icon-label {
        font-size: 11px;
    }

    /* Start Menu */
    #start-menu {
        width: 90%;
        left: 5%;
        bottom: 70px;
        /* Slightly higher */
    }

    /* Windows - Force Full Screen behavior on Mobile */
    .window {
        width: 95% !important;
        height: calc(100% - 80px) !important;
        /* Reserve space for taskbar */
        top: 10px !important;
        left: 2.5% !important;
        max-width: none;
        max-height: none;
    }

    /* Disable resizing on mobile */
    .resize-handle {
        display: none;
    }

    /* Window Controls - Make bigger for touch */
    .window-controls div,
    .new-tab-btn {
        width: 20px !important;
        height: 20px !important;
        margin-left: 8px;
    }

    .new-tab-btn {
        font-size: 12px;
    }

    /* Pet Widget */
    #pet-widget {
        bottom: 70px;
        right: 10px;
    }

    .pet-bubble {
        width: 150px;
    }
}