/* -- root variables & fonts -- */
:root {
    --bg-color: #12141c; /* dark slate background */
    --text-color: #e2e8f0; /* light grey-blue text */
    --accent-color: #89b4f9; /* soft, modern blue */
    --link-color: #a872e0; /* a nice purple for links */
    --window-bg: #1a1d28; /* slightly lighter window bg */
    --header-bg: #222633; /* darker header */
    --border-color: #3f4459; /* subtle border */
    --glow-subtle: 0 0 8px rgba(137, 180, 249, 0.4);
    --glow-intense: 0 0 15px var(--accent-color), 0 0 25px rgba(137, 180, 249, 0.6);
    --font-ui: 'Chakra Petch', sans-serif;
    --font-heading: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

/* -- global styles & body -- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-ui);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    cursor: none !important;
    user-select: none;
}

/* custom cursor */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10000;
    transition: width 0.2s ease, height 0.2s ease, transform 0.1s ease, border-radius 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    mix-blend-mode: exclusion;
}
.custom-cursor.active { transform: translate(-50%, -50%) scale(1.2); }
.custom-cursor.pointer {
    width: 28px;
    height: 28px;
    border: none;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent-color);
}
.custom-cursor.grab {
    width: 32px;
    height: 32px;
    border: 3px dashed var(--accent-color);
    border-radius: 4px;
    background-color: transparent;
    transform: translate(-50%, -50%) rotate(45deg);
}
.custom-cursor.text {
    width: 4px;
    height: 24px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 0;
    animation: blink 1s infinite;
}

a, button, .desktop-icon, .window-header, input, textarea {
    cursor: none !important;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
a:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--link-color);
}

/* --- mobile warning --- */
#mobile-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    font-family: var(--font-mono);
}
.warning-content {
    max-width: 500px;
    padding: 40px;
    background-color: var(--window-bg);
    border: 2px solid var(--accent-color);
    border-radius: 15px;
    box-shadow: var(--glow-intense);
}
.warning-content h1 {
    font-family: var(--font-heading);
    color: #ff6058;
    text-shadow: 0 0 10px #ff6058;
    font-size: 2rem;
    margin-bottom: 20px;
    text-transform: uppercase;
}
.warning-content p {
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.5;
}


/* --- boot-up sequence --- */
#boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 1s ease-out;
}
.boot-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.boot-icon {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 15px var(--accent-color));
    animation: pulseGlow 2s infinite ease-in-out;
}
.box-animate { animation: rotateBox 4s linear infinite; }
.diamond-animate { animation: rotateDiamond 4s linear infinite; }
.circle-animate { animation: pulse 2s infinite ease-in-out; }
@keyframes rotateBox { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotateDiamond { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } }
@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 15px var(--accent-color)); }
    50% { filter: drop-shadow(0 0 25px var(--accent-color)); }
}
.boot-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--accent-color);
    text-shadow: var(--glow-subtle);
    margin-top: 25px;
    opacity: 0;
    animation: fadeInUp 0.8s 1s forwards;
}
.loading-bar {
    width: 250px;
    height: 6px;
    background-color: var(--header-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 30px;
    box-shadow: inset 0 0 5px #000;
}
.loading-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background-color: var(--accent-color);
    box-shadow: var(--glow-subtle);
    animation: loading 3s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes loading { from { width: 0; } to { width: 100%; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- desktop ui --- */
#desktop {
    position: relative;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    padding-bottom: 60px;
    overflow: hidden;
    display: block;
    opacity: 0;
    transition: opacity 1s ease;
}
#desktop.hide { display: none; }
#desktop-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.6;
}

/* --- tooltips --- */
#tooltip {
    position: fixed;
    background-color: var(--header-bg);
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9999;
    pointer-events: none;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    left: 0;
    top: 0;
    transform: translate(-50%, -100%);
}

