/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg-light: #0e110e;
    --bg-panel: rgba(10, 10, 10, 0.92);
    --text: #00ff41;
    --text-bright: #39ff14;
    --text-dim: #00b33c;
    --text-muted: #005a1e;
    --border: #00b33c;
    --border-dim: #003d12;
    --link-hover: #7dff6a;
    --selection-bg: #00ff41;
    --selection-text: #0a0a0a;
    --header-bg: rgba(10, 14, 10, 0.95);
    --error: #ff453a;
    --warn: #ffd60a;
    --cyan: #00ff41;
    --purple: #bf5af2;
    --glow-xs: rgba(0, 255, 65, 0.08);
    --glow-sm: rgba(0, 255, 65, 0.15);
    --glow-md: rgba(0, 255, 65, 0.25);
    --glow-lg: rgba(0, 255, 65, 0.4);
    --font-mono: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
}

::selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}

html {
    font-size: 15px;
}

body {
    background:
        /* Fine grid lines (20px) */
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        /* Major grid lines (80px) */
        linear-gradient(rgba(0, 255, 65, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.06) 1px, transparent 1px),
        /* Center radial vignette */
        radial-gradient(ellipse at center, rgba(0, 255, 65, 0.04) 0%, transparent 60%),
        /* Base dark background */
        var(--bg);
    background-size:
        20px 20px,
        20px 20px,
        80px 80px,
        80px 80px,
        100% 100%,
        100% 100%;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.65;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Matrix Canvas Background === */
#matrix-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.08;
}

body.no-grid #matrix-bg {
    display: none;
}

/* === CRT Scanlines === */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.04) 1px,
            rgba(0, 0, 0, 0.04) 2px
        );
}

/* CRT flicker disabled */
.crt-flicker { display: none; }

/* === Canvas Container (zoom target) === */
.canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 36px;
    z-index: 1;
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

/* === Terminal Window === */
.terminal-window {
    position: absolute;
    z-index: 1;
    width: 920px;
    min-width: 360px;
    min-height: 200px;
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    box-shadow:
        0 0 0 1px var(--border-dim),
        0 0 10px var(--glow-xs),
        0 0 40px rgba(0, 255, 65, 0.03),
        0 25px 70px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Active (focused) terminal */
.terminal-window.active {
    border-color: var(--text-dim);
    box-shadow:
        0 0 0 1px var(--text-dim),
        0 0 15px var(--glow-sm),
        0 0 50px rgba(0, 255, 65, 0.05),
        0 30px 80px rgba(0, 0, 0, 0.7);
}

/* Dragging state */
.terminal-window.dragging {
    opacity: 0.92;
    box-shadow:
        0 0 0 1px var(--text-dim),
        0 0 20px var(--glow-md),
        0 0 60px rgba(0, 255, 65, 0.08),
        0 40px 100px rgba(0, 0, 0, 0.8);
    transition: none;
}

/* === Header (title bar / drag handle) === */
.terminal-header {
    background: #141814;
    padding: 0 16px;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    flex-shrink: 0;
    cursor: grab;
}

.terminal-header:active,
.terminal-window.dragging .terminal-header {
    cursor: grabbing;
}

.terminal-header { touch-action: none; }
.browser-header { touch-action: none; }

.terminal-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.terminal-buttons span {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    color: transparent;
    transition: filter 0.2s;
    cursor: pointer;
    border: none;
}

.btn-close { background: #ff5f57; }
.btn-minimize { background: #febc2e; }
.btn-maximize { background: #28c840; }

.terminal-buttons:hover span {
    font-size: 0.55rem;
    font-weight: 700;
}

.terminal-buttons:hover .btn-close { color: rgba(0, 0, 0, 0.6); }
.terminal-buttons:hover .btn-minimize { color: rgba(0, 0, 0, 0.6); }
.terminal-buttons:hover .btn-maximize { color: rgba(0, 0, 0, 0.6); }

.terminal-buttons span:hover { filter: brightness(1.2); }

.terminal-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    flex: 1;
    text-align: center;
    letter-spacing: 0.3px;
    font-weight: 400;
}

/* Tab style for the title */
.terminal-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.3px;
}

.terminal-tab .tab-icon {
    color: var(--text-dim);
    font-size: 0.72rem;
}

.terminal-header-right {
    width: 68px; /* balance against buttons */
}

/* === Terminal Body === */
.terminal-body {
    padding: 22px 26px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Scrollbar */
.terminal-body::-webkit-scrollbar { width: 5px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
.terminal-body::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

.terminal-output { flex: 1; }

/* === Prompt === */
.prompt {
    font-weight: 600;
    white-space: nowrap;
}

.prompt-user { color: var(--text-bright); text-shadow: 0 0 8px var(--glow-sm); }
.prompt-at { color: var(--text-muted); }
.prompt-host { color: var(--text-bright); text-shadow: 0 0 8px var(--glow-sm); }
.prompt-path { color: var(--text-dim); }

.cmd-echo .prompt,
.input-line .prompt {
    color: var(--text-bright);
}

/* === Command Input Line === */
.input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-shrink: 0;
    padding: 4px 0;
}

.input-wrap {
    flex: 1;
    position: relative;
}

.cmd-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    caret-color: var(--text-bright);
    padding: 0;
    line-height: 1.65;
    text-shadow: 0 0 6px var(--glow-xs);
}

.tab-hint {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--text-muted);
    pointer-events: none;
    line-height: 1.65;
    font-size: 0.9rem;
    white-space: pre;
    opacity: 0.4;
}

/* === HUD Controls === */
.hud-controls {
    position: fixed;
    bottom: 48px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    padding: 6px 10px;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.5),
        0 0 8px var(--glow-xs);
    user-select: none;
}

