/* ==========================================================================
   win95.css — Windows 95 chrome system for cryptopnuks.com
   Self-contained. No external fonts (system Tahoma stack only).
   ========================================================================== */

:root {
  --w95-bg:       #008080;     /* desktop teal */
  --w95-face:     #c0c0c0;     /* button face */
  --w95-shadow:   #808080;     /* mid shadow */
  --w95-dark:     #404040;     /* deep shadow */
  --w95-darker:   #000000;
  --w95-light:    #dfdfdf;
  --w95-white:    #ffffff;
  --w95-tb:       #000080;     /* title bar blue */
  --w95-tb2:      #1084d0;     /* title bar gradient end */
  --w95-tb-inact: #808080;
  --w95-text:     #000000;
  --w95-disabled: #808080;
  --w95-link:     #0000ee;
  --w95-link-v:   #551a8b;

  --w95-font:     'Pixelated MS Sans Serif', 'MS Sans Serif', Tahoma, Geneva, Verdana, sans-serif;
  --w95-mono:     'Lucida Console', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--w95-bg);
  color: var(--w95-text);
  font-family: var(--w95-font);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  cursor: default;
}

/* ----- desktop ----- */
.desktop {
  min-height: 100vh;
  padding: 14px;
  padding-bottom: 48px;       /* space for taskbar */
  position: relative;
}

/* Background desktop layer — sits behind any window on every page.
   Page bodies don't need .desktop wrapper; .desktop-bg is fixed and
   covers the viewport, with icons clustered in the top-left. The
   window sits in normal flow over it via higher z-index. */
.desktop-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 30px;  /* above taskbar */
  background: var(--w95-bg);
  z-index: 0;
  padding: 14px;
  pointer-events: none;       /* let clicks pass through to icons only */
}
.desktop-bg .desktop-icons { pointer-events: auto; }

.desktop-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, 88px);
  gap: 2px;
  align-content: start;
}
.desktop-icon {
  width: 88px;
  padding: 6px 4px;
  text-align: center;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.desktop-icon .ico {
  width: 32px; height: 32px;
  margin: 0 auto 4px;
  image-rendering: pixelated;
  display: block;
}
.desktop-icon .lbl {
  font-size: 11px;
  text-shadow: 1px 1px 0 #000;
  padding: 1px 3px;
  display: inline-block;
  line-height: 1.25;
}
.desktop-icon:focus { outline: none; }
.desktop-icon:focus .lbl,
.desktop-icon.selected .lbl,
.desktop-icon:hover .lbl {
  background: var(--w95-tb);
  outline: 1px dotted #fff;
  outline-offset: -1px;
  color: #fff;
}
.desktop-icon.selected .ico {
  filter: hue-rotate(180deg) saturate(2);
}
/* tiny dotted focus ring around the whole icon when selected — Win95 vibe */
.desktop-icon.selected {
  outline: 1px dotted rgba(255,255,255,0.8);
  outline-offset: -2px;
}

/* ----- window ----- */
.window {
  background: var(--w95-face);
  color: var(--w95-text);
  border-top: 2px solid var(--w95-white);
  border-left: 2px solid var(--w95-white);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  box-shadow:
    inset -1px -1px 0 0 var(--w95-darker),
    inset  1px  1px 0 0 var(--w95-light);
  display: flex;
  flex-direction: column;
}
.window.with-shadow { box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light), 2px 2px 0 0 rgba(0,0,0,0.4); }