/* --- taskbar --- */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: rgba(26, 30, 42, 0.9);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
}
.taskbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.taskbar-apps {
    display: flex;
    gap: 10px;
}
.taskbar-app-icon {
    width: 50px;
    height: 50px;
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    user-select: none;
}
.taskbar-app-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--accent-color);
    filter: drop-shadow(0 0 5px var(--accent-color));
    transition: stroke 0.3s ease, filter 0.3s ease;
}
.taskbar-app-icon:hover {
    background-color: rgba(137, 180, 249, 0.1);
}
.taskbar-app-icon.open {
    background-color: rgba(137, 180, 249, 0.2);
    border-color: var(--accent-color);
    box-shadow: var(--glow-subtle);
}
.taskbar-app-icon.open::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 30px;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
    box-shadow: var(--glow-subtle);
}
.taskbar-app-icon.pinned::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #e0e7ff;
    border-radius: 50%;
    box-shadow: 0 0 5px #e0e7ff;
}
.system-tray {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    font-family: var(--font-heading);
}
#system-time {
    color: var(--accent-color);
    text-shadow: var(--glow-subtle);
}

/* desktop icons */
.desktop-icons {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 30px;
    padding: 30px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.desktop-icons::-webkit-scrollbar { display: none; }
.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100px;
    padding: 15px 10px;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    user-select: none;
}
.desktop-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--accent-color);
    filter: drop-shadow(0 0 5px var(--accent-color));
    transition: stroke 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}
