:root {
    --nes-black: #000000;
    --nes-white: #FCFCFC;
    --nes-gray-light: #C4C4C4;
    --nes-gray: #A0A0A0;
    --nes-gray-dark: #808080;
    --nes-blue: #0055FF;
    --nes-blue-dark: #003399;
    --nes-red: #CC0000;
    --nes-green: #00AA00;
    --nes-green-dark: #006600;
    --nes-green-light: #55DD55;
    --nes-yellow: #FFCC00;
    --nes-sky: #5C94FC;
    --nes-sky-light: #88B8FF;

    --win-bg: #3a464c;
    --win-highlight: #4f5b62;
    --win-shadow: #2d353b;
    --win-dark-shadow: #232a2e;
    --win-titlebar: #5c6e5a;
    --win-titlebar-inactive: #4f5b62;
    --win-titlebar-text: #d3c6aa;
    --win-body-bg: #2d353b;
    --win-text: #d3c6aa;
    --win-accent: #a7c080;
    --win-accent-hover: #e67e80;
    --win-link: #7fbbb3;
    --win-link-hover: #e69875;
    --win-muted: #859289;
    --win-subtle-bg: #343f44;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
}

#desktop {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    zoom: 1.25;
}

#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: boot-fadeout 0.4s ease 1.4s forwards;
}

.boot-content {
    text-align: center;
}

.boot-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    animation: boot-pulse 1s ease infinite;
}

.boot-kirby {
    width: 64px;
    height: 64px;
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.boot-text {
    color: var(--nes-white);
    font-size: 20px;
    margin-bottom: 24px;
    letter-spacing: 4px;
}

.boot-bar-track {
    width: 200px;
    height: 12px;
    border: 2px solid var(--nes-gray);
    background: #111;
    margin: 0 auto 12px;
}

.boot-bar-fill {
    height: 100%;
    background: var(--nes-blue);
    width: 0%;
    animation: boot-load 1.2s steps(8) forwards;
}

.boot-sub {
    color: var(--nes-gray-dark);
    font-size: 8px;
}

@keyframes boot-load {
    to { width: 100%; }
}

@keyframes boot-fadeout {
    0% { opacity: 1; pointer-events: auto; }
    100% { opacity: 0; pointer-events: none; }
}

@keyframes boot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#desktop-surface {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#forest-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #c8e8a0;
    box-shadow: 0 0 6px 2px rgba(180, 220, 120, 0.6);
    animation: firefly-float 6s ease-in-out infinite, firefly-glow 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.firefly-1 { left: 20%; top: 55%; animation-delay: 0s, 0s; }
.firefly-2 { left: 65%; top: 40%; animation-delay: -2s, -1s; }
.firefly-3 { left: 40%; top: 65%; animation-delay: -4s, -2s; }
.firefly-4 { left: 80%; top: 50%; animation-delay: -1s, -0.5s; }
.firefly-5 { left: 15%; top: 72%; animation-delay: -3s, -1.5s; }
.firefly-6 { left: 55%; top: 58%; animation-delay: -5s, -2.5s; }
.firefly-7 { left: 75%; top: 68%; animation-delay: -2.5s, -0.8s; }
.firefly-8 { left: 35%; top: 48%; animation-delay: -3.5s, -1.8s; }

@keyframes firefly-float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(12px, -8px); }
    50% { transform: translate(-6px, -14px); }
    75% { transform: translate(8px, -4px); }
}

@keyframes firefly-glow {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.9; }
}

#icons-area {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    padding: 6px 4px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 0;
    position: relative;
    transition: none;
}

