@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@300;400;600;700&display=swap');

        :root {
            /* Палитра */
            --metro-blue: #2d89ef;
            --metro-green: #00a300;
            --metro-purple: #7459d1;
            --metro-red: #b91d47;
            --metro-teal: #117a90;
            --metro-rust: #d6522e;
            --metro-dark: #1d1d1d;
            --metro-yellow: #e3a21a;
            --metro-orange: #da532c;
            --metro-indigo: #603cba;
            --metro-gray: #555555;
            --metro-bright-purple: #a200ff;
            --metro-cyan: #00879d; 
            
            /* Новые цвета по запросу */
            --metro-video-color: #b21a41;
            --metro-mail-color: #008fa3;
            --metro-explorer-color: #e3c800; /* Желтый для проводника */

            --text-white: #ffffff;
            --text-dim: #d9e5ff;
            --surface-glass: rgba(18, 24, 42, 0.62);
            --tile-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
            
            /* Размеры */
            --cell-size: 135px; 
            --gap-size: 6px;
        }

        body {
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', sans-serif;
            background:
                radial-gradient(circle at 12% 20%, rgba(45, 137, 239, 0.35), transparent 40%),
                radial-gradient(circle at 85% 70%, rgba(116, 89, 209, 0.3), transparent 35%),
                linear-gradient(145deg, rgba(5, 12, 26, 0.88), rgba(13, 24, 49, 0.9)),
                url('LockScreen.png') no-repeat center center fixed;
            background-size: cover;
            background-color: #111; 
            color: var(--text-white);
            height: 100vh;
            overflow: hidden;
            user-select: none; /* Запрет выделения текста */
            letter-spacing: 0.2px;
        }

        /* --- ВЕРХНЯЯ ПАНЕЛЬ --- */
        .top-bar {
            padding: 15px 60px 8px 60px;
            animation: fadeIn 1s ease;
            position: sticky;
            top: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 60px;
            backdrop-filter: blur(10px);
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.1));
            z-index: 25;
        }

        .start-title {
            font-size: 2.8rem;
            font-weight: 300;
            text-shadow: 2px 2px 10px rgba(0,0,0,0.6);
            line-height: 1;
            color: #f6fbff;
        }

        .top-right-container { display: flex; align-items: center; gap: 20px; }

        .edit-mode-btn {
            width: 40px; height: 40px;
            border-radius: 50%;
            border: 2px solid white;
            background: rgba(255,255,255,0.05);
            color: white;
            font-size: 1.2rem;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: 0.3s;
            z-index: 60;
        }
        .edit-mode-btn:hover { background: rgba(255,255,255,0.2); transform: translateY(-1px); }
        .edit-mode-btn.active { background: var(--metro-red); border-color: var(--metro-red); transform: rotate(45deg); }

        .user-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; }
        .user-name { font-size: 1.2rem; font-weight: 600; text-shadow: 1px 1px 5px rgba(0,0,0,0.5); color: var(--text-dim); }
        
        .user-avatar { 
            width: 40px; height: 40px; 
            border-radius: 0; /* КВАДРАТНАЯ */
            object-fit: cover; 
            border: 2px solid rgba(255,255,255,0.8); 
            background: #ccc; 
        }

        /* --- СЕТКА ПЛИТОК --- */
        .scroll-container { 
            width: 100%; 
            height: calc(100vh - 80px);
            overflow-x: auto; 
            overflow-y: hidden; 
            padding-left: 60px;
            padding-right: 60px;
            padding-top: 20px;
            padding-bottom: 20px;
            white-space: nowrap;
        }
        
        .scroll-container::-webkit-scrollbar { height: 12px; }
        .scroll-container::-webkit-scrollbar-track { background: transparent; }
        .scroll-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 6px; }
        .scroll-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

        .tile-grid {
            display: grid;
            grid-template-rows: repeat(4, var(--cell-size));
            grid-auto-columns: var(--cell-size);
            grid-auto-flow: column; 
            gap: var(--gap-size);
            animation: slideIn 0.6s cubic-bezier(0.1, 0.9, 0.2, 1);
            width: max-content;
            height: max-content;
        }

        .tile-grid.editing-active .tile { 
            transform: scale(0.92); opacity: 0.8; cursor: grab; 
            outline: 2px dashed rgba(255,255,255,0.5); transition: all 0.3s;
        }
        .tile-grid.editing-active .tile:hover, .tile-grid.editing-active .tile.dragging { 
            transform: scale(1.05); opacity: 1; outline: none; box-shadow: 0 10px 25px rgba(0,0,0,0.7); z-index: 100;
        }

        @keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        /* --- ПЛИТКА --- */
        .tile {
            position: relative; cursor: pointer; transition: transform 0.18s ease, outline 0.18s ease, box-shadow 0.18s ease;
            overflow: hidden; background-color: var(--metro-dark); box-shadow: var(--tile-shadow);
            grid-column: span 1; grid-row: span 1;
            border: 1px solid rgba(255,255,255,0.1);
        }
        .tile::before {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(160deg, rgba(255,255,255,0.16), transparent 42%);
            opacity: 0.8;
            pointer-events: none;
            z-index: 1;
        }
        .tile:hover { outline: 2px solid rgba(255,255,255,0.5); z-index: 10; transform: translateY(-2px); }
        .tile:active { transform: scale(0.97); }
        
        /* Размеры */
        .size-small { grid-column: span 1; grid-row: span 1; }
        .size-wide { grid-column: span 2; grid-row: span 1; }
        .size-large { grid-column: span 2; grid-row: span 2; }

        .tile-content { position: absolute; bottom: 8px; left: 12px; display: flex; flex-direction: column; width: 85%; z-index: 2; pointer-events: none; }
        .tile-label { font-size: 0.9rem; font-weight: 600; margin-top: 5px; text-shadow: 0 1px 4px rgba(0,0,0,0.8);}
        .tile-img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 55%; max-height: 55%; object-fit: contain; z-index: 1; pointer-events: none; }
        .tile-img-full { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; pointer-events: none; }

        /* Цвета */
        .tile-game { background: var(--metro-blue); }
        .tile-clock { background-color: var(--metro-purple); display: flex; align-items: center; justify-content: center; }
        .clock-data { display: flex; flex-direction: column; align-items: center; z-index: 2; pointer-events: none;}
        .time-text { font-size: 3rem; font-weight: 300; line-height: 1; }
        .date-text { font-size: 1rem; opacity: 0.8; margin-top: 5px; }
        
        .tile-store { background-color: var(--metro-green); }
        .tile-desktop { background-color: #2b2b2b; }
        .tile-return { background-color: var(--metro-teal); }
        .tile-about { background-color: var(--metro-rust); }
        .tile-music { background-color: var(--metro-indigo); }
        .tile-weather { background-color: var(--metro-orange); }
        .tile-gallery { background-color: var(--metro-cyan); }
        .tile-settings { background-color: var(--metro-gray); }
        
        .tile-letter { display: flex; align-items: center; justify-content: center; }
        .letter-span { font-size: 3.5rem; font-weight: 700; text-shadow: 2px 2px 0px rgba(0,0,0,0.2); pointer-events: none; }
        .tile-me { background-color: var(--metro-bright-purple); }
        .tile-me .letter-span { letter-spacing: 8px; }
        .tile-t { background-color: var(--metro-blue); }
        .tile-r { background-color: var(--metro-yellow); }
        .tile-l { background-color: #e3a21a; }
        .tile-s { background-color: #b91d47; }

        /* Новые плитки */
        .tile-video { background-color: var(--metro-video-color); }
        .tile-mail { background-color: var(--metro-mail-color); }
        .tile-explorer { background-color: var(--metro-explorer-color); }

        /* --- НИЖНЯЯ ПАНЕЛЬ (APP BAR) --- */
        #bottom-bar {
            position: fixed;
            bottom: -100px; /* Скрыто */
            left: 0;
            width: 100%;
            height: 80px;
            background: linear-gradient(180deg, rgba(5, 8, 15, 0.88), rgba(5, 8, 15, 0.96));
            border-top: 2px solid #2d89ef;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 40px;
            box-sizing: border-box;
            transition: bottom 0.3s ease-out;
            z-index: 200;
            backdrop-filter: blur(10px);
        }

        #bottom-bar.visible {
            bottom: 0;
        }

        .bar-btn {
            background: none;
            border: 2px solid #8ea6d8;
            color: white;
            border-radius: 50%;
            width: 45px; height: 45px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.2rem;
            cursor: pointer;
            margin-bottom: 5px;
        }
        .bar-btn:hover { border-color: white; background: rgba(255,255,255,0.14); }
        
        .bar-item {
            display: flex; flex-direction: column; align-items: center;
            cursor: pointer;
            color: #ccc;
            font-size: 0.9rem;
        }
        .bar-item:hover { color: white; }

        .bar-group { display: flex; gap: 30px; }

        /* --- ОКНО ПРИЛОЖЕНИЯ --- */
        .app-window {
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: #111; z-index: 100; flex-direction: column;
            animation: appLaunch 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
        }
        @keyframes appLaunch { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

        .app-header { padding: 15px 30px; display: flex; align-items: center; background: linear-gradient(90deg, #1f1f1f, #1f2430); box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
        .back-btn { background: none; border: 2px solid white; border-radius: 50%; color: white; width: 35px; height: 35px; font-size: 18px; cursor: pointer; margin-right: 20px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
        .back-btn:hover { background: white; color: black; }
        .app-title { font-size: 1.5rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

        .app-view { display: none; width: 100%; height: 100%; overflow-y: auto; flex-direction: column; }
        
        /* ИГРА */
        #view-game { align-items: center; }
        #mode-selection { display: flex; flex-direction: row; align-items: center; justify-content: center; height: 100%; gap: 40px; }
        .selection-card { width: 280px; height: 280px; background: #333; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; transition: transform 0.22s ease, box-shadow 0.22s ease; padding: 20px; text-align: center; border: 2px solid transparent; box-shadow: var(--tile-shadow);}
        .selection-card:hover { transform: translateY(-4px) scale(1.03); outline: 3px solid rgba(255,255,255,0.3); box-shadow: 0 16px 32px rgba(0,0,0,0.4); }
        .card-create { background: var(--metro-blue); }
        .card-random { background: var(--metro-green); }
        .card-img-icon { width: 100px; height: 100px; object-fit: contain; margin-bottom: 20px; }
        .card-title { font-size: 1.8rem; font-weight: 600; margin: 0; }
        .card-desc { font-size: 1rem; opacity: 0.8; margin-top: 10px; }

        .create-interface { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; animation: fadeIn 0.5s; }
        .metro-input { background: rgba(255,255,255,0.05); border: 2px solid transparent; border-bottom: 2px solid #666; color: white; font-size: 2.5rem; text-align: center; width: 80%; max-width: 400px; padding: 10px; margin-bottom: 40px; text-transform: uppercase; outline: none; transition: border-color 0.3s, background 0.3s; }
        .metro-input:focus { border-color: var(--metro-blue); }
        .metro-btn-action { background: var(--metro-blue); color: white; padding: 15px 40px; font-size: 1.2rem; cursor: pointer; border: none; font-weight: 600; transition: 0.2s; }
        .metro-btn-action:hover { background: #1b6eae; transform: translateY(-2px); }
        .link-box { background: #222; border: 1px solid #444; padding: 15px; width: 80%; max-width: 500px; color: #aaa; margin-top: 20px; font-family: monospace; font-size: 1.1rem; text-align: center; }

        #game-interface { display: none; flex-direction: column; height: 100%; width: 100%; }
        #game-container { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
        .row { display: flex; gap: 6px; }
        .tile-game-cell { width: 55px; height: 55px; border: 2px solid #444; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; text-transform: uppercase; transition: background-color 0.5s, border-color 0.5s; }
        .correct { background-color: var(--metro-green) !important; border-color: var(--metro-green) !important; color: white; }
        .present { background-color: var(--metro-yellow) !important; border-color: var(--metro-yellow) !important; color: white; }
        .absent { background-color: #3a3a3c !important; border-color: #3a3a3c !important; color: white; }
        #message-area { text-align: center; min-height: 30px; color: white; font-size: 1.2rem; margin-top: 10px; padding: 4px 10px; }

        #keyboard-container { background: #1a1a1a; padding: 15px 0 25px 0; display: flex; justify-content: center; }
        #mini-keyboard { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 98%; max-width: 800px; }
        .kb-row { display: flex; justify-content: center; gap: 5px; width: 100%; }
        .key { height: 50px; flex: 1; background: #444; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; cursor: pointer; border-radius: 4px; max-width: 50px; transition: background 0.1s; }
        .key:hover { background: #666; transform: translateY(-1px); }
        .key:active { background: #888; }
        .key-wide { flex: 1.5; max-width: 80px; font-size: 0.9rem; }
        .key-enter { background: var(--metro-green); }
        .key-back { background: var(--metro-red); }

        /* О ПРОГРАММЕ */
        #view-about { padding: 40px; max-width: 800px; margin: 0 auto; color: #eee; }
        #view-about h2 { font-size: 2.5rem; margin-bottom: 10px; color: var(--metro-rust); }
        #view-about h4 { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.8; font-weight: 300; }
        #view-about p { font-size: 1.1rem; line-height: 1.6; margin-bottom: 20px; }
        #view-about .credits { margin-top: 40px; border-top: 1px solid #444; padding-top: 20px; }
        #view-about .ps { margin-top: 30px; font-style: italic; opacity: 0.7; font-size: 0.9rem; }

        .message-success { color: #8df2ab; }
        .message-warning { color: #ffd479; }
        .message-error { color: #ff8d8d; }

        @media (max-width: 900px) {
            .top-bar { padding: 12px 20px 6px; }
            .start-title { font-size: 2rem; }
            .scroll-container { padding-left: 20px; padding-right: 20px; }
            :root { --cell-size: 118px; }
            #mode-selection { flex-direction: column; gap: 18px; }
            .selection-card { width: min(88vw, 320px); height: 210px; }
            #bottom-bar { padding: 0 20px; }
            .bar-group { gap: 16px; }
        }

        @media (prefers-reduced-motion: reduce) {
            * { animation: none !important; transition: none !important; }
        }