.desktop-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(137, 180, 249, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.desktop-icon:hover::before { transform: translateX(100%); }
.desktop-icon:hover {
    background-color: rgba(137, 180, 249, 0.08);
    box-shadow: var(--glow-subtle);
    transform: scale(1.05);
}
.desktop-icon:hover svg {
    transform: scale(1.1);
}
.desktop-icon span {
    font-size: 0.9rem;
    margin-top: 8px;
    text-shadow: 0 0 5px rgba(137, 180, 249, 0.5);
    text-transform: lowercase;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- custom context menu --- */
.context-menu {
    position: fixed;
    background-color: rgba(26, 30, 42, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    z-index: 100;
    min-width: 180px;
    font-size: 0.95rem;
    transition: opacity 0.2s ease;
}
.context-menu-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.context-menu-item:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-weight: bold;
}

.hidden { display: none !important; }

/* --- window ui --- */
.window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 650px;
    min-height: 450px;
    max-height: 85vh;
    max-width: 90vw;
    background-color: var(--window-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    resize: both;
    min-width: 350px;
    z-index: 10;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease, box-shadow 0.3s ease;
    opacity: 0;
    visibility: hidden;
}
.resizer {
    position: absolute;
    width: 15px;
    height: 15px;
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
    z-index: 10;
}
.window.active { 
    z-index: 20;
    box-shadow: 0 0 30px rgba(0,0,0,0.6), 0 0 20px var(--accent-color);
}
.window.open { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
    visibility: visible; 
}
.window.minimized {
    opacity: 0;
    visibility: hidden;
}
.window.maximized {
    width: calc(100vw - 4px);
    height: calc(100vh - 64px);
    max-height: 100vh;
    max-width: 100vw;
    top: 2px;
    left: 2px;
    border-radius: 0;
    transform: none;
    transition: all 0.3s ease-in-out;
    resize: none;
}
.window.transmuting {
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
}
.window-header {
    background-color: var(--header-bg);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    font-family: var(--font-ui);
    text-transform: uppercase;
    font-weight: 700;
    cursor: grab;
    flex-shrink: 0;
}
.window-header:active {
    cursor: grabbing;
}
.window-title {
    color: var(--accent-color);
    text-shadow: var(--glow-subtle);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.window-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.window-controls button {
    background: none;
    border: none;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
    padding: 0;
    margin: 0;
}
.window-controls button::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.window-controls button:hover::before {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 1;
}
.window-controls .close-btn::before { background-color: #ff6058; }
.window-controls .minimize-btn::before { background-color: #ffbd2f; }
.window-controls .maximize-btn::before { background-color: #26c840; }
.window-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* --- terminal styles --- */
.terminal-body {
    background-color: #0d0f16;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #00ffc8;
    padding: 15px;
    height: 100%;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    text-shadow: 0 0 5px rgba(0, 255, 200, 0.5);
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.terminal-body::-webkit-scrollbar { display: none; }
.terminal-output {
    min-height: calc(100% - 25px);
    display: flex;
    flex-direction: column;
}
.line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 25px;
}
.prompt { color: #888; text-transform: lowercase; }
.user-prompt { color: #e0e7ff; }
.command { flex: 1; text-transform: lowercase; }
.terminal-input {
    background: none;
    border: none;
    color: #e0e7ff;
    outline: none;
    width: 100%;
    flex: 1;
    caret-color: transparent;
    text-transform: lowercase;
    font-family: var(--font-mono);
    font-size: 1rem;
}
.blinking-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background-color: var(--accent-color);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { background-color: transparent; } }

/* easter egg zone */
.easter-egg-zone {
    width: 80px;
    height: 80px;
    background-color: transparent;
    position: absolute;
    bottom: 25px;
    right: 25px;
    cursor: pointer;
    z-index: 5;
    transition: transform 0.3s ease;
}
.easter-egg-zone:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Core Sentinel / Hacker Game App */
.hacker-game-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}
#password-input {
    width: 80%;
    max-width: 300px;
    padding: 12px;
    font-size: 1rem;
    background-color: #000;
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    border-radius: 6px;
    text-align: center;
    transition: box-shadow 0.3s ease;
}
#password-input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--accent-color);
}
#password-submit-btn {
    padding: 10px 25px;
    font-size: 1.1rem;
    font-family: var(--font-ui);
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    font-weight: bold;
}
#password-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-intense);
}
.status-message {
    margin-top: 10px;
    min-height: 25px;
    color: #ffbd2f;
    text-shadow: 0 0 5px #ffbd2f;
}
.status-message.success {
    color: #26c840;
    text-shadow: 0 0 10px #26c840;
}

/* Editor / Notes App */
.notes-textarea {
    width: 100%;
    height: 100%;
    min-height: 350px;
    background-color: #0d0f16;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 15px;
    font-family: var(--font-mono);
    font-size: 1rem;
    resize: none;
    outline: none;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}
.notes-textarea:focus {
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 10px var(--accent-color);
}

/* Settings App */
.theme-wizard-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.theme-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#reset-theme-btn {
    padding: 10px;
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#reset-theme-btn:hover {
    background-color: #a872e0;
}

/* File Explorer */
.file-explorer-body {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.file-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--header-bg);
    flex-shrink: 0;
}
#current-path {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--accent-color);
}
.toolbar-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
.toolbar-btn:hover {
    background-color: rgba(137, 180, 249, 0.2);
    border-color: var(--accent-color);
}
.file-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
}
.file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    user-select: none;
}
.file-icon:hover {
    background-color: rgba(137, 180, 249, 0.1);
}
.file-icon svg {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 5px var(--icon-color));
    stroke: var(--icon-color);
    transition: transform 0.2s ease;
}
.file-icon:hover svg {
    transform: scale(1.1);
}
.file-icon.folder { --icon-color: #66d9ef; }
.file-icon.file-txt { --icon-color: #e2e8f0; }
.file-icon.file-app { --icon-color: #26c840; }
.file-icon.file-img { --icon-color: #ffbd2f; }
.file-icon.file-log { --icon-color: #ff6058; }
.file-icon.file-bin { --icon-color: #a872e0; }

.file-icon span {
    font-size: 0.8rem;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

/* System Monitor */
.sys-monitor-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.monitor-item {
    display: flex;
    align-items: center;
    gap: 15px;
}
.monitor-label {
    width: 120px;
    font-family: var(--font-heading);
    color: var(--accent-color);
}
.monitor-bar-container {
    flex-grow: 1;
    height: 20px;
    background-color: #2d3448;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.monitor-bar {
    height: 100%;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px var(--bar-color);
    background-color: var(--bar-color);
}
#cpu-bar { --bar-color: #ff6058; }
#ram-bar { --bar-color: #a872e0; }
#disk-bar { --bar-color: #26c840; }
.monitor-value {
    width: 50px;
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text-color);
}
.monitor-chart {
    flex-grow: 1;
    height: 100px;
    background-color: #0d0f16;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}
.monitor-chart::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(42, 46, 58, 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgba(42, 46, 58, 0.5) 1px, transparent 1px);
    background-size: 20px 20px;
}

#final-success-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(137, 180, 249, 0.8);
    color: #12141c;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 3rem;
    opacity: 0;
    animation: fadeInAndOut 5s forwards ease-in-out;
    backdrop-filter: blur(10px);
    text-shadow: 0 0 10px #fff;
}

@keyframes fadeInAndOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}