.hud-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-dim);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.hud-btn:hover {
    background: rgba(0, 255, 65, 0.08);
    color: var(--text-bright);
    border-color: var(--text-dim);
}

.hud-btn:active {
    background: rgba(0, 255, 65, 0.15);
}

.hud-btn-new {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-bright);
    border-color: var(--text-muted);
}

.hud-zoom-level {
    color: var(--text-dim);
    font-size: 0.72rem;
    min-width: 36px;
    text-align: center;
    letter-spacing: 0.5px;
}

.hud-divider {
    width: 1px;
    height: 18px;
    background: var(--border-dim);
    margin: 0 4px;
}

/* === Output Blocks === */
.output-block {
    margin-bottom: 10px;
    animation: fadeSlideIn 0.15s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cmd-echo {
    color: var(--text);
    margin-bottom: 6px;
}

.cmd-echo .prompt { margin-right: 8px; }
.cmd-echo .cmd-text { color: var(--text); }

/* === ASCII Banner === */
.ascii-banner {
    color: var(--text-bright);
    font-size: 0.45rem;
    line-height: 1.15;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 14px;
    text-shadow:
        0 0 5px var(--glow-md),
        0 0 20px var(--glow-sm),
        0 0 40px var(--glow-xs);
    animation: bannerGlitch 8s ease-in-out infinite;
}

@keyframes bannerGlitch {
    0%, 100% { opacity: 1; transform: translate(0); }
    92% { opacity: 1; transform: translate(0); }
    93% { opacity: 0.8; transform: translate(-2px, 0); filter: hue-rotate(40deg); }
    94% { opacity: 1; transform: translate(1px, 0); }
    95% { opacity: 0.9; transform: translate(0, 1px); filter: hue-rotate(-20deg); }
    96% { opacity: 1; transform: translate(0); filter: none; }
}

/* === Welcome Text === */
.welcome-text {
    margin-bottom: 3px;
    line-height: 1.7;
}

.welcome-text .highlight {
    color: var(--text-bright);
    text-shadow: 0 0 10px var(--glow-sm);
}

.welcome-text .dim,
.welcome-text.dim { color: var(--text-dim); }

.welcome-text .muted,
.welcome-text.muted { color: var(--text-muted); font-size: 0.82rem; }

/* === Boot Sequence === */
.boot-line {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.5;
    opacity: 0;
    animation: bootFadeIn 0.3s ease-out forwards;
}

.boot-line .ok {
    color: var(--text-bright);
    font-weight: 600;
}

.boot-line .warn {
    color: var(--warn);
}

@keyframes bootFadeIn {
    to { opacity: 1; }
}

/* === Help Output === */
.help-table { margin: 4px 0 2px; }

.help-row {
    display: flex;
    gap: 12px;
    padding: 2px 0;
    border-radius: 3px;
    transition: background 0.1s;
}

.help-row:hover {
    background: var(--glow-xs);
}

.help-cmd {
    color: var(--text-bright);
    min-width: 210px;
    white-space: nowrap;
}

.help-desc { color: var(--text-dim); }

.help-section {
    color: var(--warn);
    margin-top: 14px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(255, 214, 10, 0.15);
}

/* === Post List (ls output) === */
.post-list-output { margin: 6px 0; }

.post-row {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 7px 10px;
    flex-wrap: wrap;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.post-row:hover {
    background: var(--glow-xs);
    border-color: var(--border-dim);
    box-shadow: 0 0 12px var(--glow-xs);
}

.post-row:hover .post-filename {
    color: var(--link-hover);
    text-shadow: 0 0 8px var(--glow-sm);
}

.post-permissions { color: var(--text-muted); font-size: 0.82rem; }
.post-date { color: var(--text-dim); font-size: 0.82rem; min-width: 85px; }

.post-filename {
    color: var(--text-bright);
    font-weight: 500;
    transition: color 0.2s, text-shadow 0.2s;
}

.post-desc-line {
    color: var(--text-dim);
    font-size: 0.82rem;
    padding-left: 28px;
    margin-top: 1px;
}

.post-tags-line {
    padding-left: 28px;
    margin-top: 3px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    color: var(--text-muted);
    font-size: 0.72rem;
    border: 1px solid var(--border-dim);
    padding: 1px 8px;
    border-radius: 3px;
    transition: all 0.15s;
}

.post-row:hover .tag {
    border-color: var(--text-muted);
    color: var(--text-dim);
}

.ls-total { color: var(--text-dim); margin-bottom: 6px; font-size: 0.85rem; }

/* === Single Post (cat output) === */
.post-view { margin: 6px 0; }

.post-header {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-dim);
}

.post-header h1 {
    color: var(--text-bright);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow:
        0 0 10px var(--glow-sm),
        0 0 30px var(--glow-xs);
}

.post-header-meta {
    color: var(--text-dim);
    font-size: 0.8rem;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.post-body {
    color: var(--text);
    line-height: 1.85;
}

.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
    color: var(--text-bright);
    margin: 1.6em 0 0.6em;
    font-weight: 600;
}
.post-body h1 { font-size: 1.35rem; }
.post-body h2 {
    font-size: 1.15rem;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-dim);
}
.post-body h3 { font-size: 1.02rem; }

