html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.nosel {
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  background: #06080a;
}

canvas#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
}

/* Pokémon-style dialogue box (intro greeting) */
#dialogue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: none;
  padding: 0 20px 24px;
  pointer-events: none;
}

#dialogueBox {
  position: relative;
  max-width: 660px;
  margin: 0 auto;
  background: #fff;
  border: 3px solid #383838;
  border-radius: 18px;
  padding: 16px 56px 20px 22px;
  box-shadow: 4px 6px 0 rgba(0, 0, 0, .4);
  pointer-events: auto;
  cursor: pointer;
}

#dialogueText {
  font-family: 'VT323', monospace;
  font-size: 30px;
  line-height: 1.1;
  color: #2c2c2c;
}

#dialogueText .spk {
  color: #0f7d6c;
  letter-spacing: 1px;
  margin-right: 6px;
}

#dialogueArrow {
  position: absolute;
  right: 20px;
  bottom: 10px;
  font-size: 20px;
  color: #383838;
  animation: arrowpulse 0.9s infinite;
}

@keyframes arrowpulse {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(3px); opacity: 1; }
}

#dialogueTail {
  position: absolute;
  right: 52px;
  bottom: -13px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-right: 3px solid #383838;
  border-bottom: 3px solid #383838;
  transform: rotate(45deg);
}

#fxCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  display: none;
}

@keyframes hintpulse {
  0%, 100% { opacity: .35; }
  50% { opacity: .95; }
}

#hint {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  font-family: 'Silkscreen', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: #d3d9d4;
  text-shadow: 0 2px 0 #000;
  animation: hintpulse 1.8s infinite;
  pointer-events: none;
  z-index: 30;
}

#muteBtn {
  position: absolute;
  right: 14px;
  top: 12px;
  z-index: 35;
  font-family: 'Silkscreen', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #d3d9d4;
  background: rgba(10, 12, 16, .62);
  border: 1px solid #3a3f44;
  padding: 6px 9px;
  cursor: pointer;
}

/* ---------- Windows 95 desktop (in-computer view) ---------- */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  pointer-events: none;
}

#desktop {
  position: absolute;
  inset: 0;
  background: #3a8a85;
  overflow: hidden;
  cursor: default;
  font-family: 'Tahoma', 'MS Sans Serif', 'Segoe UI', Geneva, sans-serif;
  font-size: 12px;
  color: #000;
}

/* --- desktop icons --- */
#deskIcons {
  position: absolute;
  top: 14px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
}

.dicon {
  width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 3px 2px;
  text-align: center;
  cursor: default;
}

.dicon canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.dicon span {
  color: #fff;
  font-size: 12px;
  line-height: 1.12;
  padding: 1px 3px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .55);
}

.dicon:active span,
.dicon.sel span {
  background: #000080;
  outline: 1px dotted #d8d8d8;
  text-shadow: none;
}

.dicon-bin {
  position: absolute;
  right: 18px;
  bottom: 46px;
  z-index: 2;
}

/* --- windows layer --- */
#windows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.win {
  position: absolute;
  box-sizing: border-box;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: #c0c0c0;
  padding: 3px;
  pointer-events: auto;
  box-shadow:
    inset -1px -1px 0 #000,
    inset 1px 1px 0 #dfdfdf,
    inset -2px -2px 0 #808080,
    inset 2px 2px 0 #fff;
  color: #000;
}

.win-title {
  flex: none;
  display: flex;
  align-items: center;
  height: 20px;
  padding: 0 2px 0 3px;
  background: #808080;
  color: #d0d0d0;
  cursor: default;
}

/* bottom-right resize grip */
.win-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  z-index: 2;
  background: repeating-linear-gradient(-45deg, #808080 0 1px, #fff 1px 2px, transparent 2px 4px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.win.active .win-title {
  background: #000080;
  color: #fff;
}

.win-title .win-titleicon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  margin-right: 4px;
  flex: none;
}

