/* ── Win95 System Colors ── */
:root {
  --c-gray:    #c0c0c0;
  --c-white:   #ffffff;
  --c-black:   #000000;
  --c-mid:     #808080;
  --c-light:   #dfdfdf;
  --c-blue:    #000080;
  --c-teal:    #008080;
  --c-hilight: #0000a0;
  --room-back: #008080;
  --room-side: #007477;
  --room-side-edge: #00686c;
  --room-ceiling-color: #007a7a;
  --room-floor-color: #006f72;
  --room-shell: #00696c;
  --room-corner: #005f63;
  --room-seam: rgba(0, 83, 86, 0.62);
  --room-soft-shadow: rgba(0, 79, 82, 0.28);
  --backwall-left: 16vw;
  --backwall-top: 14vh;
  --backwall-width: 68vw;
  --backwall-height: 66vh;
  --room-wall: clamp(118px, 14vw, 240px);
  --room-ceiling: clamp(78px, 12vh, 136px);
  --room-floor: clamp(90px, 15vh, 174px);
  --room-recede: 0px;
  --room-plane-overlap: 0px;
  --backwall-frame: 3px;
  --taskbar-height: 28px;
  --room-seam-light: rgba(28, 132, 128, 0.42);
  --room-seam-dark: rgba(0, 83, 86, 0.58);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif;
  font-size: 11px;
}

/* ── 3D Bevel Helpers ── */
.raised {
  background: var(--c-gray);
  border-top:    2px solid var(--c-white);
  border-left:   2px solid var(--c-white);
  border-right:  2px solid var(--c-black);
  border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
}
.pressed {
  background: var(--c-gray);
  border-top:    2px solid var(--c-black);
  border-left:   2px solid var(--c-black);
  border-right:  2px solid var(--c-white);
  border-bottom: 2px solid var(--c-white);
  box-shadow: inset 1px 1px 0 var(--c-mid), inset -1px -1px 0 var(--c-light);
}
.inset {
  border-top:    2px solid var(--c-mid);
  border-left:   2px solid var(--c-mid);
  border-right:  2px solid var(--c-light);
  border-bottom: 2px solid var(--c-light);
  box-shadow: inset 1px 1px 0 var(--c-black), inset -1px -1px 0 var(--c-gray);
}

/* ── Shell ── */
#shell {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  background:
    linear-gradient(180deg, var(--room-ceiling-color) 0%, var(--room-shell) 50%, var(--room-floor-color) 100%);
}
#shell::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,100,104,0.12), transparent 18%, transparent 82%, rgba(0,91,95,0.12)),
    linear-gradient(180deg, rgba(44,143,141,0.08), transparent 32%, transparent 78%, rgba(0,91,95,0.1));
  z-index: 2;
}
#shell > * { z-index: 3; }

#shell .room-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}
.room-guide-lines {
  fill: none;
  stroke: rgba(0, 75, 78, 0.58);
  stroke-width: 0.28;
  vector-effect: non-scaling-stroke;
}
#shell .side-wall-left-layer,
#shell .side-wall-right-layer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16vw;
  pointer-events: none;
  z-index: 2;
  overflow: visible; /* allow rotated preview cards to paint outside element box */
}
#shell .side-wall-left-layer { left: 0; }
/* Explicit left keeps arithmetic predictable for child anchoring */
#shell .side-wall-right-layer { left: 84vw; }

/* ── Desktop (back wall of the room) ── */
.backwall-surface {
  position: absolute;
  left: var(--backwall-left);
  top: var(--backwall-top);
  width: var(--backwall-width);
  height: var(--backwall-height);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--room-back);
  pointer-events: auto;
  border-top: var(--backwall-frame) solid rgba(35, 135, 132, 0.72);
  border-left: var(--backwall-frame) solid rgba(26, 123, 121, 0.68);
  border-right: var(--backwall-frame) solid rgba(0, 85, 88, 0.72);
  border-bottom: var(--backwall-frame) solid rgba(0, 79, 82, 0.72);
  box-shadow:
    -8px 0 14px rgba(0, 79, 82, 0.3),
    8px 0 14px rgba(0, 79, 82, 0.3),
    0 -6px 10px rgba(0, 90, 92, 0.24),
    0 9px 16px rgba(0, 82, 85, 0.3),
    0 0 0 2px var(--room-seam),
    inset 0 0 0 1px rgba(53, 151, 148, 0.16),
    inset 0 0 18px rgba(0, 94, 96, 0.13);
  isolation: isolate;
  z-index: 5;
}
.backwall-surface::before,
.backwall-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.backwall-surface::before {
  z-index: 5;
  box-shadow:
    inset 0 0 0 1px rgba(0,91,94,0.48),
    inset 0 20px 24px rgba(50,150,147,0.04),
    inset 0 -22px 28px rgba(0,90,94,0.1),
    inset 18px 0 22px rgba(0,98,101,0.07),
    inset -18px 0 22px rgba(0,98,101,0.07);
}
.backwall-surface::after {
  display: none;
}