.post-body p { margin: 0.85em 0; }

.post-body a {
    color: var(--link-hover);
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    text-underline-offset: 3px;
    transition: color 0.15s, text-shadow 0.15s;
}
.post-body a:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--glow-sm);
}

.post-body code {
    background: rgba(0, 255, 65, 0.06);
    border: 1px solid rgba(0, 255, 65, 0.08);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    color: var(--text-bright);
}

.post-body pre {
    background: var(--bg-light);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    padding: 18px;
    overflow-x: auto;
    margin: 1.2em 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}
.post-body pre code { background: none; border: none; padding: 0; }

.post-body blockquote {
    border-left: 3px solid var(--text-dim);
    padding-left: 18px;
    margin: 1.2em 0;
    color: var(--text-dim);
    font-style: italic;
}

.post-body ul, .post-body ol { padding-left: 26px; margin: 0.85em 0; }
.post-body li { margin: 0.35em 0; }
.post-body li::marker { color: var(--text-dim); }

.post-body img {
    max-width: 100%;
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    margin: 1.2em 0;
}

.post-body hr {
    border: none;
    border-top: 1px dashed var(--border-dim);
    margin: 2em 0;
}

.post-body table { border-collapse: collapse; width: 100%; margin: 1.2em 0; }
.post-body th, .post-body td { border: 1px solid var(--border-dim); padding: 10px 14px; text-align: left; }
.post-body th { background: var(--glow-xs); color: var(--text-bright); font-weight: 600; }

