:root {
  --face: #d4d0c8;
  --navy: #0a246a;
  --desk: #3a6ea5;
  --light: #ffffff;
  --dark: #404040;
  --mid: #808080;
  --title-a: #2d2a28;
  --title-b: #4a4540;
  --title-idle-a: #6e6a66;
  --title-idle-b: #908c88;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font: 11px/1.35 Tahoma, "MS Sans Serif", "Segoe UI", sans-serif;
  color: #000;
  background: var(--desk);
  overflow: auto;
}

.desktop {
  position: relative;
  min-width: 1260px;
  min-height: calc(100vh - 30px);
  height: calc(100vh - 30px);
  padding-bottom: 0;
}

/* ---- desktop icons ---- */

.icons {
  position: absolute;
  left: 8px;
  top: 10px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 88px;
}

.desk-icon {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  width: 88px;
  color: #fff;
  text-decoration: none;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font: 11px/1.2 Tahoma, "MS Sans Serif", sans-serif;
}

.desk-icon span:last-child {
  padding: 1px 3px;
  max-width: 88px;
  overflow-wrap: anywhere;
}

.desk-icon:focus,
.desk-icon:hover span:last-child,
.desk-icon.sel span:last-child {
  outline: 1px dotted #fff;
  background: #00008099;
}

.ico {
  width: 32px;
  height: 32px;
  display: block;
  image-rendering: pixelated;
  background: center / 32px 32px no-repeat;
}

.ico-win {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='2' y='4' width='28' height='22' rx='1' fill='%230a246a' stroke='%23fff' stroke-width='1'/><rect x='4' y='8' width='24' height='14' fill='%237eb8da'/><rect x='11' y='26' width='10' height='3' fill='%23c0c0c0'/><rect x='8' y='29' width='16' height='2' fill='%23808080'/></svg>");
}
.ico-mac {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='5' y='6' width='22' height='16' rx='2' fill='%23c0c0c0' stroke='%23404040'/><rect x='7' y='8' width='18' height='10' fill='%23111'/><rect x='4' y='22' width='24' height='5' rx='1' fill='%23e0e0e0' stroke='%23808080'/><circle cx='22' cy='24.5' r='1.2' fill='%2366cc66'/></svg>");
}
.ico-deb {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='8' y='8' width='16' height='18' fill='%23e95420' stroke='%237a2a10'/><rect x='6' y='12' width='20' height='6' fill='%23ef7a4a'/><text x='16' y='22' text-anchor='middle' font-size='9' font-family='Tahoma' fill='%23fff'>deb</text></svg>");
}
.ico-rpm {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><ellipse cx='16' cy='16' rx='12' ry='12' fill='%23294172'/><ellipse cx='16' cy='16' rx='7' ry='7' fill='%233e6ab0'/><text x='16' y='19' text-anchor='middle' font-size='8' font-family='Tahoma' fill='%23fff'>rpm</text></svg>");
}
.ico-src {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><path d='M4 10h10l2 3h12v14H4z' fill='%23e6d084' stroke='%23806b20'/><path d='M4 10V8h8l2 2' fill='%23f3e6a8'/></svg>");
}
.ico-txt {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><path d='M8 3h11l7 7v19H8z' fill='%23fff' stroke='%23404040'/><path d='M19 3v7h7' fill='%23e8e8e8' stroke='%23404040'/><path d='M11 16h12M11 20h12M11 24h8' stroke='%23000' stroke-width='1.4'/></svg>");
}

/* ---- windows ---- */

.win {
  position: absolute;
  background: var(--face);
  display: flex;
  flex-direction: column;
  min-width: 180px;
  min-height: 80px;
  border: 1px solid #1a1a1a;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .35);
  user-select: none;
}

.win.notepad {
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: 1px 1px 0 #0006;
}

.win.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  box-shadow: none;
  border-radius: 0;
}

.win.minimized,
.win.closed { display: none; }

.titlebar {
  height: 20px;
  padding: 0 4px 0 6px;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: default;
  flex: 0 0 auto;
  gap: 8px;
}

.win.app .titlebar {
  background: linear-gradient(90deg, var(--title-idle-a), var(--title-idle-b));
}