.win-title .win-name {
  flex: 1;
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-controls {
  display: flex;
  gap: 2px;
}

.wc {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: #000;
  box-shadow:
    inset -1px -1px 0 #000,
    inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080,
    inset 2px 2px 0 #dfdfdf;
}

.wc:active {
  box-shadow:
    inset 1px 1px 0 #000,
    inset -1px -1px 0 #fff,
    inset 2px 2px 0 #808080,
    inset -2px -2px 0 #dfdfdf;
}

.wc i { display: block; background: #000; }
.wc-min i { width: 7px; height: 2px; margin-top: 6px; }
.wc-max i { width: 9px; height: 8px; border: 1px solid #000; border-top-width: 2px; background: transparent; }
.wc-close { font-size: 12px; font-weight: bold; line-height: 1; }

.win-menu {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 2px 1px 3px;
  font-size: 12px;
}
.win-menu span { padding: 1px 6px; }

.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 3px;
}

.win-inset {
  flex: 1;
  min-height: 90px;
  overflow: auto;
  background: #fff;
  padding: 8px;
  color: #000;
  font-size: 12px;
  line-height: 1.35;
  box-shadow:
    inset 1px 1px 0 #808080,
    inset -1px -1px 0 #fff,
    inset 2px 2px 0 #000,
    inset -2px -2px 0 #dfdfdf;
}

.win-inset b { font-weight: bold; }

.img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.img-cell {
  aspect-ratio: 4 / 3;
  background: #e8e8e8;
  display: flex;
  align-items: flex-end;
  padding: 3px;
  font-size: 10px;
  color: #333;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}

.win-note { margin-top: 8px; font-size: 11px; color: #333; }

.win-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 108px;
  text-align: center;
  color: #555;
}
.win-empty b { font-weight: normal; font-size: 13px; color: #222; }
.win-empty span { font-size: 11px; color: #777; }

/* ---- IMAGES gallery ---- */
.gal-inset { padding: 6px; }
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
  align-content: start;
}
.gal-grid.gal-msg { display: block; }
.gal-cell {
  padding: 0;
  border: 0;
  margin: 0;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  background: #d9d9d9;
  overflow: hidden;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}
.gal-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #e8e8e8;
}
.gal-cell:hover { outline: 2px solid #000080; outline-offset: -2px; }
.gal-cell:active img { filter: brightness(0.9); }
.gal-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 120px; text-align: center; color: #555;
}
.gal-empty b { font-weight: normal; font-size: 13px; color: #222; }
.gal-empty span { font-size: 11px; color: #777; max-width: 260px; }
.win-status {
  flex: none;
  margin-top: 3px;
  padding: 2px 6px;
  font-size: 11px;
  color: #000;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}

/* ---- Lightbox ---- */
.gal-lightbox {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
.gal-lightbox.open { display: flex; }
.glb-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.82); cursor: pointer; }
.glb-img {
  position: relative;
  max-width: 88%;
  max-height: 84%;
  object-fit: contain;
  border: 2px solid #c0c0c0;
  box-shadow: 0 0 0 1px #000, 0 8px 40px rgba(0, 0, 0, 0.6);
  background: #000;
}
.glb-close, .glb-nav {
  position: absolute;
  z-index: 2;
  background: #c0c0c0;
  color: #000;
  border: 2px outset #fff;
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
}
.glb-close {
  top: 14px; right: 16px;
  width: 30px; height: 28px;
  font-size: 14px;
}
.glb-nav {
  top: 50%; transform: translateY(-50%);
  width: 40px; height: 56px;
  font-size: 30px;
}
.glb-prev { left: 16px; }
.glb-next { right: 16px; }
.glb-close:active, .glb-nav:active { border-style: inset; }
.glb-cap {
  position: absolute;
  bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 2;
  background: #c0c0c0;
  color: #000;
  padding: 3px 12px;
  font-size: 12px;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
}

.np-area {
  flex: 1;
  min-height: 110px;
  overflow: auto;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
  color: #000;
  white-space: pre-wrap;
  box-shadow:
    inset 1px 1px 0 #808080,
    inset -1px -1px 0 #fff,
    inset 2px 2px 0 #000,
    inset -2px -2px 0 #dfdfdf;
}
.np-caret { animation: caretblink 1s steps(1) infinite; }
@keyframes caretblink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* --- taskbar --- */
#taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  background: #c0c0c0;
  z-index: 9000;
  pointer-events: auto;
  box-shadow: inset 0 1px 0 #fff, inset 0 2px 0 #dfdfdf;
}

#startBtn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px 0 4px;
  background: #c0c0c0;
  border: none;
  cursor: default;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  color: #000;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}
#startBtn:active {
  box-shadow:
    inset 1px 1px 0 #000, inset -1px -1px 0 #fff,
    inset 2px 2px 0 #808080, inset -2px -2px 0 #dfdfdf;
}
#startBtn canvas { width: 18px; height: 16px; image-rendering: pixelated; }

#taskbarTabs {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow: hidden;
  height: 22px;
}

.tb-tab {
  min-width: 88px;
  max-width: 158px;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  background: #c0c0c0;
  border: none;
  cursor: default;
  font-family: inherit;
  font-size: 12px;
  color: #000;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}
.tb-tab canvas { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
.tb-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#tray {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 8px;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}
#trayClock { font-size: 12px; color: #000; }
#backBtn {
  height: 18px;
  padding: 0 7px;
  background: #c0c0c0;
  border: none;
  cursor: default;
  font-family: inherit;
  font-size: 11px;
  color: #000;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}
#backBtn:active {
  box-shadow:
    inset 1px 1px 0 #000, inset -1px -1px 0 #fff,
    inset 2px 2px 0 #808080, inset -2px -2px 0 #dfdfdf;
}

/* --- intro question dialogs (Win95 error-message style) --- */
#introModal {
  position: absolute;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.dlg {
  min-width: 320px;
  max-width: 440px;
  box-sizing: border-box;
  background: #c0c0c0;
  padding: 3px;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #dfdfdf,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #fff,
    4px 5px 12px rgba(0, 0, 0, .4);
  font-family: 'Tahoma', 'MS Sans Serif', 'Segoe UI', sans-serif;
}

.dlg-title {
  display: flex;
  align-items: center;
  height: 20px;
  padding: 0 2px 0 4px;
  background: #000080;
  color: #fff;
}
.dlg-title span { flex: 1; font-weight: bold; font-size: 12px; }
.dlg-x {
  width: 16px; height: 14px;
  background: #c0c0c0; border: none; color: #808080;
  font-size: 10px; cursor: default;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}

.dlg-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px 16px;
}

.dlg-icon {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  background: #d81e1e;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .28), inset 2px 2px 0 rgba(255, 255, 255, .45);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: bold; font-size: 20px; line-height: 1;
}

.dlg-msg { font-size: 13px; color: #000; line-height: 1.35; }

.dlg-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 4px 16px 18px;
}

.dlg-btn {
  min-width: 84px;
  height: 24px;
  padding: 0 12px;
  background: #c0c0c0;
  border: none;
  cursor: default;
  font-family: inherit;
  font-size: 12px;
  color: #000;
  box-shadow:
    inset -1px -1px 0 #000, inset 1px 1px 0 #fff,
    inset -2px -2px 0 #808080, inset 2px 2px 0 #dfdfdf;
}
.dlg-btn:active {
  box-shadow:
    inset 1px 1px 0 #000, inset -1px -1px 0 #fff,
    inset 2px 2px 0 #808080, inset -2px -2px 0 #dfdfdf;
}
.dlg-btn:focus { outline: 1px dotted #000; outline-offset: -4px; }