#desktop {
  flex: 1;
  background:
    linear-gradient(180deg, rgba(38,138,135,0.04), transparent 24%, transparent 82%, rgba(0,95,98,0.055)),
    linear-gradient(90deg, rgba(0,103,106,0.035), transparent 12%, transparent 88%, rgba(0,103,106,0.035)),
    var(--room-back);
  position: relative; overflow: hidden;
  isolation: isolate;
  box-shadow:
    -1px 0 0 #006467, 1px 0 0 #006467, 0 -1px 0 #006467, 0 1px 0 #006467,
    inset 0 12px 16px rgba(47,147,144,0.018),
    inset 0 -14px 18px rgba(0,91,94,0.045);
}
#desktop::before,
#desktop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#desktop::before {
  z-index: 1;
  box-shadow:
    inset 2px 0 0 var(--room-seam-light),
    inset -2px 0 0 rgba(0,92,95,0.32),
    inset 0 2px 0 var(--room-seam-light),
    inset 0 -2px 0 rgba(0,92,95,0.36),
    inset 12px 0 16px rgba(0,99,102,0.028),
    inset -12px 0 16px rgba(0,99,102,0.028),
    inset 0 12px 16px rgba(0,99,102,0.024),
    inset 0 -14px 18px rgba(0,99,102,0.035);
}
#desktop::after {
  display: none;
}
#icons-area {
  position: absolute; top: 8px; left: 10px;
  display: flex; flex-direction: column; gap: 0;
  z-index: 3;
}

/* ── Desktop Icons ── */
.desktop-icon {
  display: flex; flex-direction: column; align-items: center;
  width: 82px; height: 68px;        /* fixed height = uniform grid rows */
  padding: 4px 4px 2px;
  cursor: default;
  outline: 1px solid transparent;   /* space for focus ring */
}
.desktop-icon .d-ico {
  width: 32px; height: 32px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block; pointer-events: none; flex-shrink: 0;
}
.desktop-icon .icon-label {
  margin-top: 3px; text-align: center; color: #ffffff;
  font-size: 11px; line-height: 1.2;
  text-shadow: 1px 1px 1px #000, -1px -1px 1px #000,
               1px -1px 1px #000, -1px  1px 1px #000;
  word-break: break-word; max-width: 78px;
  padding: 1px 3px;
}
/* Win95 selected: blue tint on icon, blue fill on label */
.desktop-icon.selected .d-ico {
  filter: invert(35%) sepia(100%) saturate(600%)
          hue-rotate(190deg) brightness(0.85);
}
.desktop-icon.selected .icon-label {
  background: var(--c-hilight); color: #fff; text-shadow: none;
}
.desktop-icon:hover:not(.selected) .icon-label {
  background: rgba(0, 0, 128, 0.45);
}

/* ── Taskbar ── */
#taskbar {
  height: var(--taskbar-height); background: var(--c-gray);
  border-top: 2px solid var(--c-white);
  border-left: 1px solid rgba(255,255,255,0.25);
  border-right: 1px solid rgba(0,0,0,0.38);
  display: flex; align-items: center;
  padding: 2px 4px; gap: 4px; flex-shrink: 0;
  position: relative;
  z-index: 6;
  box-shadow:
    inset 0 1px 0 var(--c-light),
    0 -1px 0 rgba(0,83,86,0.68),
    0 -2px 0 rgba(47,143,141,0.12),
    0 -3px 0 rgba(0,97,100,0.34),
    0 4px 8px rgba(0,83,86,0.28);
}
#start-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--c-gray); height: 22px; padding: 0 8px;
  min-width: 56px; flex-shrink: 0;
  border-top: 2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
  cursor: pointer;
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif;
  font-size: 11px; font-weight: bold;
}
#start-btn:active, #start-btn.pressed {
  border-top: 2px solid var(--c-black); border-left: 2px solid var(--c-black);
  border-right: 2px solid var(--c-white); border-bottom: 2px solid var(--c-white);
  box-shadow: inset 1px 1px 0 var(--c-mid);
  padding-left: 9px; padding-top: 1px;
}
.win-flag {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  width: 16px; height: 16px; flex-shrink: 0;
}
.win-flag span { display: block; }

/* vertical separator between Start and task buttons */
.taskbar-divider {
  width: 4px; height: 22px; flex-shrink: 0;
  border-left:  1px solid var(--c-mid);
  border-right: 1px solid var(--c-white);
}

#task-buttons { display: flex; align-items: center; gap: 2px; flex: 1; overflow: hidden; }

.task-btn {
  height: 22px; min-width: 100px; max-width: 160px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 6px; overflow: hidden; white-space: nowrap;
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif; font-size: 11px;
  cursor: pointer; background: var(--c-gray);
  border-top: 2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
}
.task-btn .t-ico { width: 14px; height: 14px; image-rendering: pixelated; flex-shrink: 0; }
.task-btn span:last-child { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.task-btn.active {
  border-top: 1px solid var(--c-black); border-left: 1px solid var(--c-black);
  border-right: 1px solid var(--c-white); border-bottom: 1px solid var(--c-white);
  box-shadow: inset 1px 1px 0 var(--c-mid);
  background: var(--c-light);
  padding-left: 7px; padding-top: 1px;
}

#tray {
  display: flex; align-items: center; gap: 5px;
  border-top:    1px solid var(--c-mid);  border-left:   1px solid var(--c-mid);
  border-right:  1px solid var(--c-white);border-bottom: 1px solid var(--c-white);
  box-shadow: inset 1px 1px 0 #000;
  padding: 1px 8px 1px 6px; height: 22px;
}
.tray-ico {
  width: 16px; height: 16px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  flex-shrink: 0;
}
#clock { font-size: 11px; white-space: nowrap; }