/* === About (whoami output) === */
.about-output { margin: 6px 0; }

.about-field {
    display: flex;
    gap: 10px;
    margin: 5px 0;
    padding: 2px 0;
}

.about-key {
    color: var(--text-bright);
    min-width: 120px;
    font-weight: 500;
    text-shadow: 0 0 6px rgba(100, 210, 255, 0.1);
}

.about-value { color: var(--text); }

.about-value a {
    color: var(--link-hover);
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    text-underline-offset: 3px;
    transition: color 0.15s, text-shadow 0.15s;
}
.about-value a:hover { color: #fff; text-shadow: 0 0 8px var(--glow-sm); }

.about-section-break {
    border: none;
    border-top: 1px dashed var(--border-dim);
    margin: 14px 0;
}

/* === Error output === */
.error-text {
    color: var(--error);
    white-space: pre-wrap;
    text-shadow: 0 0 6px rgba(255, 69, 58, 0.2);
}

/* === Clickable output links === */
.clickable-cmd {
    color: var(--text-bright);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: var(--text-muted);
    text-underline-offset: 3px;
    transition: color 0.15s, text-shadow 0.15s;
}
.clickable-cmd:hover {
    color: var(--link-hover);
    text-shadow: 0 0 8px var(--glow-sm);
}

/* === Neofetch === */
.neofetch {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.neofetch-art {
    color: var(--text-bright);
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: pre;
    flex-shrink: 0;
    text-shadow:
        0 0 5px var(--glow-md),
        0 0 15px var(--glow-sm);
}

.neofetch-info {
    white-space: pre;
    line-height: 1.55;
    font-size: 0.85rem;
}

.neofetch-title {
    color: var(--text-bright);
    font-weight: 700;
    text-shadow: 0 0 10px var(--glow-sm);
}

.neofetch-sep { color: var(--border-dim); }

.neofetch-key {
    color: var(--text-bright);
    font-weight: 600;
}

/* === Grep match highlight === */
.grep-match {
    color: var(--bg);
    background: var(--text-bright);
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 600;
    box-shadow: 0 0 6px var(--glow-sm);
}

/* === Browser Window === */
.browser-window {
    position: absolute;
    z-index: 1;
    width: 960px;
    min-width: 400px;
    min-height: 280px;
    height: 640px;
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    box-shadow:
        0 0 0 1px var(--border-dim),
        0 0 10px var(--glow-xs),
        0 0 40px rgba(0, 255, 65, 0.03),
        0 25px 70px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.browser-window.active {
    border-color: var(--text-dim);
    box-shadow:
        0 0 0 1px var(--text-dim),
        0 0 15px var(--glow-sm),
        0 0 50px rgba(0, 255, 65, 0.05),
        0 30px 80px rgba(0, 0, 0, 0.7);
}

.browser-window.dragging {
    opacity: 0.92;
    box-shadow:
        0 0 0 1px var(--text-dim),
        0 0 20px var(--glow-md),
        0 0 60px rgba(0, 255, 65, 0.08),
        0 40px 100px rgba(0, 0, 0, 0.8);
    transition: none;
}


/* Browser header */
.browser-header {
    background: #141814;
    padding: 0 12px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    flex-shrink: 0;
    cursor: grab;
}

.browser-header:active,
.browser-window.dragging .browser-header {
    cursor: grabbing;
}

/* Nav buttons */
.browser-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.browser-nav-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font-mono);
}

.browser-nav-btn:hover:not(:disabled) {
    background: rgba(0, 255, 65, 0.08);
    color: var(--text-bright);
}

.browser-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Address bar */
.browser-address-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 5px 12px;
    min-width: 0;
}

