@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=VT323&display=swap');

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

:root {
    --pink: #ff2975;
    --purple: #8c1eff;
    --cyan: #32ffd1;
    --yellow: #ffd23f;
    --bg: #1a0638;
    --face: #c0c0c0;
    --hi: #ffffff;
    --lo: #808080;
    --dk: #000000;
    --taskbar: 36px;
    --ui: Tahoma, "MS Sans Serif", Verdana, Geneva, sans-serif;
}

html, body { height: 100%; }

body {
    font-family: var(--ui);
    font-size: 13px;
    color: #000;
    background: var(--bg);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ---------- Scène synthwave ---------- */
.scene {
    position: fixed; inset: 0 0 var(--taskbar) 0;
    background: linear-gradient(180deg, #0b0221 0%, #2a0a5e 38%, #7a1b8f 58%, #ff2975 74%, #ff9e3d 100%);
    overflow: hidden;
}

.stars {
    position: absolute; inset: 0 0 45% 0;
    background-image:
        radial-gradient(1px 1px at 12% 20%, #fff, transparent),
        radial-gradient(1px 1px at 27% 55%, #fff, transparent),
        radial-gradient(2px 2px at 41% 14%, #cfe, transparent),
        radial-gradient(1px 1px at 58% 38%, #fff, transparent),
        radial-gradient(1px 1px at 73% 12%, #fff, transparent),
        radial-gradient(2px 2px at 86% 47%, #fde, transparent),
        radial-gradient(1px 1px at 92% 22%, #fff, transparent),
        radial-gradient(1px 1px at 5% 70%, #fff, transparent),
        radial-gradient(1px 1px at 66% 66%, #fff, transparent),
        radial-gradient(1px 1px at 35% 80%, #fff, transparent);
    animation: twinkle 4s ease-in-out infinite alternate;
}

.sun {
    position: absolute; left: 50%; bottom: 36%;
    width: min(46vw, 46vh, 420px); aspect-ratio: 1;
    transform: translateX(-50%);
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe45c 0%, #ff9e3d 40%, #ff2975 75%, #c4169a 100%);
    box-shadow: 0 0 60px 10px rgba(255, 41, 117, .55), 0 0 160px 40px rgba(140, 30, 255, .35);
    /* bandes qui s'épaississent vers le bas */
    -webkit-mask-image: linear-gradient(180deg,
        #000 0 48%, transparent 48% 51%,
        #000 51% 60%, transparent 60% 64%,
        #000 64% 72%, transparent 72% 77%,
        #000 77% 84%, transparent 84% 90%,
        #000 90% 94%, transparent 94% 100%);
    mask-image: linear-gradient(180deg,
        #000 0 48%, transparent 48% 51%,
        #000 51% 60%, transparent 60% 64%,
        #000 64% 72%, transparent 72% 77%,
        #000 77% 84%, transparent 84% 90%,
        #000 90% 94%, transparent 94% 100%);
    animation: sunpulse 6s ease-in-out infinite alternate;
}

.mountains {
    position: absolute; left: 0; width: 100%; bottom: 33%;
    height: 17%;
}
.mountains polygon { fill: #12032e; }
.mountains polyline { fill: none; stroke: var(--cyan); stroke-width: 2; vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 4px var(--cyan)); }

.floor {
    position: absolute; left: 0; right: 0; bottom: 0; height: 33%;
    background: linear-gradient(180deg, #12032e 0%, #1c0545 100%);
    border-top: 2px solid var(--pink);
    box-shadow: 0 -2px 18px var(--pink);
    overflow: hidden;
    perspective: 260px;
    perspective-origin: 50% 0;
}
.floor-grid {
    position: absolute; left: -50%; right: -50%; top: 0; height: 300%;
    transform-origin: 50% 0;
    transform: rotateX(72deg);
    background-image:
        linear-gradient(90deg, rgba(255, 41, 117, .9) 2px, transparent 2px),
        linear-gradient(0deg, rgba(50, 255, 209, .75) 2px, transparent 2px);
    background-size: 70px 70px;
    animation: gridmove 1.4s linear infinite;
}
.floor::after { /* fondu vers l'horizon */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, #12032e 0%, transparent 55%);
}

.crt {
    position: fixed; inset: 0; z-index: 99999; pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.45) 100%);
}

/* ---------- Icônes du bureau ---------- */
.desktop-icons {
    position: fixed; top: 10px; left: 8px; bottom: calc(var(--taskbar) + 8px);
    display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start;
    gap: 6px; z-index: 5;
}
.icon {
    width: 82px; padding: 6px 2px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: 1px dotted transparent;
    color: #fff; font: inherit; text-decoration: none; cursor: pointer;
}
.icon-img { font-size: 34px; line-height: 1; filter: drop-shadow(0 0 6px rgba(50,255,209,.7)) drop-shadow(1px 1px 0 #000); }
.icon-label { text-align: center; text-shadow: 1px 1px 0 #000, 0 0 6px var(--purple); line-height: 1.15; padding: 1px 3px; }
.icon:focus-visible, .icon.sel { outline: none; border-color: #fff; }
.icon:focus-visible .icon-label, .icon.sel .icon-label { background: #000080; text-shadow: none; }

/* ---------- Fenêtres ---------- */
.win {
    position: fixed; z-index: 100;
    background: var(--face);
    border: 2px solid;
    border-color: var(--hi) var(--dk) var(--dk) var(--hi);
    box-shadow: inset -1px -1px 0 var(--lo), inset 1px 1px 0 #dfdfdf, 6px 8px 0 rgba(0,0,0,.35), 0 0 28px rgba(255,41,117,.35);
    padding: 2px;
    max-width: calc(100vw - 8px);
    visibility: hidden; /* révélée par le script, évite un flash en haut à gauche */
}
.win.ready { visibility: visible; }
.win.min { display: none; }
.win.opening { animation: pop .18s ease-out; }

.win-bar {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 3px 3px 4px; height: 22px;
    background: linear-gradient(90deg, #5b1aa6, var(--pink) 70%, #ff9e3d);
    color: #fff; font-weight: bold; cursor: grab; touch-action: none;
}
.win:not(.active) .win-bar { background: linear-gradient(90deg, #4a4560, #8a85a0); color: #d6d3e0; }
.win-bar.dragging { cursor: grabbing; }
.win-ico { font-size: 13px; }
.win-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.win-btns { display: flex; gap: 2px; }
.win-btn {
    width: 18px; height: 16px; padding: 0;
    background: var(--face); color: #000;
    border: 1px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi);
    box-shadow: inset -1px -1px 0 var(--lo);
    font: bold 11px/1 var(--ui); cursor: pointer;
    display: grid; place-items: center;
}
.win-btn:active { border-color: var(--dk) var(--hi) var(--hi) var(--dk); box-shadow: inset 1px 1px 0 var(--lo); }

.win-menu { display: flex; gap: 2px; padding: 2px 2px 3px; }
.win-menu span { padding: 1px 7px; }
.win-menu span:hover { background: #000080; color: #fff; }

.win-body {
    margin: 2px; background: #fff; color: #000;
    border: 2px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo);
    box-shadow: inset 1px 1px 0 var(--dk);
    padding: 14px; overflow: auto; user-select: text; -webkit-user-select: text;
}
.win-status { display: flex; justify-content: space-between; gap: 8px; padding: 2px 4px 1px; font-size: 12px; }
.win-status > * { border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); padding: 1px 6px; }
.win-status > :first-child { flex: 1; }

/* Bienvenue */
.welcome-body {
    text-align: center;
    background: linear-gradient(180deg, #14042f, #2a0a5e);
    color: #fff; padding: 26px 16px 22px;
}
.neon-title {
    font-family: 'Orbitron', sans-serif; font-weight: 900;
    font-size: clamp(2rem, 9vw, 3.4rem); letter-spacing: 3px; text-transform: uppercase;
    color: #fff;
    background: linear-gradient(180deg, #fff 8%, #ffd23f 40%, #ff2975 60%, #8c1eff 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(255,41,117,.9)) drop-shadow(0 0 22px rgba(140,30,255,.9));
    animation: neon 6s infinite;
}
.subtitle {
    font-family: 'VT323', monospace; font-size: 1.7rem; margin: 6px 0 20px;
    color: var(--cyan); text-shadow: 0 0 8px var(--cyan);
}
.subtitle::after { content: "_"; animation: blink 1s steps(1) infinite; }
.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* Boutons 98 */
.btn98 {
    display: inline-block; min-width: 88px; padding: 6px 14px;
    background: var(--face); color: #000; font: 13px var(--ui); text-decoration: none; text-align: center;
    border: 2px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi);
    box-shadow: inset -1px -1px 0 var(--lo), inset 1px 1px 0 #dfdfdf;
    cursor: pointer;
}
.btn98:active:not(.disabled) { border-color: var(--dk) var(--hi) var(--hi) var(--dk); box-shadow: inset 1px 1px 0 var(--lo); padding: 7px 13px 5px 15px; }
.btn98:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
a.btn98:hover { color: #000; }
.btn98.disabled { color: var(--lo); text-shadow: 1px 1px 0 #fff; cursor: not-allowed; }

/* Terminal */
.term {
    background: #05000f; color: var(--cyan);
    font-family: 'VT323', monospace; font-size: 18px; line-height: 1.2;
    min-height: 130px; text-shadow: 0 0 5px rgba(50,255,209,.7);
}
.term .ln { white-space: pre-wrap; word-break: break-word; margin: 2px 0; }
.term .cur::after { content: "█"; animation: blink 1s steps(1) infinite; }

/* Rickroll */
.rick { background: #05000f; color: var(--cyan); text-align: center; font-family: 'VT323', monospace; font-size: 20px; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.rick .btn98 { font-size: 12px; }

/* Console / Explorateur */
.console-out {
    background: #000; color: var(--cyan); font: 17px/1.2 'VT323', monospace;
    height: 190px; overflow-y: auto; padding: 4px;
    border: 2px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo);
    user-select: text;
}
.console-out div { white-space: pre-wrap; }
.console-line { display: flex; align-items: center; background: #000; margin-top: 2px; border: 2px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); }
.console-line span { color: var(--cyan); font: 17px 'VT323', monospace; padding-left: 4px; }
.console-in { flex: 1; background: #000; color: var(--cyan); border: 0; outline: 0; font: 17px 'VT323', monospace; padding: 2px 4px; user-select: text; }
.win-body.flush { padding: 6px; background: var(--face); }
.win-body.iframe { padding: 0; height: 280px; background: #000; }
.win-body.iframe iframe { width: 100%; height: 100%; border: 0; display: block; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; background: #fff; min-height: 90px; padding: 8px; border: 2px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo); }
.file-list .icon { color: #000; width: 74px; }
.file-list .icon-label { text-shadow: none; }
.file-list .icon-img { filter: none; }

/* Message box */
.msg { display: flex; gap: 14px; align-items: center; padding: 12px 8px 4px; background: var(--face); }
.msg .msg-ico { font-size: 30px; }
.msg p { white-space: pre-line; }
.msg-actions { display: flex; justify-content: center; padding: 8px 0 4px; background: var(--face); }
.win-body.msgbody { padding: 0; background: var(--face); border: 0; box-shadow: none; }

/* ---------- Signature ---------- */
.signature {
    position: fixed; right: 18px; bottom: calc(var(--taskbar) + 12px); z-index: 6;
    font-family: 'Orbitron', sans-serif; font-weight: 700; letter-spacing: 3px; font-size: .8rem;
    color: var(--pink);
    text-shadow: 0 0 5px var(--pink), 0 0 12px var(--pink), 0 0 28px var(--purple);
    animation: neon 7s infinite; pointer-events: none;
}

/* ---------- Barre des tâches ---------- */
.taskbar {
    position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar); z-index: 10000;
    display: flex; align-items: center; gap: 4px; padding: 3px 3px;
    background: var(--face);
    border-top: 2px solid var(--hi);
    box-shadow: 0 -2px 18px rgba(255,41,117,.55);
}
.tb-btn {
    height: 28px; display: flex; align-items: center; gap: 5px; padding: 0 8px;
    background: var(--face); color: #000; font: 13px var(--ui);
    border: 2px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi);
    box-shadow: inset -1px -1px 0 var(--lo);
    cursor: pointer; white-space: nowrap; overflow: hidden;
}
.tb-btn.start { font-weight: bold; padding: 0 8px 0 6px; flex: none; }
.tb-btn.start .logo { width: 16px; height: 16px; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 1px; }
.logo i:nth-child(1) { background: var(--pink); } .logo i:nth-child(2) { background: var(--cyan); }
.logo i:nth-child(3) { background: var(--purple); } .logo i:nth-child(4) { background: var(--yellow); }
.tb-btn.pressed { border-color: var(--dk) var(--hi) var(--hi) var(--dk); box-shadow: inset 1px 1px 0 var(--lo);
    background: repeating-conic-gradient(#c0c0c0 0 25%, #fff 0 50%) 0 0 / 2px 2px; font-weight: bold; }
.tb-btn.start.pressed { background: var(--face); }
.tb-sep { width: 2px; height: 24px; border-left: 1px solid var(--lo); border-right: 1px solid var(--hi); flex: none; }
.tb-tasks { flex: 1; display: flex; gap: 3px; min-width: 0; }
.tb-tasks .tb-btn { flex: 0 1 160px; min-width: 40px; text-overflow: ellipsis; }
.tb-tray {
    flex: none; height: 28px; display: flex; align-items: center; gap: 8px; padding: 0 10px;
    border: 1px solid; border-color: var(--lo) var(--hi) var(--hi) var(--lo);
}

/* Menu Démarrer */
.start-menu {
    position: fixed; left: 2px; bottom: var(--taskbar); z-index: 10001; display: none;
    background: var(--face); padding: 2px;
    border: 2px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi);
    box-shadow: inset -1px -1px 0 var(--lo), 4px 4px 0 rgba(0,0,0,.4), 0 0 24px rgba(255,41,117,.5);
}
.start-menu.open { display: flex; }
.start-side {
    width: 26px; background: linear-gradient(0deg, var(--pink), var(--purple) 55%, #1a0638);
    display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
}
.start-side span {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font: 900 18px 'Orbitron', sans-serif; letter-spacing: 1px; color: #fff; text-shadow: 0 0 6px #000;
}
.start-side b { color: var(--cyan); }
.start-items { min-width: 190px; padding: 2px 0; }
.start-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 14px 7px 8px;
    background: none; border: 0; text-align: left; font: 14px var(--ui); color: #000; cursor: pointer;
}
.start-item .si { font-size: 20px; width: 26px; text-align: center; }
.start-item:hover, .start-item:focus-visible { background: #000080; color: #fff; outline: none; }
.start-sep { height: 0; margin: 3px 2px; border-top: 1px solid var(--lo); border-bottom: 1px solid var(--hi); }

/* ---------- Écran d'extinction ---------- */
.shutdown {
    position: fixed; inset: 0; z-index: 100000; display: none; place-items: center; text-align: center;
    background: #000; color: var(--yellow); font: 26px 'VT323', monospace; padding: 20px; cursor: pointer;
}
.shutdown.on { display: grid; }
.shutdown small { display: block; margin-top: 14px; color: var(--cyan); font-size: 18px; }

.noscript { position: fixed; top: 40%; left: 0; right: 0; text-align: center; color: #fff; z-index: 50; }

/* ---------- Animations ---------- */
@keyframes gridmove { to { background-position: 0 70px; } }
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
@keyframes sunpulse { from { filter: brightness(.95); } to { filter: brightness(1.12); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes neon {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
    20%, 24%, 55% { opacity: .45; }
}

/* ---------- Scrollbars 98 ---------- */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: repeating-conic-gradient(#c0c0c0 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
::-webkit-scrollbar-thumb { background: var(--face); border: 2px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); }
::-webkit-scrollbar-button { background: var(--face); border: 2px solid; border-color: var(--hi) var(--dk) var(--dk) var(--hi); width: 16px; height: 16px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
    .desktop-icons { flex-direction: row; right: 8px; bottom: auto; top: 6px; }
    .icon { width: 64px; }
    .icon-img { font-size: 26px; }
    .icon-label { font-size: 11px; }
    .tb-tasks .tb-btn { flex-basis: 40px; }
    .tb-tasks .tb-btn .tb-name { display: none; }
    .tb-tray .tray-ico { display: none; }
    .signature { right: 0; left: 0; text-align: center; font-size: .65rem; }
    .win-bar { height: 26px; }
    .win-btn { width: 22px; height: 20px; }
    .floor-grid { background-size: 50px 50px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; }
}

.start-item { text-decoration: none; }

.about { display: flex; gap: 16px; align-items: center; padding: 10px; background: var(--face); }
.about-cat { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 8px var(--purple)); }
.about p { margin-bottom: 8px; line-height: 1.4; }
.about-q { font-weight: bold; color: #5b1aa6; }

/* Le fichier "bug" de la Corbeille */
body.glitch .scene, body.glitch .desktop-icons, body.glitch .win, body.glitch .taskbar, body.glitch .signature {
    animation: screenbug .35s steps(2, end) infinite;
}
body.glitch .scene { animation-name: screenbug, scenebug; animation-duration: .35s, 1.1s; }
.glitch-bars {
    position: fixed; inset: 0; z-index: 99998; pointer-events: none;
    background:
        linear-gradient(0deg, transparent 0 12%, rgba(255,41,117,.55) 12% 14%, transparent 14% 41%, rgba(50,255,209,.5) 41% 44%, transparent 44% 73%, rgba(140,30,255,.6) 73% 74%, transparent 74%),
        repeating-linear-gradient(0deg, rgba(140,30,255,.1) 0 2px, transparent 2px 5px);
    mix-blend-mode: screen;
    animation: bars .25s steps(3, end) infinite;
}
@keyframes screenbug {
    0%   { transform: translate(0, 0); filter: none; }
    20%  { transform: translate(-9px, 2px) skewX(3deg); filter: hue-rotate(90deg) saturate(2.5); }
    40%  { transform: translate(7px, -3px); filter: hue-rotate(180deg) saturate(3); }
    60%  { transform: translate(-4px, 5px) skewX(-4deg); filter: hue-rotate(250deg) contrast(1.8); }
    80%  { transform: translate(10px, 0); filter: drop-shadow(6px 0 0 rgba(255,0,60,.8)) drop-shadow(-6px 0 0 rgba(0,255,255,.8)); }
    100% { transform: translate(0, 0); filter: none; }
}
@keyframes scenebug { 0%, 100% { clip-path: inset(0); } 30% { clip-path: inset(18% 0 55% 0); } 60% { clip-path: inset(62% 0 8% 0); } }
@keyframes bars { 0% { transform: translateY(0); } 50% { transform: translateY(-37px); } 100% { transform: translateY(21px); } }

.file-list .icon.sel .icon-label, .file-list .icon:focus-visible .icon-label { color: #fff; }

.garble { color: #b00020; font-family: 'Courier New', monospace; font-weight: bold; text-shadow: 1px 0 rgba(0,200,255,.8), -1px 0 rgba(255,0,100,.8); word-break: break-all; }

/* Bouton réduire : trait dessiné, placé près du centre */
.win-btn[data-act="min"] { font-size: 0; }
.win-btn[data-act="min"]::before { content: ""; width: 8px; height: 2px; background: #000; transform: translateY(4px); }

/* lecteurs du dossier mixtape : petit écran cathodique */
.rick { padding: 10px; }
.tv {
    position: relative; overflow: hidden; background: #000; margin-bottom: 10px;
    border-radius: 18px / 14px;
    border: 3px solid #1a1a1a; box-shadow: inset 0 0 30px rgba(0,0,0,.9), 0 0 14px rgba(50,255,209,.35);
}
.tv-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    filter: contrast(1.25) saturate(1.5) brightness(1.05) drop-shadow(2px 0 0 rgba(255,0,60,.55)) drop-shadow(-2px 0 0 rgba(0,220,255,.55));
    animation: tvflicker 3.2s infinite, tvjitter 5s infinite;
}
.tv::before { /* lignes de balayage et masque RGB */
    content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(255,0,0,.07) 0 1px, rgba(0,255,0,.05) 1px 2px, rgba(0,0,255,.07) 2px 3px);
}
.tv::after { /* vignettage et reflet de la vitre */
    content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 18%, rgba(255,255,255,.10), transparent 40%),
        radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%);
}
.tv-roll { /* bande qui défile */
    position: absolute; left: 0; right: 0; height: 22%; z-index: 2; pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(140,30,255,.16), transparent);
    animation: tvroll 6s linear infinite;
}
@keyframes tvroll { from { top: -25%; } to { top: 110%; } }
@keyframes tvflicker { 0%, 100% { opacity: 1; } 47% { opacity: .93; } 50% { opacity: .82; } 53% { opacity: .96; } }
@keyframes tvjitter { 0%, 93%, 100% { transform: none; } 94% { transform: translateX(-3px); } 96% { transform: translateX(4px) skewX(2deg); } 98% { transform: translateX(-1px); } }
