:root,
[data-theme="cyan"] {
    --bg-deep: #050811;
    --bg-surface: rgba(10, 16, 30, 0.76);
    --bg-surface-elevated: rgba(14, 22, 42, 0.90);
    --accent: #00f0ff;
    --accent-soft: rgba(0, 240, 255, 0.14);
    --accent-border: rgba(0, 240, 255, 0.28);
    --secondary: #ff3366;
    --text-main: #e6f2ff;
    --text-muted: #7e97b8;
    --danger: #ff3366;
    --success: #00e5a3;
}

[data-theme="crimson"] {
    --bg-deep: #090509;
    --bg-surface: rgba(24, 10, 18, 0.78);
    --bg-surface-elevated: rgba(34, 12, 24, 0.92);
    --accent: #ff2a5f;
    --accent-soft: rgba(255, 42, 95, 0.15);
    --accent-border: rgba(255, 42, 95, 0.30);
    --secondary: #00f0ff;
    --text-main: #ffeef2;
    --text-muted: #b58392;
}

[data-theme="violet"] {
    --bg-deep: #070512;
    --bg-surface: rgba(16, 12, 34, 0.78);
    --bg-surface-elevated: rgba(22, 16, 46, 0.92);
    --accent: #9d7bff;
    --accent-soft: rgba(157, 123, 255, 0.15);
    --accent-border: rgba(157, 123, 255, 0.30);
    --secondary: #00f0ff;
    --text-main: #f0ebff;
    --text-muted: #9386b8;
}

[data-theme="emerald"] {
    --bg-deep: #040d0a;
    --bg-surface: rgba(8, 24, 18, 0.78);
    --bg-surface-elevated: rgba(10, 32, 24, 0.92);
    --accent: #00f5a0;
    --accent-soft: rgba(0, 245, 160, 0.14);
    --accent-border: rgba(0, 245, 160, 0.28);
    --secondary: #00d9f5;
    --text-main: #e6fff5;
    --text-muted: #78ab96;
}

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --taskbar-h: 48px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* Во время перетаскивания окон отключаем перехват мыши внутри iframe */
body.is-dragging-window iframe {
    pointer-events: none !important;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.ambient-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at 50% 45%, transparent 40%, rgba(2, 4, 10, 0.7) 100%);
}

/* Универсальный стиль стеклянных панелей */
.hud-glass {
    background: var(--bg-surface);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--accent-border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Загрузочный экран */
#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: #03050b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.boot-box {
    width: 360px;
    text-align: center;
}

.boot-brand {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 6px;
    color: #fff;
    text-shadow: 0 0 24px var(--accent);
}

.boot-brand span {
    color: var(--accent);
}

.boot-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 6px;
}

.boot-log {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    margin: 24px 0 10px;
    height: 18px;
}

.boot-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.boot-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    transition: width 0.25s ease;
}

/* Рабочий стол и ярлыки */
#desktop {
    position: relative;
    z-index: 2;
    width: 100vw;
    height: calc(100vh - var(--taskbar-h));
}

#desktop-icons {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.desktop-icon {
    position: absolute;
    pointer-events: auto;
    width: 98px;
    padding: 10px 6px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.desktop-icon:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    transform: translateY(-2px);
}

.desktop-icon.dragging {
    opacity: 0.85;
    transform: scale(1.06);
    z-index: 50;
    transition: none;
}

.desktop-icon.droppable {
    background: rgba(255, 51, 102, 0.24);
    border-color: var(--danger);
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.4);
    transform: scale(1.1);
}

.icon-svg-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(10, 18, 34, 0.75);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: inset 0 0 12px var(--accent-soft);
}

.desktop-icon span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: var(--text-main);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    line-height: 1.25;
    word-break: break-word;
}

/* Окна ОС */
#windows-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.os-window {
    position: absolute;
    pointer-events: auto;
    min-width: 420px;
    min-height: 280px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.os-window.active {
    border-color: var(--accent);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.78), 0 0 24px var(--accent-soft);
}

.os-window.minimized {
    opacity: 0;
    transform: scale(0.88) translateY(40px);
    pointer-events: none;
}

.os-window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    resize: none;
}

.window-header {
    height: 40px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    flex-shrink: 0;
}

.window-header:active {
    cursor: grabbing;
}

.window-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.window-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.window-title {
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--text-main);
    text-transform: uppercase;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.win-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.win-btn:hover {
    background: var(--accent-soft);
    color: #fff;
    border-color: var(--accent-border);
}

.win-btn.close-btn:hover {
    background: rgba(255, 51, 102, 0.25);
    border-color: var(--danger);
    color: #fff;
}

.window-body {
    flex: 1;
    overflow: auto;
    padding: 18px;
    user-select: text;
}

.window-body.no-padding {
    padding: 0;
    overflow: hidden;
}

/* Внутренние стили приложений */
.sci-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sci-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-soft);
}

.sci-btn.primary {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #fff;
}

.sci-btn.danger {
    border-color: rgba(255, 51, 102, 0.4);
    color: #ff8aa3;
}

.sci-btn.danger:hover {
    background: rgba(255, 51, 102, 0.2);
    border-color: var(--danger);
}

