/* ========================================
   macOS Portfolio - Stylesheet
   Christian Arzaluz - iOS Developer
   ======================================== */

:root {
    --bg-peal: rgba(255, 255, 255, 0.1); /* non-blurred fallback */
    --dock-bg: rgba(20, 20, 20, 0.3);
    --menu-bg: rgba(20, 20, 20, 0.3);
    --window-bg: rgba(30, 30, 32, 0.85);
    --window-header: #2d2d2d;
    --text-color: #ffffff;
    --accent: #007aff;
    --system-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; user-select: none; }
body, html {
    margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden;
    font-family: var(--system-font); color: var(--text-color);
    /* Default Wallpaper - Monterey style */
    background: linear-gradient(200deg, #a729f5, #5823d6, #092775, #1d6f9c);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    cursor: default;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 99999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 1s ease-out;
}
.apple-logo { color: white; font-size: 80px; margin-bottom: 40px; }
.loading-bar {
    width: 200px; height: 6px; background: #333; border-radius: 3px; overflow: hidden;
}
.loading-progress {
    height: 100%; background: #fff; width: 0%; border-radius: 3px;
    transition: width 3s ease-in-out;
}

/* --- UI Layout --- */
#desktop { width: 100%; height: 100%; position: relative; }

/* Menu Bar */
#menubar {
    position: absolute; top: 0; width: 100%; height: 30px;
    background: var(--menu-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; font-size: 13px; font-weight: 500; z-index: 5000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.menu-left, .menu-right { display: flex; gap: 15px; align-items: center; }
.menu-item:hover { background: rgba(255,255,255,0.1); border-radius: 4px; padding: 2px 8px; margin: -2px -8px;}
.apple-icon { font-size: 16px; }
#active-app-name { font-weight: 700; }

/* Dock */
#dock-container {
    position: absolute; bottom: 10px; width: 100%;
    display: flex; justify-content: center; z-index: 6000;
}
#dock {
    background: var(--dock-bg);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255,255,255,0.1);
    height: 70px; padding: 5px 10px; border-radius: 20px;
    display: flex; align-items: flex-end; gap: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}
.dock-item {
    width: 55px; height: 55px; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); position: relative;
    cursor: pointer;
}
/* SVG Icon Styles */
.dock-icon-svg { width: 100%; height: 100%; border-radius: 14px; position: relative; overflow: hidden; display: flex; justify-content: center; align-items: center;}

.dock-item:hover { transform: scale(1.2) translateY(-10px); margin: 0 5px; }
.dock-dot {
    width: 5px; height: 5px; background: rgba(255,255,255,0.4); border-radius: 50%;
    position: absolute; bottom: -8px; display: none;
}
.dock-item.active .dock-dot { display: block; }

/* Bounce Animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
.bouncing { animation: bounce 0.6s ease infinite; }

/* --- Windows System --- */
.window {
    position: absolute; background: var(--window-bg);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; overflow: hidden;
    min-width: 300px; min-height: 200px;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.2s;
    transform-origin: center;
}

/* Window opening animation */
.window.opening { animation: winOpen 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes winOpen { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; }}