.browser-lock {
    font-size: 0.65rem;
    opacity: 0.5;
    flex-shrink: 0;
}

.browser-url {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-header-right {
    width: 12px;
    flex-shrink: 0;
}

/* Browser body / iframe */
.browser-body {
    flex: 1;
    overflow: hidden;
    background: #000;
}

.browser-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #0a0a0a;
}

/* === Desktop Taskbar === */
.desktop-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(36px + env(safe-area-inset-bottom, 0px));
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(8, 10, 8, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0, 255, 65, 0.12);
    padding: 0 max(10px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(10px, env(safe-area-inset-left, 0px));
    font-size: 0.72rem;
    user-select: none;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.5);
}

.taskbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.taskbar-launcher {
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid rgba(0, 255, 65, 0.15);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.taskbar-launcher:hover {
    background: rgba(0, 255, 65, 0.15);
    border-color: rgba(0, 255, 65, 0.3);
}

.taskbar-workspaces {
    display: flex;
    gap: 2px;
}

.workspace {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.workspace:hover {
    background: rgba(0, 255, 65, 0.08);
    color: var(--text-dim);
}

.workspace.active {
    background: rgba(0, 255, 65, 0.12);
    color: var(--text-bright);
    border: 1px solid rgba(0, 255, 65, 0.2);
}

.taskbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    overflow: hidden;
    padding: 0 12px;
}

.taskbar-window-entry {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.68rem;
    font-family: var(--font-mono);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.taskbar-window-entry:hover {
    background: rgba(0, 255, 65, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 255, 65, 0.15);
}

.taskbar-window-entry.active {
    background: rgba(0, 255, 65, 0.1);
    color: var(--text-bright);
    border-color: rgba(0, 255, 65, 0.25);
}

.taskbar-window-entry .tw-icon {
    font-size: 0.6rem;
    flex-shrink: 0;
}

.taskbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.taskbar-metric {
    color: var(--text-muted);
    font-size: 0.68rem;
    letter-spacing: 0.3px;
}

.taskbar-divider {
    width: 1px;
    height: 16px;
    background: rgba(0, 255, 65, 0.12);
}

.taskbar-clock {
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    min-width: 100px;
    text-align: right;
}

/* === Desktop Icons === */
.desktop-icons {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    padding: 8px 4px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(0, 255, 65, 0.05);
    border-color: rgba(0, 255, 65, 0.1);
}

.desktop-icon.selected {
    background: rgba(0, 255, 65, 0.1);
    border-color: rgba(0, 255, 65, 0.2);
}

.desktop-icon-img {
    font-size: 1.6rem;
    line-height: 1;
    margin-bottom: 4px;
    filter: grayscale(0.3);
    transition: filter 0.15s;
}

.desktop-icon:hover .desktop-icon-img {
    filter: grayscale(0);
}

.desktop-icon-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* === Desktop Selection Rectangle === */
.desktop-select-box {
    position: fixed;
    border: 1px solid rgba(0, 255, 65, 0.4);
    background: rgba(0, 255, 65, 0.06);
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.1);
}

/* === Matrix rain (inline command) === */
.matrix-rain {
    color: var(--text);
    font-size: 0.7rem;
    line-height: 1.2;
    opacity: 0.75;
    letter-spacing: 2px;
    overflow: hidden;
    text-shadow: 0 0 5px var(--glow-md);
}

/* === Minimized / Maximized Terminal === */
.terminal-window.minimized {
    display: none !important;
}

.terminal-window.maximized {
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0;
    z-index: 999 !important;
}

/* === Right-click Context Menu === */
.desktop-context-menu {
    position: fixed;
    z-index: 10000;
    background: rgba(12, 14, 12, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 255, 65, 0.05);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    animation: menuFadeIn 0.1s ease-out;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.ctx-item:hover {
    background: rgba(0, 255, 65, 0.1);
    color: var(--text-bright);
}

.ctx-item .ctx-icon {
    width: 16px;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.7;
}

.ctx-separator {
    height: 1px;
    background: rgba(0, 255, 65, 0.1);
    margin: 4px 0;
}

/* === Run Command Dialog === */
.run-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    animation: menuFadeIn 0.1s ease-out;
}

.run-dialog {
    background: rgba(12, 14, 12, 0.97);
    border: 1px solid rgba(0, 255, 65, 0.25);
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 420px;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 255, 65, 0.06);
}

