/* The Liminal workstation: the company's own desktop software, in the company's
   colours (the client's palette), a little dated, and never an imitation of
   Windows. The feed that runs round it is drawn by ring-web.js. */

.p-desk { position: fixed; inset: var(--ring-band, 0px); z-index: 20; }
.p-desk[hidden] { display: none; }
body.in-session { overflow: hidden; }
body.in-session .masthead, body.in-session .footer, body.in-session .portal, body.in-session .skip { display: none; }

.ws {
  --panel: #16191e;
  --panel-2: #1c2026;
  --line: #2a2f37;
  --line-2: #3a414c;
  --text: #d7dadf;
  --dim: #858c97;
  --amber: #d89c3a;
  --cyan: #86dfeb;
  --green: #3fb950;
  --red: #e0605a;
  --mono: Consolas, "Cascadia Mono", monospace;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(134, 223, 235, 0.06), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 3px),
    #0a0d11;
  user-select: none;
}
.ws button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
/* The font choice (LIMINAL menu), the same three pairs the client offers. */
.ws[data-font="cascadia"] { --mono: "Cascadia Mono", Consolas, monospace; }
.ws[data-font="verdana"] { --mono: "Lucida Console", Consolas, monospace; font-family: Verdana, "Segoe UI", sans-serif; }
.ws [hidden] { display: none !important; }