.desktop-icon:hover,
.desktop-icon:focus {
    background: rgba(0, 0, 128, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
}

.desktop-icon:active {
    background: rgba(0, 0, 128, 0.45);
}

.icon-graphic {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    image-rendering: pixelated;
}

.icon-graphic svg {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.icon-label {
    color: white;
    font-size: 8px;
    text-align: center;
    text-shadow:
        1px 0 0 #000,
        -1px 0 0 #000,
        0 1px 0 #000,
        0 -1px 0 #000,
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000;
    line-height: 1.3;
    word-break: break-word;
}

.recycle-bin {
    margin-top: auto;
}

.tooltip-pixel {
    display: none;
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nes-yellow);
    color: var(--nes-black);
    font-size: 7px;
    padding: 4px 8px;
    white-space: nowrap;
    border: 2px solid var(--nes-black);
    z-index: 100;
    pointer-events: none;
}

.recycle-bin:hover .tooltip-pixel {
    display: block;
}

#windows-area {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.win98-window {
    position: absolute;
    background: var(--win-bg);
    border: 3px solid;
    border-color: var(--win-highlight) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-highlight);
    box-shadow: inset 1px 1px 0 var(--win-highlight), inset -1px -1px 0 var(--win-shadow);
    min-width: 240px;
    min-height: 120px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    animation: win-open 0.15s steps(3) both;
}

@keyframes win-open {
    0% {
        transform: scale(0.85);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.win-titlebar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px;
    background: var(--win-titlebar);
    color: var(--win-titlebar-text);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.win-titlebar:active {
    cursor: grabbing;
}

.win-titlebar-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.win-title {
    flex: 1;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 1px;
}

.win-controls {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.win-btn {
    width: 18px;
    height: 18px;
    border: 2px solid;
    border-color: var(--win-highlight) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-highlight);
    background: var(--win-bg);
    color: var(--win-text);
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.win-btn:active {
    border-color: var(--win-dark-shadow) var(--win-highlight) var(--win-highlight) var(--win-dark-shadow);
}

.win-btn:hover {
    background: var(--win-accent-hover);
    color: var(--win-dark-shadow);
}

.win-body {
    padding: 12px;
    flex: 1;
    overflow: hidden;
    border: 2px solid var(--win-dark-shadow);
    margin: 4px;
    background: var(--win-body-bg);
    color: var(--win-text);
}

.win-scrollable {
    overflow-y: auto;
    scrollbar-width: thin;
}

.win-scrollable::-webkit-scrollbar {
    width: 16px;
}

.win-scrollable::-webkit-scrollbar-track {
    background: var(--win-dark-shadow);
    border: 1px solid var(--win-shadow);
}

.win-scrollable::-webkit-scrollbar-thumb {
    background: var(--win-highlight);
    border: 2px solid;
    border-color: var(--win-muted) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-muted);
}

.win98-window.inactive .win-titlebar {
    background: var(--win-titlebar-inactive);
}

.about-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.about-photo img {
    width: 220px;
    height: 260px;
    object-fit: cover;
    object-position: center 15%;
    border: 3px solid var(--win-highlight);
    image-rendering: auto;
}

.photo-placeholder {
    width: 220px;
    height: 260px;
    border: 3px solid var(--win-highlight);
    display: none;
    align-items: center;
    justify-content: center;
    background: #E0E0E0;
}

.about-text h2 {
    font-size: 15px;
    color: var(--win-accent);
    margin-bottom: 12px;
}

.about-text p {
    margin-bottom: 10px;
    line-height: 1.9;
    font-size: 11px;
}

.about-text a {
    color: var(--win-link);
    text-decoration: none;
    border-bottom: 1px dashed var(--win-link);
}

.about-text a:hover {
    color: var(--win-link-hover);
    border-bottom-color: var(--win-link-hover);
}

.pub-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pub-item {
    padding: 8px;
    border-bottom: 1px solid var(--win-highlight);
    transition: background 0.1s;
}

.pub-item:last-child {
    border-bottom: none;
}

.pub-item:hover {
    background: var(--win-subtle-bg);
}

.pub-venue {
    display: inline-block;
    background: var(--win-accent);
    color: var(--win-dark-shadow);
    font-size: 8px;
    padding: 3px 8px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.pub-title {
    display: block;
    color: var(--win-link);
    text-decoration: none;
    font-size: 11px;
    line-height: 1.7;
    margin-bottom: 6px;
}

.pub-title:hover {
    color: var(--win-link-hover);
}

.pub-authors {
    font-size: 9px;
    color: var(--win-muted);
    line-height: 1.7;
}

.pub-authors strong {
    color: var(--win-text);
}

.pub-note {
    font-size: 7px;
    color: var(--win-muted);
    font-style: italic;
}

.links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 12px;
}

.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: transparent;
    border: 2px solid transparent;
    text-decoration: none;
    color: var(--win-text);
    font-size: 10px;
    cursor: pointer;
}

.link-card:hover {
    background: var(--win-subtle-bg);
    border-color: var(--win-highlight);
}

.link-card:active {
    background: var(--win-highlight);
}

.link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tesseract-body {
    background: #1a2420 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tesseract-canvas {
    width: 100%;
    height: 100%;
}

#start-menu {
    position: fixed;
    bottom: 36px;
    left: 4px;
    z-index: 1001;
    background: var(--win-bg);
    border: 3px solid;
    border-color: var(--win-highlight) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-highlight);
    display: flex;
    min-width: 220px;
    animation: win-open 0.1s steps(2) both;
}