.run-dialog-title {
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.run-dialog-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    outline: none;
    caret-color: var(--text-bright);
    transition: border-color 0.15s;
}

.run-dialog-input:focus {
    border-color: rgba(0, 255, 65, 0.4);
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.08);
}

.run-dialog-input::placeholder {
    color: var(--text-muted);
}

.run-dialog-hint {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-top: 8px;
    text-align: right;
}

/* === No-Grid Mode === */
body.no-grid {
    background: var(--bg) !important;
}

/* === Window Resize Handles === */
.resize-handle {
    position: absolute;
    z-index: 10;
}
.resize-handle-n  { top: -3px; left: 8px; right: 8px; height: 6px; cursor: n-resize; }
.resize-handle-s  { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: s-resize; }
.resize-handle-e  { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: e-resize; }
.resize-handle-w  { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: w-resize; }
.resize-handle-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: ne-resize; }
.resize-handle-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nw-resize; }
.resize-handle-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }
.resize-handle-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: sw-resize; }

/* === CMatrix Animation === */
.cmatrix-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin: 4px 0;
    font-family: monospace;
}

.cmatrix-col {
    position: absolute;
    top: 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1;
    white-space: pre;
    text-shadow: 0 0 8px var(--glow-md);
    animation: cmatrixFall linear infinite;
}

.cmatrix-col .head {
    color: #fff;
    text-shadow: 0 0 12px var(--glow-lg);
}

@keyframes cmatrixFall {
    from { transform: translateY(-100%); }
    to { transform: translateY(200px); }
}

/* === Figlet Output === */
.figlet-output {
    color: var(--text-bright);
    font-size: 0.5rem;
    line-height: 1.1;
    white-space: pre;
    text-shadow: 0 0 10px var(--glow-md), 0 0 30px var(--glow-sm);
    margin: 6px 0;
    overflow-x: auto;
}

/* === Color Palette === */
.color-palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin: 8px 0;
}

.color-swatch {
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px currentColor;
    z-index: 1;
}

/* === SL (Steam Locomotive) Animation === */
.sl-container {
    overflow: hidden;
    white-space: pre;
    font-size: 0.55rem;
    line-height: 1.1;
    color: var(--text);
    margin: 4px 0;
    height: 80px;
    position: relative;
}

.sl-train {
    position: absolute;
    right: -400px;
    animation: slMove 4s linear forwards;
    text-shadow: 0 0 5px var(--glow-sm);
}

@keyframes slMove {
    from { right: -400px; }
    to { right: 110%; }
}

/* === Workspace Active Indicator === */
.workspace.has-windows::after {
    content: '';
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-dim);
}

.workspace {
    position: relative;
}

/* === Taskbar Minimized Indicator === */
.taskbar-window-entry.minimized {
    opacity: 0.5;
    border-style: dashed;
}

