/* ═══════════════════════════════════════════════════════════════
   A16 OS v14.0  //  Ultimate OS Experience  //  Full Stylesheet
   Boot · Desktop · Windows · Apps · Micro-interactions
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. DESIGN TOKENS ────────────────────────────────────── */
:root {
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --surface-1: #111111;
    --surface-2: #191919;
    --surface-3: #262626;
    --glass-bg: rgba(20, 20, 20, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --widget-bg: rgba(20, 20, 20, 0.6);
    --widget-border: rgba(255, 255, 255, 0.08);
    --widget-hover: rgba(30, 30, 30, 0.8);
    --radius-widget: 24px;
    --padding-widget: 24px;
    --gap-grid: 20px;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #52525b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --font-main: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Kernel Modes */
body.kernel-performance {
    --accent-blue: #f59e0b;
    --accent-green: #f59e0b;
}

body.kernel-secure {
    --accent-blue: #ef4444;
    --accent-green: #ef4444;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* ── 2. LOGIN SCREEN (Windows-style) ─────────────────────── */
#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', var(--font-main);
    transition: opacity 0.8s ease, transform 0.8s ease;
    overflow: hidden;
}

#boot-screen.hidden {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.login-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.06) 0%, transparent 60%),
        linear-gradient(135deg, #0a0a1a 0%, #0d1117 40%, #161b22 100%);
    filter: blur(0px);
    z-index: 0;
}

.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

/* Date/Time - Bottom Left */
.login-datetime {
    position: absolute;
    bottom: 60px;
    left: 50px;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.login-time {
    font-size: 72px;
    font-weight: 300;
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
}

.login-date {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
}

/* Center Content */
.login-center {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Avatar with glow ring */
.login-avatar-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.5));
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.2), 0 0 80px rgba(139, 92, 246, 0.1);
    animation: avatarPulse 3s ease-in-out infinite;
    margin-bottom: 8px;
}

.login-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(0, 0, 0, 0.6);
}

@keyframes avatarPulse {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.2), 0 0 60px rgba(139, 92, 246, 0.1);
    }

    50% {
        box-shadow: 0 0 50px rgba(59, 130, 246, 0.35), 0 0 100px rgba(139, 92, 246, 0.2);
    }
}

.login-username {
    font-size: 28px;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Windows-style spinning dots */
.login-spinner {
    display: flex;
    gap: 5px;
    margin-top: 16px;
    height: 20px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s;
}

.login-spinner.active {
    opacity: 1;
}

.spinner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    animation: winSpinner 1.8s ease-in-out infinite;
}

.spinner-dot:nth-child(1) {
    animation-delay: 0s;
}

.spinner-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0.3s;
}

.spinner-dot:nth-child(4) {
    animation-delay: 0.45s;
}

.spinner-dot:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes winSpinner {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.5);
    }

    30%,
    60% {
        opacity: 1;
        transform: scale(1);
    }
}

.login-status {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.5s;
}

.login-status.visible {
    opacity: 1;
}

/* Footer icons - bottom right */
.login-footer {
    position: absolute;
    bottom: 40px;
    right: 40px;
    z-index: 2;
    display: flex;
    gap: 8px;
}

.login-footer-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.2s;
}

.login-footer-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive login */
@media (max-width: 640px) {
    .login-time {
        font-size: 48px;
    }

    .login-date {
        font-size: 14px;
    }

    .login-datetime {
        bottom: 40px;
        left: 24px;
    }

    .login-avatar-ring {
        width: 120px;
        height: 120px;
    }

    .login-username {
        font-size: 22px;
    }

    .login-footer {
        right: 20px;
        bottom: 24px;
    }
}

/* ── 3. WALLPAPER ────────────────────────────────────────── */
#wallpaper {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 15% 25%, #1a1a2e 0%, transparent 50%),
        radial-gradient(ellipse at 85% 75%, #16213e 0%, transparent 50%), #050505;
    transition: background 0.5s;
}

/* ── 4. TOP BAR ──────────────────────────────────────────── */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 12px;
    font-weight: 500;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-center {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.kernel-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s;
}

