/* ============================================================
   apps.css — Content inside windows + responsive/mobile
   ============================================================ */

.app { font-size: 13px; line-height: 1.5; }
.app.pad { padding: 14px 16px; }
.app h1 { font-size: 18px; margin: 0 0 8px; }
.app h2, .project-body h2 { font-size: 15px; margin: 16px 0 6px; border-bottom: 1px solid var(--edge-shadow); box-shadow: 0 1px var(--edge-light); padding-bottom: 3px; }
.app h3 { font-size: 13.5px; margin: 12px 0 4px; }
.app p, .project-body p { margin: 0 0 10px; }
.app ul, .project-body ul { margin: 6px 0 10px; padding-left: 22px; }
.app li, .project-body li { margin: 3px 0; }
.muted { color: #444; }
.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 7px; margin: 2px 3px 2px 0;
  background: var(--silver); color: #102b6b;
  box-shadow: inset -1px -1px var(--edge-dark), inset 1px 1px var(--edge-light),
    inset -2px -2px var(--edge-shadow), inset 2px 2px var(--edge-face);
}

/* ---- Welcome ---- */
.welcome { padding: 0; }
.welcome-head {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  color: #fff; background: linear-gradient(120deg, #1d6fd6, #0c3f9e);
}
.welcome-head .w-logo { width: 46px; height: 46px; }
.welcome-head h1 { margin: 0; font-size: 19px; }
.welcome-head p { margin: 2px 0 0; font-size: 12.5px; opacity: .9; }
.welcome-body { padding: 14px 16px; }
.welcome-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.welcome-tile {
  display: flex; gap: 10px; align-items: center; padding: 10px;
  background: #fff; cursor: pointer; text-align: left;
  box-shadow: inset -1px -1px var(--edge-light), inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face), inset 2px 2px var(--edge-dark);
}
.welcome-tile:hover { background: #eef4ff; }
.welcome-tile .wt-ic { width: 30px; height: 30px; flex: 0 0 30px; }
.welcome-tile .wt-ic svg { width: 100%; height: 100%; }
.welcome-tile b { display: block; color: #0a3; font-size: 13px; color: #14387f; }
.welcome-tile span { font-size: 11.5px; color: #555; }
.welcome-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

/* ---- About ---- */
.about-hero {
  display: flex; gap: 16px; align-items: center; padding: 16px;
  background: linear-gradient(120deg, #e9f1ff, #cfe0fb);
  border-bottom: 1px solid #9db8e0;
}
.about-avatar {
  width: 92px; height: 92px; flex: 0 0 92px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(160deg, #3a6ea5, #14387f);
  display: grid; place-items: center; color: #fff; font-size: 34px; font-weight: 800;
  box-shadow: inset -1px -1px var(--edge-light), inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face), inset 2px 2px var(--edge-dark);
}
.about-avatar svg { width: 100%; height: 100%; }
.about-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-hero h1 { margin: 0 0 2px; }
.about-hero .role { color: #14387f; font-weight: 700; font-size: 13.5px; }
.about-hero .loc { color: #444; font-size: 12.5px; margin-top: 4px; }
.about-hero .status {
  display: inline-block; margin-top: 8px; font-size: 12px; padding: 2px 9px;
  background: #d6f5d6; color: #15691a; border: 1px solid #7cc97c;
}
.featured {
  display: flex; gap: 12px; align-items: stretch; width: 100%; text-align: left;
  margin: 14px 0; padding: 8px; cursor: pointer;
  background: linear-gradient(120deg, #eef4ff, #dbe7fb);
  box-shadow: inset -1px -1px var(--edge-light), inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face), inset 2px 2px var(--edge-dark);
}
.featured:hover { background: linear-gradient(120deg, #f6f9ff, #e7f0ff); }
.featured:focus-visible { outline: 1px dotted #14387f; outline-offset: 2px; }
.featured-thumb {
  width: 104px; height: 78px; flex: 0 0 104px; object-fit: cover; display: block;
  border: 1px solid #9db8e0; background: #fff;
}
.featured-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.featured-eyebrow {
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: #5878a8; font-weight: 700;
}
.featured-name { font-size: 14px; font-weight: 700; color: #14387f; line-height: 1.2; }
.featured-desc { font-size: 11.5px; color: #444; line-height: 1.35; }
.featured-cta { font-size: 11px; color: #14387f; font-weight: 700; margin-top: auto; }

/* ---- Explorer / Folder view (Projects) ---- */
.explorer { display: flex; height: 100%; }
.explorer-side {
  flex: 0 0 156px; padding: 10px; font-size: 12px;
  background: linear-gradient(180deg, #2b78da, #3f8df0 12%, #6ba8f5 60%, #a7cef0);
  color: #fff;
}
.explorer-side .es-card { background: rgba(255,255,255,.92); color: #14387f; border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.explorer-side .es-card h4 { margin: 0 0 4px; font-size: 12.5px; color: #0a3f9e; }
.explorer-side .es-card p { margin: 0; font-size: 11.5px; color: #333; }
.explorer-main { flex: 1 1 auto; background: #fff; overflow: auto; padding: 8px; }
.explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.file-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px;
  cursor: pointer; border: 1px solid transparent; border-radius: 3px; text-align: center;
}
.file-item:hover { background: #eaf2ff; border-color: #b9d3f6; }
.file-item .fi-ic { width: 44px; height: 44px; }
.file-item .fi-ic svg { width: 100%; height: 100%; }
.file-item .fi-name { font-size: 12px; line-height: 1.2; }
.file-item .fi-sub { font-size: 10.5px; color: #777; }

/* ---- Project detail ---- */
.project { padding: 0; }
.project-banner {
  padding: 16px; color: #fff; position: relative; overflow: hidden;
}
.project-banner h1 { margin: 0; font-size: 19px; }
.project-banner .pb-sub { font-size: 12.5px; opacity: .92; margin-top: 3px; }
.project-banner .pb-period { position: absolute; top: 14px; right: 16px; font-size: 11.5px; opacity: .9; }
.project-body { padding: 14px 16px; }
.project-figure {
  height: 150px; margin: 0 0 12px; border-radius: 4px; display: grid; place-items: center;
  color: #fff; font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), inset -1px -1px var(--edge-light),
    inset 1px 1px var(--edge-shadow);
}
.project-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 10px 0; }
.project-meta .pm-row { font-size: 12.5px; }
.project-meta .pm-row b { color: #14387f; }
.project-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.project-specs {
  display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px;
  margin: 6px 0 12px; font-size: 12.5px;
}
.project-specs dt { color: #14387f; font-weight: 700; }
.project-specs dd { margin: 0; color: #1c1c1c; }
.project-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 4px; }
.project-metric {
  text-align: center; padding: 8px 4px; border-radius: 3px; background: var(--silver);
  box-shadow: inset -1px -1px var(--edge-dark), inset 1px 1px var(--edge-light),
    inset -2px -2px var(--edge-shadow), inset 2px 2px var(--edge-face);
}
.project-metric b { display: block; font-size: 15px; color: #102b6b; line-height: 1.2; }
.project-metric span { font-size: 10px; color: #444; text-transform: uppercase; letter-spacing: .3px; }

/* ---- Resume ---- */
.resume { background: #fff; }
.resume-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--silver); border-bottom: 1px solid var(--edge-shadow); box-shadow: 0 1px var(--edge-light);
}
.resume-page { padding: 22px clamp(16px, 4vw, 40px); max-width: 760px; margin: 12px auto; background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.resume-page .r-name { font-size: 24px; font-weight: 800; color: #102b6b; }
.resume-page .r-contact { font-size: 12px; color: #444; margin: 4px 0 14px; }
.resume-page h2 { color: #14387f; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.resume-entry { margin: 8px 0 12px; }
.resume-entry .re-head { display: flex; justify-content: space-between; gap: 12px; }
.resume-entry .re-title { font-weight: 700; }
.resume-entry .re-date { color: #555; font-size: 12px; white-space: nowrap; }
.resume-entry .re-org { color: #14387f; font-size: 12.5px; font-style: italic; }

/* ---- Skills (retro progress bars) ---- */
.skills { padding: 14px 16px; }
.skill-group { margin-bottom: 16px; }
.skill-row { display: grid; grid-template-columns: 130px 1fr 42px; gap: 10px; align-items: center; margin: 7px 0; }
.skill-row .sk-name { font-size: 12.5px; }
.skill-bar {
  display: block;
  height: 18px; background: #fff; padding: 2px;
  box-shadow: inset -1px -1px var(--edge-light), inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face), inset 2px 2px var(--edge-dark);
}
.skill-bar .sk-fill {
  display: block;
  height: 100%; width: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.35), transparent) ,
    repeating-linear-gradient(90deg, #1f7a1f 0 11px, transparent 11px 14px),
    #2aa02a;
  transition: width .9s cubic-bezier(.2,.8,.2,1);
}
.skill-row .sk-pct { font-size: 11.5px; color: #555; text-align: right; }

/* ---- Contact (Outlook-style) ---- */
.mail { display: flex; flex-direction: column; height: 100%; }
.mail-head { padding: 10px 12px; background: linear-gradient(120deg, #1d6fd6, #0c3f9e); color: #fff; }
.mail-head h1 { margin: 0; font-size: 16px; }
.mail-head p { margin: 2px 0 0; font-size: 12px; opacity: .9; }
.mail-form { padding: 12px; display: grid; gap: 8px; }
.mail-form label { font-size: 12px; display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; }
.mail-form textarea { min-height: 110px; }
.contact-links { display: grid; gap: 6px; margin-top: 10px; }
.contact-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer;
  background: #fff; text-decoration: none; color: #102b6b;
  box-shadow: inset -1px -1px var(--edge-light), inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face), inset 2px 2px var(--edge-dark);
}
.contact-link:hover { background: #eef4ff; }
.contact-link .cl-ic { width: 26px; height: 26px; flex: 0 0 26px; }
.contact-link .cl-ic svg { width: 100%; height: 100%; }
.contact-link b { font-size: 13px; }
.contact-link span { font-size: 11.5px; color: #555; display: block; }

/* ---- System properties (My Computer) ---- */
.sysprop { padding: 16px; display: flex; gap: 16px; }
.sysprop .sp-logo { flex: 0 0 96px; display: grid; place-items: center; }
.sysprop .sp-logo svg, .sysprop .sp-logo .ico-img { width: 84px; height: 84px; }
.sysprop .sp-info { font-size: 12.5px; line-height: 1.6; }
.sysprop .sp-info .sp-line { display: flex; gap: 6px; }
.sysprop .sp-info b { color: #14387f; }

/* dialog (small modal-ish content) */
.dialog { padding: 16px; }
.dialog .dl-row { display: flex; gap: 12px; align-items: flex-start; }
.dialog .dl-ic { width: 38px; height: 38px; flex: 0 0 38px; }
.dialog .dl-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
/* ===================== Clippy (desktop assistant) ===================== */
.clippy {
  position: absolute; right: 16px; bottom: calc(var(--taskbar-h) + 12px);
  z-index: 50; width: 128px;   /* below the window range (100+) so windows cover it */
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.clippy > * { pointer-events: auto; }
.clippy-sprite {
  width: 128px; height: 128px;
  background-repeat: no-repeat; background-position: 0 0;
  cursor: pointer;
  filter: drop-shadow(2px 5px 4px rgba(0,0,0,.35));
  animation: clippy-in .3s ease-out;
}
@keyframes clippy-in { from { transform: translateY(16px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.clippy-bubble {
  position: relative; max-width: 210px;
  background: linear-gradient(#fffdf0, #fbf3c4);
  border: 1px solid #cdb85a; border-radius: 9px;
  padding: 9px 24px 9px 11px;
  font-family: var(--ui-font); font-size: 12px; color: #2a2a1e; line-height: 1.4;
  box-shadow: 2px 3px 9px rgba(0,0,0,.3);
  animation: clippy-bubble-in .18s ease-out;
}
@keyframes clippy-bubble-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.clippy-bubble::after {
  content: ""; position: absolute; right: 30px; bottom: -8px;
  border: 8px solid transparent; border-top-color: #fbf3c4; border-bottom: 0;
}
.clippy-bubble b { color: #14387f; }
.clippy-close {
  position: absolute; top: 2px; right: 3px;
  width: 17px; height: 17px; padding: 0;
  border: none; background: transparent; cursor: pointer;
  color: #9a8f5a; font-size: 13px; line-height: 1;
}
.clippy-close:hover { color: #c0392b; }

/* "Fill the screen" mode: portrait phones (narrow) + landscape phones (short).
   Keep this condition in sync with OS.stage.MOBILE_QUERY in js/stage.js. */
@media (max-width: 760px), (max-height: 480px) and (max-width: 1024px) {
  :root { --taskbar-h: 46px; }

  /* Drop the CRT frame on phones — the OS fills the screen instead */
  body { background: #000; }
  #scene {
    position: fixed; inset: 0; top: 0; left: 0;
    width: 100%; height: 100%;
    transform: none !important;
    background: none;
  }
  #stage {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    transform: none;          /* drop the CRT internal-resolution scaling */
    box-shadow: none;
  }
  .glass { display: none; }
  /* Clippy stays on phones, just scaled down a touch so it's less in the way.
     transform-scale keeps the 128px sprite-frame math (in clippy.js) intact. */
  .clippy { right: 10px; transform: scale(.82); transform-origin: bottom right; }

  .desktop-icons { gap: 8px 10px; }
  .desktop-icon { width: 74px; }

  /* Windows behave like a phone app stack: full-width, system-managed.
     Minesweeper is exempt: it floats at its fitted board size (sized and
     centered by fitWindow in minesweeper.js), like the classic game. */
  .window:not([data-id="app:minesweeper"]) {
    left: 0 !important; right: 0; top: 0 !important;
    width: 100% !important;
    height: calc(100% ) !important;
    border-radius: 0; border-width: 0;
    padding-bottom: 0;
    animation: win-open-mobile .16s ease-out;
  }
  .window > .window-menubar,
  .window > .window-body,
  .window > .window-statusbar { margin-left: 0; margin-right: 0; }
  .title-bar { border-radius: 0; }
  @keyframes win-open-mobile { from { transform: translateY(18px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
  .window.minimizing { animation: win-min-mobile .16s ease-in forwards; }
  @keyframes win-min-mobile { to { transform: translateY(30vh); opacity: 0; } }

  .title-bar { height: 38px; padding: 0 4px 0 8px; }
  .title-bar-text { font-size: 15px; }
  .tb-btn { width: 34px; height: 30px; }
  .tb-btn svg { width: 13px; height: 13px; }
  .tb-btn.min { display: none; } /* minimize is awkward on mobile */
  .resize-handle { display: none; }

  /* Keep the bar (and its buttons) above the iOS home indicator / out from
     under the notch. env() is 0 on devices without insets, so this is a no-op
     on everything else. */
  .taskbar {
    height: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .desktop-icons { top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px)); }

  /* Taskbar: bigger touch targets, hide task labels to save room */
  .start-button { font-size: 18px; padding: 0 16px 3px 10px; }
  .task-button { flex: 1 1 auto; font-size: 13px; }
  .tray-ic { width: 26px; height: 26px; }
  .clock { font-size: 13px; min-width: 48px; }

  /* Start menu: a compact panel anchored bottom-left, not a full-width sheet
     (avoids the wasted horizontal space a 100%-wide menu leaves) */
  .start-menu {
    left: calc(env(safe-area-inset-left, 0px)); right: auto;
    width: min(300px, 86vw); bottom: var(--taskbar-h);
    max-height: calc(100% - var(--taskbar-h)); overflow: auto;
    border-radius: 0 7px 0 0;
  }
  .start-body { flex-direction: column; }
  .start-col-left { flex: 1 1 auto; border-right: none; }
  .start-col-right { border-left: none; border-top: 1px solid #aac6ee; }
  .start-item, .start-place, .start-all { padding: 11px 12px; }
  .start-item .si-ico { width: 30px; height: 30px; flex: 0 0 30px; }
  .start-place .si-ico { width: 26px; height: 26px; flex: 0 0 26px; }

  /* App layouts that need to reflow */
  .explorer { flex-direction: column; }
  .explorer-side { flex: 0 0 auto; display: none; }
  .project-meta, .welcome-tiles { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 96px 1fr 38px; }
  .mail-form label { grid-template-columns: 1fr; }
  .sysprop { flex-direction: column; align-items: center; text-align: center; }
}

@media (orientation: landscape) and (max-height: 480px) and (max-width: 1024px) {
  .desktop-icons { flex-direction: row; max-height: none; }
}

/* ============================================================
   Mobile intro — desk scene that zooms into the CRT screen.
   Built/positioned by js/mobileIntro.js (mobile only). The desk photo
   lives in a 3344×1882 box scaled about the screen centre; the live OS
   reveals behind it as the overlay fades. Sits above everything.
   ============================================================ */
.mobile-intro {
  position: fixed; inset: 0; z-index: 9600;
  background: #000; overflow: hidden; cursor: pointer;
  transition: opacity .45s ease;
}
.mobile-intro.mi-done { opacity: 0; }
.mobile-intro .mi-scene {
  position: absolute; width: 3344px; height: 1882px;
  transform-origin: 1668px 830px;          /* SCREEN centre — the zoom pivot */
  background: url("../assets/CRT_DESK.png") center / 100% 100% no-repeat;
  will-change: transform;
}
/* the OS's screen cutout in the photo — shows the boot animation while zooming */
.mobile-intro .mi-screen {
  position: absolute; left: 889px; top: 304px; width: 1558px; height: 1052px;
  background: #000; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
/* width is set in JS so it lands viewport-width at the zoom-end; .mi-screen
   centres it on a black field, matching the real fill-mode boot screen */
.mobile-intro .mi-boot { display: block; height: auto; max-width: 100%; }

/* ============================================================
   Project gallery — thumbnails inside a project window
   ============================================================ */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}
.project-thumb {
  display: block; cursor: pointer; padding: 2px;
  aspect-ratio: 4 / 3; background: #fff;
  border: 1px solid var(--edge-dark);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .18);
  transition: transform .08s ease, border-color .08s ease, box-shadow .08s ease;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb:hover,
.project-thumb:focus-visible {
  border-color: #2f6fd6;
  box-shadow: 0 0 0 1px #2f6fd6, 1px 2px 6px rgba(0, 0, 0, .32);
  transform: translateY(-1px);
  outline: none;
}

/* ============================================================
   Lightbox — full-size image viewer (lives inside the CRT screen)
   ============================================================ */
.lightbox { position: absolute; inset: 0; z-index: 8000; }
.lightbox .lb-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .84);
  animation: lb-fade .12s ease;
}
.lightbox .lb-stage {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 30px 46px 46px; box-sizing: border-box; pointer-events: none;
}
.lightbox .lb-img {
  display: block; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain;
  pointer-events: auto; filter: drop-shadow(0 6px 22px rgba(0, 0, 0, .55));
}
.lightbox .lb-caption {
  position: absolute; left: 0; right: 0; bottom: 12px; text-align: center;
  color: #f3f3f3; font-size: 12.5px; letter-spacing: .2px;
  text-shadow: 0 1px 3px #000; padding: 0 18px; pointer-events: none;
}
.lightbox .lb-counter {
  position: absolute; left: 12px; top: 12px; color: #e6e6e6; font-size: 12px;
  text-shadow: 0 1px 3px #000; pointer-events: none;
}
.lightbox .lb-btn {
  position: absolute; pointer-events: auto; cursor: pointer; color: #fff;
  background: rgba(18, 18, 18, .55); border: 1px solid rgba(255, 255, 255, .28);
  display: grid; place-items: center; border-radius: 3px; line-height: 1;
  font-family: Tahoma, sans-serif;
}
.lightbox .lb-btn:hover { background: rgba(48, 48, 48, .85); border-color: rgba(255, 255, 255, .5); }
.lightbox .lb-close { right: 10px; top: 10px; width: 28px; height: 28px; font-size: 15px; }
.lightbox .lb-prev,
.lightbox .lb-next { top: 50%; transform: translateY(-50%); width: 30px; height: 50px; font-size: 22px; }
.lightbox .lb-prev { left: 10px; }
.lightbox .lb-next { right: 10px; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   Résumé email gate — modal in front of the PDF (resumeGate.js)
   ============================================================ */
.resume-gate { position: absolute; inset: 0; z-index: 8000; }
.resume-gate .rg-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .5);
  animation: lb-fade .12s ease;
}
.resume-gate .rg-dialog {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 32px));
  background: var(--luna-face); border: 1px solid var(--luna-frame-edge);
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5), inset 0 0 0 1px var(--luna-frame);
  animation: lb-fade .12s ease;
}
.resume-gate .rg-titlebar {
  height: var(--titlebar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 1px 9px; border-radius: 7px 7px 0 0;
  background: var(--title-active); color: var(--title-active-text);
  font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  position: relative;
}
.resume-gate .rg-titlebar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0));
  pointer-events: none;
}
.resume-gate .rg-x {
  width: 21px; height: 21px; display: grid; place-items: center; cursor: pointer;
  color: #fff; font-size: 13px; line-height: 1; border-radius: 3px;
  border: 1px solid rgba(255,255,255,.55);
  background: linear-gradient(180deg, #e2645a, #c23a2e);
  position: relative; z-index: 1;
}
.resume-gate .rg-x:hover { background: linear-gradient(180deg, #ef7d72, #d2483b); }
.resume-gate .rg-body { padding: 14px 16px 16px; }
.resume-gate .rg-lead { margin: 0 0 12px; font-size: 12.5px; color: #233; line-height: 1.5; }
.resume-gate .rg-label {
  display: block; font-size: 11px; color: #444; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 4px;
}
.resume-gate .win-input { width: 100%; box-sizing: border-box; }
.resume-gate .rg-err { color: #b00000; font-size: 12px; margin-top: 6px; }
.resume-gate .rg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 760px), (max-height: 480px) and (max-width: 1024px) {
  .project-gallery { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .project-metrics { grid-template-columns: repeat(2, 1fr); }
  .lightbox .lb-stage { padding: 46px 8px 46px; }
  .lightbox .lb-close { width: 38px; height: 38px; font-size: 18px; }
  .lightbox .lb-prev,
  .lightbox .lb-next { width: 40px; height: 66px; font-size: 26px; }
}

/* ============================================================
   Minesweeper (easter-egg game) — js/minesweeper.js
   Sprites: assets/minesweeper/*.png (sliced from the atlas).
   ============================================================ */
.ms {
  /* Bumped up from the authentic 16px so the board is legible at the
     scaled-up desktop resolution. LED/face scale to match. */
  --ms-cell: 24px;
  --ms-digit-w: 19px;
  --ms-digit-h: 34px;
  --ms-face: 38px;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px;
  background: var(--silver);
}
/* the classic sunken playfield panel */
.ms-panel {
  align-self: center;
  padding: 6px;
  background: var(--silver);
  box-shadow:
    inset -1px -1px var(--edge-light),
    inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face),
    inset 2px 2px var(--edge-dark);
}
.ms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  margin-bottom: 6px;
  box-shadow:
    inset -1px -1px var(--edge-light),
    inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face),
    inset 2px 2px var(--edge-dark);
}
/* LED counters: black bezel with red 7-seg digits */
.ms-led {
  display: flex;
  gap: 1px;
  padding: 1px;
  background: #000;
  border: 1px solid;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}
.ms-digit {
  width: var(--ms-digit-w);
  height: var(--ms-digit-h);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  image-rendering: pixelated;
}
.ms-face {
  width: var(--ms-face);
  height: var(--ms-face);
  background-repeat: no-repeat;
  background-position: center;
  background-size: calc(var(--ms-face) - 2px) calc(var(--ms-face) - 2px);
  image-rendering: pixelated;
  cursor: pointer;
}
.ms-board {
  display: grid;
  /* grid-template-columns is set per-difficulty in JS */
  gap: 0;
  background: var(--gray);
  box-shadow:
    inset -1px -1px var(--edge-light),
    inset 1px 1px var(--edge-shadow),
    inset -2px -2px var(--edge-face),
    inset 2px 2px var(--edge-dark);
}
.ms-cell {
  width: var(--ms-cell);
  height: var(--ms-cell);
  padding: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  image-rendering: pixelated;
  cursor: pointer;
}
.ms-cell.open { cursor: default; }

/* Keep the Game/Help labels highlighted while their menu is open */
.window-menubar span.menu-open { background: var(--select-blue-soft); color: #fff; }

/* Dropdown menus (Game / Help) — positioned by JS, anchored to the menu bar */
.ms-menu {
  position: absolute;
  z-index: 50;
  margin: 0; padding: 2px;
  list-style: none;
  min-width: 150px;
  background: var(--silver);
  border: 1px solid var(--edge-dark);
  box-shadow: 1px 1px 0 var(--edge-dark), 2px 2px 6px rgba(0,0,0,.35);
}
.ms-menu li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  font-size: 13px;
  cursor: default;
  white-space: nowrap;
}
.ms-menu li:hover { background: var(--select-blue-soft); color: #fff; }
.ms-menu li.disabled { color: var(--gray); pointer-events: none; }
.ms-menu li.sep {
  height: 0; padding: 0; margin: 3px 2px;
  border-top: 1px solid var(--edge-shadow);
  border-bottom: 1px solid var(--edge-light);
}
.ms-menu .mi-mark { text-align: center; font-size: 12px; }
.ms-menu .mi-accel { color: var(--gray-dark); font-size: 12px; padding-left: 14px; }
.ms-menu li:hover .mi-accel { color: #dbe6ff; }

/* Classic little Help dialog (How to Play / About) */
.ms-dialog {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  background: rgba(0,0,0,.12);
}
.ms-dialog-box {
  width: min(280px, 100%);
  background: var(--silver);
  border: 1px solid var(--luna-frame-edge);
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.ms-dialog-title {
  padding: 4px 8px; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--title-active-flat);
}
.ms-dialog-body { padding: 12px; font-size: 12.5px; line-height: 1.45; }
.ms-dialog-body p { margin: 0 0 8px; }
.ms-dialog-body p:last-child { margin-bottom: 0; }
.ms-dialog-foot { padding: 0 12px 12px; display: flex; justify-content: center; }

/* On touch / mobile the cells grow for fingers (Game ▸ Flag mode does flagging) */
@media (max-width: 760px), (max-height: 480px) and (max-width: 1024px) {
  .ms { --ms-cell: 30px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