/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
    .terminal-window {
        width: min(920px, calc(100vw - 100px));
    }
    .browser-window {
        width: min(960px, calc(100vw - 100px));
    }
    .run-dialog { min-width: 360px; }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
    html { font-size: 14px; }

    .ascii-banner { font-size: 0.3rem; }

    /* Windows fill screen on mobile */
    .terminal-window {
        width: calc(100vw - 10px) !important;
        height: calc(100vh - 52px) !important;
        left: 5px !important;
        top: 5px !important;
        border-radius: 8px;
        min-width: 0;
    }
    .browser-window {
        width: calc(100vw - 10px) !important;
        height: calc(100vh - 52px) !important;
        left: 5px !important;
        top: 5px !important;
        border-radius: 8px;
        min-width: 0;
    }

    .terminal-body { padding: 14px 16px; }
    .terminal-header { height: 36px; padding: 0 12px; }
    .browser-header { height: 38px; padding: 0 10px; }

    /* Hide resize handles - windows are fullscreen on mobile */
    .resize-handle { display: none; }

    /* Content adjustments */
    .post-row { flex-direction: column; gap: 2px; padding: 6px 4px; }
    .post-desc-line, .post-tags-line { padding-left: 0; }
    .about-field { flex-direction: column; gap: 0; }
    .about-key { min-width: auto; }
    .help-row { flex-direction: column; gap: 0; }
    .help-cmd { min-width: auto; }
    .neofetch { flex-direction: column; gap: 12px; }
    .neofetch-art { font-size: 0.55rem; }
    .color-palette { grid-template-columns: repeat(4, 1fr); }

    /* Desktop icons - horizontal row at top */
    .desktop-icons {
        flex-direction: row;
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 2px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .desktop-icon {
        width: 56px;
        padding: 4px 2px;
        flex-shrink: 0;
    }
    .desktop-icon-img { font-size: 1.2rem; }
    .desktop-icon-label { font-size: 0.55rem; }

    /* Taskbar simplifications */
    .taskbar-workspaces { display: none; }
    .taskbar-metric { display: none; }
    .taskbar-divider { display: none; }

    /* HUD */
    .hud-controls { bottom: 48px; right: 10px; }

    /* Run dialog */
    .run-dialog { min-width: 0; width: calc(100vw - 40px); }
}

/* Phone portrait */
@media (max-width: 480px) {
    .ascii-banner { display: none; }
    html { font-size: 13px; }

    .terminal-header { padding: 0 10px; height: 34px; gap: 8px; }
    .terminal-buttons span { width: 11px; height: 11px; }
    .terminal-tab { padding: 3px 10px; font-size: 0.72rem; }
    .terminal-header-right { width: 48px; }

    .terminal-body { padding: 10px 12px; }
    .cmd-input { font-size: 0.82rem; }
    .prompt { font-size: 0.82rem; }

    .browser-header { gap: 6px; height: 36px; }
    .browser-nav-btn { width: 22px; height: 22px; font-size: 0.75rem; }
    .browser-address-bar { padding: 4px 8px; }
    .browser-url { font-size: 0.68rem; }

    /* Desktop icons - even smaller */
    .desktop-icons { display: none; }

    /* Taskbar */
    .taskbar-center { display: none; }
    .taskbar-launcher { font-size: 0.65rem; padding: 2px 8px; }
    .taskbar-clock { min-width: 70px; font-size: 0.65rem; }

    /* HUD */
    .hud-controls { bottom: 44px; right: 8px; padding: 4px 8px; }
    .hud-btn { width: 26px; height: 26px; font-size: 0.85rem; }
    .hud-zoom-level { font-size: 0.65rem; min-width: 28px; }

    /* Context menu */
    .desktop-context-menu { min-width: 160px; }

    /* Neofetch side by side is too tight */
    .neofetch-art { font-size: 0.5rem; }
    .neofetch-info { font-size: 0.75rem; }
}

/* Reduce motion for those who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    #matrix-bg { display: none; }
    .crt-flicker { display: none; }
}