/* ── Start Menu ── */
#start-menu {
  position: fixed;
  bottom: calc(20vh + var(--backwall-frame) + var(--taskbar-height));
  left: calc(var(--backwall-left) + var(--backwall-frame) + 4px);
  background: var(--c-gray); z-index: 8000;
  border-top: 2px solid var(--c-white); border-right: 2px solid var(--c-black);
  border-left: 2px solid var(--c-white); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid),
              3px 3px 0 #000;   /* drop shadow lifts menu off desktop */
  display: flex; width: 214px;
}
#start-brand {
  width: 24px; background: #000080;
  display: flex; align-items: flex-end; padding-bottom: 10px; justify-content: center;
  flex-shrink: 0;
}
#start-brand-text {
  writing-mode: vertical-rl; transform: rotate(180deg);
  color: #fff; font-size: 15px; font-weight: bold;
  letter-spacing: 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}
#start-items { flex: 1; padding: 4px 0; }
.sm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; cursor: default; position: relative;
  white-space: nowrap; font-size: 12px;
}
.sm-item:hover { background: var(--c-blue); color: #fff; }
.sm-ico { width: 16px; height: 16px; image-rendering: pixelated; flex-shrink: 0; }
.sm-item .arrow { margin-left: auto; font-size: 9px; }
.sm-sep { height: 1px; background: var(--c-mid); margin: 3px 4px; box-shadow: 0 1px 0 var(--c-white); }

/* Submenus */
.submenu {
  position: absolute; left: 100%; top: -2px;
  background: var(--c-gray); z-index: 8001; min-width: 188px;
  border-top: 2px solid var(--c-white); border-right: 2px solid var(--c-black);
  border-left: 2px solid var(--c-white); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid),
              3px 3px 0 #000;
  display: none; padding: 4px 0;
}
.has-sub:hover > .submenu { display: block; }

