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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* macOS Menu Bar */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: rgba(50, 50, 50, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 10px;
    z-index: 1000;
    color: white;
    font-size: 13px;
    opacity: 0;
    animation: fadeIn 0.5s ease-in 1.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.menu-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.apple-logo {
    font-size: 16px;
}

.menu-item {
    cursor: default;
    padding: 2px 5px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.menu-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-icon {
    font-size: 14px;
    cursor: default;
}

.menu-time {
    font-size: 12px;
    margin-left: 5px;
}

/* Desktop Background */
.desktop {
    position: fixed;
    top: 25px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.5s ease-in 1.5s forwards;
}

.screensaver-image {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center;
    z-index: 0;
}

/* Desktop Icon */
.desktop-icon {
    position: absolute;
    top: 50px;
    right: 100px;
    width: 80px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s ease;
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
}

.desktop-icon:hover {
    transform: scale(1.1);
}

.desktop-icon:active {
    transform: scale(0.95);
}

/* Dragging state */
.desktop-icon.dragging {
    cursor: grabbing;
    transition: none;
    transform: scale(1.05);
}

.icon-image {
    width: 64px;
    height: 64px;
    margin: 0 auto 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.icon-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.icon-label {
    color: white;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

/* Notes App Modal */
.notes-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.notes-modal.active {
    display: block;
    padding: 0;
}

.notes-window {
    width: 90%;
    max-width: 1400px;
    min-width: 600px;
    height: 85vh;
    min-height: 400px;
    background: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notes-title-bar {
    background: #2c2c2e;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #3a3a3c;
    cursor: move;
    user-select: none;
}

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

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.control.close {
    background: #ff5f57;
}

.control.minimize {
    background: #ffbd2e;
}

.control.maximize {
    background: #28ca42;
}

.control.close:hover {
    background: #ff3b30;
}

.control.minimize:hover {
    background: #ff9500;
}

.control.maximize:hover {
    background: #34c759;
}

.window-title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.notes-window-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #1e1e1e;
}

/* Left Sidebar */
.notes-left-sidebar {
    width: 200px;
    background: #2c2c2e;
    border-right: 1px solid #3a3a3c;
    overflow-y: auto;
    padding: 15px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.folder-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.folder-icon {
    font-size: 20px;
    filter: sepia(100%) saturate(500%) hue-rotate(0deg) brightness(1.1);
    position: relative;
}

.folder-name {
    flex: 1;
    color: #ffffff;
    font-size: 14px;
}

.folder-count {
    color: #ffffff;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
}

.new-folder-btn {
    background: transparent;
    border: 1px solid #3a3a3c;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.new-folder-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Middle Pane - Notes List */
.notes-middle-pane {
    width: 280px;
    background: #1e1e1e;
    border-right: 1px solid #3a3a3c;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-list-header {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 15px;
    border-bottom: 1px solid #3a3a3c;
}

.notes-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.note-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    background: transparent;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.note-item.active {
    background: #3a3a3c;
}

.note-item-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-item-time {
    color: #8e8e93;
    font-size: 11px;
    margin-bottom: 4px;
}

.note-item-preview {
    color: #8e8e93;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Right Pane - Note Content */
.notes-content-pane {
    flex: 1;
    overflow-y: auto;
    background: #1e1e1e;
    padding: 40px 60px;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.note-content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3a3c;
}

.note-date {
    color: #8e8e93;
    font-size: 13px;
    margin-bottom: 8px;
}

.note-title-main {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.note-body {
    font-size: 16px;
    line-height: 1.8;
    color: #ffffff;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.note-body p {
    margin-bottom: 20px;
    color: #ffffff;
}

.note-body h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 20px;
    color: #ffffff;
}

/* Scrollbar styling */
.notes-left-sidebar::-webkit-scrollbar,
.notes-list-container::-webkit-scrollbar,
.notes-content-pane::-webkit-scrollbar {
    width: 8px;
}

.notes-left-sidebar::-webkit-scrollbar-track,
.notes-list-container::-webkit-scrollbar-track,
.notes-content-pane::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.notes-left-sidebar::-webkit-scrollbar-thumb,
.notes-list-container::-webkit-scrollbar-thumb,
.notes-content-pane::-webkit-scrollbar-thumb {
    background: #3a3a3c;
    border-radius: 4px;
}

.notes-left-sidebar::-webkit-scrollbar-thumb:hover,
.notes-list-container::-webkit-scrollbar-thumb:hover,
.notes-content-pane::-webkit-scrollbar-thumb:hover {
    background: #4a4a4c;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: #ffffff;
}

.loading-logo {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: 8px;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #ffffff 0%, #888888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

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

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.infinity-symbol {
    font-size: 48px;
    color: #ffffff;
    font-weight: 300;
    animation: infinityRotate 2s ease-in-out infinite;
}

@keyframes infinityRotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 0.8;
    }
}

.loading-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fadeInOut 2s ease-in-out infinite;
}

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

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    /* Prevent horizontal scroll on mobile */
    body {
        overflow-x: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* Menu Bar - Mobile */
    .menu-bar {
        height: 44px;
        padding: 0 15px;
        padding-top: max(env(safe-area-inset-top), 0);
        padding-bottom: max(env(safe-area-inset-bottom), 0);
    }
    
    .menu-time {
        font-size: 14px;
    }
    
    /* Desktop - Mobile */
    .desktop {
        top: max(44px, env(safe-area-inset-top, 0));
        padding-bottom: max(env(safe-area-inset-bottom, 0), 0);
    }
    
    /* Desktop Icon - Mobile */
    .desktop-icon {
        width: 90px;
        top: 30px;
        right: 20px;
    }
    
    .icon-image {
        width: 80px;
        height: 80px;
    }
    
    .icon-label {
        font-size: 12px;
    }
    
    /* Notes Window - Mobile */
    .notes-window {
        width: 95%;
        max-width: 100%;
        height: 90vh;
        max-height: 90vh;
        min-width: 320px;
        min-height: 500px;
    }
    
    /* Notes Title Bar - Mobile */
    .notes-title-bar {
        height: 44px;
        padding: 0 10px;
    }
    
    .window-controls {
        gap: 6px;
        margin-right: 10px;
    }
    
    .control {
        width: 10px;
        height: 10px;
    }
    
    /* Notes Window Content - Mobile */
    .notes-window-content {
        flex-direction: column;
    }
    
    /* Middle Pane - Mobile */
    .notes-middle-pane {
        width: 100%;
        height: 40%;
        min-height: 200px;
        border-right: none;
        border-bottom: 1px solid #3a3a3c;
    }
    
    .notes-list-header {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .notes-list-container {
        padding: 5px;
    }
    
    .note-item {
        padding: 10px;
        margin-bottom: 5px;
    }
    
    .note-item-title {
        font-size: 13px;
    }
    
    .note-item-time {
        font-size: 10px;
    }
    
    .note-item-preview {
        font-size: 11px;
    }
    
    /* Content Pane - Mobile */
    .notes-content-pane {
        width: 100%;
        height: 60%;
        padding: 20px 25px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Android-specific: Add extra space at bottom */
    .android-device .notes-content-pane {
        padding-bottom: calc(20px + 2em);
    }
    
    .notes-list-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .note-content-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .note-date {
        font-size: 12px;
    }
    
    .note-title-main {
        font-size: 24px;
        line-height: 1.3;
    }
    
    .note-body {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .note-body h2 {
        font-size: 20px;
        margin-top: 30px;
        margin-bottom: 15px;
    }
    
    .note-body p {
        margin-bottom: 15px;
    }
    
    /* Loading Screen - Mobile */
    .loading-logo {
        font-size: 48px;
        letter-spacing: 6px;
        margin-bottom: 30px;
    }
    
    .infinity-symbol {
        font-size: 36px;
    }
    
    .loading-text {
        font-size: 12px;
    }
}

/* Small Mobile Devices */
@media screen and (max-width: 480px) {
    .menu-bar {
        height: 44px;
        padding-top: max(env(safe-area-inset-top), 0);
    }
    
    .desktop {
        top: max(44px, env(safe-area-inset-top, 0));
    }
    
    .desktop-icon {
        width: 80px;
        top: 20px;
        right: 15px;
    }
    
    .icon-image {
        width: 70px;
        height: 70px;
    }
    
    .icon-label {
        font-size: 11px;
    }
    
    .notes-window {
        width: 98%;
        height: 92vh;
        min-width: 300px;
        padding-top: max(env(safe-area-inset-top, 0), 0);
        padding-bottom: max(env(safe-area-inset-bottom, 0), 0);
    }
    
    .notes-content-pane {
        padding: 15px 20px;
    }
    
    /* Android-specific: Add extra space at bottom */
    .android-device .notes-content-pane {
        padding-bottom: calc(15px + 2em);
    }
    
    .note-title-main {
        font-size: 20px;
    }
    
    .note-body {
        font-size: 13px;
    }
    
    .note-body h2 {
        font-size: 18px;
    }
    
    .loading-logo {
        font-size: 36px;
        letter-spacing: 4px;
    }
    
    .infinity-symbol {
        font-size: 32px;
    }
}

/* Touch Support */
@media (hover: none) and (pointer: coarse) {
    .desktop-icon:active {
        transform: scale(0.9);
    }
    
    .note-item:active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .note-item.active:active {
        background: #3a3a3c;
    }
    
    /* Disable resizing on mobile */
    .resize-handle {
        display: none;
    }
    
    /* Make Notes window fullscreen on mobile */
    .notes-window {
        width: 100% !important;
        height: 100vh !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .notes-modal.active {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }
    
    /* Prevent dragging on mobile */
    .notes-title-bar {
        touch-action: none;
    }
    
    /* Better touch targets */
    .desktop-icon {
        min-width: 90px;
        min-height: 90px;
    }
    
    .icon-image {
        min-width: 80px;
        min-height: 80px;
    }
    
    .control {
        min-width: 20px;
        min-height: 20px;
    }
}