/* The desk ----------------------------------------------------------------- */
.ws-desk { flex: 1; position: relative; overflow: hidden; }
.ws-desk::after {
  content: "";
  position: absolute; inset: 0;
  background: url("/assets/wordmark.svg") center 45% / min(44%, 520px) no-repeat;
  opacity: 0.05;
  pointer-events: none;
}
.ws-icons { position: absolute; top: 14px; left: 14px; display: grid; gap: 8px; z-index: 1; }
.ws-icon {
  width: 88px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 7px 4px; border-radius: 4px; border: 1px solid transparent;
  font-size: 12px; text-align: center;
  /* A dark halo, so a label still reads over the lattice on the desk. */
  text-shadow: 0 1px 2px #000, 0 0 3px #0a0d11, 0 0 6px #0a0d11;
}
.ws-icon:hover { background: rgba(134, 223, 235, 0.08); }
.ws-icon:focus-visible { background: rgba(134, 223, 235, 0.14); border-color: rgba(134, 223, 235, 0.35); outline: none; }
.ws-icon img { image-rendering: pixelated; }
.ws-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
/* The bleed, drawn by signal.js: behind the icons, and over the windows. Never takes a click. */
.ws-signal { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ws-signal-desk { z-index: 0; }
.ws-signal-over { z-index: 3; }
.ws-layer > * { pointer-events: auto; }

/* Windows ------------------------------------------------------------------- */
.ws-win {
  position: absolute;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  resize: both;
  overflow: hidden;
  min-width: 260px; min-height: 160px;
  max-width: 100%; max-height: 100%;
}
.ws-win.max { border-radius: 0; resize: none; }
.ws-win.active { border-color: var(--line-2); }
.ws-titlebar {
  display: flex; align-items: center; gap: 8px;
  height: 30px; flex: none;
  padding: 0 4px 0 10px;
  background: linear-gradient(#20252c, #191c21);
  border-bottom: 1px solid var(--line);
  font: 600 11px/1 var(--mono); letter-spacing: 0.06em;
  color: var(--dim);
  touch-action: none;
}
.ws-win.active .ws-titlebar { color: var(--text); }
.ws-title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-tb { width: 26px; height: 22px; border-radius: 3px; color: var(--dim); font-size: 12px; line-height: 22px; text-align: center; }
.ws-tb:hover { background: #2b3038; color: var(--text); }
.ws-tb-close:hover { background: #5a2624; color: #ffd0cc; }
.ws-body { flex: 1; min-height: 0; display: flex; }

/* Taskbar and its menu -------------------------------------------------------- */
.ws-taskbar {
  height: 38px; flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px;
  background: #12151a;
  border-top: 1px solid var(--line);
}
.ws-start {
  display: flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 4px; background: #1a1e24;
  font: 600 11px/1 var(--mono) !important; letter-spacing: 0.1em; color: var(--amber) !important;
}
.ws-start:hover { background: #242931; }
.ws-tasks { flex: 1; min-width: 0; display: flex; gap: 4px; overflow: hidden; }
.ws-task {
  display: flex; align-items: center; gap: 6px;
  height: 28px; max-width: 220px; min-width: 0; padding: 0 10px;
  border: 1px solid transparent; border-radius: 4px; background: #1a1e24;
  font-size: 12px !important;
}
.ws-task-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-task:hover { background: #20252c; }
.ws-task.active { background: #242931; border-color: var(--line-2); }
.ws-tray { display: flex; align-items: center; gap: 9px; padding: 0 4px 0 8px; font: 12px/1 var(--mono); color: var(--dim); }
.ws-who { color: var(--text); }
.ws-light { width: 9px; height: 9px; border-radius: 50%; background: #4a5058; }
.ws-light.ACTIVE { background: var(--green); box-shadow: 0 0 6px rgba(63, 185, 80, 0.6); }
.ws-light.AWAY { background: var(--amber); }
.ws-menu, .ws-context {
  min-width: 210px; padding: 4px;
  background: #1a1e24; border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  font: 13px/1.4 "Segoe UI", system-ui, sans-serif; color: #d7dadf;
}
.ws-menu { position: absolute; left: 8px; bottom: 44px; z-index: 1000; }
.ws-context { position: fixed; z-index: 2000; }
.ws-menu-item { display: block; width: 100%; padding: 7px 12px; border-radius: 4px; text-align: left; font: inherit; color: inherit; background: none; border: 0; }
.ws-menu-item:hover, .ws-menu-item:focus-visible { background: #242931; outline: none; }
.ws-menu-sep { height: 1px; margin: 4px 6px; background: #2a2f37; }

/* Glyph icons: drawn by the company, in pixels ------------------------------- */
.ws-glyph { width: 16px; height: 16px; flex: none; display: inline-block; position: relative; }
.ws-glyph-file, .ws-glyph-sheet, .ws-glyph-config {
  background: linear-gradient(135deg, transparent 0 70%, #6b7480 70% 100%) top right / 5px 5px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 3px, #5d6570 3px 4px) 3px 5px / 8px 8px no-repeat,
    #d7dadf;
  clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%, 0 100%);
  transform: scale(0.8, 1);
}
.ws-glyph-sheet { background-color: #bfe3c4; }
.ws-glyph-config { background-color: #c9cfd8; }
.ws-glyph-image {
  background: repeating-linear-gradient(180deg, #86dfeb 0 1px, transparent 1px 3px) 3px 4px / 10px 8px no-repeat, #05080a;
  outline: 1px solid #3a414c; outline-offset: -1px;
}
.ws-glyph-zip { background: repeating-linear-gradient(180deg, #1a1e24 0 2px, #d89c3a 2px 4px) 7px 0 / 2px 16px no-repeat, #8a6a34; }
.ws-glyph-folder { background: linear-gradient(#d89c3a, #b88230); clip-path: polygon(0 18%, 40% 18%, 50% 30%, 100% 30%, 100% 90%, 0 90%); }
.ws-glyph-bin { background: linear-gradient(90deg, transparent 0 20%, #858c97 20% 80%, transparent 80%) bottom / 100% 80% no-repeat, linear-gradient(#a5acb6, #a5acb6) top / 100% 18% no-repeat; }
.ws-icons .ws-glyph { width: 32px; height: 32px; }
.ws-glyph-client { background: var(--green); border-radius: 50%; transform: scale(0.5); }
.ws-glyph-monitor { background: #05080a; border: 2px solid #858c97; border-radius: 3px; box-shadow: inset 0 -5px 0 #1f5d66, inset 0 0 0 2px #0f1a1f; }
.ws-icons .ws-glyph-monitor { width: 30px; height: 24px; margin: 4px 1px; }
.ws-icon[hidden], .ws-menu-item[hidden] { display: none; }
.ws-icon { position: relative; }
.ws-glyph-carrier { background: #1f5d66; border-radius: 5px 5px 5px 1px; box-shadow: inset 0 0 0 2px #86dfeb; }
.ws-icons .ws-glyph-carrier { width: 30px; height: 24px; margin: 4px 1px; }
.ws-badge { position: absolute; top: 2px; right: 16px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #d89c3a; color: #0a0d11; font: 700 11px/18px var(--mono); text-align: center; }
.ws-badge[hidden] { display: none; }

/* Records Browser -------------------------------------------------------------- */
.rb { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rb-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); flex: none; }
.rb-btn {
  min-width: 30px; height: 28px;
  border: 1px solid #30363f !important; border-radius: 4px; background: #1d2127 !important;
  font-size: 12.5px !important; text-align: center;
}
.rb-btn:hover:not(:disabled) { background: #2d333c !important; }
.rb-btn:disabled { color: #545b66 !important; }
.rb-wide { padding: 0 12px !important; }
.rb-crumbs {
  flex: 1; min-width: 0; height: 28px;
  display: flex; align-items: center; gap: 1px; overflow: hidden;
  padding: 0 6px; background: #0f1114; border: 1px solid #30363f; border-radius: 4px;
}
.rb-crumb { padding: 2px 6px; border-radius: 3px; font-size: 12.5px !important; white-space: nowrap; }
.rb-crumb:hover { background: #242931 !important; }
.rb-crumb.drop, .rb-node.drop, .rb-row.drop { outline: 1px dashed var(--cyan); outline-offset: -1px; background: rgba(134, 223, 235, 0.1) !important; }
.rb-sep { color: var(--dim); padding: 0 1px; }
.rb-main { flex: 1; min-height: 0; display: flex; }
.rb-tree { width: 176px; flex: none; overflow: auto; padding: 4px 0; border-right: 1px solid var(--line); }
.rb-node { display: flex; align-items: center; gap: 6px; height: 25px; padding-right: 10px; font-size: 12.5px; white-space: nowrap; }
.rb-node:hover { background: rgba(255, 255, 255, 0.03); }
.rb-node.here { background: #242931; }
.rb-twisty { width: 14px; flex: none; color: var(--dim); font-size: 10px; text-align: center; }
.rb-icon { image-rendering: pixelated; flex: none; }
.rb-list { flex: 1; min-width: 0; display: flex; flex-direction: column; outline: none; }
.rb-head, .rb-row { display: grid; grid-template-columns: minmax(150px, 2.4fr) minmax(148px, 1.3fr) minmax(112px, 1fr) minmax(56px, 0.55fr); }
.rb-head { flex: none; border-bottom: 1px solid var(--line); }
.rb-col { padding: 6px 8px !important; text-align: left; font: 600 11px/1 var(--mono) !important; letter-spacing: 0.05em; color: var(--dim) !important; white-space: nowrap; }
.rb-col.sorted { color: var(--text) !important; }
.rb-arrow { margin-left: 5px; font-size: 9px; }
.rb-rows { flex: 1; overflow: auto; }
.rb-row { align-items: center; height: 26px; border: 1px solid transparent; font-size: 12.5px; }
.rb-row:hover { background: rgba(255, 255, 255, 0.03); }
.rb-row.selected { background: rgba(134, 223, 235, 0.13); border-color: rgba(134, 223, 235, 0.3); }
.rb-row.readonly .rb-name-text { color: var(--dim); }
.rb-cell { padding: 0 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--dim); }
.rb-name { display: flex; align-items: center; gap: 7px; color: var(--text); }
.rb-name-text { overflow: hidden; text-overflow: ellipsis; }
.rb-size { text-align: right; }
.rb-rename { width: 100%; min-width: 0; font: inherit; color: var(--text); background: #0f1114; border: 1px solid var(--cyan); border-radius: 2px; padding: 1px 4px; user-select: text; }
.rb-empty { padding: 18px 12px; color: var(--dim); font-size: 12.5px; }
.rb-status { flex: none; display: flex; gap: 14px; padding: 5px 10px; border-top: 1px solid var(--line); font: 11.5px/1.3 var(--mono); color: var(--dim); }
.rb-status-msg { color: var(--cyan); }
.rb-status-msg.bad { color: var(--red); }
.bin-head, .bin-row { grid-template-columns: minmax(170px, 2fr) minmax(140px, 1.4fr) minmax(130px, 1.2fr); }

/* Text Editor ------------------------------------------------------------------ */
.ed { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ed-state { font: 11.5px var(--mono); color: var(--amber); }
.ed-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #2a2214; color: #f2d8a8; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.ed-bar > span { flex: 1; }
.ed-text {
  flex: 1; min-height: 0; resize: none;
  border: 0; outline: none; padding: 10px 12px;
  background: #0f1114; color: var(--text);
  font: 13px/1.55 var(--mono); tab-size: 4;
  white-space: pre; overflow: auto; user-select: text;
}
.ed-text[readonly] { color: var(--dim); }

/* Image Viewer and the client ---------------------------------------------------- */
.iv { flex: 1; overflow: auto; background: #05080a; }
.iv-canvas { display: block; }
.ws-client-frame { flex: 1; width: 100%; height: 100%; border: 0; background: var(--panel); }

/* Perimeter Monitor -------------------------------------------------------------- */
.pm { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #05080a; }
.pm-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pm-cam { font: 600 12px/1 var(--mono); letter-spacing: 0.08em; color: var(--cyan); }
.pm-head .spacer { flex: 1; }
.pm-body { flex: 1; min-height: 140px; display: flex; gap: 6px; padding: 6px; }
.pm-screen { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #000; }
.pm-bank { flex: none; width: 200px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.pm-thumb { position: relative; display: block; width: 200px; height: 100px; padding: 1px; background: #000; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.pm-thumb:hover { border-color: var(--cyan); }
.pm-thumb[hidden] { display: none; }
.pm-thumb-view { display: block; image-rendering: pixelated; }
.pm-thumb-label { position: absolute; left: 5px; top: 4px; font: 600 11px/1 var(--mono); letter-spacing: 0.06em; color: var(--cyan); text-shadow: 0 0 3px #000; }
.pm-view { display: block; image-rendering: pixelated; }
.pm-caption { position: absolute; left: 10px; bottom: 8px; font: 600 12px/1.3 var(--mono); letter-spacing: 0.06em; color: #e5484d; text-shadow: 0 0 3px #000; }
.pm-foot { flex: none; display: flex; gap: 10px; padding: 8px; border-top: 1px solid var(--line); height: 190px; }
.pm-map { flex: 1.3; min-width: 0; height: 100%; cursor: pointer; }
.pm-side { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.pm-stretch { font-size: 13px; line-height: 1.45; }
.pm-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pm-note { font-size: 12.5px; color: var(--amber, #d89c3a); min-height: 1.3em; }

/* Carrier ---------------------------------------------------------------------- */
.cr { flex: 1; min-height: 0; display: flex; }
.cr-channels { width: 190px; flex: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-right: 1px solid var(--line); overflow: auto; }
.cr-channel { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 3px; color: var(--dim); text-align: left; font-size: 13px; }
.cr-channel:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.cr-channel.current { background: rgba(134, 223, 235, 0.12); color: var(--text); }
.cr-channel.direct { margin-top: 10px; font-family: var(--mono); letter-spacing: 0.04em; color: var(--cyan); }
.cr-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cr-unread { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #d89c3a; color: #0a0d11; font: 700 11px/18px var(--mono); text-align: center; }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-topic { flex: none; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 12.5px; }
.cr-log { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.cr-msg { display: grid; grid-template-columns: max-content 1fr; column-gap: 10px; row-gap: 2px; align-items: baseline; font-size: 13.5px; line-height: 1.45; }
.cr-msg .cr-text, .cr-msg .cr-link { grid-column: 1 / -1; }
.cr-at { color: var(--dim); font: 12px var(--mono); }
.cr-from { font: 600 12px var(--mono); color: var(--text); white-space: nowrap; }
.cr-text, .cr-link { min-width: 0; overflow-wrap: anywhere; }
.cr-unauth .cr-from { color: var(--cyan); letter-spacing: 0.06em; }
.cr-unauth .cr-text { color: #cfe9ee; }
.cr-link { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.cr-link:hover { color: #fff; }
.cr-transmission { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.cr-code-row { display: flex; align-items: center; gap: 8px; }
.cr-code { font: 600 14px/1 var(--mono); letter-spacing: 0.08em; color: var(--cyan); padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; user-select: all; }
.cr-still { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 3px; background: rgba(0, 0, 0, 0.25); }
.cr-still-view { display: block; width: 100%; max-width: 440px; height: auto; background: #000; image-rendering: pixelated; }
.cr-still-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.cr-still-name { font: 600 12px/1.35 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.cr-still-control { font: 12px/1 var(--mono); letter-spacing: 0.06em; color: var(--amber, #d89c3a); }
.cr-still-side .rb-btn { margin-left: auto; }
.cr-still-note { flex-basis: 100%; font-size: 12.5px; color: var(--dim); min-height: 1.3em; overflow-wrap: anywhere; }

/* Overlap (installed client, Windows and macOS; STATUS.md): the workstation over
   the player's own desktop. The company's windows keep their frames and solid
   backgrounds; the desk itself is not drawn, so the desktop shows through it. */
html.overlap, html.overlap body, body.overlap .p-desk { background: transparent !important; }
body.overlap .ws { background: transparent; }
body.overlap:not(.in-session) > * { visibility: hidden; } /* nothing of the portal is laid over your desktop */
body.overlap .ws-desk::after { display: none; } /* the company's wordmark is not put on your desktop */
body.overlap .ws-signal-desk { display: none; } /* the lattice never crosses your own icons */
body.overlap[data-os="windows"] .ws-icons { left: auto; right: 14px; } /* not on top of your own */
body.overlap .ws-icon span { text-shadow: 0 1px 2px #000, 0 0 5px #000; } /* readable on any wallpaper */
/* Corner: the client alone fills the panel. */
body.corner .p-desk { inset: 0; }
.p-corner-frame { display: block; width: 100%; height: 100%; border: 0; background: #0a0d11; }
.p-overlap-note {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 8px 14px; border: 1px solid #3a414c; border-radius: 3px; background: #16191e;
  color: #d7dadf; font: 600 13px/1.3 Consolas, "Cascadia Mono", monospace; letter-spacing: 0.04em;
}
