/* ══════════════════════════════════════
   ROOT & RESET
══════════════════════════════════════ */
:root {
  --blue:       #2E6CB8;
  --blue-dark:  #1A4F9A;
  --blue-light: #4A87D0;
  --cream:      #EDE9D0;
  --coral:      #E8614A;
  --text:       #1B3A6E;
  --border:     #9A9880;
  --taskbar:    #D4D0B8;
  --green:      #2ecc71;
  --px: 'Press Start 2P', monospace;
  --vt: 'VT323', monospace;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--blue);
  font-family: var(--px);
  overflow: hidden;
  user-select: none;
}

/* CRT scanlines overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,.04) 2px, rgba(0,0,0,.04) 4px
  );
  pointer-events: none;
  z-index: 9000;
}

/* ══════════════════════════════════════
   BOOT SCREEN
══════════════════════════════════════ */
#boot {
  position: fixed; inset: 0;
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; z-index: 9999;
}
.boot-logo {
  font-family: var(--px); font-size: 14px; color: var(--blue-light);
  line-height: 2.4; text-align: center; letter-spacing: 2px;
}
.boot-logo span { color: var(--coral); }
.boot-bar-wrap {
  width: 260px; height: 18px;
  border: 2px solid var(--blue); background: #000; overflow: hidden;
}
#boot-fill { height: 100%; width: 0%; background: var(--blue); transition: width .08s linear; }
#boot-msg  { font-family: var(--vt); font-size: 20px; color: #4A87D0; min-height: 24px; text-align: center; }

/* ══════════════════════════════════════
   BACKGROUND VIDEO
══════════════════════════════════════ */
#bg-video {
  position: fixed; inset: 0;
  transform: scale(1.2,1.2);
  object-position: center 70% ;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  top: 3%;
  
}

/* ══════════════════════════════════════
   DESKTOP
══════════════════════════════════════ */
#desktop {
  position: fixed; top: 0; left: 0;
  width: 100%; height: calc(100vh - 44px);
  z-index: 1;
}

