@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --accent: #8b5cf6;
    --accent-secondary: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --blur-val: 40px;
    --ios-blur: blur(var(--blur-val)) saturate(210%);
    --spring-easing: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
    cursor: none !important;
    user-select: none;
    box-sizing: border-box;
    transition: background-color 0.3s, border-color 0.3s;
    ime-mode: disabled;
}

body {
    background: #000;
    margin: 0;
    width: 100vw;
    height: 100vh;
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow: hidden;
    color: white;
}

#custom-cursor {
    position: fixed;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    backdrop-filter: invert(0.5);
    transition: transform 0.1s ease-out, width 0.3s, height 0.3s, border-radius 0.3s, background 0.3s;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-hover #custom-cursor { transform: translate(-50%, -50%) scale(2.8); background: rgba(255, 255, 255, 0.1); }
.cursor-text #custom-cursor { width: 2px; height: 26px; border-radius: 0; background: white; }
.cursor-code #custom-cursor::after { content: '{}'; font-size: 6px; font-weight: 800; color: white; }

#desktop {
    width: 100%; height: 100%; position: relative;
    background-size: cover;
    background-position: center;
    display: flex; flex-direction: column;
    transition: background-image 1s var(--spring-easing);
}

#menu-bar {
    height: 32px; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(25px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    display: flex; justify-content: space-between; align-items: center; padding: 0 16px; font-size: 13px; z-index: 1000;
}

#desktop-island {
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    height: 20px; width: 140px; background: #000; border-radius: 20px; z-index: 1100;
    transition: all 0.6s var(--spring-easing); display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 10px; font-weight: 700; cursor: pointer;
}
#desktop-island.expanded { width: 480px; height: 110px; top: 40px; border-radius: 32px; padding: 24px; }

#widget-layer {
    position: absolute; inset: 0; padding: 60px 40px; z-index: 5;
    display: flex; flex-direction: column; gap: 24px; pointer-events: none;
}
.widget {
    pointer-events: auto;
    width: 280px; background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    animation: widgetFadeIn 0.8s var(--spring-easing) forwards;
}
@keyframes widgetFadeIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

.widget-weather { height: 160px; display: flex; flex-direction: column; justify-content: space-between; }
.widget-clock { width: 340px; background: transparent; backdrop-filter: none; border: none; box-shadow: none; }
.widget-note { height: 200px; }