.title-bar {
  background: linear-gradient(90deg, var(--w95-tb) 0%, var(--w95-tb2) 100%);
  color: #fff;
  padding: 2px 2px 2px 4px;
  display: flex; align-items: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.title-bar.inactive { background: linear-gradient(90deg, var(--w95-tb-inact) 0%, #b5b5b5 100%); }
.title-bar .title-text { flex: 1; padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-bar .title-icon { width: 16px; height: 16px; image-rendering: pixelated; margin-right: 4px; flex-shrink: 0; }
.title-bar .controls { display: flex; gap: 2px; }
.title-bar .ctrl {
  width: 16px; height: 14px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  color: var(--w95-text);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--w95-font);
  text-align: center;
  line-height: 10px;
  cursor: pointer;
  padding: 0;
}
.title-bar .ctrl:active { border-top-color: var(--w95-dark); border-left-color: var(--w95-dark); border-right-color: var(--w95-white); border-bottom-color: var(--w95-white); box-shadow: inset 1px 1px 0 0 var(--w95-darker); }

.menu-bar {
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  padding: 2px 4px;
  font-size: 11px;
  display: flex; gap: 0;
  flex-shrink: 0;
}
.menu-bar .menu {
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
}
.menu-bar .menu u { text-decoration: underline; }
.menu-bar .menu:hover { background: var(--w95-tb); color: #fff; }

.toolbar {
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  padding: 4px;
  display: flex; gap: 4px; flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.statusbar {
  border-top: 1px solid var(--w95-white);
  background: var(--w95-face);
  display: flex;
  font-size: 11px;
  flex-shrink: 0;
}
.statusbar .panel {
  padding: 3px 8px;
  border-right: 1px solid var(--w95-shadow);
  border-top: 1px solid var(--w95-shadow);
  border-left: 1px solid var(--w95-shadow);
  border-bottom: 1px solid var(--w95-white);
  flex: 1;
  min-height: 18px;
}
.statusbar .panel:last-child { border-right: 0; }

.window-body { padding: 12px; flex: 1; overflow: auto; }

/* ----- buttons ----- */
.btn {
  background: var(--w95-face);
  color: var(--w95-text);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  padding: 4px 14px;
  font-family: var(--w95-font);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 75px;
  justify-content: center;
  user-select: none;
}
.btn:focus { outline: 1px dotted var(--w95-text); outline-offset: -4px; }
.btn:active, .btn.pressed {
  border-top-color: var(--w95-dark);
  border-left-color: var(--w95-dark);
  border-right-color: var(--w95-white);
  border-bottom-color: var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  padding: 5px 13px 3px 15px;
}
.btn[disabled], .btn.disabled { color: var(--w95-disabled); text-shadow: 1px 1px 0 var(--w95-white); cursor: not-allowed; }
.btn.primary { font-weight: 700; }
.btn .ico { width: 16px; height: 16px; image-rendering: pixelated; flex-shrink: 0; }

/* ----- form fields ----- */
.field {
  background: var(--w95-white);
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker), inset -1px -1px 0 0 var(--w95-light);
  padding: 3px 4px;
  font-family: var(--w95-font);
  font-size: 11px;
  color: var(--w95-text);
  width: 100%;
}
.field:focus { outline: none; }
textarea.field { resize: vertical; line-height: 1.4; }

label.checkbox, label.radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

/* ----- fieldset ----- */
.group {
  border: 1px solid var(--w95-dark);
  box-shadow: inset 1px 1px 0 0 var(--w95-light), 1px 1px 0 0 var(--w95-white);
  padding: 12px;
  margin: 0 0 12px;
  position: relative;
}
.group > legend, .group > .legend {
  padding: 0 6px;
  font-size: 11px;
  background: var(--w95-face);
  display: inline-block;
  margin-left: -3px;
  margin-bottom: 4px;
  margin-top: -20px;
  position: relative;
  z-index: 1;
}

/* ----- tabs ----- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--w95-dark); margin-bottom: -1px; }
.tabs .tab {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 0;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  margin-bottom: -1px;
  position: relative;
  user-select: none;
}
.tabs .tab.on { background: var(--w95-face); padding: 5px 11px 5px 11px; margin-top: -2px; z-index: 2; border-bottom: 1px solid var(--w95-face); }

/* ----- links ----- */
a { color: var(--w95-link); }
a:visited { color: var(--w95-link-v); }
.windowed a { color: var(--w95-link); }

/* ----- table ----- */
table.win-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--w95-white);
  font-size: 11px;
}
.win-table th {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  padding: 3px 6px;
  text-align: left;
  font-weight: 400;
}
.win-table td {
  padding: 3px 6px;
  border-bottom: 1px dotted var(--w95-shadow);
}
.win-table tr.selected td { background: var(--w95-tb); color: #fff; }

/* ----- taskbar (fixed bottom) ----- */
.taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  box-shadow: inset 0 1px 0 0 var(--w95-light);
  display: flex; align-items: center;
  padding: 2px 4px;
  gap: 4px;
  z-index: 100;
  font-size: 11px;
}
.taskbar .start-btn {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  padding: 2px 8px 2px 6px;
  font-weight: 700;
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
  user-select: none;
  height: 22px;
}
.taskbar .start-btn:active, .taskbar .start-btn.on {
  border-top-color: var(--w95-dark);
  border-left-color: var(--w95-dark);
  border-right-color: var(--w95-white);
  border-bottom-color: var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  padding-top: 3px; padding-left: 7px; padding-bottom: 1px; padding-right: 7px;
}
.taskbar .start-btn .flag {
  width: 16px; height: 14px;
  background: linear-gradient(180deg, #fc0 0 25%, #f00 25% 50%, #0c0 50% 75%, #0cf 75% 100%);
  flex-shrink: 0;
  display: inline-block;
}
.taskbar .tasks { flex: 1; display: flex; gap: 3px; padding: 0 6px; overflow: hidden; }
.taskbar .task-btn {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  padding: 2px 8px;
  height: 22px;
  font-size: 11px;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none;
  color: var(--w95-text);
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.taskbar .task-btn.active {
  border-top-color: var(--w95-dark);
  border-left-color: var(--w95-dark);
  border-right-color: var(--w95-white);
  border-bottom-color: var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  background-image: repeating-conic-gradient(var(--w95-light) 0% 25%, var(--w95-face) 25% 50%);
  background-size: 4px 4px;
}
.taskbar .tray {
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  padding: 0 8px;
  font-size: 11px;
  height: 22px;
  display: inline-flex; align-items: center; gap: 6px;
}

/* ----- start menu ----- */
.start-menu {
  position: fixed;
  left: 4px; bottom: 32px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: 1px 1px 0 0 var(--w95-darker);
  width: 220px;
  display: none;
  z-index: 200;
  font-size: 12px;
}
.start-menu.open { display: flex; }
.start-menu .rail {
  width: 24px;
  background: linear-gradient(180deg, #808080 0%, #c0c0c0 100%);
  position: relative;
  flex-shrink: 0;
}
.start-menu .rail .vlabel {
  position: absolute; bottom: 12px; left: 4px;
  transform: rotate(-90deg); transform-origin: left bottom;
  font-weight: 900; font-size: 14px; color: #fff;
  letter-spacing: 4px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #404040;
}
.start-menu ul { list-style: none; margin: 0; padding: 2px; flex: 1; }
.start-menu li { display: block; padding: 0; }
.start-menu li a {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px;
  text-decoration: none;
  color: var(--w95-text);
  font-size: 12px;
  user-select: none;
}
.start-menu li a:hover { background: var(--w95-tb); color: #fff; }
.start-menu li a .ico { width: 24px; height: 24px; image-rendering: pixelated; flex-shrink: 0; }
.start-menu hr { border: 0; border-top: 1px solid var(--w95-shadow); border-bottom: 1px solid var(--w95-white); margin: 2px 0; }

/* ----- dialog (modal-style window centered) ----- */
.dialog-wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  z-index: 50;
}
.dialog { width: min(540px, 100%); }

/* ----- scrollbar styling ----- */
.windowed ::-webkit-scrollbar, .field ::-webkit-scrollbar, .window-body::-webkit-scrollbar { width: 16px; height: 16px; }
.windowed ::-webkit-scrollbar-track, .window-body::-webkit-scrollbar-track {
  background-image: repeating-conic-gradient(var(--w95-light) 0% 25%, var(--w95-face) 25% 50%);
  background-size: 2px 2px;
}
.windowed ::-webkit-scrollbar-thumb, .window-body::-webkit-scrollbar-thumb {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
}

/* ----- helpers ----- */
.inline-icon { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: middle; }
.kbd {
  display: inline-block;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  padding: 0 4px;
  font-family: var(--w95-mono); font-size: 11px;
}
.spacer { flex: 1; }
hr.win-sep { border: 0; border-top: 1px solid var(--w95-dark); border-bottom: 1px solid var(--w95-white); margin: 8px 0; }
.muted { color: var(--w95-shadow); }

/* ----- pixelated images by default for the pnuk thumbs ----- */
.pnuk-img { image-rendering: pixelated; display: block; }

/* ----- page-with-shell: body uses bg + window centered above ----- */
body.has-shell {
  min-height: 100vh;
  padding: 30px 20px 50px;     /* room for taskbar + breathing on top */
  position: relative;
  z-index: 1;
}
body.has-shell .window {
  position: relative;
  z-index: 10;
  margin: 0 auto;
}

/* Window-open animation — brief grow from a dimmer-rect (Win95 vibe). */
@keyframes pnuk-window-open {
  0%   { transform: scale(0.75) translateY(20px); opacity: 0; }
  60%  { transform: scale(1.02) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
body.has-shell .window {
  animation: pnuk-window-open 0.18s ease-out;
}

/* Tray LED for "online" indicator */
.tray-led {
  width: 8px; height: 8px;
  background: #0c0;
  border-radius: 50%;
  box-shadow: 0 0 4px #0f0, inset -1px -1px 0 0 rgba(0,0,0,0.3);
  display: inline-block;
}

/* desktop icons highlight for active page (subtle dotted outline) */
.desktop-icon.is-active .lbl {
  background: rgba(255,255,255,0.15);
}

/* ---- embedded mode: page is loaded inside a host window's iframe ---- */
body.embedded {
  padding: 0 !important;
  margin: 0 !important;
  background: var(--w95-face) !important;
  display: block !important;
  min-height: 0 !important;
}
body.embedded .title-bar { display: none !important; }
body.embedded > .window,
body.embedded > .dialog-wrap > .window {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100vh !important;
  height: 100vh !important;
  animation: none !important;
}
body.embedded .dialog-wrap {
  position: static !important;
  inset: auto !important;
  display: block !important;
  padding: 0 !important;
  height: 100vh;
}
/* Explorer window grows to fill the host iframe */
body.embedded .explorer-window {
  height: 100vh !important;
  max-width: none !important;
}
body.embedded .with-shadow { box-shadow: none !important; }

/* Hide nav links to / when embedded — host window has the close button */
body.embedded a.nav-btn[href="/"],
body.embedded a.btn[href="/"] { display: none !important; }

/* ---- desktop window manager (drag-and-drop windows on the landing) ---- */
#windows-host {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 30px;     /* above taskbar */
  pointer-events: none;                         /* container ignores clicks */
  z-index: 5;
  overflow: hidden;
}
.pwin {
  pointer-events: auto;                         /* but each window catches them */
  user-select: none;
  display: flex;
  flex-direction: column;
  position: absolute;
  background: var(--w95-face);
  color: var(--w95-text);
  border-top: 2px solid var(--w95-white);
  border-left: 2px solid var(--w95-white);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  box-shadow:
    inset -1px -1px 0 0 var(--w95-darker),
    inset  1px  1px 0 0 var(--w95-light),
    2px 2px 0 0 rgba(0,0,0,0.4);
  animation: pnuk-window-open 0.18s ease-out;
}
.pwin .pwin-title-bar {
  cursor: move;
  background: linear-gradient(90deg, var(--w95-tb) 0%, var(--w95-tb2) 100%);
  color: #fff;
  padding: 2px 2px 2px 4px;
  display: flex; align-items: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  font-family: var(--w95-font);
}
.pwin .pwin-title-bar .title-text { flex: 1; padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.pwin .pwin-title-bar .pwin-icon { pointer-events: none; flex-shrink: 0; }
.pwin .pwin-title-bar .controls { display: flex; gap: 2px; cursor: default; }
.pwin .pwin-title-bar .ctrl {
  width: 16px; height: 14px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  color: var(--w95-text);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--w95-font);
  text-align: center;
  line-height: 10px;
  cursor: pointer;
  padding: 0;
}
.pwin .pwin-title-bar .ctrl:active {
  border-top-color: var(--w95-dark);
  border-left-color: var(--w95-dark);
  border-right-color: var(--w95-white);
  border-bottom-color: var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
}
.pwin .pwin-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--w95-face);
}
.pwin .pwin-body iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
/* Eight resize handles per window — 4 edges + 4 corners */
.pwin .pwin-resize-handle {
  position: absolute;
  background: transparent;
  z-index: 1;
}
.pwin .pwin-resize-n  { top: -4px;    left: 8px;     right: 8px;    height: 6px;   cursor: ns-resize; }
.pwin .pwin-resize-s  { bottom: -4px; left: 8px;     right: 8px;    height: 6px;   cursor: ns-resize; }
.pwin .pwin-resize-e  { top: 8px;     right: -4px;   bottom: 8px;   width: 6px;    cursor: ew-resize; }
.pwin .pwin-resize-w  { top: 8px;     left: -4px;    bottom: 8px;   width: 6px;    cursor: ew-resize; }
.pwin .pwin-resize-ne { top: -4px;    right: -4px;   width: 14px;   height: 14px;  cursor: nesw-resize; }
.pwin .pwin-resize-nw { top: -4px;    left: -4px;    width: 14px;   height: 14px;  cursor: nwse-resize; }
.pwin .pwin-resize-se {
  bottom: -4px; right: -4px; width: 16px; height: 16px;
  cursor: nwse-resize;
  /* ridge pattern in the corner so it's discoverable */
  background-image:
    linear-gradient(135deg,
      transparent 0%, transparent 40%,
      var(--w95-shadow) 40%, var(--w95-shadow) 50%,
      var(--w95-white) 50%, var(--w95-white) 60%,
      var(--w95-shadow) 60%, var(--w95-shadow) 70%,
      var(--w95-white) 70%, var(--w95-white) 80%,
      var(--w95-shadow) 80%, var(--w95-shadow) 90%,
      var(--w95-white) 90%, var(--w95-white) 100%);
}
.pwin .pwin-resize-sw { bottom: -4px; left: -4px;    width: 14px;   height: 14px;  cursor: nesw-resize; }
/* While dragging or resizing, freeze iframe pointer-events so the mouse
   stays in the parent context — otherwise the iframe's content would
   eat the mousemove events */
body.pwin-dragging, body.pwin-resizing {
  user-select: none;
  cursor: move;
}
body.pwin-dragging .pwin iframe,
body.pwin-resizing .pwin iframe {
  pointer-events: none;
}
body.pwin-resizing { cursor: nwse-resize; }

/* Inline-content welcome window — re-uses .window-body styles */
.pwin.pwin-welcome .pwin-body { padding: 0; overflow: auto; }

/* ==================================================================== */
/*   DISPLAY PROPERTIES (wallpaper picker)                                */
/* ==================================================================== */
.pwin.pwin-display .pwin-body { padding: 0; }
.dp-tabs { display: flex; gap: 0; padding: 4px 4px 0; background: var(--w95-face); border-bottom: 1px solid var(--w95-dark); }
.dp-tabs .tab {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
}
.dp-tabs .tab.on { padding: 5px 13px 5px 11px; margin-top: -2px; z-index: 2; border-bottom: 1px solid var(--w95-face); position: relative; }
.dp-pane { padding: 14px; }
.dp-monitor {
  width: 240px; height: 140px; margin: 0 auto 14px;
  background: #000; padding: 10px;
  border-top: 2px solid var(--w95-white);
  border-left: 2px solid var(--w95-white);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  border-radius: 18px 18px 18px 18px / 8px 8px 8px 8px;
  position: relative;
}
.dp-monitor::after {
  content: '';
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 80px; height: 12px;
  background: linear-gradient(180deg, var(--w95-light), var(--w95-shadow));
  border-radius: 2px;
}
.dp-screen {
  width: 100%; height: 100%;
  background: #008080;
  border: 1px solid #000;
}

/* ==================================================================== */
/*   PAINT                                                                */
/* ==================================================================== */
.pwin .paint-toolbar {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  padding: 4px 6px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  font-size: 11px;
}
.pwin .paint-toolbar label { font-size: 11px; padding: 0 4px; }
.pwin .paint-toolbar .paint-sep { display: inline-block; width: 1px; height: 18px; background: var(--w95-shadow); border-right: 1px solid var(--w95-white); margin: 0 4px; }
.pwin .paint-stage {
  flex: 1;
  background: var(--w95-shadow);
  padding: 12px;
  overflow: auto;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.pwin .paint-stage canvas {
  background: #fff;
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  cursor: crosshair;
  display: block;
}
.pwin .paint-palette {
  display: grid;
  grid-template-columns: repeat(12, 18px);
  gap: 2px;
  padding: 4px 6px;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-shadow);
}
.pwin .paint-color {
  width: 18px; height: 18px;
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  cursor: pointer;
  padding: 0;
}
.pwin .paint-color.on { outline: 2px solid #ff0; outline-offset: -2px; }

/* ==================================================================== */
/*   NOTEPAD                                                              */
/* ==================================================================== */
.pwin .notepad-area {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  font-family: 'Lucida Console', 'Consolas', monospace;
  font-size: 13px;
  padding: 8px;
  resize: none;
  outline: none;
  white-space: pre;
  overflow: auto;
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
}

/* ==================================================================== */
/*   CALCULATOR                                                           */
/* ==================================================================== */
.calc {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  height: 100%;
  background: var(--w95-face);
}
.calc-screen {
  background: var(--w95-white);
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  padding: 6px 10px;
  text-align: right;
  font-family: var(--w95-mono);
  font-size: 18px;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
}
.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.calc-key {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: inset -1px -1px 0 0 var(--w95-darker), inset 1px 1px 0 0 var(--w95-light);
  padding: 8px 0;
  font-family: var(--w95-font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.calc-key:active {
  border-top-color: var(--w95-dark);
  border-left-color: var(--w95-dark);
  border-right-color: var(--w95-white);
  border-bottom-color: var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
}
.calc-key.calc-op { color: #c00; }
.calc-key.calc-eq { color: #0070ff; }
.calc-key.calc-clear { color: #c00; }
.calc-key.calc-zero { grid-column: span 2; }
.calc-pnuk-row { display: flex; gap: 6px; }
.calc-pnuk-row .btn { flex: 1; min-width: 0; font-size: 10px; padding: 4px 8px; }

/* ==================================================================== */
/*   MINESWEEPER                                                          */
/* ==================================================================== */
.pwin.pwin-minesweeper .pwin-body { padding: 0; display: flex; flex-direction: column; background: var(--w95-face); }
.ms-toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 6px 8px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  font-size: 11px;
}
.ms-meta { font-size: 11px; font-family: var(--w95-mono); }
.ms-meta b { color: #c00; font-size: 13px; }
.ms-status { margin-left: auto; font-size: 11px; }
.ms-grid {
  display: grid;
  gap: 1px;
  padding: 8px;
  background: var(--w95-shadow);
  width: max-content;
  margin: 8px;
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
}
.ms-cell {
  width: 24px; height: 24px;
  background: var(--w95-face);
  border-top: 2px solid var(--w95-white);
  border-left: 2px solid var(--w95-white);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  font-family: var(--w95-font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.ms-cell.revealed {
  border: 1px solid var(--w95-shadow);
  background: var(--w95-light);
}
.ms-cell.flagged { color: #c00; }
.ms-cell.pnuk { background: #f00; padding: 0; }
.ms-cell.pnuk img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.ms-cell.n1 { color: #0000c0; }
.ms-cell.n2 { color: #008000; }
.ms-cell.n3 { color: #c00000; }
.ms-cell.n4 { color: #800080; }
.ms-cell.n5 { color: #800000; }
.ms-cell.n6 { color: #008080; }
.ms-cell.n7 { color: #000; }
.ms-cell.n8 { color: #808080; }

/* ==================================================================== */
/*   MY COMPUTER                                                          */
/* ==================================================================== */
.pwin.pwin-mycomputer .pwin-body { padding: 0; }
.mc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px;
}
.mc-item {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.mc-item:hover { background: #f0f0ff; border-color: #b0b0d0; }
.mc-item.selected { background: var(--w95-tb); color: #fff; }
.mc-ico { font-size: 28px; line-height: 1; flex-shrink: 0; width: 36px; text-align: center; }
.mc-meta { flex: 1; min-width: 0; }
.mc-label { font-size: 12px; font-weight: 700; }
.mc-desc { font-size: 11px; color: var(--w95-shadow); }
.mc-item.selected .mc-desc { color: #cce; }

/* ==================================================================== */
/*   CONTEXT MENU                                                         */
/* ==================================================================== */
#ctx-menu {
  position: fixed;
  background: var(--w95-face);
  border-top: 1px solid var(--w95-white);
  border-left: 1px solid var(--w95-white);
  border-right: 1px solid var(--w95-dark);
  border-bottom: 1px solid var(--w95-dark);
  box-shadow: 1px 1px 0 0 var(--w95-darker);
  font-family: var(--w95-font);
  font-size: 12px;
  min-width: 180px;
  padding: 2px;
  z-index: 1000;
  user-select: none;
}
#ctx-menu .ctx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 22px 4px 22px;
  cursor: default;
}
#ctx-menu .ctx-item:hover { background: var(--w95-tb); color: #fff; }
#ctx-menu .ctx-item.disabled { color: var(--w95-shadow); }
#ctx-menu .ctx-item.disabled:hover { background: var(--w95-face); color: var(--w95-shadow); }
#ctx-menu .kbd-hint { font-size: 11px; margin-left: 16px; color: var(--w95-shadow); }
#ctx-menu .ctx-item:hover .kbd-hint { color: #cce; }
#ctx-menu hr { border: 0; border-top: 1px solid var(--w95-shadow); border-bottom: 1px solid var(--w95-white); margin: 2px 0; }

/* ==================================================================== */
/*   RUN dialog                                                           */
/* ==================================================================== */
.pwin.pwin-run .pwin-body { padding: 0; }

/* ==================================================================== */
/*   MOBILE — phones / small tablets                                      */
/*                                                                        */
/*   The Win95 desktop metaphor doesn't translate to a 380px viewport so  */
/*   on small screens we go single-window-fullscreen. Every host window   */
/*   fills the viewport above the taskbar; resize handles are hidden;     */
/*   the title bar still drags but in practice you only get one window    */
/*   on screen at a time. Welcome dialog and standalone pages get the     */
/*   same treatment.                                                      */
/* ==================================================================== */

@media (max-width: 760px) {

  /* Smaller default font on mobile */
  html, body { font-size: 13px; }

  /* Host windows on mobile: keep them as proper draggable windows, just
     never let them spill past the viewport. JS picks initial size; CSS
     enforces a hard max so giant default sizes don't overflow. */
  .pwin {
    max-width: calc(100vw - 8px) !important;
    max-height: calc(100vh - 50px) !important;
  }
  /* Allow touch drag on title bars + resize on handles without the
     browser intercepting for scroll. */
  .pwin .pwin-title-bar { touch-action: none; padding: 4px 4px 4px 6px; font-size: 12px; }
  .pwin .pwin-title-bar .ctrl { width: 22px; height: 18px; line-height: 14px; font-size: 12px; }
  .pwin .pwin-resize-handle { touch-action: none; }
  /* Bump tiny edge handles up to finger-friendly hit areas */
  .pwin .pwin-resize-n  { height: 10px; top: -6px; }
  .pwin .pwin-resize-s  { height: 10px; bottom: -6px; }
  .pwin .pwin-resize-e  { width: 10px;  right: -6px; }
  .pwin .pwin-resize-w  { width: 10px;  left: -6px; }
  .pwin .pwin-resize-ne, .pwin .pwin-resize-nw,
  .pwin .pwin-resize-se, .pwin .pwin-resize-sw { width: 22px; height: 22px; }

  /* Welcome / dialog overlay (legacy path — most pages use .pwin now) */
  .dialog-wrap { padding: 30px 14px !important; align-items: flex-start !important; }
  .dialog { width: 100% !important; max-width: none !important; max-height: 70vh !important; }
  .dialog .window-body { overflow-y: auto; }

  /* Desktop icons — bigger touch targets, looser grid, hide labels of pinned items */
  .desktop-bg { padding: 14px !important; }
  .desktop-icons {
    grid-template-columns: repeat(auto-fill, minmax(80px, 80px)) !important;
    gap: 6px 4px !important;
  }
  .desktop-icon {
    width: 80px !important;
    padding: 10px 4px !important;
  }
  .desktop-icon .ico { width: 36px !important; height: 36px !important; margin-bottom: 6px; }
  .desktop-icon .lbl { font-size: 11px; }

  /* Standalone pages (explorer / generator / pnuk / etc) on mobile.
     They mount their own .window centered on a desktop-bg layer; on
     mobile we want the same full-bleed experience. */
  body.has-shell { padding: 0 !important; display: block !important; }
  body.has-shell > .window {
    position: relative !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-height: calc(100vh - 30px) !important;
    height: auto !important;
    border-width: 0 !important;
    box-shadow: none !important;
    animation: none !important;
  }
  body.has-shell .explorer-window {
    height: calc(100vh - 30px) !important;
  }
  body.has-shell .gen-window,
  body.has-shell .props-window,
  body.has-shell .holder-window,
  body.has-shell .traits-window {
    width: 100% !important;
    max-width: none !important;
  }

  /* Hide Clippy on mobile — overlaps content too much */
  #pnuk-clippy { display: none !important; }

  /* Taskbar trims. Hide tray clock to save horizontal space; keep Start
     button + active task. */
  .taskbar { padding: 2px 4px; }
  .taskbar .tasks .task-btn { max-width: 100px; }
  .taskbar .tray { padding: 0 6px; }
  .taskbar .tray .tray-led { display: none; }
  .taskbar .start-btn { padding: 2px 8px 2px 4px; }
  .taskbar .start-btn span:last-child { font-size: 11px; }

  /* Start menu — wider on mobile to be tappable */
  .start-menu { width: min(280px, calc(100vw - 8px)); left: 4px !important; }
  .start-menu li a { padding: 8px 12px 8px 8px; font-size: 13px; }

  /* Menu bar items in apps — taller for fingers */
  .menu-bar .menu { padding: 4px 8px; font-size: 12px; }

  /* Buttons — bigger tap targets */
  .btn { padding: 6px 14px; font-size: 12px; min-width: 70px; }
  .btn.nav-btn { padding: 5px 10px; }

  /* Form fields — slightly bigger to avoid iOS auto-zoom on focus */
  .field { font-size: 16px !important; }      /* iOS won't zoom on focus when ≥16px */

  /* Explorer-specific: hide sidebar on mobile (already does via existing
     media query), pager controls stack better */
  .pager { flex-wrap: wrap; gap: 4px; }
  .pager .info { width: 100%; text-align: center; margin: 0; }

  /* Tab bars (props / traits) — scroll horizontally if too many */
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs .tab { white-space: nowrap; }

  /* Welcome preview strip: fewer columns */
  .preview-strip { grid-template-columns: repeat(5, 1fr) !important; gap: 3px !important; padding: 3px !important; }

  /* Right-click context menu won't trigger on touch normally,
     but if it does — make it tappable */
  #ctx-menu .ctx-item { padding: 8px 22px; }

  /* Wallpaper picker preview monitor — smaller on mobile */
  .dp-monitor { width: 200px; height: 120px; }

  /* Calculator — full-width keys */
  .calc { padding: 8px; }
  .calc-key { padding: 12px 0; font-size: 14px; }

  /* Minesweeper — smaller cells so beginner board fits */
  .ms-cell { width: 22px !important; height: 22px !important; font-size: 11px !important; }

  /* Right-click context menu on touch — won't trigger from tap, but
     the long-press might. Keep menu visible above safe area. */
}

/* Even tinier — narrow phones in portrait */
@media (max-width: 380px) {
  .desktop-icons {
    grid-template-columns: repeat(auto-fill, minmax(70px, 70px)) !important;
  }
  .desktop-icon { width: 70px !important; padding: 8px 2px !important; }
  .desktop-icon .ico { width: 32px !important; height: 32px !important; }
  .desktop-icon .lbl { font-size: 10px; }
}

/* ==================================================================== */
/*   CLIPPY ASSISTANT                                                     */
/* ==================================================================== */
#pnuk-clippy {
  position: fixed;
  right: 18px;
  bottom: 42px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--w95-font);
  pointer-events: none;
}
#pnuk-clippy > * { pointer-events: auto; }
.pclippy-figure {
  width: 56px; height: 56px;
  background: linear-gradient(180deg, #ffeb3b, #ffc107);
  border: 2px solid #000;
  border-radius: 50%;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 0 0 rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.pclippy-figure:hover { transform: scale(1.05); }
.pclippy-figure:active { transform: scale(0.95); }
#pnuk-clippy.pclippy-bobbing .pclippy-figure {
  animation: pclippy-bob 1.6s ease-in-out infinite;
}
@keyframes pclippy-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-4px) rotate(3deg); }
}
.pclippy-bubble {
  background: #fffbcc;
  border: 1px solid var(--w95-dark);
  box-shadow: 1px 1px 0 0 rgba(0,0,0,0.3);
  padding: 8px 10px;
  font-size: 12px;
  max-width: 280px;
  line-height: 1.4;
  position: relative;
  border-radius: 4px;
}
.pclippy-bubble::after {
  content: '';
  position: absolute;
  right: 22px; bottom: -10px;
  width: 0; height: 0;
  border: 5px solid transparent;
  border-top-color: var(--w95-dark);
  border-bottom: 0;
}
.pclippy-bubble::before {
  content: '';
  position: absolute;
  right: 23px; bottom: -8px;
  width: 0; height: 0;
  border: 4px solid transparent;
  border-top-color: #fffbcc;
  border-bottom: 0;
  z-index: 1;
}
.pclippy-text { margin-bottom: 8px; }
.pclippy-actions { display: flex; gap: 4px; justify-content: flex-end; }
.pclippy-actions .btn { min-width: 50px; padding: 2px 8px; font-size: 11px; }

/* ==================================================================== */
/*   SCREENSAVER                                                          */
/* ==================================================================== */
#pnuk-saver {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  overflow: hidden;
}
#pnuk-saver.on {
  opacity: 1;
  pointer-events: auto;
  cursor: none;
}
.pnuk-saver-pnuk {
  position: absolute;
  image-rendering: pixelated;
  border: 1px solid #333;
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
}

/* ==================================================================== */
/*   RECYCLE BIN — Burned Pnuks                                           */
/* ==================================================================== */
.pwin.pwin-recycle .pwin-body { padding: 0; }
.recycle-body { display: flex; flex-direction: column; height: 100%; }
.recycle-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  background: var(--w95-face);
  border-bottom: 1px solid var(--w95-shadow);
  font-size: 12px;
}
.recycle-title { font-weight: 700; }
.recycle-count {
  background: var(--w95-white);
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  padding: 1px 8px;
  font-family: var(--w95-mono);
  font-size: 11px;
}
.recycle-refresh { margin-left: auto; min-width: auto; }
.recycle-list {
  flex: 1;
  overflow-y: auto;
  background: var(--w95-white);
  border-top: 1px solid var(--w95-dark);
  border-left: 1px solid var(--w95-dark);
  border-right: 1px solid var(--w95-white);
  border-bottom: 1px solid var(--w95-white);
  box-shadow: inset 1px 1px 0 0 var(--w95-darker);
  margin: 4px 8px;
  padding: 8px;
}
.recycle-loading, .recycle-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--w95-shadow);
}
.recycle-empty .big { font-size: 48px; margin-bottom: 8px; line-height: 1; }
.recycle-empty p { margin: 4px 0; font-size: 12px; }
.recycle-empty .muted { color: var(--w95-shadow); font-size: 11px; }
.burn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.burn-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px;
  background: #f8f8f8;
  border: 1px solid var(--w95-dark);
  box-shadow: 1px 1px 0 0 var(--w95-shadow);
}
.burn-img {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border: 1px solid var(--w95-dark);
  background: #ddd;
  position: relative;
  overflow: hidden;
}
.burn-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
  filter: grayscale(0.85) brightness(0.7);
}
.burn-img::after {
  content: '🔥';
  position: absolute; top: 2px; right: 2px;
  font-size: 14px;
  text-shadow: 0 0 2px #000;
}
.burn-meta { font-size: 11px; line-height: 1.4; min-width: 0; }
.burn-id { font-weight: 700; }
.burn-by, .burn-date, .burn-tx { color: var(--w95-shadow); }
.burn-by a, .burn-tx a { color: var(--w95-link); }
.recycle-explainer {
  background: var(--w95-face);
  border-top: 1px solid var(--w95-shadow);
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
}
.recycle-explainer code {
  background: var(--w95-white);
  padding: 0 4px;
  font-family: var(--w95-mono);
  font-size: 10px;
}

