/* 繁星系 FXOS Desktop Styles */
:root {
    --bg-deep: #0b0e17;
    --bg-panel: #151a27;
    --bg-window: #1a2030;
    --bg-title: #121722;
    --accent: #6c8cff;
    --accent-hover: #8ba4ff;
    --text: #e8ecf4;
    --text-dim: #9aa3b8;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 12px 40px rgba(0,0,0,0.45);
    --radius: 12px;
    --taskbar-h: 48px;
    --font: 'Noto Sans TC', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: var(--font); background: var(--bg-deep); color: var(--text); }

/* ===== 登入畫面 ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 30% 20%, #1a2440 0%, var(--bg-deep) 60%);
}
.login-card {
    width: 380px;
    padding: 40px 36px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.logo-area { text-align: center; margin-bottom: 32px; }
.logo-icon {
    font-size: 42px;
    color: var(--accent);
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(108,140,255,0.5);
}
.logo-area h1 { font-size: 28px; font-weight: 700; letter-spacing: 2px; }
.subtitle { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}
.form-group input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent), #4a6cf7);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,140,255,0.35); }
.form-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 14px; }
.error-msg { color: #ff6b7a; font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }
.login-footer { text-align: center; margin-top: 20px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }

/* ===== 桌面 ===== */
.desktop {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at 70% 30%, #1e2a45 0%, #0b0e17 55%);
    overflow: hidden;
}
.desktop-icons {
    position: absolute;
    inset: 0 0 var(--taskbar-h) 0;
    padding: 16px;
}
.desktop-icon {
    position: absolute;
    width: 80px;
    text-align: center;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 10px;
    user-select: none;
    transition: background .15s;
}
.desktop-icon:hover, .desktop-icon.selected { background: rgba(108,140,255,0.18); }
.desktop-icon .icon-img {
    width: 48px;
    height: 48px;
    margin: 0 auto 6px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2a3550, #1a2235);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.desktop-icon .icon-label {
    font-size: 12px;
    color: var(--text);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    word-break: break-all;
    line-height: 1.3;
}

/* ===== 視窗 ===== */
.window {
    position: absolute;
    min-width: 320px;
    min-height: 200px;
    background: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}
.window.active { border-color: rgba(108,140,255,0.35); }
.window-titlebar {
    height: 36px;
    background: var(--bg-title);
    display: flex;
    align-items: center;
    padding: 0 8px 0 14px;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}
.window-title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.window-controls { display: flex; gap: 6px; }
.window-btn {
    width: 28px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.window-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.window-btn.close:hover { background: #e74c3c; color: #fff; }
.window-body {
    flex: 1;
    overflow: auto;
    background: var(--bg-window);
}
.window-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - var(--taskbar-h)) !important;
    border-radius: 0;
}
.window.minimized { display: none; }

/* ===== 工作列 ===== */
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--taskbar-h);
    background: rgba(15,18,28,0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 9999;
}
.start-btn {
    width: 40px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.start-btn:hover { background: rgba(108,140,255,0.15); }
.taskbar-apps {
    flex: 1;
    display: flex;
    gap: 4px;
    padding: 0 12px;
    overflow-x: auto;
}
.taskbar-item {
    height: 36px;
    min-width: 40px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.taskbar-item:hover, .taskbar-item.active { background: rgba(255,255,255,0.08); }
.taskbar-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
.taskbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.clock { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.user-menu { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.btn-icon {
    width: 32px; height: 32px;
    border: none; border-radius: 8px;
    background: transparent; color: var(--text-dim);
    cursor: pointer; font-size: 16px;
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* ===== 開始選單 ===== */
.start-menu {
    position: absolute;
    bottom: calc(var(--taskbar-h) + 8px);
    left: 10px;
    width: 320px;
    max-height: 70vh;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.start-menu.hidden { display: none; }
.start-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.start-logo { font-weight: 600; color: var(--accent); }
.version { font-size: 12px; color: var(--text-dim); }
.start-apps {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.start-app {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
}
.start-app:hover { background: rgba(108,140,255,0.12); }
.start-app .app-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #24304a;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.start-footer {
    border-top: 1px solid var(--border);
    padding: 8px;
    display: flex;
    gap: 4px;
}
.start-item {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
}
.start-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* 內部 App 基本樣式（iframe 內可再覆寫） */
.app-content { padding: 16px; height: 100%; }
.app-content h2 { margin-bottom: 12px; font-size: 18px; }
.app-content textarea {
    width: 100%; height: calc(100% - 40px);
    background: #0f131c; border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); padding: 12px;
    font-family: ui-monospace, monospace; resize: none; outline: none;
}