/* ── Window ── */
.win95-window {
  position: absolute; background: var(--c-gray);
  border-top:  2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid),
              0 0 0 1px #000;          /* outer black perimeter border */
  display: flex; flex-direction: column; min-width: 200px; min-height: 120px;
  z-index: 500;
}
/* Title bar */
.win-titlebar {
  height: 22px; display: flex; align-items: center;
  padding: 2px 3px; gap: 3px; cursor: default; flex-shrink: 0;
}
.win95-window.active .win-titlebar {
  background: #000080;
}
.win95-window:not(.active) .win-titlebar {
  background: #808080;
}
/* Inactive title: dimmed text + buttons so active/inactive is obvious */
.win95-window:not(.active) .win-title-text {
  color: #c8c8c8;
}
.win95-window:not(.active) .win-btn {
  opacity: 0.75;
}
.win-icon {
  width: 16px; height: 16px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  flex-shrink: 0; display: block;
}
.win-title-text {
  flex: 1; color: #fff; font-weight: bold; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Title bar buttons — square, Win95 style */
.win-btn {
  width: 16px; height: 16px; flex-shrink: 0; background: var(--c-gray);
  border-top: 2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 9px; font-weight: bold; line-height: 1; color: #000;
}
.win-btn:active {
  border-top: 2px solid var(--c-black); border-left: 2px solid var(--c-black);
  border-right: 2px solid var(--c-white); border-bottom: 2px solid var(--c-white);
  box-shadow: inset 1px 1px 0 var(--c-mid);
  padding-top: 2px; padding-left: 1px;
}

/* Menu bar */
.win-menubar {
  display: flex; background: var(--c-gray);
  border-bottom: 1px solid var(--c-mid); padding: 1px 2px; flex-shrink: 0;
}
.win-menu-item {
  padding: 2px 6px; cursor: default; font-size: 11px; position: relative;
}
.win-menu-item:hover { background: var(--c-blue); color: #fff; }
.win-menu-item:hover .menu-dd { display: block; }
.menu-dd {
  position: absolute; top: 100%; left: -2px; z-index: 9000;
  background: var(--c-gray); min-width: 140px;
  border-top: 2px solid var(--c-white); border-right: 2px solid var(--c-black);
  border-left: 2px solid var(--c-white); border-bottom: 2px solid var(--c-black);
  box-shadow: 2px 2px 0 #000; display: none; padding: 2px 0;
}
.mdd-item {
  padding: 4px 16px; cursor: default; color: #000;
  font-size: 11px; white-space: nowrap;
}
.mdd-item:hover { background: var(--c-blue); color: #fff; }
.mdd-sep { height: 1px; background: var(--c-mid); margin: 2px 4px; box-shadow: 0 1px 0 var(--c-white); }

/* Toolbar */
.win-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 2px 4px; flex-shrink: 0;
  border-bottom: 1px solid var(--c-mid); background: var(--c-gray);
}
.tb-btn {
  width: 22px; height: 22px; background: var(--c-gray);
  border-top: 1px solid var(--c-white); border-left: 1px solid var(--c-white);
  border-right: 1px solid var(--c-black); border-bottom: 1px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
}
.tb-btn:active {
  border-top: 1px solid var(--c-black); border-left: 1px solid var(--c-black);
  border-right: 1px solid var(--c-white); border-bottom: 1px solid var(--c-white);
}
.tb-sep {
  width: 1px; height: 18px; background: var(--c-mid);
  margin: 0 2px; box-shadow: 1px 0 0 var(--c-white);
}
.tb-label { font-size: 11px; white-space: nowrap; padding: 0 4px; }
.addr-bar { flex: 1; display: flex; align-items: center; gap: 4px; }
.addr-input {
  flex: 1; height: 18px;
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif; font-size: 11px;
  border-top: 1px solid var(--c-mid); border-left: 1px solid var(--c-mid);
  border-right: 1px solid var(--c-light); border-bottom: 1px solid var(--c-light);
  box-shadow: inset 1px 1px 0 var(--c-black);
  background: #fff; padding: 0 3px; outline: none;
}

/* Content area */
.win-content {
  flex: 1; overflow: auto; position: relative;
  display: flex; flex-direction: column;
}
.win-client {
  flex: 1; overflow: auto;
  border-top: 1px solid var(--c-mid); border-left: 1px solid var(--c-mid);
  border-right: 1px solid var(--c-light); border-bottom: 1px solid var(--c-light);
  box-shadow: inset 1px 1px 0 var(--c-black);
  background: #fff; margin: 2px;
}
/* Status bar */
.win-status {
  height: 20px; display: flex; align-items: center;
  padding: 2px 4px;
  border-top:    1px solid var(--c-mid);
  border-bottom: 1px solid var(--c-white);
  background: var(--c-gray); flex-shrink: 0;
}
.status-panel {
  padding: 0 6px; height: 16px; display: flex; align-items: center;
  border-top:    1px solid var(--c-mid);    border-left:   1px solid var(--c-mid);
  border-right:  1px solid var(--c-white);  border-bottom: 1px solid var(--c-white);
  font-size: 11px; white-space: nowrap;
}

/* Dialog button */
.win-dialog-btn {
  padding: 3px 14px; background: var(--c-gray);
  border-top: 2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
  cursor: pointer;
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif;
  font-size: 11px; min-width: 75px; height: 23px;
}
.win-dialog-btn:active {
  border-top: 2px solid var(--c-black); border-left: 2px solid var(--c-black);
  border-right: 2px solid var(--c-white); border-bottom: 2px solid var(--c-white);
  padding-left: 15px; padding-top: 4px;
}
.win-dialog-btn.default-btn {
  outline: 1px solid var(--c-black); outline-offset: -4px;
}

/* ── App-specific Content Styles ── */

/* Files / Explorer */
.exp-layout { display: flex; height: 100%; }
.exp-tree {
  width: 160px; flex-shrink: 0; border-right: 1px solid var(--c-mid);
  background: #fff; overflow: auto; padding: 4px 0;
}
.exp-node {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 6px; font-size: 11px; cursor: default;
}
.exp-node .n-ico { width: 16px; height: 16px; image-rendering: pixelated; flex-shrink: 0; }
.exp-node:hover { background: var(--c-hilight); color: #fff; }
.exp-files {
  flex: 1; background: #fff;
  display: flex; flex-wrap: wrap; align-content: flex-start;
  padding: 8px; gap: 8px; overflow: auto;
}
.file-icon {
  display: flex; flex-direction: column; align-items: center;
  width: 68px; padding: 4px; cursor: default; text-align: center;
}
.file-icon .f-ico { width: 32px; height: 32px; image-rendering: pixelated; display: block; }
.file-icon span:last-child {
  margin-top: 3px; font-size: 11px;
  word-break: break-all; line-height: 1.2;
}
.file-icon:hover { background: var(--c-hilight); color: #fff; }

/* Notepad */
.notepad-area {
  flex: 1; padding: 4px; border: none; resize: none; outline: none;
  font-family: "Courier New", monospace; font-size: 12px;
  background: #fff; color: #000; width: 100%;
}

/* Net Explorer */
.ie-content { flex: 1; background: #fff; overflow: auto; padding: 8px 16px; }
.ie-content h2 { font-size: 16px; color: #000080; margin-bottom: 8px; font-family: "Times New Roman",serif; }
.ie-content p { font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
.ie-content a { color: #0000cc; text-decoration: underline; cursor: pointer; }
.ie-content hr { border: none; border-top: 1px solid var(--c-mid); margin: 8px 0; }
.ie-content .link-list { margin: 4px 0; padding-left: 16px; }
.ie-content .link-list li { margin-bottom: 4px; font-size: 12px; }

/* Control Panel */
.cp-grid {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px; align-content: flex-start; background: #fff;
}
.cp-item {
  display: flex; flex-direction: column; align-items: center;
  width: 80px; padding: 6px 4px; cursor: default; text-align: center;
}
.cp-item .cp-ico { width: 32px; height: 32px; image-rendering: pixelated; display: block; }
.cp-item span:last-child { margin-top: 4px; font-size: 11px; line-height: 1.2; }
.cp-item:hover { background: var(--c-hilight); color: #fff; }

/* Terminal / MS-DOS Prompt */
.term-body {
  flex: 1; background: #000000; color: #c0c0c0;
  padding: 4px 8px; overflow-y: auto;
  font-family: "Lucida Console","Courier New",monospace; font-size: 12px; line-height: 1.4;
  user-select: text;
}
.term-line { white-space: pre-wrap; }
.term-line.t-cmd  { color: #ffffff; }
.term-line.t-info { color: #c0c0c0; }
.term-line.t-err  { color: #ff6060; }
.term-input-row {
  display: flex; background: #000000; padding: 2px 8px 4px;
  border-top: 1px solid #222;
}
.term-input-prefix {
  color: #c0c0c0; font-family: "Lucida Console","Courier New",monospace;
  font-size: 12px; padding-top: 0; white-space: pre; flex-shrink: 0;
}
.term-input {
  flex: 1; background: #000000; color: #ffffff;
  border: none; outline: none;
  font-family: "Lucida Console","Courier New",monospace; font-size: 12px;
  caret-color: #ffffff; user-select: text;
}

/* Paint */
.paint-layout { display: flex; height: 100%; }
.paint-tools {
  width: 52px; flex-shrink: 0; background: var(--c-gray);
  border-right: 2px solid var(--c-mid); padding: 3px 2px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  align-content: start;
  box-shadow: inset -1px 0 0 var(--c-white);
}
.paint-tool {
  width: 22px; height: 22px; background: var(--c-gray);
  border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: default; font-family: monospace;
}
.paint-tool:hover {
  border-top: 1px solid var(--c-white); border-left: 1px solid var(--c-white);
  border-right: 1px solid var(--c-black); border-bottom: 1px solid var(--c-black);
}
.paint-tool.sel {
  border-top: 1px solid var(--c-black); border-left: 1px solid var(--c-black);
  border-right: 1px solid var(--c-white); border-bottom: 1px solid var(--c-white);
  background: var(--c-light);
}
.paint-canvas-wrap { flex: 1; background: var(--c-gray); overflow: auto; padding: 4px; }
.paint-canvas { background: #fff; display: block; cursor: crosshair; border: 1px solid var(--c-mid); }
.paint-colors { display: flex; flex-wrap: wrap; gap: 0; }
.paint-col { width: 16px; height: 16px; border: 1px solid #000; cursor: pointer; flex-shrink: 0; }

/* My System */
.sys-layout { padding: 8px; background: #fff; }
.sys-row {
  display: flex; align-items: center; gap: 12px;
  padding: 5px 0; border-bottom: 1px solid var(--c-mid); font-size: 12px;
}
.sys-label { color: #808080; width: 120px; flex-shrink: 0; }
.sys-val { color: #000; }

/* Inbox */
.inbox-layout { display: flex; height: 100%; }
.inbox-sidebar {
  width: 140px; flex-shrink: 0; background: #fff;
  border-right: 2px solid var(--c-mid); overflow: auto;
}
.inbox-folder {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; font-size: 11px; cursor: default;
}
.inbox-folder .if-ico { width: 16px; height: 16px; image-rendering: pixelated; flex-shrink: 0; }
.inbox-folder:hover { background: var(--c-hilight); color: #fff; }
.inbox-folder.sel { background: var(--c-hilight); color: #fff; }
.inbox-msg {
  display: grid;
  grid-template-columns: 20px 160px 1fr 90px;
  border-bottom: 1px solid var(--c-mid);
  align-items: center; height: 20px;
  padding: 0 4px; font-size: 11px; cursor: default;
}
.inbox-msg:hover { background: var(--c-hilight); color: #fff; }
.inbox-msg.unread { font-weight: bold; }
.inbox-header {
  display: grid; grid-template-columns: 20px 160px 1fr 90px;
  padding: 0 4px; border-bottom: 2px solid var(--c-mid);
}
.inbox-col {
  padding: 2px 4px; font-size: 11px; font-weight: bold;
  border-right: 1px solid var(--c-mid);
  border-top: 1px solid var(--c-white); border-left: 1px solid var(--c-white);
  background: var(--c-gray);
}

/* Network */
.net-grid {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 12px; background: #fff; align-content: flex-start;
}
.net-item {
  display: flex; flex-direction: column; align-items: center;
  width: 80px; padding: 6px; text-align: center; cursor: default;
}
.net-item .ni-ico { width: 32px; height: 32px; image-rendering: pixelated; display: block; }
.net-item span:last-child { margin-top: 4px; font-size: 11px; }
.net-item:hover { background: var(--c-hilight); color: #fff; }

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 20000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.01);
}
.modal-box {
  background: var(--c-gray);
  border-top: 2px solid var(--c-white); border-left: 2px solid var(--c-white);
  border-right: 2px solid var(--c-black); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid), 3px 3px 0 #000;
  min-width: 300px;
}
.modal-title {
  background: #000080; color: #fff; font-weight: bold;
  padding: 3px 6px; font-size: 11px;
}
.modal-body { padding: 16px; }
.modal-footer { display: flex; justify-content: center; gap: 8px; padding: 8px 16px 12px; }

/* ── Right-click context menu ── */
.ctx-menu {
  position: fixed; z-index: 9500;
  background: var(--c-gray); min-width: 140px;
  border-top: 2px solid var(--c-white); border-right: 2px solid var(--c-black);
  border-left: 2px solid var(--c-white); border-bottom: 2px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid), 2px 2px 0 #000;
  padding: 2px 0; display: none;
}
.ctx-item {
  padding: 4px 16px; cursor: default; font-size: 11px;
}
.ctx-item:hover { background: var(--c-blue); color: #fff; }
.ctx-sep { height: 1px; background: var(--c-mid); margin: 2px 4px; box-shadow: 0 1px 0 var(--c-white); }

/* ── My Computer drive grid ── */
.mycomp-grid {
  display: flex; flex-wrap: wrap; gap: 0;
  padding: 8px; align-content: flex-start; background: #fff;
}
.mycomp-item {
  display: flex; flex-direction: column; align-items: center;
  width: 80px; padding: 8px 4px 6px;
  cursor: default; text-align: center;
}
.mycomp-item:hover { background: var(--c-hilight); color: #fff; }
.mycomp-label {
  margin-top: 4px; font-size: 11px; line-height: 1.2;
  word-break: break-word; max-width: 76px;
}
.mycomp-free { font-size: 10px; color: #808080; margin-top: 1px; }
.mycomp-item:hover .mycomp-free { color: #bbccff; }

/* ── Explorer tree indentation levels ── */
.exp-node.l1 { padding-left: 18px; }
.exp-node.l2 { padding-left: 30px; }
.exp-node.l3 { padding-left: 42px; }
.exp-node.lsel { background: var(--c-hilight); color: #fff; }

/* ── Toolbar labeled buttons (IE-style icon+text) ── */
.tb-lbl-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 38px; height: 32px; padding: 1px 4px;
  background: var(--c-gray); border: 1px solid transparent;
  cursor: pointer; gap: 0;
}
.tb-lbl-btn:hover {
  border-top:   1px solid var(--c-white); border-left:   1px solid var(--c-white);
  border-right: 1px solid var(--c-black); border-bottom: 1px solid var(--c-black);
}
.tb-lbl-btn:active {
  border-top:   1px solid var(--c-black); border-left:   1px solid var(--c-black);
  border-right: 1px solid var(--c-white); border-bottom: 1px solid var(--c-white);
}
.tb-lbl-btn .tbi { font-size: 14px; line-height: 1.2; }
.tb-lbl-btn .tbt { font-size: 9px;  line-height: 1.2;
  font-family: "MS Sans Serif","Tahoma",sans-serif; }
.tb-lbl-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── IE homepage ── */
.ie-page { background: #fff; font-size: 12px; display: flex; flex-direction: column; height: 100%; }
.ie-hdr {
  background: #003c74; color: #fff; padding: 5px 10px;
  font-family: "MS Sans Serif","Tahoma",sans-serif;
  font-size: 13px; font-weight: bold;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.ie-nav {
  background: var(--c-gray); padding: 2px 8px;
  border-bottom: 2px solid var(--c-mid);
  display: flex; gap: 12px; font-size: 11px; flex-shrink: 0;
}
.ie-nav a {
  color: var(--c-blue); text-decoration: none; cursor: pointer;
}
.ie-nav a:hover { text-decoration: underline; }
.ie-body { display: flex; flex: 1; overflow: hidden; }
.ie-main { flex: 2; padding: 10px 14px; overflow-y: auto; border-right: 1px solid #d0d0d0; }
.ie-side { flex: 1; padding: 8px 10px; overflow-y: auto; min-width: 130px; }
.ie-main h3 {
  font-size: 13px; color: #000080; margin: 0 0 6px; font-family: "Times New Roman",serif;
  border-bottom: 1px solid #c0c0c0; padding-bottom: 2px;
}
.ie-main p { margin: 4px 0; font-size: 11px; }
.ie-main a { color: #0000bb; text-decoration: underline; cursor: pointer; font-size: 11px; }
.ie-main ul { margin: 0; padding-left: 18px; }
.ie-main li { margin-bottom: 3px; font-size: 11px; }
.ie-side h4 { font-size: 11px; font-weight: bold; margin: 0 0 4px; color: #000080; }
.ie-side ul { margin: 0 0 8px; padding-left: 14px; }
.ie-side li { margin-bottom: 3px; font-size: 11px; }
.ie-side a  { color: #0000bb; text-decoration: underline; cursor: pointer; }

/* ── Notepad ── */
.notepad-area {
  flex: 1; padding: 4px 6px; border: none; resize: none; outline: none;
  font-family: "Courier New", monospace; font-size: 12px; line-height: 1.4;
  background: #fff; color: #000; width: 100%; user-select: text;
}

/* ── Win95 form controls ── */
input[type="radio"], input[type="checkbox"] {
  accent-color: #000080; cursor: default;
}
select {
  font-family: "MS Sans Serif","Tahoma","Gulim","Dotum",sans-serif;
  font-size: 11px; background: #fff;
  border: 2px inset var(--c-mid);
}

/* ── Recycle Bin ── */
.trash-items { background: #fff; flex: 1; overflow: auto; }
.trash-item {
  display: grid; grid-template-columns: 20px 180px 120px 80px;
  align-items: center; height: 20px;
  padding: 0 4px; font-size: 11px; cursor: default;
  border-bottom: 1px solid #e8e8e8;
}
.trash-item:hover { background: var(--c-hilight); color: #fff; }
.trash-header {
  display: grid; grid-template-columns: 20px 180px 120px 80px;
  padding: 0 4px; border-bottom: 2px solid var(--c-mid);
}
.trash-col {
  padding: 2px 4px; font-size: 11px; font-weight: bold;
  border-right: 1px solid var(--c-mid);
  border-top: 1px solid var(--c-white); border-left: 1px solid var(--c-white);
  background: var(--c-gray);
}

/* ── Nested submenu z-index ── */
.submenu          { z-index: 8001; }
.submenu .submenu { z-index: 8002; }

/* ── Desktop icon label: natural word wrap (no \n artifacts) ── */
.desktop-icon .icon-label { white-space: normal; }

/* ── Taskbar stability ── */
#task-buttons { height: 22px; }
.task-btn { flex-shrink: 0; }

/* ── Tray clock: slightly spaced for readability ── */
#clock { letter-spacing: 0; }

/* ── Window chrome: no text selection on chrome elements ── */
.win-titlebar, .win-menubar, .win-toolbar, .win-status, .win-btn { user-select: none; }

/* ── Inactive window: dim icon for clear active/inactive read ── */
.win95-window:not(.active) .win-icon { opacity: 0.7; }

/* ── Maximized window: drop outer shadow (looks cleaner at screen edge) ── */
.win95-window.maximized-state {
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
}

/* ══════════════════════════════════════════════════════════════
   3D ROOM COMPOSITION
   The Windows 95 desktop is the BACK WALL of a box room.
   Layout (flex column inside #shell):

     ┌─────────────────────────────────────┐  ← .room-ceiling (90px)
     │  .room-left │  #desktop  │ .room-right│  ← .room-middle (flex:1)
     │   (120px)   │ (back wall)│  (120px)   │
     ├─────────────────────────────────────┤  ← .room-floor (52px)
     │              #taskbar               │  ← taskbar (28px)
     └─────────────────────────────────────┘

   Stable rectangular bands/panels create a clean 2.5D room.
   Depth comes from teal tone changes and seams, not clipped wedges.
   ══════════════════════════════════════════════════════════════ */

/* ── Room flex middle row: walls on either side of the desktop ── */
.room-middle {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;   /* prevent flex children from overflowing */
  background: var(--room-shell);
  position: relative;
  z-index: 4;
}

/* ── Left wall ── */
.room-left {
  width: var(--room-wall);
  flex-shrink: 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
  clip-path: none;
  background:
    linear-gradient(180deg, rgba(0,91,94,0.08), transparent 24%, transparent 76%, rgba(0,84,88,0.1)),
    linear-gradient(to right,
      #005f63 0%,
      #006e72 34%,
      var(--room-side) 74%,
      #007b7d 100%
    );
  box-shadow:
    inset -5px 0 10px rgba(0, 83, 86, 0.26),
    inset 12px 0 18px rgba(44, 143, 141, 0.04);
}
.room-left::before,
.room-left::after,
.room-right::before,
.room-right::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.room-left::before {
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0,83,86,0.42);
  box-shadow: -4px 0 8px rgba(0,88,91,0.12);
}
.room-left::after {
  inset: -8px -2px -8px 0;
  background:
    linear-gradient(18deg, transparent 0 50%, rgba(0,83,86,0.13) 50.3%, transparent 51%),
    linear-gradient(162deg, transparent 0 50%, rgba(0,101,104,0.12) 50.3%, transparent 51%),
    linear-gradient(90deg, rgba(0,89,92,0.18), transparent 50%, rgba(46,145,142,0.08));
  transform: perspective(900px) rotateY(10deg);
  transform-origin: right center;
}

/* ── Right wall ── */
.room-right {
  width: var(--room-wall);
  flex-shrink: 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
  clip-path: none;
  background:
    linear-gradient(180deg, rgba(0,91,94,0.08), transparent 24%, transparent 76%, rgba(0,84,88,0.1)),
    linear-gradient(to left,
      #005f63 0%,
      #006e72 34%,
      var(--room-side) 74%,
      #007b7d 100%
    );
  box-shadow:
    inset 5px 0 10px rgba(0, 83, 86, 0.26),
    inset -12px 0 18px rgba(44, 143, 141, 0.04);
}
.room-right::before {
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0,83,86,0.42);
  box-shadow: 4px 0 8px rgba(0,88,91,0.12);
}
.room-right::after {
  inset: -8px 0 -8px -2px;
  background:
    linear-gradient(162deg, transparent 0 50%, rgba(0,83,86,0.13) 50.3%, transparent 51%),
    linear-gradient(18deg, transparent 0 50%, rgba(0,101,104,0.12) 50.3%, transparent 51%),
    linear-gradient(270deg, rgba(0,89,92,0.18), transparent 50%, rgba(46,145,142,0.08));
  transform: perspective(900px) rotateY(-10deg);
  transform-origin: left center;
}

/* ── Ceiling ── (full viewport width, tapers to desktop width at bottom) */
.room-ceiling {
  height: var(--room-ceiling);
  flex-shrink: 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0,88,91,0.16), transparent 22%, transparent 78%, rgba(0,88,91,0.16)),
    linear-gradient(to bottom,
      #006f72 0%,
      var(--room-ceiling-color) 54%,
      #008080 100%
    );
  box-shadow:
    inset 0 -4px 9px rgba(0, 86, 89, 0.24),
    inset 0 8px 12px rgba(42, 139, 137, 0.035);
  /* Trapezoid: full width at top, inset by wall-width at bottom
     – the bottom edge aligns with where the walls start          */
  clip-path: none;
}
.room-ceiling::before {
  content: "";
  position: absolute;
  left: var(--room-wall);
  right: var(--room-wall);
  bottom: 0;
  height: 2px;
  pointer-events: none;
  background: rgba(0,83,86,0.4);
  box-shadow: 0 -4px 8px rgba(0,89,92,0.12);
}
.room-ceiling::after {
  content: "";
  position: absolute;
  inset: -10px 0 0;
  pointer-events: none;
  background:
    linear-gradient(14deg, transparent 0 49.5%, rgba(0,83,86,0.13) 49.8%, transparent 50.3%),
    linear-gradient(166deg, transparent 0 49.5%, rgba(0,83,86,0.13) 49.8%, transparent 50.3%),
    linear-gradient(90deg, rgba(0,91,94,0.11), transparent 22%, transparent 78%, rgba(0,91,94,0.11)),
    linear-gradient(to bottom, rgba(0,89,92,0.07), transparent 60%);
  transform: perspective(900px) rotateX(-7deg);
  transform-origin: bottom center;
}

/* ── Floor strip ── (full viewport width, tapers up to desktop width) */
.room-floor {
  height: var(--room-floor);
  flex-shrink: 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0,84,87,0.18), transparent 22%, transparent 78%, rgba(0,84,87,0.18)),
    linear-gradient(to top,
      #006367 0%,
      var(--room-floor-color) 52%,
      #007a7c 100%
    );
  box-shadow:
    inset 0 4px 10px rgba(0, 82, 85, 0.26),
    inset 0 -7px 12px rgba(45, 137, 135, 0.025);
  /* Trapezoid: inset by wall-width at top, full width at bottom */
  clip-path: none;
}
.room-floor::before {
  content: "";
  position: absolute;
  left: var(--room-wall);
  right: var(--room-wall);
  top: 0;
  height: 2px;
  pointer-events: none;
  background: rgba(0,82,85,0.42);
  box-shadow: 0 4px 8px rgba(0,86,89,0.14);
}
.room-floor::after {
  content: "";
  position: absolute;
  inset: 0 0 -10px;
  pointer-events: none;
  background:
    linear-gradient(166deg, transparent 0 49.5%, rgba(0,82,85,0.15) 49.8%, transparent 50.3%),
    linear-gradient(14deg, transparent 0 49.5%, rgba(0,82,85,0.15) 49.8%, transparent 50.3%),
    linear-gradient(90deg, rgba(0,84,87,0.13), transparent 22%, transparent 78%, rgba(0,84,87,0.13)),
    linear-gradient(to top, rgba(0,83,86,0.09), transparent 58%);
  transform: perspective(900px) rotateX(7deg);
  transform-origin: top center;
}

/* SVG room mode: legacy CSS planes stay in DOM for compatibility only. */
.room-ceiling,
.room-left,
.room-right,
.room-floor {
  display: none;
}
#shell .room-middle {
  position: absolute;
  inset: 0;
  display: block;
  background: transparent;
  pointer-events: none;
  z-index: 4;
}

/* ══════════════════════════════════════════════════════════════
   SIDE-WALL WINDOW MODE
   The REAL window moves onto the side wall via position:fixed.
   All positional values (top, left/right, width, height, transform)
   are set as inline styles by wall.js for full runtime control.
   CSS classes provide only: position:fixed, z-index, transform-origin,
   and transitions. No positional !important here.
   ══════════════════════════════════════════════════════════════ */

/* position:fixed breaks window out of #desktop overflow:hidden */
.win95-window.sw-wall-left,
.win95-window.sw-wall-right {
  position:   fixed  !important;
  z-index:    600    !important;
  min-width:  0      !important;
  min-height: 0      !important;
  /* transition controlled inline by wall.js for smooth handoff */
}

/* transform-origin: seam edge stays pinned, outer edge recedes */
.win95-window.sw-wall-left  { transform-origin: right center; }
.win95-window.sw-wall-right { transform-origin: left center; }

/* Expanded mode — same structure, transitions already on base class */
.win95-window.sw-wall-expanded { /* marker class only; all values set inline */ }

/* ── Wall-approach drag hint ── */
.side-wall-left-layer.sw-hint,
.side-wall-right-layer.sw-hint {
  background:    rgba(0, 148, 148, 0.10);
  outline:       1px solid rgba(0, 190, 190, 0.35);
  outline-offset: -1px;
}

/* ── Side-wall taskbar strips (disabled) ── */
.side-taskbar-left,
.side-taskbar-right { display: none !important; }

/* keep rule below for layout reference only */
.side-taskbar-left,
.side-taskbar-right {
  position:    absolute;
  top:         80vh;
  left:        0;
  right:       0;
  height:      24px;
  background:  var(--c-gray);
  border-top:  2px solid var(--c-white);
  box-shadow:  inset 0 1px 0 var(--c-light), 0 1px 0 var(--c-black);
  display:     flex;
  align-items: center;
  padding:     1px 3px;
  gap:         2px;
  pointer-events: auto;
  z-index:     5;
  overflow:    hidden;
}

/* Buttons inside side-taskbar strips */
.side-task-btn {
  height:      18px;
  min-width:   40px;
  max-width:   110px;
  display:     flex;
  align-items: center;
  gap:         3px;
  padding:     0 5px;
  overflow:    hidden;
  white-space: nowrap;
  font-family: "MS Sans Serif","Tahoma",sans-serif;
  font-size:   9px;
  cursor:      pointer;
  background:  var(--c-gray);
  border-top:    1px solid var(--c-white);
  border-left:   1px solid var(--c-white);
  border-right:  1px solid var(--c-black);
  border-bottom: 1px solid var(--c-black);
  box-shadow: inset 1px 1px 0 var(--c-light), inset -1px -1px 0 var(--c-mid);
}
.side-task-btn.active {
  border-top:    1px solid var(--c-black);
  border-left:   1px solid var(--c-black);
  border-right:  1px solid var(--c-white);
  border-bottom: 1px solid var(--c-white);
  box-shadow: inset 1px 1px 0 var(--c-mid);
  background: var(--c-light);
}
.side-task-btn span {
  overflow:      hidden;
  text-overflow: ellipsis;
  flex:          1;
  min-width:     0;
}

/* Main taskbar button: dimmed + italic while window is on a side wall */
.task-btn.parked {
  opacity:    0.58;
  font-style: italic;
}

@media (max-width: 760px) {
  :root {
    --room-wall: clamp(68px, 18vw, 92px);
    --room-ceiling: clamp(64px, 12vh, 84px);
    --room-floor: clamp(68px, 13vh, 90px);
    --room-recede: 0px;
  }
  #icons-area { top: 10px; left: 10px; }
  .desktop-icon { width: 70px; height: 78px; padding-left: 2px; padding-right: 2px; }
  .desktop-icon .icon-label { max-width: 68px; }
}