.win.app.active .titlebar {
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
}

.win.notepad .titlebar {
  background: linear-gradient(90deg, #808080, #c0c0c0);
  height: 18px;
}

.win.notepad.active .titlebar {
  background: linear-gradient(90deg, #0a246a, #a6caf0);
}

.titlebar > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dots {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 0 0 auto;
}

.dots button {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6b6560;
  border: 1px solid #2a2725;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.win.active .dots button { background: #7a7570; }

.dots button:hover { filter: brightness(1.25); }
.dots button[data-close]:hover { background: #b44; }

.caps { display: flex; gap: 2px; }

.cap {
  width: 16px;
  height: 14px;
  padding: 0;
  background: var(--face);
  border: 1px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
  cursor: pointer;
  position: relative;
}

.cap:active {
  border-color: var(--dark) var(--light) var(--light) var(--dark);
}

.cap.min::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 2px;
  height: 2px;
  background: #000;
}

.cap.max::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 2px;
  bottom: 2px;
  border: 1px solid #000;
  border-top-width: 2px;
}

.win.maximized .cap.max::after {
  left: 4px;
  top: 3px;
  width: 6px;
  height: 6px;
  right: auto;
  bottom: auto;
  box-shadow: -2px -2px 0 -1px var(--face), -2px -2px 0 0 #000;
}

.cap.close::before,
.cap.close::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 6px;
  height: 1.5px;
  background: #000;
}
.cap.close::before { transform: rotate(45deg); }
.cap.close::after { transform: rotate(-45deg); }

.menubar {
  padding: 2px 8px;
  color: #222;
  flex: 0 0 auto;
}

.menubar span { margin-right: 12px; }
.menubar u { text-underline-offset: 1px; }

.body {
  padding: 6px 8px 14px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.video {
  background: #000;
  border: 2px inset #808080;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.video-wrap { position: relative; }

.pip {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 28%;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px #000;
  pointer-events: none;
}

.row {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex: 0 0 auto;
}

.row.start { justify-content: flex-start; }

.btn {
  flex: 1;
  background: var(--face);
  border: 2px solid #fff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  padding: 3px 4px;
  font: inherit;
  text-align: center;
  color: #000;
  cursor: pointer;
}

.btn:active {
  border-color: #404040 #fff #fff #404040;
}

.btn.fixed { flex: 0 0 auto; width: 76px; }
.btn.widebtn { flex: 0 0 auto; width: 128px; }
.row.start { width: max-content; }
.btn.send { flex: 0 0 64px; }
.btn.combo { flex: 1; text-align: left; padding-left: 6px; }

.banner {
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 3px;
  margin-top: 6px;
}

.small {
  margin: 6px 0 3px;
}

.list {
  background: #fff;
  border: 2px inset #808080;
  min-height: 40px;
  padding: 3px 5px;
  flex: 0 0 auto;
}

.win.maximized .list,
.win.maximized .chatlog,
.win.maximized .board,
.win.maximized .table-wrap {
  flex: 1 1 auto;
  max-height: none;
  height: auto;
}

.tools {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.iconbtn {
  width: 32px;
  height: 28px;
  border: 2px solid #fff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  background: var(--face);
  display: grid;
  place-items: center;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.iconbtn:active {
  border-color: #404040 #fff #fff #404040;
}

.status {
  border-top: 1px solid #808080;
  padding: 3px 8px;
  font-size: 11px;
  color: #222;
  flex: 0 0 auto;
}

.blurb { margin: 0 0 6px; }
.logged { margin: 0 0 6px; color: #333; }

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
}

.tab {
  background: #c4c0b8;
  border: 1px solid #808080;
  padding: 3px 10px;
  font: inherit;
  cursor: pointer;
}

.tab.on {
  background: var(--face);
  border-bottom-color: var(--face);
  position: relative;
  z-index: 1;
}

.table-wrap {
  background: #fff;
  border: 2px inset #808080;
  overflow: auto;
  max-height: 140px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 11px;
}

th {
  background: var(--navy);
  color: #fff;
  text-align: left;
  padding: 3px 6px;
  font-weight: 600;
}

td {
  border-bottom: 1px solid #ddd;
  padding: 4px 6px;
  white-space: nowrap;
}

tr.you td { background: #e8e4dc; }
tr.sel td { background: #0a246a; color: #fff; }

.chatlog {
  background: #fff;
  border: 2px inset #808080;
  height: 108px;
  padding: 6px;
  overflow: auto;
  flex: 0 0 auto;
  user-select: text;
}

.chatlog p { margin: 0 0 5px; }
.whisper { color: #444; font-style: italic; }

.board {
  background: #fff;
  border: 2px inset #808080;
  height: 168px;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.board svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pointer {
  position: absolute;
  left: 62%;
  top: 40%;
  width: 0;
  height: 0;
  border-left: 10px solid #c00;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.pointer span {
  position: absolute;
  left: 12px;
  top: -6px;
  color: #c00;
  font-size: 11px;
  font-weight: 700;
}

.palette {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.palette .btn { flex: 0 0 auto; padding: 3px 8px; }

.swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #404040;
  display: inline-block;
}

.inputrow {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.inputrow input {
  flex: 1;
  border: 2px inset #808080;
  padding: 3px 5px;
  font: inherit;
}

.win.notepad .menubar {
  padding: 2px 8px;
  border-bottom: 1px solid var(--mid);
}

.win.notepad pre {
  margin: 0;
  padding: 6px 8px 8px;
  background: #fff;
  border: 2px inset #808080;
  font: 11px/1.35 "Lucida Console", "Courier New", monospace;
  white-space: pre-wrap;
  flex: 1 1 auto;
  overflow: auto;
  user-select: text;
  cursor: text;
  min-height: 0;
}

.grip {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  opacity: 0;
  background:
    linear-gradient(135deg, transparent 50%, #808080 50% 55%, transparent 55% 70%, #808080 70% 75%, transparent 75% 90%, #808080 90%);
}

.win:hover .grip,
.win.active .grip { opacity: 1; }

.win.maximized .grip { display: none; }

.win.small .list { min-height: 36px; }
.win.small .banner { font-size: 11px; }
.win.small .btn { font-size: 10px; padding: 2px 2px; }

/* ---- taskbar ---- */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  background: var(--face);
  border-top: 2px solid var(--light);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 3px;
  z-index: 1000;
}

.start {
  display: flex;
  align-items: center;
  gap: 5px;
  font: 700 12px Tahoma, sans-serif;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  padding: 1px 10px 1px 5px;
  cursor: pointer;
  height: 24px;
}

.start:active,
.start[aria-expanded="true"] {
  border-color: var(--dark) var(--light) var(--light) var(--dark);
}

.start img {
  width: 16px;
  height: 16px;
}

.start-menu {
  position: absolute;
  left: 2px;
  bottom: 30px;
  width: 220px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  display: flex;
  flex-direction: column;
  padding: 2px;
  z-index: 1001;
}

.start-menu[hidden] { display: none; }

.start-banner {
  background: linear-gradient(#0a246a, #5a7ec4);
  color: #fff;
  font-weight: 700;
  font-style: italic;
  padding: 18px 10px 8px;
  margin-bottom: 2px;
}

.start-menu a,
.start-menu button {
  color: #000;
  text-decoration: none;
  padding: 6px 10px;
  text-align: left;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.start-menu a:hover,
.start-menu button:hover {
  background: var(--navy);
  color: #fff;
}

.start-menu hr {
  border: 0;
  border-top: 1px solid var(--mid);
  border-bottom: 1px solid var(--light);
  margin: 4px 6px;
}

.tasks {
  display: flex;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.task {
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--dark) var(--dark) var(--light);
  padding: 2px 10px;
  min-width: 90px;
  max-width: 160px;
  height: 22px;
  font: 11px Tahoma, sans-serif;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.task.active {
  border-color: var(--dark) var(--light) var(--light) var(--dark);
  background: #ece9d8;
  font-weight: 700;
}

.tray {
  margin-left: auto;
  border: 2px solid;
  border-color: var(--dark) var(--light) var(--light) var(--dark);
  padding: 2px 10px;
  min-width: 72px;
  text-align: center;
  height: 22px;
}

@media (max-width: 720px) {
  .desktop { min-width: 720px; }
}