/* ══════════════════════════════════════
   WINDOWS
══════════════════════════════════════ */
.win {
  position: absolute;
  background: var(--cream);
  border: 2px solid var(--border);
  box-shadow:
    inset  1px  1px 0 rgba(255,255,255,.7),
    inset -1px -1px 0 rgba(0,0,0,.15),
    4px 4px 0 rgba(0,0,0,.35);
  min-width: 280px; min-height: 120px; z-index: 10;
  animation: fadein .15s ease;
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* ── Resize handles ── */
.win .rz {
  position: absolute; z-index: 20;
  background: transparent;
}
/* bordas */
.win .rz-r  { right:  0; top: 4px; width: 5px; height: calc(100% - 8px); cursor: ew-resize; }
.win .rz-b  { bottom: 0; left: 4px; width: calc(100% - 8px); height: 5px; cursor: ns-resize; }
.win .rz-l  { left:   0; top: 4px; width: 5px; height: calc(100% - 8px); cursor: ew-resize; }
.win .rz-t  { top:    0; left: 4px; width: calc(100% - 8px); height: 5px; cursor: ns-resize; }
/* cantos */
.win .rz-br { right:  0; bottom: 0; width: 10px; height: 10px; cursor: nwse-resize; }
.win .rz-bl { left:   0; bottom: 0; width: 10px; height: 10px; cursor: nesw-resize; }
.win .rz-tr { right:  0; top:    0; width: 10px; height: 10px; cursor: nesw-resize; }
.win .rz-tl { left:   0; top:    0; width: 10px; height: 10px; cursor: nwse-resize; }
/* pixel corner decorativo no canto inferior direito */
.win .rz-br::after {
  content: '';
  position: absolute; right: 2px; bottom: 2px;
  width: 6px; height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--border) 0px, var(--border) 1px,
    transparent 1px, transparent 3px
  );
}
.win.hidden { display: none !important; }
/* minimizado: esconde mas mantém no DOM para a taskbar funcionar */
.win.win-minimised { display: none !important; }
/* maximizado: sem animação de resize, drag desativado visualmente */
.win.win-maximised { border-radius: 0; box-shadow: none; animation: none; }
.win.win-maximised .titlebar { cursor: default; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.titlebar {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-light));
  padding: 5px 8px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: move;
}
.titlebar > span {
  color: #fff; font-size: 9px; font-family: var(--px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-btns { display: flex; gap: 3px; flex-shrink: 0; margin-left: 8px; }
.wb {
  width: 16px; height: 16px;
  background: var(--cream); border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.8), inset -1px -1px 0 rgba(0,0,0,.25);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: var(--text); font-family: monospace;
}
.wb:hover { background: #ffe8e3; }
.wb.x:hover { background: var(--coral); color: #fff; }

.wcontent {
  padding: 14px 16px;
  font-family: var(--vt); font-size: 20px; color: var(--text); line-height: 1.7;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}
.wcontent::-webkit-scrollbar { width: 10px; }
.wcontent::-webkit-scrollbar-track { background: var(--cream); border-left: 1px solid var(--border); }
.wcontent::-webkit-scrollbar-thumb { background: var(--blue); }

/* ══════════════════════════════════════
   HOME WINDOW
══════════════════════════════════════ */
#w-home     { top: 70px; left: 60px; }
#w-about    { }
#w-cv       { }
#w-contacts { }
#w-settings { }
.home-inner { text-align: center; padding: 6px 4px; }
.big-title { font-family: var(--px); font-size: 28px; color: var(--blue); line-height: 1.5; margin-bottom: 4px; }
.sub-name  { font-family: var(--vt); font-size: 24px; color: var(--text); margin-bottom: 6px; opacity: .85; }

.tagline {
  font-family: var(--vt); font-size: 20px;
  color: var(--text); opacity: .75;
  margin-bottom: 14px; font-style: italic;
}

.roles { list-style: none; text-align: left; margin-bottom: 14px; border-left: 3px solid var(--blue); padding-left: 12px; }
.roles li { font-family: var(--vt); font-size: 22px; color: var(--text); padding: 1px 0; }
.roles li::before { content: '> '; color: var(--blue); }

.status-line { font-family: var(--vt); font-size: 18px; color: var(--text); margin-bottom: 20px; line-height: 1.8; }
.avail { color: var(--green); font-family: var(--px); font-size: 9px; }

/* ══════════════════════════════════════
   CTA BUTTONS
══════════════════════════════════════ */
.cta {
  display: inline-block;
  background: var(--coral); color: #fff;
  border: 2px solid #C94A36;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.25), 3px 3px 0 rgba(0,0,0,.3);
  padding: 10px 22px;
  font-family: var(--px); font-size: 10px;
  cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
  text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.cta:hover { background: #F0735A; }
.cta:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(0,0,0,.3); }

.cta-sm {
  display: inline-block; color: #fff;
  border: 2px solid rgba(0,0,0,.3);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.2), 2px 2px 0 rgba(0,0,0,.25);
  padding: 8px 16px;
  font-family: var(--px); font-size: 7px;
  cursor: pointer; text-transform: uppercase; text-decoration: none;
  transition: transform .08s, box-shadow .08s; white-space: nowrap;
}
.cta-sm:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 rgba(0,0,0,.25); }
.cta-sm.blue { background: var(--blue); }
.cta-sm.blue:hover { background: var(--blue-light); }
.cta-sm.red  { background: var(--coral); }
.cta-sm.red:hover  { background: #F0735A; }

/* ══════════════════════════════════════
   PORTFOLIO WINDOW
══════════════════════════════════════ */
#w-portfolio { }

.section-label {
  font-family: var(--px); font-size: 8px; color: var(--blue);
  margin-bottom: 6px; letter-spacing: .5px; display: block;
}

/* Filter buttons — maiores */
.filter-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.fbtn {
  font-family: var(--px); font-size: 8px; color: var(--text);
  border: 2px solid var(--border); padding: 8px 14px;
  cursor: pointer; background: var(--cream);
  transition: background .1s, color .1s;
}
.fbtn:hover, .fbtn.on {
  background: var(--blue); color: #fff; border-color: var(--blue-dark);
}

/* Project cards */
.proj-card {
  border: 2px solid var(--blue); margin-bottom: 14px;
  background: #fff; box-shadow: 3px 3px 0 var(--blue);
  overflow: hidden;
  transition: box-shadow .1s, border-color .1s;
}
.proj-card:hover { box-shadow: 5px 5px 0 var(--coral); border-color: var(--coral); }
.proj-card.hidden { display: none; }
.proj-img { width: 100%; height: 175px; object-fit: cover; display: block; border-bottom: 2px solid var(--blue); }
.proj-info { padding: 10px 12px; }
.proj-title { font-family: var(--px); font-size: 8.5px; color: var(--text); margin-bottom: 4px; line-height: 1.6; }
.proj-cat   { font-family: var(--vt); font-size: 16px; color: var(--coral); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.proj-desc  { font-family: var(--vt); font-size: 18px; color: var(--text); opacity: .8; margin-bottom: 10px; line-height: 1.5; }
.proj-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.tool-icons  { display: flex; gap: 4px; flex-wrap: wrap; }

/* Pixel-art tool badges */
.tbadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  font-family: var(--px); font-size: 5.5px;
  border: 1px solid rgba(0,0,0,.4);
  image-rendering: pixelated; cursor: default; position: relative;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.2), inset -1px -1px 0 rgba(0,0,0,.3);
}
.tbadge:hover::after {
  content: attr(title);
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; font-family: var(--px); font-size: 7px;
  padding: 3px 5px; white-space: nowrap; z-index: 200;
}
.t-ps { background: #001E36; color: #31A8FF; }
.t-ai { background: #FF7900; color: #2D0600; }
.t-ae { background: #00005B; color: #9999FF; }
.t-id { background: #49021F; color: #FF3366; }
.t-bl { background: #232323; color: #EA7600; }
.t-fg { background: #1A1A1A; color: #F24E1E; }
.t-cn { background: #00C4CC; color: #fff;    }

.behance-link {
  font-family: var(--px); font-size: 7px; color: var(--blue);
  text-decoration: none; border-bottom: 1px dotted var(--blue);
}
.behance-link:hover { color: var(--coral); border-color: var(--coral); }

/* ══════════════════════════════════════
   ABOUT WINDOW
══════════════════════════════════════ */
#w-about { }

.about-photo-wrap {
  width: 100%;
  background: var(--blue);
  overflow: hidden;
}
.about-photo {
  /* mantém proporção 1500 × 1130 */
  width: 100%;
  aspect-ratio: 1500 / 1130;
  object-fit: cover;
  object-position: left top;
  display: block;
}

/* CV WINDOW */
#w-cv { top: 100px; left: 220px; width: 360px; }
.cv-entry { border-left: 3px solid var(--blue); padding-left: 12px; margin-bottom: 14px; }
.cv-year  { font-family: var(--px); font-size: 8px; color: var(--coral); margin-bottom: 3px; }
.cv-ttl   { font-family: var(--px); font-size: 8.5px; color: var(--text); margin-bottom: 3px; }
.cv-desc  { font-family: var(--vt); font-size: 18px; color: var(--text); opacity: .8; }
.cv-dl-row {
  display: flex; flex-direction: column;
  gap: 8px; margin-top: 14px;
}
.cv-dl-row .cta-sm {
  display: block; text-align: center; width: 100%;
  padding-top: 10px; padding-bottom: 10px;
}


/* ══════════════════════════════════════
   CONTACTS WINDOW
══════════════════════════════════════ */
#w-contacts { }
.crow  { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-family: var(--vt); }
.cico  { width: 26px; height: 26px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.crow a { color: var(--text); text-decoration: none; font-size: 16px; }
.crow a:hover { color: var(--coral); }
.clabel { font-size: 14px; opacity: .7; }

/* ══════════════════════════════════════
   SETTINGS WINDOW
══════════════════════════════════════ */
#w-settings { }

/* ══════════════════════════════════════
   TASKBAR
══════════════════════════════════════ */
#taskbar {
  position: fixed; bottom: 0; left: 0;
  width: 100%; height: 44px;
  background: var(--taskbar); border-top: 2px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  display: flex; align-items: center; padding: 0 4px; gap: 2px; z-index: 1000;
}
#start {
  height: 34px; padding: 0 12px;
  background: linear-gradient(135deg, var(--blue-light), var(--blue-dark));
  color: #fff; border: 1px solid var(--blue-dark);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.35), 2px 2px 0 rgba(0,0,0,.2);
  font-family: var(--px); font-size: 9px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0;
}
#start:hover { background: linear-gradient(135deg, #5A97E0, #2A5FAA); }
.sep { width: 2px; height: 30px; background: var(--border); margin: 0 3px; flex-shrink: 0; }
.tb {
  height: 34px; padding: 0 9px;
  background: var(--cream); border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.8), inset -1px -1px 0 rgba(0,0,0,.2);
  font-family: var(--px); font-size: 7px; color: var(--text);
  cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0;
}
.tb:hover { background: var(--blue); color: #fff; }
.tb.on    { background: var(--blue); color: #fff; box-shadow: inset 2px 2px 0 rgba(0,0,0,.25); }
#clock {
  margin-left: auto; height: 34px; padding: 0 12px;
  background: var(--cream); border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.8);
  font-family: var(--px); font-size: 9px; color: var(--text);
  display: flex; align-items: center; letter-spacing: 1px; flex-shrink: 0;
}
#lang-btn {
  height: 34px; padding: 0 11px;
  background: var(--cream); border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.8);
  font-family: var(--px); font-size: 8px; color: var(--text);
  cursor: pointer; display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
#lang-btn:hover { background: var(--blue); color: #fff; }
#lang-btn:hover .lang-act { color: #FFB38A; }
.lang-act { color: var(--coral); }

.dot   { width: 6px; height: 6px; background: var(--coral); display: inline-block; animation: blink 1.4s step-end infinite; }
.blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ══════════════════════════════════════
   CONTEXT MENU
══════════════════════════════════════ */
#ctxmenu {
  position: fixed; background: var(--cream);
  border: 1px solid var(--border); box-shadow: 3px 3px 0 rgba(0,0,0,.3);
  z-index: 5000; display: none; min-width: 150px;
}
.ci { padding: 6px 14px; font-family: var(--px); font-size: 8px; color: var(--text); cursor: pointer; }
.ci:hover { background: var(--blue); color: #fff; }
.csep { height: 1px; background: var(--border); margin: 2px 0; }

/* ══════════════════════════════════════
   MOBILE
══════════════════════════════════════ */
#mobile {
  display: none; flex-direction: column;
  height: 100vh;
  height: 100dvh; /* fallback para browsers antigos + valor correto em mobile */
  width: 100%;
  background: var(--cream);
  position: fixed; padding: 0;  
}

/* Status bar */
.sb {
  background: var(--blue); color: #fff;
  height: 46px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--px); font-size: 11px; flex-shrink: 0;
}
.sb-logo { color: var(--coral); font-size: 18px; }
.sb-right { display: flex; align-items: center; gap: 10px; }
.mlang {
  font-family: var(--px); font-size: 7.5px; color: #fff;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  padding: 3px 7px; cursor: pointer; letter-spacing: .5px;
}
.mlang:hover { background: var(--coral); border-color: var(--coral); }
.mlang .la { color: #FFB38A; }

/* FIX #2/#3: .mcontent precisa de min-height:0 para que o overflow-y:auto
   funcione dentro de um pai flex (#mobile). Sem isto o conteúdo esticava
   o #mobile inteiro (que é position:fixed) em vez de fazer scroll. */
.mcontent {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mpage { display: none; padding: 18px; }
.mpage.on { display: block; }

/* Mobile home — full page video bg */
#mp-home {
  position: relative;
  padding: 0;
  height: calc(100vh - 46px - 76px);
  height: calc(100dvh - 46px - 76px);
  overflow: hidden;
}

.m-bg-video {
  position: absolute; top: 80px; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 75%; 
    transform: scale(1.15);
  z-index: 0;
  opacity: .70;
}

/* FIX #3: .mhome estava ancorado com "bottom:200px" sem "top", o que o
   flutuava consoante a altura do conteúdo em vez de ficar alinhado ao
   topo. Agora ocupa toda a página e alinha o conteúdo ao topo com flex. */
.mhome {
  position: absolute;
  top: 0; left: 0;
  height: 100%; width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}
.mroles {
  font-family: var(--vt); font-size: 22px; color: var(--blue); line-height: 1.8;
  width: 100%; padding: 16px 16px 0;
}

/* Mobile hero — text block centered over video */
.mhero {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.mhero-content {
  text-align: center; padding: 24px 16px;
}
.mtitle { font-family: var(--px); font-size: 27px; color: var(--blue); line-height: 1.5; margin-bottom: 8px; }
.mname  { font-family: var(--vt); font-size: 24px; color: var(--blue); margin-bottom: 8px; }
.m-tagline {
  font-family: var(--vt); font-size: 19px;
  color: var(--text); opacity: .8; font-style: italic;
}
.mhero-logo {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  
}
.mhero-logo.on { display: none; }

/* Mobile CV — botões empilhados, centrados, de ponta a ponta */
.m-cv-dl-row {
  display: flex; flex-direction: column;
  align-items: stretch; gap: 10px;
  margin-top: 18px;
}
.m-cv-dl-row .cta-sm {
  font-size: 9px; padding: 12px 0;
  width: 100%;
  text-align: center; display: block;
}
.mstitle {
  font-family: var(--px); font-size: 9px; color: var(--blue);
  margin: 18px 0 10px; padding-bottom: 5px; border-bottom: 2px solid var(--blue);
}

/* Mobile tags */
.m-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.m-skill-badge {
  font-family: var(--px); font-size: 6.5px; color: var(--blue);
  border: 1px solid var(--blue); padding: 4px 7px;
}

/* Mobile filter buttons — maiores */
.m-fbtn {
  font-family: var(--px); font-size: 7.5px; color: var(--text);
  border: 2px solid var(--border); padding: 7px 12px;
  cursor: pointer; background: var(--cream);
}
.m-fbtn.on, .m-fbtn:hover { background: var(--blue); color: #fff; border-color: var(--blue-dark); }

/* Mobile project card */
.mcard { border: 2px solid var(--blue); margin-bottom: 14px; background: #fff; box-shadow: 3px 3px 0 var(--blue); overflow: hidden; }
.mcard.hidden { display: none; }
.mcard-img    { width: 100%; height: 155px; object-fit: cover; display: block; border-bottom: 2px solid var(--blue); }
.mcard-body   { padding: 10px; }
.mcard-title  { font-family: var(--px); font-size: 8px; color: var(--text); margin-bottom: 4px; line-height: 1.6; }
.mcard-cat    { font-family: var(--vt); font-size: 16px; color: var(--coral); margin-bottom: 5px; }
.mcard-desc   { font-family: var(--vt); font-size: 18px; color: var(--text); opacity: .8; margin-bottom: 8px; }
.mcard-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }

/* Mobile about */
.m-about-photo-wrap {
  width: 100%; overflow: hidden;
  background: var(--blue);
  margin-bottom: 16px;
}
.m-about-photo {
  /* proporção 1500 × 1130 */
  width: 100%;
  aspect-ratio: 1500 / 1130;
  object-fit: cover; object-position: left top; display: block;
}
.mtext { font-family: var(--vt); font-size: 22px; color: var(--text); line-height: 1.7; margin-bottom: 14px; }

/* Mobile tools — maiores */
.m-tools-big .m-skill-badge {
  font-size: 8px; padding: 6px 10px;
  background: var(--blue); color: #fff;
  border-color: var(--blue-dark);
}

/* Mobile cv text bigger */
#mp-cv .cv-year { font-size: 9px; }
#mp-cv .cv-ttl  { font-size: 10px; line-height: 1.6; }
#mp-cv .cv-desc { font-size: 20px; }

/* Mobile contacts */
.mci { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.mcico { width: 36px; height: 36px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; border: 2px solid var(--text); }
.mclabel { font-family: var(--px); font-size: 7px; color: var(--blue); margin-bottom: 2px; }
.mcval   { font-family: var(--vt); font-size: 18px; color: var(--text); }

/* Mobile bottom nav — ÚNICA definição (a duplicada com position:absolute
   foi removida; era ela que estava a tirar a nav do fluxo flex e a
   quebrar o scroll do .mcontent) */
.mnav {
  height: 76px; background: var(--cream);
  border-top: 2px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 4px; flex-shrink: 0;
}
.mnb {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; padding: 5px 7px; border: 2px solid transparent;
  font-family: var(--px); font-size: 6.5px; color: var(--text);
}
.mnb.on { border-color: var(--coral); color: var(--coral); }
.mnb .ni { font-size: 24px; }

/* Center HOME button */
.mnb-home {
  background: var(--blue);
  border: 2px solid var(--blue-dark) !important;
  box-shadow: 0 -4px 0 var(--blue-dark), inset 1px 1px 0 rgba(255,255,255,.2);
  color: #fff !important;
  margin-top: -14px; padding: 10px 10px 6px;
}
.mnb-home .ni { font-size: 28px; }
.mnb-home.on {
  background: var(--coral);
  border-color: #C94A36 !important;
  box-shadow: 0 -4px 0 #C94A36, inset 1px 1px 0 rgba(255,255,255,.2);
  color: #fff !important;
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 767px) {
  #boot, #desktop, #taskbar, #ctxmenu { display: none !important; }
  #mobile { display: flex !important; }
  body { overflow: hidden; }
}

/* FIX #1: garante explicitamente que o layout mobile nunca aparece em
   ecrãs de desktop — mesmo que haja cache antigo do CSS ou algum
   z-index/overflow a "empurrar" o #mobile para cima do #desktop. */
@media (min-width: 768px) {
  #mobile { display: none !important; }
}

/* ══════════════════════════════════════
   PROJECT DETAIL WINDOW (desktop)
══════════════════════════════════════ */
.proj-win { width: 680px; height: 600px; }
.proj-win .wcontent {
  padding: 0;
}

/* Gallery scroll area */
.proj-gallery-wrap {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--blue) var(--cream);
}
.proj-gallery-wrap::-webkit-scrollbar { width: 10px; }
.proj-gallery-wrap::-webkit-scrollbar-track { background: var(--cream); }
.proj-gallery-wrap::-webkit-scrollbar-thumb { background: var(--blue); }

/* Hero banner */
.proj-hero {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid var(--border);
}
.proj-hero-video {
  width: 100%; display: block;
  border-bottom: 2px solid var(--border);
  background: #000;
}
.proj-hero-embed {
  width: 100%; aspect-ratio: 16/9;
  border: none; display: block;
  border-bottom: 2px solid var(--border);
  background: #000;
}

/* Header block */
.proj-detail-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.proj-detail-title {
  font-family: var(--px); font-size: 11px;
  color: var(--text); line-height: 1.6; margin-bottom: 6px;
}
.proj-detail-cat {
  font-family: var(--vt); font-size: 18px;
  color: var(--coral); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .5px;
}
.proj-detail-desc {
  font-family: var(--vt); font-size: 20px;
  color: var(--text); line-height: 1.6; opacity: .85;
  margin-bottom: 10px;
}

/* Inline gallery grid */
.proj-gallery {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.proj-gallery.single { grid-template-columns: 1fr; }

.gallery-item { overflow: hidden; border: 1px solid var(--border); background: #000; }
.gallery-item img {
  width: 100%; height: 200px;
  object-fit: cover; display: block;
  transition: transform .2s;
}
.gallery-item img:hover { transform: scale(1.03); }
.gallery-item.wide {
  grid-column: 1 / -1;
}
.gallery-item.wide img { height: 260px; }

.gallery-embed {
  width: 100%; aspect-ratio: 16/9;
  border: none;
}
.gallery-video {
  width: 100%; display: block;
  max-height: 300px; background: #000;
}

/* Footer bar inside window */
.proj-detail-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 8px;
  background: var(--cream);
}

/* ══════════════════════════════════════
   PROJECT DETAIL — MOBILE
══════════════════════════════════════ */
.m-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--px); font-size: 8px;
  color: var(--blue); background: transparent;
  border: 1px solid var(--blue); padding: 6px 12px;
  cursor: pointer; margin: 14px 0 0 0;
}
.m-back-btn:hover { background: var(--blue); color: #fff; }

#mp-proj-detail { padding: 0 0 20px; }
#mp-proj-detail .proj-detail-header { padding: 12px 14px 10px; }
#mp-proj-detail .proj-detail-title  { font-size: 9px; }
#mp-proj-detail .proj-detail-desc   { font-size: 18px; }
#mp-proj-detail .proj-gallery        { grid-template-columns: 1fr; padding: 10px 14px; }
#mp-proj-detail .gallery-item img    { height: 220px; }
#mp-proj-detail .gallery-item.wide img { height: 220px; }
#mp-proj-detail .proj-detail-footer  { padding: 10px 14px; }
#mp-proj-detail .m-back-btn          { margin: 0 14px 0; }

/* Empty gallery placeholder */
.gallery-placeholder {
  grid-column: 1 / -1;
  padding: 24px; text-align: center;
  font-family: var(--vt); font-size: 20px; color: var(--text); opacity: .5;
  border: 1px dashed var(--border);
}

/* ══════════════════════════════════════
   VIDEO GALLERY CAPTION
══════════════════════════════════════ */
.gallery-caption {
  font-family: var(--vt); font-size: 17px;
  color: var(--text); opacity: .7;
  padding: 5px 10px 8px;
  background: var(--cream);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ══════════════════════════════════════
   PDF SECTION (inline no projeto)
══════════════════════════════════════ */
.proj-pdf-section {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.proj-pdf-label {
  font-family: var(--px); font-size: 7.5px;
  color: var(--blue); margin-bottom: 10px;
  letter-spacing: .5px;
}
.proj-pdf-frame {
  width: 100%;
  height: 520px;
  border: 2px solid var(--border);
  display: block;
  background: #fff;
}
/* Fallback link para quando o iframe não carrega */
.proj-pdf-fallback {
  margin-top: 8px;
  text-align: right;
  font-family: var(--px); font-size: 7px;
}

/* PDF button no footer do projeto */
.proj-pdf-btn {
  font-size: 7.5px;
}

/* Mobile — PDF frame menor */
#mp-proj-detail .proj-pdf-frame {
  height: 380px;
}
#mp-proj-detail .proj-pdf-section {
  padding: 12px 14px;
}
