/* ==========================================================================
   mahbodgh.me — retro desktop portfolio
   1. Fonts & tokens   2. Base   3. CRT intro   4. Boot & welcome
   5. Desktop          6. Taskbar, Start menu, tray
   7. Window chrome & shared controls            8. Apps
   9. Overlays         10. Keyframes             11. Small screens & motion
   ========================================================================== */

/* ---------- 1. Fonts & tokens ---------- */
@font-face { font-family: "Arimo"; src: url("../fonts/arimo-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url("../fonts/vt323-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: url("../fonts/press-start-2p-latin.woff2") format("woff2"); font-display: swap; }

:root {
  --font-ui: "Arimo", Tahoma, "Segoe UI", Verdana, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Lucida Console", monospace;
  --font-crt: "VT323", "Courier New", monospace;
  --font-pixel: "Press Start 2P", "Courier New", monospace;

  --luna: #0055ea;
  --luna-dark: #0a4fd6;
  --luna-ink: #0040b5;
  --select: #316ac5;
  --face: #ece9d8;
  --face-line: #cbc6b0;
  --text: #1c1c12;
  --green: #388e3c;
  --red: #e04343;
  --term-bg: #0c1021;
  --term-green: #4af626;
  --term-amber: #ffb000;
  --term-line: #1e2740;

  --taskbar-h: 34px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.4 var(--font-ui);
  color: var(--text);
  background: #0d0e14;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--luna-ink); }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 16px; height: 16px; flex: none; }

.stage { position: fixed; inset: 0; display: none; }
body[data-stage="intro"] #intro,
body[data-stage="boot"] #boot,
body[data-stage="welcome"] #welcome { display: flex; }
body[data-stage="desktop"] #desktop { display: block; }

.noscript { position: fixed; inset: 0; z-index: 10000; overflow: auto; padding: 32px; background: #fdfae8; color: #1c1c12; font-size: 15px; user-select: text; }

.ping { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; flex: none; }
.ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #34d399; animation: ping 1.4s cubic-bezier(0, 0, .2, 1) infinite; }

.avatar {
  display: grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 6px; border: 2px solid #fff;
  background: linear-gradient(135deg, #ffb347, #e8590c);
  color: #fff; font: 700 18px var(--font-ui); text-shadow: 1px 1px 1px rgba(0, 0, 0, .4);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, .4);
}
.avatar.has-photo { overflow: hidden; background: #dfe6f3; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- 3. CRT intro ---------- */
.intro {
  flex-direction: column; align-items: center; justify-content: space-between;
  padding: 20px 16px; color: #e7e5e4; overflow: hidden;
}
.intro-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 700px 550px at 50% 50%, rgba(16, 185, 129, .10), transparent 70%),
    linear-gradient(rgba(56, 189, 248, .04) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(56, 189, 248, .04) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(ellipse at top, #2a2d3d, #161720 55%, #0d0e14);
}
.intro-top {
  position: relative; z-index: 1; width: 100%; max-width: 1024px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; border-radius: 16px;
  border-bottom: 1px solid rgba(41, 37, 36, .8);
  background: rgba(12, 10, 9, .4); backdrop-filter: blur(12px);
}
.intro-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.intro-badge {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: rgba(2, 44, 34, .8); border: 1px solid rgba(16, 185, 129, .4);
  color: #34d399; font: 10px var(--font-pixel); box-shadow: 0 0 10px rgba(16, 185, 129, .2);
}
.intro-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.intro-name h1 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .03em; color: #f5f5f4; }
.intro-pill { padding: 1px 6px; border-radius: 4px; font: 10px var(--font-mono); color: #34d399; background: rgba(16, 185, 129, .2); border: 1px solid rgba(16, 185, 129, .3); }
.intro-id p { margin: 2px 0 0; font: 12px var(--font-mono); color: #a8a29e; }
.intro-specs { display: flex; align-items: center; gap: 16px; font: 12px var(--font-mono); color: #a8a29e; white-space: nowrap; }
.intro-specs span { display: flex; align-items: center; gap: 8px; }
.intro-specs span + span { border-left: 1px solid #292524; padding-left: 16px; }
.intro-specs .dim { color: #78716c; }
.intro-info {
  flex: none; padding: 6px 12px; border-radius: 8px; background: #1c1917; border: 1px solid rgba(68, 64, 60, .7);
  font: 12px var(--font-mono); color: #d6d3d1; transition: color .2s, border-color .2s;
}
.intro-info:hover { color: #34d399; border-color: rgba(16, 185, 129, .6); }

.intro-main { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }

.rig {
  --crt-w: clamp(210px, min(88vw, (100svh - 290px) * .72), 520px);
  font-size: calc(var(--crt-w) / 32.5);
  position: relative; display: flex; flex-direction: column; align-items: center;
  cursor: pointer; outline: none;
  animation: rig-float 5s ease-in-out infinite;
}
.rig-pill {
  display: flex; align-items: center; gap: 10px; margin-bottom: 1.25em; padding: 7px 14px;
  border-radius: 99px; background: rgba(28, 25, 23, .9); border: 1px solid rgba(16, 185, 129, .4);
  box-shadow: 0 0 20px rgba(16, 185, 129, .25); transition: transform .3s, border-color .3s, opacity .3s;
  white-space: nowrap;
}
.rig:hover .rig-pill, .rig:focus-visible .rig-pill { transform: scale(1.05); border-color: #34d399; }
.rig-pill-text { font: clamp(7px, .62em, 10px) var(--font-pixel); color: #34d399; letter-spacing: .05em; }
.rig-pill kbd { font: 11px var(--font-mono); color: #a8a29e; background: rgba(41, 37, 36, .8); padding: 1px 7px; border-radius: 4px; border: 1px solid #44403c; }

.crt {
  position: relative; width: var(--crt-w); padding: 2em;
  background: #dfd6be; border: .25em solid #ede7d5; border-radius: 1.75em;
  box-shadow: 0 0 5em -.6em rgba(52, 211, 153, .25), 0 1.5em 3em -.75em rgba(15, 23, 42, .4), 0 1.25em 2.2em -.3em rgba(28, 25, 23, .35);
  transition: box-shadow .3s;
}
.rig:hover .crt, .rig:focus-visible .crt { box-shadow: 0 0 5.6em .6em rgba(52, 211, 153, .35), 0 1.25em 2.2em -.3em rgba(28, 25, 23, .35); }
.crt-vents { position: absolute; top: -.1em; left: 3em; right: 3em; display: flex; gap: .25em; opacity: .4; }
.crt-vents i { flex: 1; height: .25em; border-radius: 1em; background: #9e947d; }
.crt-brand { position: absolute; top: .65em; left: 1.5em; display: flex; align-items: center; gap: .8em; font: .5em var(--font-pixel); color: #786e58; letter-spacing: .15em; }
.crt-brand b { display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: .3em; background: #065f46; border: 1px solid #059669; color: #a7f3d0; font-weight: 400; letter-spacing: 0; }
.crt-sticker { position: absolute; top: -1.8em; right: 4em; z-index: 3; padding: .4em 1em; background: #fbbf24; color: #1c1917; border: 2px solid #1c1917; border-radius: 2px; transform: rotate(6deg); font: .5em var(--font-pixel); box-shadow: 1px 2px 3px rgba(0, 0, 0, .3); }
.crt-bezel { aspect-ratio: 4 / 3; padding: 1em; background: #22211d; border: 1px solid #444036; border-radius: 1.4em; box-shadow: inset 0 .3em 1em rgba(0, 0, 0, .8), 0 2px 4px rgba(255, 255, 255, .4); }
.crt-glass {
  position: relative; height: 100%; padding: 1em; border-radius: 1em; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; color: #34d399;
  background: radial-gradient(circle at 50% 50%, #0a2e1d 0%, #04140b 80%, #020905 100%);
  box-shadow: inset 0 0 1.6em rgba(0, 0, 0, .9), inset 0 0 .6em rgba(52, 211, 153, .3);
  animation: crt-flicker .15s infinite;
  transition: box-shadow .5s;
}
.crt-glass::before {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, .4) 50%) 0 0 / 100% 4px,
    linear-gradient(90deg, rgba(255, 0, 0, .04), rgba(0, 255, 0, .02), rgba(0, 0, 255, .04)) 0 0 / 6px 100%;
}
.crt-glass::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(circle at center, transparent 65%, rgba(0, 0, 0, .6) 100%); }
.crt-beam { position: absolute; left: 0; right: 0; top: -5em; height: 2.5em; background: rgba(52, 211, 153, .1); filter: blur(6px); animation: crt-beam 6s linear infinite; }
.crt-text { position: relative; z-index: 1; font: 1.1em/1.15 var(--font-crt); letter-spacing: .05em; }
.crt-head { display: flex; justify-content: space-between; gap: 1em; margin-bottom: .5em; padding-bottom: .25em; border-bottom: 1px solid rgba(6, 95, 70, .4); font: .62em var(--font-mono); letter-spacing: 0; color: rgba(16, 185, 129, .8); white-space: nowrap; overflow: hidden; }
.crt-ready { margin: 0 0 .7em; font: .52em/1.6 var(--font-pixel); color: #6ee7b7; }
.crt-lines { min-height: 4.7em; }
.crt-lines p { margin: 0 0 .1em; white-space: nowrap; overflow: hidden; opacity: .92; }
.crt-lines .amber { color: #fcd34d; }
.crt-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin: auto 0; }
.crt-emblem { position: relative; display: grid; place-items: center; width: 3.6em; height: 3.6em; margin-bottom: .4em; border-radius: .75em; background: rgba(2, 44, 34, .6); border: 2px solid rgba(52, 211, 153, .6); box-shadow: 0 0 1.5em rgba(52, 211, 153, .4); transition: transform .3s; }
.rig:hover .crt-emblem { transform: scale(1.1); }
.crt-emblem svg { width: 2em; height: 2em; color: #34d399; }
.crt-emblem .ping { position: absolute; right: -.25em; bottom: -.25em; }
.crt-prompt { display: flex; align-items: center; gap: .2em; font: 1.4em var(--font-crt); color: #6ee7b7; }
.crt-cursor { width: .45em; height: .8em; background: #34d399; animation: blink 1s steps(1) infinite; }
.crt-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 1em; padding-top: .3em; border-top: 1px solid rgba(6, 78, 59, .4); font: .62em var(--font-mono); color: rgba(16, 185, 129, .8); white-space: nowrap; overflow: hidden; }
.crt-foot i { display: inline-block; width: .5em; height: .5em; margin-right: .5em; border-radius: 50%; background: #34d399; }
.crt-off { display: none; position: absolute; inset: 0; z-index: 3; flex-direction: column; align-items: center; justify-content: center; gap: .6em; font: 1.6em var(--font-crt); color: #1f6b4f; }
.crt-off small { font-size: .6em; animation: blink 1.2s steps(1) infinite; }
.intro.is-off .crt-glass { animation: none; background: #050806; box-shadow: inset 0 0 1.6em #000; }
.intro.is-off .crt-glass > :not(.crt-off) { display: none; }
.intro.is-off .crt-off { display: flex; }
.intro.is-off .crt-led { background: #7c2d12; border-color: #9a3412; animation: none; }
.crt-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 1em; padding: .3em .5em 0; border-top: 1px solid rgba(197, 188, 159, .6); }
.crt-knobs { display: flex; gap: .4em; }
.crt-knobs i { width: .75em; height: .75em; border-radius: 50%; background: #baa68e; border: 1px solid #d8c8b2; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.crt-power { display: flex; align-items: center; gap: .5em; }
.crt-power span { font: .44em var(--font-pixel); color: #7d735d; }
.crt-led { width: .65em; height: .65em; border-radius: 50%; background: #10b981; border: 1px solid #6ee7b7; animation: led 2.4s ease-in-out infinite; }
.crt-power b { width: 1.75em; height: 1em; background: #baa68e; border: 2px solid #8a7f67; border-radius: 2px; }
.crt-stand { position: absolute; left: 50%; bottom: -1.5em; z-index: -1; width: 12em; height: 1.5em; transform: translateX(-50%); background: #cac0a5; border: solid #9c9179; border-width: 0 .25em .25em; border-radius: 0 0 .75em .75em; }
.crt-base { position: absolute; left: 50%; bottom: -2.5em; z-index: -2; width: 16em; height: 1.25em; transform: translateX(-50%); background: #beb397; border: .25em solid #8e846c; border-radius: 1em; box-shadow: 0 .6em 1em rgba(0, 0, 0, .3); }

.desk { display: flex; align-items: center; justify-content: space-between; width: 36em; max-width: 100%; margin-top: 3.6em; padding: 0 1em; }
.keyboard { width: 68%; padding: .6em; background: #ded4bb; border: .25em solid #efe9d9; border-radius: .5em; box-shadow: 0 1.2em 1.5em -.3em rgba(0, 0, 0, .35); transform: rotate(-1deg); }
.kb-row { display: flex; gap: .25em; }
.kb-row + .kb-row { margin-top: .25em; }
.key { flex: 1; height: .9em; background: #ede7d8; border: solid #b0a387; border-width: 0 1px 2px 0; border-radius: 2px; }
.key.dark { flex: none; width: 1.8em; background: #b5a78c; border-color: #8f8067; }
.key.blue { flex: none; width: 1.3em; background: #3b82f6; border-color: #1d4ed8; }
.key.wide { flex: 7; }
.key.gap { visibility: hidden; flex: .6; }
.kb-row.fn .key { height: .65em; }
.mousepad { display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 6em; height: 7em; padding: .4em; background: #1e293b; border: 2px solid #334155; border-radius: .75em; box-shadow: 0 .6em 1em rgba(0, 0, 0, .3); }
.mousepad span { font: .5em var(--font-pixel); color: rgba(52, 211, 153, .6); }
.mousepad small { font: .38em var(--font-mono); color: #78716c; }
.mouse { position: relative; width: 3.4em; height: 4.6em; background: #e3dac1; border: 2px solid #f7f2e4; border-radius: 1.2em 1.2em .75em .75em; box-shadow: 0 .4em .6em rgba(0, 0, 0, .4); }
.mouse::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1.9em; border-bottom: 1px solid #a89b7f; background: linear-gradient(90deg, transparent calc(50% - .5px), #a89b7f calc(50% - .5px), #a89b7f calc(50% + .5px), transparent calc(50% + .5px)); }
.mouse i { position: absolute; top: .8em; left: 50%; width: .5em; height: 1em; transform: translateX(-50%); background: #dc2626; border-radius: 2px; }
.rig-shadow { width: 90%; height: .75em; margin-top: .75em; border-radius: 50%; background: rgba(28, 25, 23, .6); filter: blur(4px); }

.rig.zooming { animation: none; transform: scale(5.2) translateY(13%); transition: transform 1.1s cubic-bezier(.85, 0, .15, 1); pointer-events: none; }
.rig.zooming .rig-pill { opacity: 0; }
.rig.zooming .crt-glass { box-shadow: inset 0 0 6em rgba(52, 211, 153, .9), 0 0 4em rgba(52, 211, 153, .9); }

.intro-foot { position: relative; z-index: 1; width: 100%; max-width: 1024px; }
.intro-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.intro-card { padding: 12px; border-radius: 12px; background: rgba(28, 25, 23, .6); border: 1px solid #292524; backdrop-filter: blur(4px); transition: border-color .2s, transform .2s; }
.intro-card:hover { border-color: rgba(16, 185, 129, .4); transform: translateY(-2px); }
.intro-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12px; color: #e7e5e4; }
.intro-card svg { width: 20px; height: 20px; flex: none; }
.intro-card p { margin: 0; font-size: 11px; line-height: 1.45; color: #a8a29e; }
.intro-copy { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(41, 37, 36, .6); font: 11px var(--font-mono); color: #78716c; }
.intro-copy b { font-weight: 400; color: #10b981; }

.intro-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .8); backdrop-filter: blur(4px); animation: fade-in .2s both; }
.intro-dialog { position: relative; width: min(420px, 100%); animation: win-open .2s both; }
.intro-dialog-body { display: block; padding: 16px; color: var(--text); user-select: text; }
.intro-dialog-body p { margin: 0 0 10px; }
.intro-dialog-list { margin: 0 0 4px; padding: 10px 12px; list-style: none; background: #fff; border: 1px solid #c8c4b0; font: 11px/1.7 var(--font-mono); }
.intro-dialog-body .dialog-buttons { padding: 12px 0 0; }

/* ---------- 4. Boot & welcome ---------- */
.boot { flex-direction: column; align-items: center; justify-content: center; background: #000; color: #fff; cursor: pointer; animation: fade-in .4s both; }
.boot-brand { display: flex; align-items: center; gap: 18px; }
.boot-brand svg { width: 76px; height: 76px; }
.boot-brand small { display: block; font-size: 15px; color: #cfd8ea; }
.boot-brand b { display: block; font: italic 700 46px/1 var(--font-ui); letter-spacing: -.02em; }
.boot-brand sup { margin-left: 3px; font: italic 700 20px var(--font-ui); color: #f47b20; }
.boot-bar { width: 176px; height: 18px; margin-top: 52px; padding: 2px; border: 2px solid #b2b2b2; border-radius: 6px; overflow: hidden; }
.boot-blocks { display: flex; gap: 3px; width: 38px; height: 100%; animation: boot-slide 1.5s linear infinite; }
.boot-blocks i { flex: 1; border-radius: 1px; background: linear-gradient(#2838c7, #5979ef 30%, #869ef3 50%, #5979ef 70%, #2838c7); }
.boot-copy, .boot-skip { position: absolute; bottom: 40px; margin: 0; font: 12px var(--font-mono); color: #8b93a7; }
.boot-copy { left: 40px; }
.boot-skip { right: 40px; color: #555d70; }

.welcome { flex-direction: column; justify-content: center; background: #00309c; animation: fade-in .35s both; }
.welcome-band {
  display: flex; align-items: center; justify-content: center; gap: clamp(20px, 5vw, 56px);
  height: 74%; padding: 0 24px;
  background: radial-gradient(ellipse at 15% 0, #a3bff5 0, #5a7edc 50%);
  border-top: 2px solid #c7d9ff; border-bottom: 2px solid #f9a03c;
}
.welcome-word { padding-right: clamp(20px, 5vw, 56px); border-right: 1px solid rgba(255, 255, 255, .5); font: italic 700 clamp(34px, 6vw, 60px) var(--font-ui); color: #fff; text-shadow: 2px 3px 2px rgba(0, 0, 40, .45); animation: welcome-in .7s .1s both; }
.welcome-user { display: flex; align-items: center; gap: 14px; color: #fff; animation: welcome-in .7s .3s both; }
.welcome-user .avatar { width: 64px; height: 64px; font-size: 24px; }
.welcome-user b { display: block; font-size: 20px; text-shadow: 1px 1px 2px rgba(0, 0, 40, .5); }
.welcome-user small { font-size: 12px; color: #dbe6ff; }

/* ---------- 5. Desktop ---------- */
.desktop { overflow: hidden; background: #3a8a2c; }
.wallpaper { position: absolute; inset: 0; overflow: hidden; background: #4c94ee url("../img/wallpaper.svg") center / cover no-repeat; transition: filter 1.2s; }
.cloud { position: absolute; left: 0; aspect-ratio: 600 / 240; background: url("../img/cloud.svg") center / contain no-repeat; will-change: transform; }
.cloud-a { top: 5%; width: clamp(260px, 36vw, 620px); animation: drift 170s linear -40s infinite; }
.cloud-b { top: 21%; width: clamp(180px, 24vw, 420px); opacity: .85; animation: drift 240s linear -150s infinite; }
.cloud-c { top: 30%; width: clamp(300px, 44vw, 760px); opacity: .7; animation: drift 300s linear -230s infinite; }

.desktop-icons {
  position: absolute; inset: 8px auto calc(var(--taskbar-h) + 8px) 8px; z-index: 1;
  display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; gap: 4px 8px;
  transition: filter 1.2s;
}
.d-icon {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 80px; padding: 5px 2px 4px; background: none; border: 1px solid transparent; border-radius: 3px;
  color: #fff; text-align: center;
}
.d-icon svg { width: 40px; height: 40px; filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, .45)); transition: transform .15s; }
.d-icon span { max-width: 100%; padding: 1px 3px; border-radius: 2px; font: 11px/1.25 var(--font-ui); overflow-wrap: anywhere; text-shadow: 1px 1px 1px #000, 0 0 3px rgba(0, 0, 0, .7); }
.d-icon:hover svg { transform: scale(1.08); }
.d-icon:focus-visible { outline: 1px dotted #fff; outline-offset: -1px; }
.d-icon.selected { background: rgba(49, 106, 197, .35); border: 1px dotted rgba(255, 255, 255, .75); }
.d-icon.selected span { background: var(--select); text-shadow: none; }
.d-icon.opening svg { animation: icon-launch .35s ease-out; }
body.desk-enter .d-icon { animation: icon-in .45s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 55ms + 350ms); }
body.desk-enter .taskbar { animation: taskbar-up .45s .1s cubic-bezier(.2, .9, .3, 1) both; }
body.desk-enter .wallpaper { animation: fade-in .7s both; }
.desktop-icons.refresh .d-icon { animation: icon-blink .3s both; animation-delay: calc(var(--i, 0) * 25ms); }

.marquee { position: absolute; z-index: 2; border: 1px dotted #fff; background: rgba(49, 106, 197, .25); pointer-events: none; }
.windows { position: absolute; inset: 0 0 var(--taskbar-h) 0; z-index: 10; pointer-events: none; transition: filter 1.2s; }
.desktop.dimmed .wallpaper, .desktop.dimmed .desktop-icons, .desktop.dimmed .windows { filter: grayscale(1) brightness(.8); }

/* ---------- 6. Taskbar, Start menu, tray ---------- */
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4000; height: var(--taskbar-h);
  display: flex; align-items: stretch;
  background: linear-gradient(180deg, #3f8cf3 0, #2a6fe0 9%, #245dda 20%, #225ad9 60%, #1d4ec2 92%, #173fa5 100%);
  box-shadow: inset 0 1px 0 #7ab6ff, 0 -1px 4px rgba(0, 0, 0, .35);
}
.start-btn {
  display: flex; align-items: center; gap: 6px; flex: none; padding: 0 22px 2px 10px; border: 0;
  border-radius: 0 12px 12px 0; color: #fff; font: italic 700 19px var(--font-ui); text-shadow: 1px 1px 2px rgba(0, 0, 0, .6);
  background: radial-gradient(circle at 20% 0, #8fe08a 0, #4caf50 35%, #388e3c 60%, #23702a 100%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .55), inset -2px -2px 3px rgba(0, 0, 0, .35), 2px 0 4px rgba(0, 0, 0, .4);
}
.start-btn svg { width: 20px; height: 20px; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .4)); }
.start-btn:hover { filter: brightness(1.12); }
.start-btn.open, .start-btn:active { filter: brightness(.86); box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .5); }
.tasks { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; padding: 3px 8px; overflow: hidden; }
.task {
  flex: 0 1 170px; min-width: 38px; height: 26px; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  border: 0; border-radius: 3px; color: #fff; font-size: 12px; text-align: left;
  background: linear-gradient(180deg, #5aa0f5 0, #3b82e6 12%, #2f6fdc 90%, #2a63cf 100%);
  box-shadow: inset 1px 1px 1px rgba(255, 255, 255, .4), inset -1px -1px 2px rgba(0, 0, 0, .4);
  animation: task-in .2s both;
}
.task svg { width: 16px; height: 16px; flex: none; }
.task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task:hover { filter: brightness(1.12); }
.task.active { background: linear-gradient(180deg, #1b4aa8 0, #1f55c0 100%); box-shadow: inset 2px 2px 3px rgba(0, 0, 0, .6), inset -1px -1px 1px rgba(255, 255, 255, .2); }
.tray {
  display: flex; align-items: center; gap: 2px; flex: none; padding: 0 10px 0 8px; color: #fff;
  background: linear-gradient(180deg, #1aa0ee 0, #1290e8 10%, #0f7fdb 50%, #0c6ccb 100%);
  border-left: 1px solid #0a3e9a; box-shadow: inset 1px 1px 1px #5cc4ff;
}
.tray-btn { display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px; border: 0; border-radius: 3px; background: none; color: #fff; font-size: 11px; font-weight: 700; }
.tray-btn svg { width: 16px; height: 16px; }
.tray-btn:hover { background: rgba(255, 255, 255, .2); }
.tray-btn.off { opacity: .55; }
.tray-like.bump svg { animation: heart-pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.clock { padding-left: 6px; font-size: 12px; white-space: nowrap; }

.start-menu {
  position: absolute; left: 0; bottom: var(--taskbar-h); z-index: 5000; width: 400px; max-width: 100vw;
  border: 1px solid var(--luna-dark); border-bottom: 0; border-radius: 8px 8px 0 0; overflow: hidden;
  background: #fff; font-size: 12px; box-shadow: 3px -2px 12px rgba(0, 0, 0, .45);
  transform-origin: bottom left; animation: menu-up .16s ease-out both;
}
.sm-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #fff; background: linear-gradient(180deg, #4d98f5, #1560d0 18%, #1a66d6 85%, #0f4fba); box-shadow: inset 0 1px #8fc0ff; }
.sm-head b { display: block; font-size: 15px; text-shadow: 1px 1px 2px rgba(0, 0, 0, .5); }
.sm-head small { display: block; opacity: .92; }
.sm-body { display: grid; grid-template-columns: 1.15fr 1fr; border-top: 2px solid #f0903a; }
.sm-left { padding: 6px; background: #fff; }
.sm-right { padding: 6px; background: #d3e5fa; border-left: 1px solid #95bdee; color: #0a246a; }
.sm-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 2px; background: none; color: inherit; font-size: 12px; text-align: left; text-decoration: none; }
.sm-item svg { width: 26px; height: 26px; flex: none; }
.sm-right .sm-item svg { width: 20px; height: 20px; }
.sm-item b { display: block; }
.sm-item small { display: block; font-size: 10.5px; color: #7b7b7b; }
.sm-item:hover, .sm-item:focus-visible { background: var(--select); color: #fff; outline: none; }
.sm-item:hover small, .sm-item:focus-visible small { color: #dfe9ff; }
.sm-sep { height: 1px; margin: 5px 4px; background: linear-gradient(90deg, transparent, #b9b9b9, transparent); }
.sm-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 8px; background: linear-gradient(180deg, #4d98f5, #1560d0 22%, #0f4fba); }
.sm-foot .sm-item { width: auto; color: #fff; }
.sm-foot .sm-item svg { width: 22px; height: 22px; }
.sm-foot .sm-item:hover { background: rgba(255, 255, 255, .2); }

.balloon {
  position: absolute; right: 10px; bottom: calc(var(--taskbar-h) + 14px); z-index: 4500; max-width: 280px;
  padding: 8px 28px 9px 10px; border: 1px solid #1c1c12; border-radius: 8px; background: #ffffe1;
  font-size: 12px; line-height: 1.4; box-shadow: 2px 3px 6px rgba(0, 0, 0, .35); cursor: pointer;
  transform-origin: bottom right; animation: balloon-in .28s cubic-bezier(.2, .9, .3, 1.3) both;
}
.balloon::after { content: ""; position: absolute; right: 74px; bottom: -8px; width: 14px; height: 14px; background: #ffffe1; border: solid #1c1c12; border-width: 0 1px 1px 0; transform: rotate(45deg); }
.balloon b { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.balloon svg { width: 16px; height: 16px; flex: none; }
.balloon-x { position: absolute; top: 5px; right: 6px; width: 16px; height: 16px; padding: 0; border: 1px solid #b5b59a; border-radius: 3px; background: #fff; font: 700 11px/1 var(--font-ui); color: #666; }
.balloon-x:hover { background: #ffd9d9; color: #a00; }

.ctx-menu { position: absolute; z-index: 6000; min-width: 190px; padding: 2px; background: #fff; border: 1px solid #aca899; font-size: 12px; box-shadow: 2px 2px 4px rgba(0, 0, 0, .4); animation: fade-in .1s both; }
.ctx-item { display: block; width: 100%; padding: 4px 22px; border: 0; background: none; text-align: left; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--select); color: #fff; outline: none; }
.ctx-sep { height: 1px; margin: 3px 1px; background: #aca899; }

/* ---------- 7. Window chrome & shared controls ---------- */
.window {
  position: absolute; display: flex; flex-direction: column; min-width: 200px; min-height: 100px;
  background: var(--face); border: 3px solid var(--luna-dark); border-top: 0; border-radius: 8px 8px 0 0;
  font-size: 12px; box-shadow: 2px 3px 9px rgba(0, 0, 0, .45); pointer-events: auto;
}
.window:not(.active) { border-color: #6f8bd6; box-shadow: 1px 2px 5px rgba(0, 0, 0, .3); }
.titlebar {
  flex: none; display: flex; align-items: center; gap: 6px; height: 29px; margin: 0 -3px; padding: 0 5px 0 7px;
  border-radius: 8px 8px 0 0; color: #fff; touch-action: none;
  background: linear-gradient(180deg, #4d9bff 0, #1568f0 8%, #0055ea 40%, #0a5be6 86%, #1b63e2 94%, #0a44c0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 1px 0 0 rgba(255, 255, 255, .2), inset -1px 0 0 rgba(0, 0, 60, .2);
}
.window:not(.active) .titlebar { background: linear-gradient(180deg, #8fa8e6 0, #7a96df 10%, #6f8bd6 60%, #6582d0 100%); box-shadow: none; }
.tb-icon { width: 16px; height: 16px; flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.tb-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 rgba(0, 0, 0, .7); }
.window:not(.active) .tb-title { color: #e3e9fb; text-shadow: none; }
.tb-controls { display: flex; gap: 2px; flex: none; }
.tb-btn { position: relative; width: 21px; height: 21px; padding: 0; border: 1px solid #fff; border-radius: 3px; background: linear-gradient(135deg, #8bb8ff 0, #2a6ae8 45%, #1b4fc4 100%); box-shadow: inset 0 0 0 1px rgba(0, 0, 80, .25); }
.tb-btn:hover { filter: brightness(1.22); }
.tb-btn:active { filter: brightness(.82); }
.tb-close { background: linear-gradient(135deg, #f7ab98 0, var(--red) 45%, #b3261a 100%); }
.tb-close:hover { background: linear-gradient(135deg, #ffc0b0 0, #ff5a5a 45%, #c8281c 100%); filter: none; }
.window:not(.active) .tb-btn { opacity: .75; }
.tb-min::before { content: ""; position: absolute; left: 4px; bottom: 4px; width: 8px; height: 3px; background: #fff; }
.tb-max::before { content: ""; position: absolute; inset: 4px; border: 1px solid #fff; border-top-width: 3px; }
.window.maximized .tb-max::before { inset: 7px 7px 3px 3px; border-top-width: 2px; background: #2a6ae8; z-index: 1; }
.window.maximized .tb-max::after { content: ""; position: absolute; inset: 3px 3px 7px 7px; border: 1px solid #fff; border-top-width: 2px; }
.tb-close::before, .tb-close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 13px; height: 2px; background: #fff; transform: translate(-50%, -50%) rotate(45deg); }
.tb-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.win-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.win-resize { position: absolute; right: -3px; bottom: -3px; z-index: 5; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none; background: radial-gradient(circle, rgba(0, 0, 0, .35) 1px, transparent 1.5px) 0 0 / 4px 4px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }

.window.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-width: 0; border-radius: 0; }
.window.maximized .titlebar { margin: 0; border-radius: 0; }
.window.maximized .win-resize { display: none; }
.window.minimized { display: none; }
.window.dragging { box-shadow: 4px 8px 22px rgba(0, 0, 0, .5); }
.window.rect-anim { transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease; }
.window.opening { animation: win-open .22s cubic-bezier(.2, .9, .3, 1.15) both; }
.window.closing { animation: win-close .15s ease-in both; pointer-events: none; }
.window.minimizing { animation: win-min .24s cubic-bezier(.5, 0, .8, .4) both; pointer-events: none; }
.window.restoring { animation: win-min .22s cubic-bezier(.5, 0, .8, .4) reverse both; }
.window.shake { animation: shake .35s; }

.window ::-webkit-scrollbar { width: 16px; height: 16px; }
.window ::-webkit-scrollbar-track { background: #f3f1e6; }
.window ::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #c8d6fb, #b3c8f5 50%, #a6bdf2); border: 1px solid #fff; border-radius: 3px; box-shadow: inset 0 0 0 1px #7b9fe8; }
.window ::-webkit-scrollbar-corner { background: #f3f1e6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 74px; min-height: 23px; padding: 3px 12px;
  border: 1px solid #003c74; border-radius: 3px; background: linear-gradient(180deg, #fff 0, #ecebe5 86%, #d8d0c4 100%);
  color: #000; font: 12px var(--font-ui); text-decoration: none; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { box-shadow: inset 0 0 0 2px rgba(49, 106, 197, .45); }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.btn:active { background: linear-gradient(180deg, #cdcac3, #e3e3db 8%, #e5e5de 94%, #f2f2f1); box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .25); padding: 4px 11px 2px 13px; }
.btn-default { box-shadow: inset 0 0 0 2px #9db9eb; }
.btn-green { border-color: #0d4f18; background: linear-gradient(180deg, #5cc463, var(--green) 60%, #2b7a30); color: #fff; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.btn-green:hover { box-shadow: none; filter: brightness(1.1); }
.btn-green:active { background: linear-gradient(180deg, #2b7a30, var(--green)); }
.btn[disabled] { opacity: .55; pointer-events: none; }

.menubar { flex: none; display: flex; gap: 2px; padding: 1px 4px; background: var(--face); border-bottom: 1px solid #d8d2bd; }
.menubar span { padding: 2px 7px; }
.menubar span:hover { background: var(--select); color: #fff; }
.toolbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 6px; background: linear-gradient(180deg, #f9f8f0, #ebe8d7); border-bottom: 1px solid var(--face-line); }
.tool { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid transparent; border-radius: 3px; background: none; color: inherit; font-size: 12px; text-decoration: none; white-space: nowrap; }
.tool svg { width: 18px; height: 18px; }
.tool:hover { border-color: #c2c0b6; background: linear-gradient(#fff, #e9e7da); box-shadow: 0 1px 1px rgba(0, 0, 0, .12); }
.tool:active { background: #dedbcb; box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .25); }
.tool[disabled] { opacity: .45; pointer-events: none; }
.tool.on { border-color: #316ac5; background: #d6e3ff; }
.tool-sep { width: 1px; height: 20px; margin: 0 3px; background: #c5c1ad; box-shadow: 1px 0 #fff; }
.tool-label { padding: 0 4px; font: 11px var(--font-mono); }
.statusbar { flex: none; display: flex; gap: 2px; padding: 2px; background: var(--face); border-top: 1px solid var(--face-line); font-size: 11px; color: #444; }
.statusbar span { flex: 1; min-width: 0; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: inset 1px 1px #9d9a8a, inset -1px -1px #fff; }
.statusbar span.fit { flex: none; }
.input { padding: 3px 5px; border: 1px solid #7f9db9; border-radius: 0; background: #fff; color: #000; font: 12px var(--font-mono); outline: none; user-select: text; -webkit-user-select: text; }
.input:focus { box-shadow: inset 0 0 0 1px var(--luna); }
.tabs { flex: none; display: flex; padding: 8px 8px 0; }
.tab { position: relative; top: 1px; margin-right: -1px; padding: 3px 11px 4px; border: 1px solid #919b9c; border-bottom: 0; border-radius: 4px 4px 0 0; background: linear-gradient(#fff, #f0efe8); font-size: 12px; }
.tab:hover { border-top-color: #e68b2c; box-shadow: inset 0 2px #ffc73c; }
.tab[aria-selected="true"] { z-index: 1; margin-top: -2px; padding-top: 4px; border-top: 3px solid #e68b2c; background: #fcfcfe; box-shadow: none; }
.tab-panel { flex: 1; min-height: 0; margin: 0 8px; padding: 14px; border: 1px solid #919b9c; background: #fcfcfe; overflow: auto; user-select: text; -webkit-user-select: text; }
.tab-panel > * { animation: fade-in .2s both; }
.dialog-buttons { flex: none; display: flex; justify-content: flex-end; gap: 6px; padding: 10px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 1px 7px; border: 1px solid #b9c7e6; border-radius: 3px; background: #eef3ff; font: 11px var(--font-mono); }
.group-box { position: relative; margin: 16px 0 0; padding: 14px 10px 8px; border: 1px solid #d0d0bf; border-radius: 4px; }
.group-box > h3 { position: absolute; top: -9px; left: 8px; margin: 0; padding: 0 4px; background: #fcfcfe; color: #0046d5; font-size: 12px; font-weight: 400; }
.msgbox { display: flex; align-items: flex-start; gap: 14px; padding: 16px 16px 6px; user-select: text; -webkit-user-select: text; }
.msgbox svg { width: 34px; height: 34px; flex: none; }
.msgbox p { margin: 4px 0; line-height: 1.45; }

/* ---------- 8. Apps ---------- */
/* About */
.about-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.about-hero .avatar { width: 84px; height: 84px; border-radius: 8px; font-size: 32px; }
.about-hero h2 { margin: 0; font-size: 20px; }
.about-hero p { margin: 2px 0; color: #444; }
.about-hero .about-role { color: var(--luna-ink); font-weight: 700; }
.about-loc { display: flex; align-items: center; gap: 4px; }
.about-loc svg { width: 14px; height: 14px; }
.about-text p { margin: 0 0 8px; line-height: 1.55; }
.about-note { padding: 6px 10px; border-left: 3px solid var(--green); background: #effaf0; }
.about-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.kv { display: grid; grid-template-columns: 124px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { font-weight: 700; color: var(--luna-ink); }
.kv dd { margin: 0; }
.job h4 { display: flex; justify-content: space-between; gap: 10px; margin: 0; font-size: 13px; }
.job h4 span { flex: none; font: 400 11px var(--font-mono); color: #666; }
.job .headline { margin: 2px 0 6px; color: var(--luna-ink); }
.job ul { margin: 0; padding-left: 18px; }
.job li { margin-bottom: 4px; line-height: 1.45; }
.job + .job { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e1e1d5; }
.job-also { margin: 6px 0 0; padding-left: 18px; color: #555; font-style: italic; }
.contact-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 8px; border: 1px solid #e1e1d5; border-radius: 4px; background: #fff; }
.contact-row svg { width: 28px; height: 28px; flex: none; }
.contact-row div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.contact-row small { display: block; color: #666; }

/* Explorer */
.addressbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: var(--face); border-bottom: 1px solid var(--face-line); color: #555; }
.address { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; padding: 2px 5px; background: #fff; border: 1px solid #7f9db9; color: #000; font: 12px var(--font-mono); }
.address svg { width: 16px; height: 16px; flex: none; }
.address span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explorer-main { flex: 1; min-height: 0; display: flex; container-type: inline-size; }
.xp-side { flex: none; width: 190px; padding: 10px; overflow: auto; background: linear-gradient(180deg, #7ba2e7, #6375d6); }
.side-box { margin-bottom: 12px; border-radius: 4px 4px 0 0; overflow: hidden; }
.side-box h3 { margin: 0; padding: 5px 10px; background: linear-gradient(90deg, #fff, #c6d3f7); color: #215dc6; font-size: 12px; }
.side-box > div { padding: 8px 10px; background: #d6dff7; border: 1px solid #fff; border-top: 0; font-size: 11.5px; line-height: 1.45; }
.side-link { display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 0; border: 0; background: none; color: #215dc6; font-size: 11.5px; text-align: left; text-decoration: none; }
.side-link svg { width: 14px; height: 14px; flex: none; }
.side-link:hover { color: #428eff; text-decoration: underline; }
.explorer-view { flex: 1; min-width: 0; padding: 12px; overflow: auto; background: #fff; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.file { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 3px; background: none; text-align: left; animation: icon-in .3s both; animation-delay: calc(var(--i, 0) * 50ms); }
.file svg { width: 44px; height: 44px; flex: none; }
.file b { display: block; font-size: 13px; }
.file small { display: block; color: #666; line-height: 1.35; }
.file:hover { background: #eef3ff; border-color: #c4d5f7; }
.file.selected, .file:focus-visible { background: #d6e3ff; border-color: var(--select); outline: none; }
.proj-detail { user-select: text; -webkit-user-select: text; animation: fade-in .25s both; }
.proj-detail header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--luna); }
.proj-detail header svg { width: 56px; height: 56px; flex: none; }
.proj-detail h2 { margin: 0; font-size: 18px; }
.proj-detail header p { margin: 2px 0 0; color: #555; }
.proj-kind { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 99px; background: #e8efff; border: 1px solid #c4d5f7; color: var(--luna-ink); font-size: 11px; font-weight: 700; }
.proj-detail h3 { margin: 14px 0 6px; font-size: 12px; color: var(--luna-ink); text-transform: uppercase; letter-spacing: .05em; }
.proj-detail ul { margin: 0; padding-left: 18px; }
.proj-detail li { margin-bottom: 5px; line-height: 1.5; }
@container (max-width: 470px) { .xp-side { display: none; } }

/* Certificates */
.cert-view { flex: 1; min-height: 0; padding: 12px; overflow: auto; background: #fff; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cert-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid #d8dce6; border-radius: 4px; background: #fff; text-align: left; animation: icon-in .3s both; animation-delay: calc(var(--i, 0) * 50ms); transition: box-shadow .15s, border-color .15s, transform .15s; }
.cert-card:hover, .cert-card:focus-visible { border-color: var(--select); box-shadow: 0 3px 10px rgba(0, 60, 160, .2); transform: translateY(-2px); outline: none; }
.cert-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid #e3e6ee; background: #f3f5fa; }
.cert-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.cert-thumb svg { width: 56px; height: 56px; }
.cert-meta b { display: block; font-size: 12.5px; line-height: 1.3; }
.cert-meta small { display: block; color: #666; line-height: 1.35; }
.cert-meta .cert-date { color: var(--luna-ink); font-weight: 700; }
.cert-image { display: block; margin: 12px 0; border: 1px solid #c8ccd6; box-shadow: 0 3px 12px rgba(0, 0, 0, .25); cursor: zoom-in; }
.cert-image img { display: block; width: 100%; height: auto; }
.cert-list { margin: 0; padding: 0; list-style: none; }
.cert-list .side-link { align-items: flex-start; padding: 3px 0; line-height: 1.35; }
.cert-list .side-link svg { width: 16px; height: 16px; margin-top: 1px; }

/* Résumé viewer */
.pdf-stage { flex: 1; min-height: 0; padding: 14px; overflow: auto; background: #525659; }
.paper { max-width: 700px; margin: 0 auto; padding: 34px 38px; background: #fff; color: #111827; font: 12.5px/1.5 var(--font-ui); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); user-select: text; -webkit-user-select: text; animation: paper-in .35s both; }
.paper h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.r-role { margin: 2px 0 6px; color: #1d4ed8; font-size: 14px; }
.r-meta { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid #1d4ed8; color: #555; font-size: 11.5px; }
.r-meta a { color: inherit; }
.paper h2 { margin: 16px 0 6px; padding-bottom: 3px; border-bottom: 1px solid #d5d9e4; font-size: 15px; }
.paper p { margin: 0 0 6px; text-align: justify; }
.r-skills { display: grid; grid-template-columns: 124px 1fr; gap: 3px 10px; margin: 0; }
.r-skills dt { font-weight: 700; }
.r-skills dd { margin: 0; }
.r-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; }
.r-row span:last-child { flex: none; font-weight: 400; color: #666; font-size: 11.5px; }
.r-sub { margin: 1px 0 4px !important; color: #1d4ed8; text-align: left !important; }
.paper ul { margin: 4px 0 8px; padding-left: 18px; }
.paper li { margin-bottom: 2px; }
.r-cols { columns: 2; column-gap: 24px; }
.r-cols li { break-inside: avoid; }
.r-badge { padding: 1px 8px; border: 1px solid #c4d5f7; border-radius: 99px; background: #e8efff; color: #1d4ed8 !important; font-size: 11px !important; font-weight: 700 !important; }
.r-item { margin-bottom: 8px; }
.r-muted { color: #666; font-size: 11.5px; }
.r-note { margin: 4px 0 8px !important; padding: 5px 10px; border-left: 3px solid #1d4ed8; background: #f1f4fb; text-align: left !important; }

/* Packet analyzer */
.sniff-filter { flex: none; display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: var(--face); border-bottom: 1px solid var(--face-line); }
.sniff-filter b { font-size: 11px; color: #555; }
.sniff-filter .input { flex: 1; min-width: 0; }
.sniff-filter .input.ok { background: #e4ffc7; }
.sniff-filter .input.bad { background: #ffd0d0; }
.sniff-list { flex: 1.5; min-height: 80px; overflow: auto; background: #fff; }
.sniff-list table { width: 100%; border-collapse: collapse; font: 11px var(--font-mono); white-space: nowrap; }
.sniff-list th { position: sticky; top: 0; z-index: 1; padding: 2px 6px; border: 1px solid var(--face-line); border-top: 0; background: linear-gradient(#fff, #e9e7da); font: 700 11px var(--font-ui); text-align: left; }
.sniff-list td { padding: 2px 6px; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.sniff-list tbody tr { cursor: pointer; animation: row-in .25s both; }
.sniff-list tr.src-portswigger { background: #fff3e0; }
.sniff-list tr.src-htb { background: #e9f9df; }
.sniff-list tr.src-progress { background: #fff9c4; }
.sniff-list tbody tr:hover { filter: brightness(.95); }
.sniff-list tr.selected { background: var(--luna-dark); color: #fff; filter: none; }
.sniff-tree { flex: .9; min-height: 56px; padding: 4px 8px; overflow: auto; background: #fff; border-top: 3px solid var(--face); font: 11px/1.65 var(--font-mono); user-select: text; -webkit-user-select: text; }
.sniff-tree .sub { padding-left: 18px; color: #444; }
.sniff-tree .hot { color: var(--luna-ink); font-weight: 700; }
.sniff-hex { flex: .7; min-height: 50px; padding: 5px 8px; overflow: auto; background: #0d1117; color: #9df898; border-top: 3px solid var(--face); font: 11px/1.5 var(--font-mono); white-space: pre; user-select: text; -webkit-user-select: text; }
.sniff-hex .off { color: #737687; }
.sniff-hex .asc { color: var(--term-amber); }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #9aa3b8; }
.live-dot.on { background: #2ecc40; animation: blink 1s steps(1) infinite; }

/* Notepad */
.notepad-text { flex: 1; min-height: 0; padding: 6px 8px; border: 0; outline: none; resize: none; background: #fff; color: #000; font: 13px/1.55 var(--font-mono); user-select: text; -webkit-user-select: text; }

/* Terminal */
.term { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); color: #d6deeb; font: 13px/1.5 var(--font-mono); }
.term-chips { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 6px 8px; border-bottom: 1px solid var(--term-line); font-size: 11px; color: #737687; }
.chip-btn { padding: 1px 8px; border: 1px solid #2c3a5e; border-radius: 3px; background: #131a30; color: #9df898; font: 11px var(--font-mono); transition: border-color .15s, background .15s, transform .1s; }
.chip-btn:hover { border-color: var(--term-green); background: #16223c; }
.chip-btn:active { transform: translateY(1px); }
.chip-btn.amber { color: var(--term-amber); }
.term-out { flex: 1; min-height: 0; padding: 8px 10px; overflow: auto; cursor: text; user-select: text; -webkit-user-select: text; }
.term-out > div { min-height: 1.5em; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-g { color: var(--term-green); }
.t-a { color: var(--term-amber); }
.t-r { color: #ff6b6b; }
.t-b { color: #7fb0ff; }
.t-d { color: #737687; }
.t-w { color: #fff; font-weight: 700; }
.term-input-row { display: flex; gap: 7px; }
.term-ps { flex: none; color: #fff; font-weight: 700; }
.term-input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none; color: var(--term-green); font: inherit; caret-color: var(--term-green); user-select: text; -webkit-user-select: text; }
.term-status { flex: none; display: flex; justify-content: space-between; gap: 10px; padding: 3px 10px; border-top: 1px solid var(--term-line); font-size: 10.5px; color: #737687; white-space: nowrap; overflow: hidden; }
.term-matrix { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.term ::-webkit-scrollbar-track, .bh::-webkit-scrollbar-track { background: var(--term-bg); }
.term ::-webkit-scrollbar-thumb, .bh::-webkit-scrollbar-thumb { background: #2c3a5e; border: 3px solid var(--term-bg); border-radius: 8px; box-shadow: none; }
.term ::-webkit-scrollbar-corner { background: var(--term-bg); }

/* BugHunt */
.bh { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; overflow: auto; background: var(--term-bg); color: #d6deeb; font: 12px var(--font-mono); }
.bh-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.bh-stat { min-width: 84px; padding: 3px 8px; border: 1px solid #2c3a5e; border-radius: 3px; background: #070a15; color: var(--term-green); text-align: center; }
.bh-status { flex: 1; font-weight: 700; letter-spacing: .05em; text-align: center; }
.bh-status.win { color: var(--term-green); }
.bh-status.lose { color: #ff6b6b; }
.bh-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.bh-bar .chip-btn.on { border-color: var(--term-amber); color: var(--term-amber); }
.bh-grid { display: grid; gap: 2px; padding: 6px; border: 1px solid #2c3a5e; border-radius: 4px; background: #070a15; touch-action: manipulation; }
.bh-cell { display: grid; place-items: center; width: var(--cell, 28px); height: var(--cell, 28px); padding: 0; border: 1px solid #4a62a0; border-radius: 3px; background: linear-gradient(145deg, #35508f, #223463); color: #fff; font: 700 13px var(--font-mono); }
.bh-cell:hover { border-color: var(--term-green); }
.bh-cell svg { width: 16px; height: 16px; pointer-events: none; }
.bh-cell.open { background: #080c18; border-color: #141b33; cursor: default; animation: cell-pop .16s both; }
.bh-cell.flag { color: var(--term-amber); }
.bh-cell.bug { background: #3a0d12; border-color: #ff6b6b; }
.bh-cell.boom { background: #c81e1e; animation: boom .45s both; }
.bh-cell.n1 { color: #7fb0ff; } .bh-cell.n2 { color: var(--term-green); } .bh-cell.n3 { color: #ff6b6b; } .bh-cell.n4 { color: #c792ea; }
.bh-cell.n5 { color: var(--term-amber); } .bh-cell.n6 { color: #5ce1e6; } .bh-cell.n7 { color: #fff; } .bh-cell.n8 { color: #9aa3b8; }
.bh-hint { font-size: 10.5px; color: #737687; text-align: center; }

/* Likes */
.like-box { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; overflow: hidden; background: linear-gradient(180deg, #fcfcfe, #eaf1ff); text-align: center; }
.like-heart { width: 88px; height: 88px; padding: 0; border: 0; background: none; animation: heartbeat 1.6s ease-in-out infinite; }
.like-heart svg { width: 100%; height: 100%; filter: grayscale(1) opacity(.5); transition: filter .3s; }
.like-heart:hover svg { filter: grayscale(.2) drop-shadow(0 4px 6px rgba(200, 30, 30, .3)); }
.like-heart.liked { cursor: default; }
.like-heart.liked svg { filter: drop-shadow(0 4px 6px rgba(200, 30, 30, .35)); }
.like-heart.pop { animation: heart-pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.like-count b { display: block; font-size: 28px; line-height: 1.1; color: #c81e1e; font-variant-numeric: tabular-nums; }
.like-count.bump b { animation: count-bump .4s; }
.like-note { max-width: 250px; font-size: 11px; color: #666; }
.float-heart { position: absolute; left: 50%; top: 42%; width: 22px; height: 22px; pointer-events: none; animation: float-up 1.3s ease-out forwards; }

.login { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 4px; }
.login-top { display: flex; align-items: center; gap: 12px; }
.login-top svg { width: 36px; height: 36px; flex: none; }
.login label { display: flex; align-items: center; gap: 8px; }
.login label span { flex: none; width: 66px; }
.login .input { flex: 1; min-width: 0; }
.login-err { min-height: 16px; color: #b3261a; font-size: 11.5px; }

.stats { flex: 1; min-height: 0; padding: 12px; overflow: auto; background: #fcfcfe; user-select: text; -webkit-user-select: text; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-tile { padding: 8px 4px; border: 1px solid #c4d5f7; border-radius: 4px; background: linear-gradient(#fff, #eef3ff); text-align: center; }
.stat-tile b { display: block; font-size: 22px; color: var(--luna-ink); font-variant-numeric: tabular-nums; }
.stat-tile small { color: #555; }
.stats h3 { margin: 14px 0 4px; font-size: 12px; color: var(--luna-ink); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 110px; padding: 6px; border: 1px solid #d0d0bf; background: #fff; }
.bar { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(#62abff, #0b4fd0); transform-origin: bottom; animation: bar-grow .5s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i, 0) * 12ms); }
.bar.empty { background: #e3e7f0; }
.bar:hover { filter: brightness(1.25); }
.bars-axis { display: flex; justify-content: space-between; font: 10px var(--font-mono); color: #777; }
.stats table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.stats th { padding: 3px 6px; border: 1px solid var(--face-line); background: var(--face); text-align: left; }
.stats td { padding: 3px 6px; border-bottom: 1px solid #eee; }
.stats td.mono { font-family: var(--font-mono); font-size: 11px; }
.stats-empty { padding: 14px; color: #666; text-align: center; }
.sec-list { margin: 0; padding-left: 18px; font-size: 11.5px; line-height: 1.7; color: #444; }
.sec-list .warn { color: #b3261a; font-weight: 700; }

/* ---------- 9. Overlays ---------- */
.scanlines { position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: 0; transition: opacity .3s; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, .3) 50%) 0 0 / 100% 3px; }
body.scan[data-stage="desktop"] .scanlines { opacity: .17; }
.blackout { position: fixed; inset: 0; z-index: 8000; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s; }
.blackout.on { opacity: 1; pointer-events: auto; }

.shutdown { position: absolute; inset: 0; z-index: 7000; display: grid; place-items: center; background: rgba(0, 10, 40, .25); animation: fade-in .3s both; }
.sd-panel { width: min(350px, 92vw); border-radius: 6px; overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, .6); animation: win-open .25s both; }
.sd-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #00309c; color: #fff; font-size: 16px; }
.sd-head svg { width: 26px; height: 26px; }
.sd-body { display: flex; justify-content: center; gap: 34px; padding: 24px 10px; background: linear-gradient(90deg, #5a7edc, #93b3f5 50%, #5a7edc); border-top: 2px solid #c7d9ff; border-bottom: 2px solid #c7d9ff; }
.sd-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; border: 0; background: none; color: #fff; font-size: 12px; font-weight: 700; text-shadow: 1px 1px 1px rgba(0, 0, 60, .5); }
.sd-opt svg { width: 38px; height: 38px; transition: transform .15s, filter .15s; }
.sd-opt:hover svg, .sd-opt:focus-visible svg { transform: scale(1.14); filter: brightness(1.2); }
.sd-foot { display: flex; justify-content: flex-end; padding: 8px 12px; background: #00309c; }

/* ---------- 10. Keyframes ---------- */
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rig-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes crt-flicker { 0% { opacity: .98; } 50% { opacity: 1; } 52% { opacity: .96; } 54% { opacity: 1; } 100% { opacity: .98; } }
@keyframes crt-beam { from { transform: translateY(0); } to { transform: translateY(40em); } }
@keyframes led { 0%, 100% { opacity: 1; box-shadow: 0 0 6px #22c55e; } 50% { opacity: .65; box-shadow: 0 0 2px #22c55e; } }
@keyframes boot-slide { from { transform: translateX(-44px); } to { transform: translateX(176px); } }
@keyframes welcome-in { from { opacity: 0; transform: translateX(-14px); } }
@keyframes drift { from { transform: translateX(-60vw); } to { transform: translateX(110vw); } }
@keyframes icon-in { from { opacity: 0; transform: translateY(10px) scale(.8); } }
@keyframes icon-blink { 50% { opacity: 0; } }
@keyframes icon-launch { 40% { transform: scale(1.25); } }
@keyframes taskbar-up { from { transform: translateY(100%); } }
@keyframes task-in { from { opacity: 0; transform: translateY(8px) scale(.9); } }
@keyframes menu-up { from { opacity: 0; transform: translateY(12px) scaleY(.92); } }
@keyframes balloon-in { from { opacity: 0; transform: scale(.6) translateY(10px); } }
@keyframes win-open { from { opacity: 0; transform: scale(.9) translateY(10px); } }
@keyframes win-close { to { opacity: 0; transform: scale(.94); } }
@keyframes win-min { to { opacity: 0; transform: translate(var(--min-x, 0), var(--min-y, 300px)) scale(.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } }
@keyframes paper-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.09); } 24% { transform: scale(1); } 36% { transform: scale(1.06); } 48% { transform: scale(1); } }
@keyframes heart-pop { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes count-bump { 40% { transform: scale(1.3); } }
@keyframes float-up { from { opacity: 1; transform: translate(-50%, 0) scale(.6); } to { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -170px) scale(1.5) rotate(var(--rot, 0deg)); } }
@keyframes cell-pop { from { transform: scale(.7); } }
@keyframes boom { 30% { transform: scale(1.5); } }
@keyframes bar-grow { from { transform: scaleY(0); } }

/* ---------- 11. Small screens & motion ---------- */
@media (max-height: 640px) {
  .intro-cards { display: none; }
  .rig { --crt-w: clamp(190px, min(88vw, (100svh - 190px) * .72), 520px); }
}
@media (max-width: 820px) {
  .intro-specs { display: none; }
  .intro-cards { grid-template-columns: repeat(2, 1fr); }
}
/* Phones and portrait tablets: every window fills the screen. Keep 900px in sync with wm.js. */
@media (max-width: 900px) {
  :root { --taskbar-h: 40px; }
  .desktop-icons { inset: 8px 8px auto 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px 4px; }
  .d-icon { width: auto; }
  .window:not(.dialog) { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-width: 0; border-radius: 0; }
  .window:not(.dialog) .titlebar { margin: 0; border-radius: 0; }
  .window.dialog { max-width: calc(100vw - 16px); }
  .titlebar { height: 36px; }
  .tb-btn { width: 28px; height: 28px; }
  .tb-max, .win-resize { display: none; }
  .tasks { padding: 4px; }
  .task { height: 30px; }
  .tray-btn { height: 30px; }
  .start-btn { padding: 0 16px 2px 8px; }
  .sm-item { padding: 8px 6px; }
  .menubar { display: none; }
  .tool { padding: 6px 8px; }
  .tab { padding: 6px 12px; }
  .side-link { padding: 5px 0; }
  .chip-btn { padding: 4px 10px; }
  .ctx-item { padding: 9px 22px; }
  .paper { max-width: 760px; }
}

/* Phones */
@media (max-width: 600px) {
  .intro { padding: 12px 10px; }
  .intro-cards { display: none; }
  .rig { --crt-w: clamp(190px, min(88vw, (100svh - 200px) * .72), 520px); }
  .intro-id p { display: none; }
  .intro-name h1 { font-size: 12px; }
  .boot-brand b { font-size: 34px; }
  .boot-brand svg { width: 56px; height: 56px; }
  .boot-copy, .boot-skip { left: 0; right: 0; text-align: center; }
  .boot-skip { bottom: 18px; }
  .welcome-band { flex-direction: column; align-items: flex-start; padding-left: 12vw; }
  .welcome-word { padding: 0 0 12px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .5); }

  .start-btn { padding: 0 14px 2px 8px; font-size: 17px; }
  .task { flex: 0 0 38px; padding: 0; justify-content: center; }
  .task span { display: none; }
  .tray { padding: 0 6px; }
  .start-menu { width: 100vw; border-radius: 0; max-height: calc(100svh - var(--taskbar-h)); overflow-y: auto; }
  .balloon { left: 10px; max-width: none; }
  .tab-panel { margin: 0 4px; padding: 10px; }
  .tabs { padding: 8px 4px 0; }
  .tab { padding: 6px 9px; }
  .about-hero { gap: 12px; }
  .about-hero .avatar { width: 68px; height: 68px; }
  .about-hero h2 { font-size: 17px; }
  .kv, .r-skills { grid-template-columns: 1fr; gap: 2px; }
  .kv dd, .r-skills dd { margin-bottom: 8px; }
  .job h4, .r-row { flex-direction: column; gap: 0; }
  .pdf-stage { padding: 8px; }
  .paper { padding: 20px 16px; }
  .paper h1 { font-size: 22px; }
  .paper p { text-align: left; }
  .r-cols { columns: 1; }
  .explorer-view, .cert-view { padding: 10px; }
  .cert-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .proj-detail header svg { width: 44px; height: 44px; }
  .proj-detail h2 { font-size: 16px; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .term { font-size: 12px; }
  .term-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .term-chips > * { flex: none; }
  .term-status span:last-child { display: none; }
  .sniff-list table { font-size: 10.5px; }
  .bh-grid { --cell: min(32px, calc((100vw - 44px) / var(--cols, 9) - 2px)); }
  .bh-hint { max-width: 320px; }
}

/* Touch screens of any size (landscape tablets included): finger-sized controls. */
@media (pointer: coarse) {
  :root { --taskbar-h: 42px; }
  .titlebar { height: 36px; }
  .tb-btn { width: 28px; height: 28px; }
  .win-resize { width: 26px; height: 26px; }
  .task { height: 32px; }
  .tray-btn { height: 32px; padding: 0 7px; }
  .sm-item { padding: 8px 6px; }
  .tool { padding: 6px 8px; }
  .tab { padding: 6px 12px; }
  .btn { min-height: 30px; }
  .chip-btn { padding: 5px 10px; }
  .d-icon:hover svg { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .cloud { animation: none; transform: translateX(20vw); }
  .cloud-b { transform: translateX(62vw); }
  .cloud-c { transform: translateX(40vw); }
}