.start-menu-sidebar {
    background: var(--win-titlebar);
    color: var(--win-titlebar-text);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding: 8px 4px;
    font-size: 12px;
    letter-spacing: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-weight: bold;
}

.start-menu-items {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 4px 0;
}

.start-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: none;
    border: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--win-text);
    cursor: default;
    text-align: left;
    width: 100%;
}

.start-menu-item.secret-item {
    cursor: pointer;
}

.start-menu-item.secret-item:hover,
.start-menu-item.fav-item:hover {
    background: var(--win-titlebar);
    color: var(--win-titlebar-text);
}

.start-menu-divider {
    height: 2px;
    background: var(--win-dark-shadow);
    margin: 4px 8px;
    border-top: 1px solid var(--win-highlight);
}

.sasha-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.sasha-photo img {
    width: 420px;
    height: 420px;
    object-fit: cover;
    object-position: center 15%;
    border: 3px solid var(--win-highlight);
    image-rendering: auto;
}

.sasha-text h2 {
    font-size: 14px;
    color: var(--win-accent);
    margin-bottom: 10px;
}

.sasha-text p {
    font-size: 10px;
    line-height: 1.9;
}

#taskbar {
    height: 36px;
    background: var(--win-shadow);
    border-top: 2px solid var(--win-highlight);
    display: flex;
    align-items: center;
    padding: 2px 4px;
    gap: 4px;
    z-index: 1000;
    flex-shrink: 0;
}

#start-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    height: 28px;
    border: 2px solid;
    border-color: var(--win-highlight) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-highlight);
    background: var(--win-bg);
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--win-text);
    font-weight: bold;
    flex-shrink: 0;
}

#start-btn:active {
    border-color: var(--win-dark-shadow) var(--win-highlight) var(--win-highlight) var(--win-dark-shadow);
}

.start-icon {
    display: flex;
    align-items: center;
}

.start-kirby {
    width: 20px;
    height: 20px;
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#taskbar-windows {
    display: flex;
    gap: 3px;
    flex: 1;
    overflow: hidden;
}

.taskbar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    height: 28px;
    border: 2px solid;
    border-color: var(--win-highlight) var(--win-dark-shadow) var(--win-dark-shadow) var(--win-highlight);
    background: var(--win-bg);
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--win-text);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.taskbar-item.active {
    border-color: var(--win-dark-shadow) var(--win-highlight) var(--win-highlight) var(--win-dark-shadow);
    background: var(--win-highlight);
}

.taskbar-item.minimized {
    color: var(--win-muted);
}

#taskbar-tray {
    display: flex;
    align-items: center;
    padding: 0 8px;
    height: 28px;
    border: 2px solid;
    border-color: var(--win-dark-shadow) var(--win-highlight) var(--win-highlight) var(--win-dark-shadow);
    background: var(--win-bg);
    flex-shrink: 0;
}

#taskbar-clock {
    font-size: 9px;
    color: var(--win-text);
    letter-spacing: 1px;
}

@media (max-width: 700px) {
    .win98-window {
        left: 4px !important;
        top: 4px !important;
        width: calc(100% - 8px) !important;
        max-height: calc(100vh - 52px);
    }

    .about-layout {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .links-grid {
        grid-template-columns: 1fr;
    }

    #icons-area {
        flex-direction: row;
        flex-wrap: wrap;
        top: 8px;
        left: 8px;
        right: 8px;
    }
}