.kernel-badge.normal {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.kernel-badge.performance {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.kernel-badge.secure {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.battery-sim {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── 5. BENTO GRID ───────────────────────────────────────── */
#bento-container {
    position: absolute;
    inset: 0;
    padding: 52px 24px 100px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 160px;
    gap: var(--gap-grid);
    width: 100%;
    max-width: 860px;
}

@media (max-width:1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 480px;
    }
}

@media (max-width:640px) {
    #bento-container {
        padding: 48px 12px 100px;
        flex-direction: column;
        align-items: center;
    }

    /* Stack sidebar + bento vertically */
    #bento-container>div {
        flex-direction: column !important;
        align-items: center;
        width: 100%;
    }

    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 12px;
        max-width: 100%;
        width: 100%;
        padding: 0;
    }

    .col-span-2 {
        grid-column: span 1;
    }

    .row-span-2 {
        grid-row: span 1;
    }

    /* Widget sizing on mobile */
    .widget {
        min-height: 140px;
        border-radius: 18px;
        padding: 16px;
    }

    .widget:hover {
        transform: none;
    }

    .widget::after {
        display: none;
    }

    /* Profile widget taller on mobile */
    .widget-profile {
        min-height: 220px;
    }

    .profile-img {
        width: 48px;
        height: 48px;
        top: 16px;
        left: 16px;
        border-radius: 14px;
    }

    .profile-content h2 {
        font-size: 18px;
    }

    .profile-content p {
        font-size: 11px;
    }

    /* System status widget */
    .widget[onclick*="workflow"] {
        min-height: 160px;
    }

    /* Clock widget */
    .widget-clock {
        min-height: 120px;
    }

    /* Map widget */
    .widget-map {
        min-height: 140px;
    }

    /* Sidebar slideshow */
    .sidebar-widget {
        width: 100% !important;
        max-width: 100% !important;
        height: 220px !important;
        order: -1;
        border-radius: 18px !important;
    }

    /* Dock: compact bottom bar */
    #dock-container {
        bottom: 36px !important;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        width: auto;
    }

    .dock {
        flex-direction: row !important;
        padding: 4px 8px;
        gap: 4px;
        border-radius: 20px;
    }

    .dock-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .dock-icon:hover {
        transform: translateY(-4px) scale(1.08);
    }

    .dock-icon .material-symbols-outlined {
        font-size: 18px !important;
    }

    .dock-indicator {
        bottom: -2px !important;
        right: auto !important;
        top: auto !important;
        left: 50%;
        transform: translateX(-50%) !important;
        width: 3px;
        height: 3px;
    }

    /* App windows: full-screen on mobile */
    .app-window {
        top: 36px !important;
        left: 0 !important;
        width: 100vw !important;
        height: calc(100vh - 36px - 70px) !important;
        border-radius: 0 !important;
        max-width: 100vw !important;
    }

    .window-header {
        border-radius: 0;
        padding: 0 10px;
        height: 36px;
        min-height: 36px;
    }

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

    /* Top bar */
    #topbar {
        height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }

    .kernel-badge {
        display: none;
    }

    .topbar-center {
        font-size: 10px;
    }

    /* Ticker */
    .ticker-wrap {
        height: 28px !important;
    }

    .ticker {
        font-size: 10px;
    }

    /* Login screen */
    .login-avatar-ring {
        width: 110px;
        height: 110px;
    }

    .login-username {
        font-size: 20px;
    }

    body {
        overflow-y: auto;
        height: auto;
    }

    #bento-container {
        position: relative;
    }

    /* Tile edit done button */
    #tile-edit-done {
        bottom: 100px;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    .dock-icon {
        width: 36px;
        height: 36px;
    }

    .dock {
        gap: 2px;
        padding: 4px 6px;
    }

    .dock-icon .material-symbols-outlined {
        font-size: 16px !important;
    }

    .widget {
        padding: 14px;
        min-height: 130px;
    }

    .widget-profile {
        min-height: 200px;
    }

    .profile-img {
        width: 42px;
        height: 42px;
    }

    .login-time {
        font-size: 42px;
    }
}