/* Inactive window state */
.window.inactive {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.05);
}
.window.inactive .traffic-lights span { background-color: #555 !important; color: #555 !important;}

.window-header {
    height: 30px; background: rgba(255,255,255,0.05);
    display: flex; align-items: center; position: relative; cursor: grab;
}
.window-header:active { cursor: grabbing; }

.traffic-lights {
    display: flex; gap: 8px; margin-left: 12px; z-index: 2;
}
.t-btn {
    width: 12px; height: 12px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: 8px; color: transparent; transition: 0.1s; cursor: default;
}
.traffic-lights:hover .t-btn { color: rgba(0,0,0,0.6); }
.close-btn { background: #ff5f56; }
.min-btn { background: #ffbd2e; }
.max-btn { background: #27c93f; }

.window-title {
    position: absolute; width: 100%; text-align: center; font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.8); pointer-events: none;
}
.window-content {
    flex: 1; overflow: auto; position: relative;
    user-select: text; /* Allow text selection inside apps */
}

/* jQuery UI Resizable Handle Fix */
.ui-resizable-se { bottom: 0; right: 0; width: 15px; height: 15px; background: none; }

/* --- Context Menu --- */
#context-menu {
    position: absolute; background: rgba(40,40,40,0.9); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 5px 0;
    width: 180px; display: none; z-index: 99999;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.ctx-item { padding: 6px 15px; font-size: 13px; cursor: default; display: flex; justify-content: space-between;}
.ctx-item:hover { background: var(--accent); color: white; }
.ctx-hr { border-top: 1px solid rgba(255,255,255,0.1); margin: 4px 0; }

/* --- APP SPECIFIC STYLES --- */

/* Generic Project Window */
.project-app { padding: 25px; line-height: 1.6; }
.project-app h2 { margin-top: 0; display: flex; align-items: center; gap: 12px; font-size: 24px;}
.project-app h3 { color: var(--accent); border-bottom: 1px solid #444; padding-bottom: 5px; margin-top: 20px; font-size: 16px;}
.project-app ul { padding-left: 20px; }
.project-app li { margin-bottom: 5px; }
.tech-stack { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding-left: 0; }
.tech-stack li { background: rgba(255,255,255,0.1); padding: 3px 10px; border-radius: 15px; font-size: 12px; }
.github-link {
    display: inline-block; margin-top: 20px; padding: 10px 15px; background: #333; color: white; text-decoration: none;
    border-radius: 8px; transition: 0.2s; font-weight: 500;
}
.github-link:hover { background: #444; }

/* Portfolio (Sobre Mí) */
.portfolio-app { padding: 25px; line-height: 1.6; }
.profile-header { display: flex; align-items: center; gap: 20px; border-bottom: 1px solid #444; padding-bottom: 20px; }
.profile-pic { width: 80px; height: 80px; background: #555; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 40px; color: #ccc; flex-shrink: 0;}
.profile-pic .initial { font-weight: 600; }
.profile-info h1 { margin: 0; font-size: 24px; }
.profile-info h2 { margin: 0; font-size: 14px; font-weight: 400; color: #bbb; }
.profile-body { padding-top: 20px; }
.profile-body h3 { color: var(--accent); border-bottom: 1px solid #444; padding-bottom: 5px; margin-top: 15px; font-size: 16px;}
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; list-style: none; padding: 0;}
.skills-grid li { background: rgba(255,255,255,0.05); padding: 8px 12px; border-radius: 6px; font-size: 13px;}


/* Terminal */
.terminal-app { background: #101010; color: #33ff00; font-family: 'Courier New', monospace; padding: 10px; height: 100%; overflow-y: auto; font-size: 13px;}
.term-line { margin-bottom: 2px; line-height: 1.4; }
.term-input-line { display: flex; }
.term-prompt { color: #00bfff; margin-right: 8px; }
#term-input { background: transparent; border: none; color: #33ff00; font-family: inherit; font-size: inherit; flex: 1; outline: none; }

/* Calculator */
.calc-app { background: #333; height: 100%; display: flex; flex-direction: column; padding: 10px; }
#calc-display { background: transparent; color: white; font-size: 36px; text-align: right; border: none; width: 100%; margin-bottom: 10px; outline: none; font-weight: 300;}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex: 1; }
.calc-btn { border: none; border-radius: 50%; font-size: 18px; cursor: pointer; transition: filter 0.1s; color: white;}
.calc-btn:active { filter: brightness(1.2); }
.c-num { background: #555; }
.c-op { background: #ff9f0a; font-size: 22px; padding-top: 3px;}
.c-top { background: #a5a5a5; color: black; }
.c-zero { grid-column: span 2; border-radius: 30px; text-align: left; padding-left: 25px;}

/* Safari */
.safari-app { display: flex; flex-direction: column; height: 100%; background: #fff; }
.safari-bar { padding: 8px; background: #f0f0f0; border-bottom: 1px solid #ccc; display: flex; gap: 10px; align-items: center; }
.url-bar { flex: 1; background: #ddd; border: none; padding: 5px 10px; border-radius: 8px; text-align: center; font-size: 12px; color: #333; outline: none;}
.safari-frame { flex: 1; border: none; width: 100%; background: white; }

/* --- SVGs for Icons (Data URIs for single file) --- */
.icon-common-fa::after {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 30px;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.icon-finder { background: linear-gradient(180deg, #e3e3e3 0%, #c7c7c7 100%); position: relative; overflow: hidden; }
.icon-finder::after { content: ':)'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(90deg); font-size: 30px; font-weight: bold; color: #2a62b3; font-family: monospace;}

.icon-safari { background: white; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='50' fill='%23fff'/%3E%3Ccircle cx='50' cy='50' r='45' fill='%231facfd'/%3E%3Cpath d='M50 5 L50 95 M5 50 L95 50' stroke='rgba(255,255,255,0.3)' stroke-width='1'/%3E%3Cpolygon points='50,10 60,45 90,50 55,60 50,90 40,55 10,50 45,40' fill='white'/%3E%3Cpolygon points='50,10 55,45 50,50 45,45' fill='%23ea4335'/%3E%3C/svg%3E"); background-size: cover;}

.icon-terminal { background: #222; position: relative; }
.icon-terminal::after { content: '>'; color: #fff; position: absolute; top: 10px; left: 10px; font-family: monospace; font-size: 24px; font-weight: bold;}

.icon-calc {
    background: #333;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    padding: 8px;
    gap: 4px;
    position: relative;
    align-items: stretch;
    justify-items: stretch;
}
.icon-calc div {
    background: #ff9f0a;
    border-radius: 4px;
    min-height: 0;
    min-width: 0;
}
.icon-calc div:nth-child(1),
.icon-calc div:nth-child(2) {
    background: #555;
}

/* NUEVOS ICONOS DE PROYECTOS */
.icon-pomo { background: linear-gradient(135deg, #d32f2f, #ff7043); }
.icon-pomo::after { content: '\f2f2'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-walden { background: linear-gradient(135deg, #2e7d32, #66bb6a); }
.icon-walden::after { content: '\f06c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-bishop { background: linear-gradient(135deg, #0277bd, #4fc3f7); }
.icon-bishop::after { content: '\f0fa'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-mail { background: #3481F8; }
.icon-mail::after { content: '\f0e0'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-trash { background: linear-gradient(180deg, #f2f2f7 0%, #d1d1d6 100%); position: relative; }
.icon-trash::after { content: '\f1f8'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #777; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-aboutme { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); position: relative; }
.icon-aboutme::after { content: '\f007'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.icon-text { background: linear-gradient(180deg, #fdfdfd 0%, #dcdcdc 100%); position: relative; }
.icon-text::after { content: ''; position: absolute; top: 15px; left: 10px; right: 10px; height: 2px; background: #999; box-shadow: 0 5px 0 #999, 0 10px 0 #999, 0 15px 0 #999; }

.icon-paint { background: linear-gradient(45deg, #ff3b30, #ff9500, #ffcc00, #4cd964, #5ac8fa, #007aff, #5856d6, #ff2d55); }
.icon-paint::after { content: '\f1fc'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: white; font-size: 30px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-shadow: 0 2px 5px rgba(0,0,0,0.3);}

.icon-settings { background: linear-gradient(180deg, #8e8e93 0%, #636366 100%); position: relative; }
.icon-settings::after { content: '\f013'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #ddd; font-size: 35px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* ========================================
   RESPONSIVE DESIGN - MOBILE & TABLETS
   ======================================== */

/* Tablets (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    /* Reduce menu bar items */
    .menu-left .menu-item:nth-child(n+3):nth-child(-n+6) {
        display: none;
    }

    /* Smaller windows by default */
    .window {
        min-width: 250px;
        min-height: 180px;
    }

    /* Adjust dock item sizes */
    .dock-item {
        width: 50px;
        height: 50px;
    }

    #dock {
        height: 65px;
        padding: 4px 8px;
        gap: 6px;
    }
}

/* Mobile Devices (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Hide menu bar on mobile */
    #menubar {
        display: none;
    }

    /* Dock - horizontal layout at bottom on mobile */
    #dock-container {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        max-width: 95%;
        height: auto;
        justify-content: center;
    }

    #dock {
        flex-direction: row;
        height: 70px;
        /* Show approximately 5 icons: 5 * 55px (icon) + 4 * 10px (gap) + 20px (padding) = 335px */
        width: auto;
        min-width: 335px;
        max-width: 95vw;
        padding: 0 10px;
        border-radius: 20px;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
        /* Align to bottom like desktop, with space for dot */
        align-items: flex-end;
        padding-bottom: 8px;
        /* Enable smooth horizontal scrolling */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        display: flex;
    }

    /* Hide scrollbar but keep functionality */
    #dock::-webkit-scrollbar {
        display: none;
    }

    #dock {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .dock-item {
        width: 55px;
        height: 55px;
        margin: 0;
        flex-shrink: 0; /* Prevent items from shrinking */
        position: relative;
    }

    .dock-item:hover {
        transform: scale(1.15) translateY(-5px);
        margin: 0;
    }

    /* Keep dot indicator at bottom like desktop */
    .dock-dot {
        bottom: -8px;
        right: auto;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        position: absolute;
    }

    /* Windows - smaller, draggable windows on mobile */
    .window {
        /* Remove fixed positioning - allow JS to control */
        min-width: 280px;
        min-height: 300px;
        border-radius: 12px;
    }

    .window-header {
        height: 40px;
        cursor: grab;
        touch-action: none;
    }

    .window-header:active {
        cursor: grabbing;
    }

    .traffic-lights {
        margin-left: 10px;
        gap: 12px;
    }

    .t-btn {
        width: 16px;
        height: 16px;
        font-size: 10px;
        /* Increase touch target area */
        padding: 4px;
        margin: -4px;
    }

    /* Always show icons on mobile for better UX */
    .traffic-lights .t-btn {
        color: rgba(0,0,0,0.6) !important;
    }

    .window-title {
        font-size: 14px;
    }

    /* Enable dragging and resizing on mobile */
    .ui-draggable {
        cursor: grab !important;
    }

    .ui-draggable-dragging {
        cursor: grabbing !important;
    }

    .ui-resizable-handle {
        display: block !important;
    }

    .ui-resizable-se {
        width: 25px;
        height: 25px;
        background: rgba(255,255,255,0.15);
        border-radius: 0 0 12px 0;
        cursor: nwse-resize;
        /* Add visual indicator */
        background-image: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.3) 40%, rgba(255,255,255,0.3) 60%, transparent 60%);
    }

    /* App-specific mobile adjustments */
    .portfolio-app,
    .project-app {
        padding: 15px;
        font-size: 14px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .profile-pic {
        width: 100px;
        height: 100px;
        font-size: 50px;
    }

    .profile-info h1 {
        font-size: 20px;
    }

    .profile-info h2 {
        font-size: 13px;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .project-app h2 {
        font-size: 20px;
    }

    .project-app h3 {
        font-size: 15px;
    }

    /* Terminal mobile adjustments */
    .terminal-app {
        font-size: 11px;
        padding: 8px;
    }

    #term-input {
        font-size: 11px;
    }

    /* Calculator mobile adjustments */
    .calc-app {
        padding: 8px;
    }

    #calc-display {
        font-size: 28px;
        margin-bottom: 8px;
    }

    .calc-grid {
        gap: 6px;
    }

    .calc-btn {
        font-size: 16px;
        min-height: 50px;
    }

    /* Finder mobile adjustments */
    .finder-sidebar {
        width: 100px;
        padding: 8px;
    }

    .sidebar-item {
        font-size: 11px;
        padding: 6px 8px;
        gap: 6px;
    }

    .sidebar-item i {
        font-size: 12px;
    }

    .finder-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 12px;
    }

    .file-icon {
        font-size: 35px;
    }

    .file-name {
        font-size: 11px;
    }

    /* TextEdit mobile adjustments */
    .text-toolbar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px;
    }

    .text-tool {
        font-size: 11px;
        padding: 5px 8px;
    }

    #text-area {
        font-size: 13px;
        padding: 10px;
    }

    /* Paint/Sketch mobile adjustments */
    .paint-toolbar {
        flex-wrap: wrap;
        padding: 8px;
        gap: 8px;
    }

    .paint-toolbar label {
        font-size: 10px;
    }

    #paint-canvas {
        cursor: crosshair;
        touch-action: none;
    }

    /* Safari mobile adjustments */
    .safari-bar {
        padding: 6px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .url-bar {
        font-size: 11px;
        padding: 6px 8px;
    }

    /* Settings mobile adjustments */
    .settings-app {
        padding: 15px;
        gap: 15px;
    }

    .wall-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Context menu mobile adjustments */
    #context-menu,
    .finder-context-menu {
        width: 200px;
        font-size: 14px;
    }

    .ctx-item {
        padding: 10px 15px;
        font-size: 14px;
    }

    /* Boot screen mobile adjustments */
    .apple-logo {
        font-size: 60px;
        margin-bottom: 30px;
    }

    .loading-bar {
        width: 150px;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media screen and (max-width: 480px) {
    #menubar {
        height: 35px;
        font-size: 11px;
        padding: 0 8px;
    }

    #clock {
        font-size: 10px;
    }

    #dock {
        width: 60px;
    }

    .dock-item {
        width: 48px;
        height: 48px;
    }

    .portfolio-app,
    .project-app {
        padding: 12px;
        font-size: 13px;
    }

    .profile-pic {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .profile-info h1 {
        font-size: 18px;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .finder-sidebar {
        width: 80px;
        padding: 5px;
    }

    .sidebar-item {
        font-size: 10px;
        padding: 5px;
    }

    .sidebar-item span {
        display: none; /* Hide text labels on very small screens */
    }

    .finder-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 10px;
    }

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

    .file-name {
        font-size: 10px;
    }

    .calc-btn {
        font-size: 14px;
        min-height: 45px;
    }

    #calc-display {
        font-size: 24px;
    }

    .wall-grid {
        grid-template-columns: 1fr;
    }
}

/* Landscape orientation for mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    #dock-container {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        height: auto;
    }

    #dock {
        flex-direction: row;
        width: auto;
        height: 60px;
        max-height: 60px;
        padding: 5px 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dock-item {
        width: 48px;
        height: 48px;
    }

    .dock-dot {
        bottom: -5px;
        right: auto;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .window {
        height: calc(100vh - 45px) !important;
        min-height: calc(100vh - 45px);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    .menu-item {
        padding: 5px 10px;
        min-height: 30px;
    }

    .dock-item {
        min-width: 55px;
        min-height: 55px;
    }

    .t-btn {
        min-width: 16px;
        min-height: 16px;
    }

    .ctx-item,
    .sidebar-item,
    .file-item {
        min-height: 40px;
    }

    /* Disable hover effects on touch devices */
    .dock-item:hover {
        transform: scale(1.05) translateY(-5px);
    }

    .menu-item:hover {
        background: none;
    }
}

/* Preview Window */
.preview-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #2b2b2b;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.preview-app img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.preview-app iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 8px;
}

/* Finder */
.finder-layout { display: flex; height: 100%; background: #1e1e1e; color: #ddd; }
.finder-sidebar { width: 140px; background: rgba(50,50,50,0.3); padding: 10px; backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 5px;}
.sidebar-item { padding: 5px 10px; border-radius: 5px; font-size: 12px; display: flex; align-items: center; gap: 8px; cursor: pointer;}
.sidebar-item:hover { background: rgba(255,255,255,0.1); }
.sidebar-item i { color: var(--accent); width: 15px; text-align: center;}
.finder-main { flex: 1; padding: 10px; overflow-y: auto; }
.finder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 15px; }
.file-item { display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; }
.file-icon { font-size: 40px; color: #5dade2; margin-bottom: 5px; }
.file-icon.folder { color: #5dade2; }
.file-icon.text { color: #ddd; }
.file-icon.img { color: #58d68d; }
.file-name { font-size: 12px; word-break: break-all; padding: 2px 4px; border-radius: 3px;}
.file-item:hover .file-name { background: var(--accent); }

/* TextEdit */
.textedit-app { background: #2d2d2d; height: 100%; display: flex; flex-direction: column; }
.text-toolbar { padding: 5px; background: #3a3a3a; border-bottom: 1px solid #444; display: flex; gap: 5px; flex-wrap: wrap; }
.text-tool { padding: 4px 8px; background: #444; border-radius: 4px; cursor: pointer; font-size: 12px; border: none; color: #fff;}
.text-tool:hover { background: #555; }
#text-area { flex: 1; background: #1e1e1e; color: #eee; border: none; padding: 15px; font-family: var(--system-font); font-size: 14px; outline: none; resize: none; line-height: 1.5; }

/* Sketch (Paint) */
.paint-app { display: flex; flex-direction: column; height: 100%; background: #fff; }
.paint-toolbar { padding: 8px; background: #f0f0f0; border-bottom: 1px solid #ccc; display: flex; gap: 10px; align-items: center; color: #333; flex-wrap: wrap;}
#paint-canvas { background: white; cursor: crosshair; touch-action: none; flex: 1; display: block;}

/* Settings */
.settings-app { padding: 20px; color: white; display: flex; flex-direction: column; gap: 20px; align-items: center; overflow-y: auto;}
.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.wall-thumb { height: 70px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: 0.2s;}
.wall-thumb:hover { transform: scale(1.02); }
.wall-thumb.selected { border-color: var(--accent); }
.lang-btn.active { background: var(--accent) !important; color: white !important; }