/* Команда (Team_Profile.exe) */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    height: 100%;
    align-items: stretch;
}

.member-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.member-card:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-3px);
}

.member-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--accent);
}

.member-role {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* RoomCore.rcx */
.rc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    height: 100%;
}

@media (max-width: 720px) {
    .rc-layout { grid-template-columns: 1fr; }
}

.rc-hero {
    background: rgba(255, 42, 95, 0.06);
    border: 1px solid rgba(255, 42, 95, 0.28);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rc-title {
    font-family: var(--font-display);
    font-size: 26px;
    color: #ff2a5f;
    text-shadow: 0 0 16px rgba(255, 42, 95, 0.45);
}

.rc-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    background: rgba(255, 42, 95, 0.2);
    color: #ff7a9b;
    border: 1px solid rgba(255, 42, 95, 0.4);
}

.rc-roadmap {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
}

.rc-roadmap li {
    padding-left: 14px;
    border-left: 2px solid #ff2a5f;
    color: var(--text-muted);
}

.rc-roadmap li strong {
    color: var(--text-main);
}

.rc-chat-demo {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rc-chat-header {
    padding: 10px 14px;
    background: rgba(255, 42, 95, 0.12);
    border-bottom: 1px solid rgba(255, 42, 95, 0.25);
    font-family: var(--font-mono);
    font-size: 11px;
    color: #ff8aa3;
}

.rc-chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
}

.rc-msg {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    line-height: 1.4;
}

.rc-msg.self {
    align-self: flex-end;
    background: rgba(255, 42, 95, 0.22);
    border: 1px solid rgba(255, 42, 95, 0.4);
}

.rc-chat-input {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rc-chat-input input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 12px;
    color: #fff;
    outline: none;
    font-size: 12px;
}

/* Терминал Console.sh */
.terminal-wrap {
    background: rgba(3, 6, 14, 0.85);
    height: 100%;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.terminal-output {
    display: flex;
    flex-direction: column;
    gap: 6px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.term-line-cmd { color: var(--text-muted); }
.term-prompt { color: var(--accent); font-weight: 600; margin-right: 8px; }
.term-accent { color: var(--accent); }
.term-err { color: var(--danger); }

.terminal-input-row {
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
}

/* Текстовый редактор Notes.app */
.notes-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
}

.notes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notes-textarea {
    flex: 1;
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.notes-textarea:focus {
    border-color: var(--accent);
}

/* Панель задач (Taskbar) */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--taskbar-h);
    z-index: 1000;
    border-left: none;
    border-right: none;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.taskbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    overflow-x: auto;
}

.start-trigger {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.start-trigger:hover, .start-trigger.active {
    background: var(--accent);
    color: #050811;
    box-shadow: 0 0 16px var(--accent-soft);
}

.taskbar-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 4px;
}

#taskbar-apps {
    display: flex;
    align-items: center;
    gap: 6px;
}

.taskbar-item {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.taskbar-item:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-main);
}

.taskbar-item.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #fff;
}

.taskbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tray-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tray-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tray-clock {
    text-align: right;
    padding-left: 6px;
}

#clock-time {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

#clock-date {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--accent);
    letter-spacing: 1px;
}

/* Меню Пуск */
#start-menu {
    position: fixed;
    left: 12px;
    bottom: calc(var(--taskbar-h) + 10px);
    width: 320px;
    border-radius: 14px;
    padding: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.start-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.start-title {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 1.5px;
}

.start-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-pill {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(0, 229, 163, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 229, 163, 0.35);
}

.start-apps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.start-app-row {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.18s ease;
}

.start-app-row:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.start-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Контекстное меню ПКМ */
#context-menu {
    position: fixed;
    z-index: 1500;
    width: 250px;
    padding: 6px;
    border-radius: 12px;
    transition: opacity 0.15s ease;
}

.ctx-item {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.15s ease;
}

.ctx-item span {
    color: var(--accent);
    font-family: var(--font-mono);
}

.ctx-item:hover {
    background: var(--accent-soft);
}

.ctx-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 5px 0;
}

/* Модальное окно досье */
#modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(3, 6, 14, 0.78);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}

.modal-card {
    width: 90%;
    max-width: 720px;
    max-height: 82vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--accent);
}

.modal-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 22px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 16px;
}

.tech-badge {
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-main);
}

/* BSOD Kernel Panic */
#bsod {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: radial-gradient(circle at center, #1a0612 0%, #050208 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bsod-card {
    max-width: 520px;
    width: 100%;
    padding: 32px;
    border-radius: 16px;
    background: rgba(25, 6, 14, 0.85);
    border: 1px solid var(--danger);
    box-shadow: 0 0 60px rgba(255, 51, 102, 0.25);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bsod-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--danger);
    letter-spacing: 2px;
}

.bsod-card h1 {
    font-family: var(--font-display);
    font-size: 24px;
    color: #fff;
}

.bsod-card p {
    color: #f2b8c6;
    line-height: 1.5;
}

.bsod-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

#bsod-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--danger);
    transition: width 0.2s ease;
}