/* ── 6. WIDGETS ──────────────────────────────────────────── */
.widget {
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.7), rgba(15, 15, 20, 0.8));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-widget);
    padding: var(--padding-widget);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    animation: wIn 0.45s var(--ease-out) forwards;
    transition: transform 0.25s var(--ease-out), background 0.25s, border-color 0.25s, box-shadow 0.25s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Subtle top-edge highlight */
.widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    z-index: 1;
    pointer-events: none;
}

/* Corner accent glow */
.widget::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -40%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    opacity: 0.5;
}

.widget:hover {
    transform: translateY(-4px) scale(1.02);
    background: linear-gradient(145deg, rgba(45, 45, 55, 0.85), rgba(20, 20, 30, 0.95));
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(59, 130, 246, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 20;
}

.widget:hover::after {
    opacity: 1;
}

.widget:active {
    transform: scale(0.98);
    transition: transform 0.05s;
}

.widget:nth-child(1) {
    animation-delay: .04s
}

.widget:nth-child(2) {
    animation-delay: .08s
}

.widget:nth-child(3) {
    animation-delay: .12s
}

.widget:nth-child(4) {
    animation-delay: .16s
}

.widget:nth-child(5) {
    animation-delay: .20s
}

.widget:nth-child(6) {
    animation-delay: .24s
}

.widget:nth-child(7) {
    animation-delay: .28s
}

.widget:nth-child(8) {
    animation-delay: .32s
}

.widget:nth-child(9) {
    animation-delay: .36s
}

.widget:nth-child(10) {
    animation-delay: .40s
}

@keyframes wIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97)
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

.col-span-1 {
    grid-column: span 1
}

.col-span-2 {
    grid-column: span 2
}

.row-span-1 {
    grid-row: span 1
}

.row-span-2 {
    grid-row: span 2
}

/* Widget Types */
.widget-profile {
    justify-content: flex-end;
    background: linear-gradient(160deg, rgba(30, 30, 50, 0.8) 20%, rgba(10, 10, 25, 0.9) 80%);
    border-color: rgba(139, 92, 246, 0.15);
}

.widget-profile::after {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}

.profile-img {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.profile-content h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.profile-content p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.widget-weather {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    justify-content: space-between;
}

.widget-calendar {
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
}

.cal-date {
    font-size: 48px;
    font-weight: 200;
    line-height: 1;
    letter-spacing: -3px;
}

.cal-day {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-red);
    text-transform: uppercase;
    margin-top: 5px;
    letter-spacing: 0.1em;
}

.widget-map {
    background: #0f172a;
    padding: 0;
    border-color: rgba(59, 130, 246, 0.15);
}

.widget-map::after {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
}

.map-bg {
    position: absolute;
    inset: 0;
    opacity: .3;
    background: radial-gradient(circle at 50% 50%, #334155 1px, transparent 1px);
    background-size: 18px 18px;
}

.map-pin {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-red);
    filter: drop-shadow(0 4px 8px rgba(239, 68, 68, .4));
}

.map-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, .95), transparent);
    z-index: 2;
}

.widget-app {
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.app-icon-large {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
}

.widget-music {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
}

.music-art {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: var(--surface-3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.music-wave {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 12px;
}

.music-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--accent-green);
    animation: mB .8s infinite ease-in-out;
}

.music-bar:nth-child(2) {
    animation-delay: .15s
}

.music-bar:nth-child(3) {
    animation-delay: .3s
}

@keyframes mB {

    0%,
    100% {
        height: 3px
    }

    50% {
        height: 12px
    }
}

/* Resource Bars (for resource monitor widget) */
.res-bar-track {
    height: 4px;
    background: var(--surface-3);
    border-radius: 2px;
    overflow: hidden;
    flex: 1;
}

.res-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

/* ── 7. DOCK ─────────────────────────────────────────────── */
#dock-container {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
}

.dock {
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 6px 10px;
    display: flex;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.dock-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    transition: all 0.25s;
    cursor: pointer;
    position: relative;
}

.dock-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-8px) scale(1.12);
}

.dock-indicator {
    position: absolute;
    bottom: -3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    transition: opacity 0.3s;
}

.dock-icon.active .dock-indicator {
    opacity: 1;
}