.window {
    position: absolute; background: rgba(18, 18, 22, 0.94); backdrop-filter: var(--ios-blur);
    border-radius: 20px; box-shadow: 0 40px 120px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.08);
    color: white; overflow: hidden; display: flex; flex-direction: column; z-index: 10;
    animation: winPop 0.4s var(--spring-easing);
}
@keyframes winPop { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.window-header {
    height: 48px; padding: 0 20px; display: flex; align-items: center;
    background: rgba(255,255,255,0.02); border-bottom: 1px solid rgba(255,255,255,0.04);
}
.window-controls { display: flex; gap: 8px; }
.control-dot { width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.dot-close { background: #ff5f56; }
.dot-min { background: #ffbd2e; }
.dot-max { background: #27c93f; }

#control-center {
    position: absolute; top: 40px; right: 12px; width: 320px;
    background: rgba(28, 28, 32, 0.85); backdrop-filter: blur(50px) saturate(210%);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px;
    padding: 20px; z-index: 2000; box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    display: none; animation: ccPop 0.4s var(--spring-easing);
}
@keyframes ccPop { from { opacity: 0; transform: translateY(-10px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.cc-tile { background: rgba(255,255,255,0.06); border-radius: 16px; padding: 12px; transition: 0.2s; cursor: pointer; border: 1px solid rgba(255,255,255,0.03); }
.cc-tile:hover { background: rgba(255,255,255,0.1); }
.cc-tile.active { background: var(--accent); color: white; }
.cc-slider { -webkit-appearance: none; height: 28px; background: rgba(255,255,255,0.1); border-radius: 14px; overflow: hidden; outline: none; }
.cc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 0; box-shadow: -400px 0 0 400px var(--accent); }

#notification-center { position: absolute; top: 40px; right: 12px; z-index: 1500; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.notif {
    pointer-events: auto; width: 280px; background: rgba(30,30,35,0.8); backdrop-filter: blur(30px);
    border-radius: 18px; padding: 16px; border: 1px solid rgba(255,255,255,0.1);
    animation: notifSlide 0.5s var(--spring-easing) forwards;
}
@keyframes notifSlide { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

#sys-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(20px); z-index: 9000; display: none; }

#dylina-ime {
    position: fixed; z-index: 11000; background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px) saturate(200%); border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px; padding: 12px; display: none; flex-direction: column; gap: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4); min-width: 200px;
    animation: imePop 0.2s var(--spring-easing);
}
@keyframes imePop { from { opacity: 0; transform: translateY(10px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
.ime-preedit { font-family: 'JetBrains Mono'; font-size: 14px; color: var(--accent); font-weight: 700; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.ime-candidates { display: flex; gap: 12px; }
.ime-candidate { font-size: 16px; cursor: pointer; transition: 0.2s; padding: 4px 8px; border-radius: 8px; }
.ime-candidate:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }
.ime-candidate.selected { color: var(--accent); font-weight: bold; background: rgba(255,255,255,0.05); }

.term-container { background: #0c0c0e; height: 100%; padding: 20px; font-family: 'JetBrains Mono', monospace; color: #10b981; display: flex; flex-direction: column; }
.term-output { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.term-line { display: flex; gap: 8px; }
.term-prompt { color: var(--accent); font-weight: bold; }
.term-input { background: transparent; border: none; outline: none; color: white; flex: 1; font-family: inherit; font-size: inherit; }

#desktop-icons {
    position: absolute; top: 60px; right: 40px;
    display: flex; flex-direction: column; gap: 30px; z-index: 5;
}
.desktop-icon {
    display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer;
    transition: 0.2s;
}
.desktop-icon:hover { transform: scale(1.05); }

#dock-container { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 1000; }
#dock {
    background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(40px) saturate(220%);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px;
    padding: 8px; display: flex; gap: 10px; align-items: flex-end;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    transition: padding 0.3s var(--spring-easing);
}
.dock-item {
    width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s ease-out, margin 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out;
    position: relative;
    will-change: transform, margin, width, height;
    transform-origin: bottom;
}
.dock-item::after {
    content: ''; position: absolute; bottom: -6px; width: 4px; height: 4px;
    background: var(--accent); border-radius: 50%; opacity: 0;
    transition: opacity 0.3s;
}
.dock-item.active::after { opacity: 1; }
.dock-item i { transition: width 0.2s, height 0.2s; }

.settings-grid { display: grid; grid-template-columns: 200px 1fr; height: 100%; background: #0c0c0e; }
.settings-sidebar { background: #121216; padding: 20px; border-right: 1px solid rgba(255,255,255,0.05); }
.settings-content { padding: 40px; overflow-y: auto; }
.wallpaper-card { width: 120px; height: 80px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; transition: 0.3s; background-size: cover; }
.wallpaper-card.active { border-color: var(--accent); transform: scale(1.05); }

.ide-main { display: grid; grid-template-columns: 220px 1fr 1fr; height: 100%; background: #0a0a0c; }
.ide-editor { background: #0a0a0c; position: relative; }
.ide-editor textarea {
    width: 100%; height: 100%; background: transparent; color: #e4e4e7;
    border: none; resize: none; outline: none; padding: 24px;
    font-family: 'JetBrains Mono', monospace; font-size: 14px; line-height: 1.6;
}

#boot-screen { position: fixed; inset: 0; background: #000; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.boot-logo { font-size: 72px; font-weight: 900; letter-spacing: -4px; background: linear-gradient(135deg, #fff, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: bootIn 2.5s var(--spring-easing) forwards; }
@keyframes bootIn { 0% { opacity: 0; transform: scale(0.8) blur(20px); } 50% { opacity: 1; transform: scale(1); blur: 0; } 100% { opacity: 0; transform: scale(1.1) blur(10px); } }

.ai-chat { display: flex; flex-direction: column; height: 100%; background: #0c0c0e; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.ai-msg { padding: 14px 18px; border-radius: 18px; font-size: 14px; max-width: 85%; line-height: 1.6; }
.ai-msg-ai { background: #1a1a20; align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid rgba(255,255,255,0.05); }
.ai-msg-user { background: var(--accent); align-self: flex-end; border-bottom-right-radius: 4px; }

/* 专属右键菜单 */
#context-menu {
    position: fixed; z-index: 12000; width: 220px;
    background: rgba(28, 28, 32, 0.8); backdrop-filter: blur(40px) saturate(210%);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px;
    padding: 6px; display: none; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    animation: menuPop 0.2s var(--spring-easing);
}
@keyframes menuPop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.menu-item {
    padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
    display: flex; items-center justify-between; cursor: pointer; transition: 0.2s;
}
.menu-item:hover { background: var(--accent); color: white; }
.menu-sep { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 6px; }

/* Python Edition 特有样式 */
.py-edition { border: 2px solid #ffd43b !important; }
.py-edition .window-header { background: rgba(255, 212, 59, 0.05); }
.py-edition .window-controls::after { content: 'PYTHON'; font-size: 8px; font-weight: 900; color: #ffd43b; margin-left: 10px; opacity: 0.5; }

/* Dylina Office PEW Ultra (Docs + Sheets + Slides) */
.pew-main { display: flex; flex-direction: column; height: 100%; background: #f8f9fa; color: #333; }
.pew-nav { height: 40px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; padding: 0 20px; gap: 24px; }
.pew-nav-item { font-size: 13px; font-weight: 700; opacity: 0.5; cursor: pointer; transition: 0.2s; position: relative; }
.pew-nav-item.active { opacity: 1; color: var(--accent); }
.pew-nav-item.active::after { content: ''; position: absolute; bottom: -11px; left: 0; width: 100%; height: 2px; background: var(--accent); }

.pew-toolbar { padding: 12px 24px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; gap: 20px; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.pew-content-area { flex: 1; overflow: hidden; position: relative; display: flex; }

/* Writer Mode */
.pew-writer { flex: 1; padding: 40px; overflow-y: auto; display: flex; justify-content: center; background: #f0f2f5; }
.pew-page { width: 100%; max-width: 820px; min-height: 1160px; background: white; box-shadow: 0 0 40px rgba(0,0,0,0.05); padding: 90px; outline: none; font-size: 16px; line-height: 1.8; color: #2c3e50; }

/* Sheets Mode */
.pew-sheets { flex: 1; display: flex; flex-direction: column; background: #fff; overflow: auto; }
.pew-grid { display: grid; grid-template-columns: 40px repeat(26, 120px); grid-auto-rows: 30px; }
.pew-cell { border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; padding: 0 8px; font-size: 13px; outline: none; background: #fff; }
.pew-cell:focus { background: rgba(139, 92, 246, 0.05); border: 1.5px solid var(--accent); z-index: 10; }
.pew-header-cell { background: #f8fafc; font-weight: 700; color: #64748b; justify-content: center; font-size: 11px; }

/* Slides Mode */
.pew-slides { flex: 1; display: grid; grid-template-columns: 240px 1fr; background: #e2e8f0; }
.pew-slide-list { background: #fff; border-right: 1px solid #cbd5e1; padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.pew-slide-thumb { aspect-ratio: 16/9; background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 8px; cursor: pointer; position: relative; }
.pew-slide-thumb.active { border-color: var(--accent); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2); }
.pew-slide-canvas-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.pew-slide-canvas { width: 100%; max-width: 900px; aspect-ratio: 16/9; background: white; box-shadow: 0 20px 50px rgba(0,0,0,0.1); border-radius: 4px; padding: 60px; outline: none; }

/* Python Mode in PEW */
.pew-python-panel { position: absolute; bottom: 0; left: 0; right: 0; height: 180px; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(20px); border-top: 2px solid #ffd43b; color: #fff; display: none; flex-direction: column; z-index: 50; }
.pew-python-header { padding: 8px 16px; background: rgba(255, 212, 59, 0.1); display: flex; justify-content: space-between; align-items: center; font-family: 'JetBrains Mono'; font-size: 11px; font-weight: 800; color: #ffd43b; }
.pew-python-editor { flex: 1; padding: 12px; font-family: 'JetBrains Mono'; font-size: 13px; color: #e2e8f0; outline: none; resize: none; background: transparent; border: none; }

/* Dylina Paint */
.paint-main { display: flex; flex-direction: column; height: 100%; background: #1a1a1a; }
.paint-canvas-container { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px; }
.paint-canvas { background: white; box-shadow: 0 10px 40px rgba(0,0,0,0.5); cursor: crosshair; }
.paint-toolbar { height: 60px; background: rgba(255,255,255,0.05); backdrop-filter: blur(20px); border-top: 1px solid rgba(255,255,255,0.1); display: flex; items-center px-6 gap-6; }