/* Desktop Layout (Dock Right, Tiles Left) */
@media (min-width: 1025px) {
    #dock-container {
        bottom: auto;
        left: auto;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
    }

    .dock {
        flex-direction: column;
        padding: 10px 6px;
        width: auto;
        height: auto;
    }

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

    .dock-indicator {
        bottom: auto;
        right: -3px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 4px;
    }

    #bento-container {
        justify-content: flex-start;
        padding-left: 60px;
        /* Offset from left edge */
        padding-right: 100px;
        /* Space for the dock on the right */
        max-width: 100%;
    }

    .bento-grid {
        margin-left: 0;
        margin-right: auto;
        max-width: 900px;
        /* Allow it to be slightly wider if needed, or keep original max */
    }
}

/* ── 8. WINDOWS ──────────────────────────────────────────── */
#os-desktop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
}

.app-window {
    position: absolute;
    background: var(--surface-1);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(.92);
    pointer-events: auto;
    transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
    overflow: hidden;
}

.app-window.is-active {
    opacity: 1;
    transform: scale(1);
}

.app-window.is-maximized {
    top: 36px !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100vh - 36px - 70px) !important;
    border-radius: 0 !important;
}

.app-window.snap-left {
    top: 36px !important;
    left: 0 !important;
    width: 50vw !important;
    height: calc(100vh - 36px - 70px) !important;
    border-radius: 0 !important;
}

.app-window.snap-right {
    top: 36px !important;
    left: 50vw !important;
    width: 50vw !important;
    height: calc(100vh - 36px - 70px) !important;
    border-radius: 0 !important;
}

.window-header {
    height: 40px;
    min-height: 40px;
    background: var(--surface-2);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    user-select: none;
    cursor: default;
    border-radius: 12px 12px 0 0;
}

.app-window.is-maximized .window-header,
.app-window.snap-left .window-header,
.app-window.snap-right .window-header {
    border-radius: 0;
}

.window-controls {
    display: flex;
    gap: 7px;
    align-items: center;
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    opacity: .7;
    transition: opacity .15s;
}

.control-btn:hover {
    opacity: 1;
}

.control-close {
    background: #ff5f57
}

.control-min {
    background: #febc2e
}

.control-max {
    background: #28c840
}

.window-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.window-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border-radius: 0 0 12px 12px;
}

.app-window.is-maximized .window-content,
.app-window.snap-left .window-content,
.app-window.snap-right .window-content {
    border-radius: 0;
}

/* Snap Preview */
#snap-preview {
    position: fixed;
    z-index: 4999;
    border: 2px solid rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.08);
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s;
}

#snap-preview.visible {
    opacity: 1;
}

/* ── 9. CONTEXT MENU ─────────────────────────────────────── */
#context-menu {
    position: fixed;
    z-index: 30000;
    background: var(--surface-1);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    opacity: 0;
    transform: scale(.95);
    pointer-events: none;
    transition: opacity .15s, transform .15s;
    font-size: 13px;
}

#context-menu.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.ctx-item {
    padding: 7px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .1s;
    color: var(--text-secondary);
}

/* ── 10. NEW WIDGET STYLES ───────────────────────────────── */
@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.widget-clock {
    display: flex;
    flex-direction: column;
}

.widget-stack {
    display: flex;
    flex-direction: column;
    padding: 16px;
}

#quick-note::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Bento Grid Adjustments for new widgets if needed */
/* Ensure the grid respects the new items */

.ctx-item:hover {
    background: var(--accent-blue);
    color: #fff;
}

.ctx-divider {
    height: 1px;
    background: #333;
    margin: 4px 0;
}

/* ── 10. SPOTLIGHT ───────────────────────────────────────── */
#spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 18vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

#spotlight-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spotlight-search {
    width: 520px;
    max-width: 90vw;
    background: var(--surface-1);
    border: 1px solid #333;
    border-radius: 14px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, .5);
    overflow: hidden;
}

.spotlight-input {
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-main);
    outline: none;
}

.spotlight-input::placeholder {
    color: var(--text-tertiary);
}

.spotlight-results {
    border-top: 1px solid #222;
}

.spotlight-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    cursor: pointer;
    transition: background .15s;
}

.spotlight-item:hover,
.spotlight-item.selected {
    background: var(--surface-2);
}

.spotlight-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── 11. NOTIFICATIONS ───────────────────────────────────── */
#notification-center {
    position: fixed;
    top: 44px;
    right: 12px;
    z-index: 25000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 320px;
    width: 100%;
}

.notification {
    background: var(--surface-1);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px 14px;
    position: relative;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
    transform: translateX(110%);
    transition: transform .35s var(--ease-out), opacity .35s;
    opacity: 0;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.notification-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-title {
    font-size: 12px;
    font-weight: 700;
    flex: 1;
}

.notification-time {
    font-size: 10px;
    color: var(--text-tertiary);
}

.notification-body {
    font-size: 11px;
    color: var(--text-secondary);
    padding-left: 36px;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity .15s;
}

.notification:hover .notification-close {
    opacity: 1;
}

/* ── 12. UTILITY ─────────────────────────────────────────── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

/* Profile Social Icons */
.hover-icon {
    transition: transform 0.2s, color 0.2s;
}

.hover-icon:hover {
    transform: translateY(-2px);
    color: var(--accent-blue);
}

/* Download CV Button */
button[onclick*="resume.html"]:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* ── RESPONSIVE & PERFORMANCE ────────────────────────────── */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .slide,
    .slide-dot,
    .widget {
        transition: none !important;
        animation: none !important;
    }
}

/* ── TILE EDIT MODE ──────────────────────────────────────── */
body.tile-edit-mode .widget {
    animation: tileWiggle 0.3s ease-in-out infinite alternate;
    cursor: grab;
    border: 2px dashed rgba(139, 92, 246, 0.4) !important;
    opacity: 1 !important;
}

body.tile-edit-mode .widget:nth-child(even) {
    animation-delay: 0.15s;
}

body.tile-edit-mode .widget:hover {
    transform: none;
    border-color: rgba(139, 92, 246, 0.7) !important;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

body.tile-edit-mode .widget:active {
    cursor: grabbing;
}

@keyframes tileWiggle {
    0% {
        transform: rotate(-0.5deg);
    }

    100% {
        transform: rotate(0.5deg);
    }
}

.tile-dragging {
    opacity: 0.4 !important;
    transform: scale(0.95) !important;
}

.tile-drag-over {
    border-color: #10b981 !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3), inset 0 0 20px rgba(16, 185, 129, 0.05) !important;
    transform: scale(1.02) !important;
}

.tile-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

#tile-edit-done {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    display: none;
    align-items: center;
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: donePulse 2s ease-in-out infinite;
}

#tile-edit-done:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.5);
}

@keyframes donePulse {

    0%,
    100% {
        box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6), 0 0 0 2px rgba(139, 92, 246, 0.3);
    }
}

/* Performance optimizations */
.slide {
    will-change: opacity;
}

.widget:hover {
    will-change: transform;
}

.slide-dot:hover {
    opacity: 1 !important;
    transform: scale(1.3);
}

/* Mobile responsive */
@media (max-width: 1024px) {
    #bento-container {
        padding-top: 70px !important;
        flex-direction: column;
    }

    #bento-container>div {
        flex-direction: column !important;
        align-items: center;
    }

    .sidebar-widget {
        width: 100% !important;
        max-width: 400px !important;
        height: 280px !important;
        margin: 0 auto;
    }

    .bento-grid {
        max-width: 100%;
        padding: 0 12px;
    }

    /* Force dock to bottom on tablets */
    #dock-container {
        bottom: 48px !important;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        width: auto;
    }

    .dock {
        flex-direction: row !important;
    }

    .dock-indicator {
        bottom: -3px !important;
        right: auto !important;
        top: auto !important;
        left: 50%;
        transform: translateX(-50%) !important;
    }
}

@media (max-width: 768px) {
    #topbar {
        padding: 0 12px;
    }

    #bento-container {
        padding-top: 60px !important;
        padding-bottom: 80px;
    }

    .sidebar-widget {
        height: 240px !important;
        max-width: 100% !important;
    }

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

    .col-span-2 {
        grid-column: span 1;
    }
}