/* WIRED — shared styles */
:root {
  --ink: #000;
  --pink: #d6708b;
  --pink-dim: #7a3e4f;
  --bone: #c8b993;
  --ash: #6f6468;
  --line: #3a2a30;
  --panel: rgba(0, 0, 0, 0.82);
  --font: "Courier New", Courier, "MS Gothic", monospace;
}

* { box-sizing: border-box; }

/* pixel cursors, drawn like 1995 (public/cursors/*.svg, generated at 2×) */
:root {
  --cur: url(/static/cursors/arrow.svg) 1 1, default;
  --cur-hand: url(/static/cursors/hand.svg) 10 1, pointer;
  --cur-wait: url(/static/cursors/wait.svg) 11 15, progress;
  --cur-text: url(/static/cursors/text.svg) 7 15, text;
}
html { cursor: var(--cur); }
a, button, select, label, summary, [role="button"], [role="tab"], input[type="range"] { cursor: var(--cur-hand); }
input:not([type="range"]), textarea { cursor: var(--cur-text); }
button:disabled { cursor: var(--cur); }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--bone);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: none;
}

::selection { background: var(--pink); color: var(--ink); }

a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* CRT scanlines over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.25) 3px
  );
  animation: hum 7s infinite steps(1);
}
@keyframes hum {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.6; }
  98% { opacity: 1; }
  99% { opacity: 0.75; }
}

/* the backdrop image, set per page */
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--ink) center / cover no-repeat;
  z-index: 0;
  transition: opacity 0.6s;
}

.wordmark {
  font-size: 34px;
  letter-spacing: 0.6em;
  color: var(--bone);
  margin: 0;
  font-weight: normal;
  animation: drift 9s infinite steps(1);
}
@keyframes drift {
  0%, 92%, 100% { text-shadow: none; transform: none; }
  93% { text-shadow: 2px 0 var(--pink), -2px 0 #4cc3c9; transform: translateX(1px); }
  94% { text-shadow: -1px 0 var(--pink); transform: translateX(-1px); }
}

.whisper { color: var(--ash); font-size: 11px; letter-spacing: 0.08em; }
.pink { color: var(--pink); }

.blink { animation: blink 1.1s infinite steps(1); }
@keyframes blink { 50% { opacity: 0; } }

/* form bits — plain, like 1998 */
input, select, button {
  font: inherit;
  color: var(--bone);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 6px;
  outline: none;
}
input:focus, select:focus { border-color: var(--pink-dim); }
input::placeholder { color: var(--ash); }

button, .btn {
  cursor: var(--cur-hand);
  border: none;
  background: none;
  color: var(--pink);
  padding: 2px 0;
  font: inherit;
  white-space: nowrap;
}
button::before, .btn::before { content: "[ "; color: var(--ash); }
button::after, .btn::after { content: " ]"; color: var(--ash); }
button:hover, .btn:hover { color: var(--bone); text-decoration: none; }

/* panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel > header {
  display: flex;
  justify-content: space-between;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--pink);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: lowercase;
}
.panel > header span:last-child { color: var(--ash); }

/* ── pixel icons ── */
.ico { display: inline-flex; vertical-align: middle; line-height: 0; }
svg.pix { image-rendering: pixelated; display: block; }

/* icon-only buttons: no [ brackets ] */
.ib {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid transparent;
  line-height: 0;
}
.ib::before, .ib::after { content: none; }
.ib:hover, .ib:focus-visible { border-color: var(--line); background: #140c0f; }

/* ── windows 95, after dark ── */
.w95 {
  position: fixed;
  z-index: 50;
  top: 22vh;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  box-shadow: inset 1px 1px 0 #3a2a30, inset -1px -1px 0 #0d0809, 8px 8px 0 rgba(0, 0, 0, 0.55);
  padding: 2px;
}
.w95[hidden] { display: none; }
.w95-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 2px 6px;
  background: linear-gradient(90deg, #7a3e4f, #2a161c);
  color: #efe6cf;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  cursor: var(--cur); /* the pixel arrow stays while a window is dragged */
  user-select: none;
}
.w95-x, .w95btn {
  font: inherit;
  color: var(--bone);
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  cursor: var(--cur-hand);
}
.w95-x::before, .w95-x::after, .w95btn::before, .w95btn::after { content: none; }
.w95-x { width: 18px; height: 16px; padding: 0; font-size: 11px; line-height: 10px; }
.w95btn { min-width: 76px; padding: 3px 10px; }
.w95btn.primary { color: var(--pink); outline: 1px dotted var(--pink-dim); outline-offset: -5px; }
.w95-x:active, .w95btn:active { border-color: #000 #5a4048 #5a4048 #000; }
.w95btn:hover { color: #efe6cf; text-decoration: none; }
.w95btn.danger { color: #ff4d6d; }
.w95btn.danger:hover { color: #ffb3c1; }
.w95-body { display: flex; align-items: center; gap: 16px; padding: 18px 16px 14px; }
.w95-body p { margin: 0; }
.w95-body p:first-child { color: #efe6cf; }
.w95-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 12px 12px; }
.w95-actions:empty { display: none; }

/* a phone that actually rings */
.call-icon { position: relative; flex: none; width: 40px; height: 32px; }
.call-icon svg { position: absolute; inset: 0; }
.call-icon.ringing { animation: jitter 0.14s steps(2) infinite; }
.call-icon.ringing .f1 { animation: frame 0.28s steps(1) infinite; }
.call-icon.ringing .f2 { animation: frame 0.28s steps(1) infinite reverse; }
@keyframes frame { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes jitter { 0% { transform: translate(-1px, 0); } 100% { transform: translate(1px, -1px); } }

/* live call panel: scope + their volume */
.w95-live { padding: 0 16px 12px; }
.w95-live[hidden] { display: none; }
#callwin { width: 440px; }
/* five buttons in a call: compact, and they wrap rather than spill out */
#callActions { flex-wrap: wrap; justify-content: flex-end; }
#callwin .w95btn { min-width: 0; padding: 3px 9px; }
.w95-live canvas {
  display: block;
  width: 100%;
  height: 56px;
  image-rendering: pixelated;
  border: 2px solid;
  border-color: #000 #5a4048 #5a4048 #000; /* sunken, like a 95 display well */
}
.live-legend { display: flex; justify-content: space-between; padding: 3px 1px 6px; }
.live-ctl { display: flex; align-items: center; gap: 8px; }
.live-ctl span { min-width: 44px; text-align: right; }

/* win95 trackbar */
.w95 input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: var(--cur-hand);
}
.w95 input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: #0a0607;
  border: 1px solid;
  border-color: #000 #5a4048 #5a4048 #000;
}
.w95 input[type="range"]::-moz-range-track {
  height: 2px;
  background: #0a0607;
  border: 1px solid;
  border-color: #000 #5a4048 #5a4048 #000;
}
.w95 input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 18px;
  margin-top: -8px;
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  border-radius: 0;
}
.w95 input[type="range"]::-moz-range-thumb {
  width: 6px;
  height: 14px;
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  border-radius: 0;
}
.w95 input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 1px dotted var(--pink); }

/* ── master volume: [speaker] ——o—— 70 ── */
.vol { display: inline-flex; align-items: center; gap: 6px; }
.vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 14px;
  padding: 0;
  border: none;
  background: transparent;
}
.vol input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: #2a1a20; border: 1px solid #000; }
.vol input[type="range"]::-moz-range-track { height: 3px; background: #2a1a20; border: 1px solid #000; }
.vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 7px;
  height: 13px;
  margin-top: -6px;
  background: #1a1215;
  border: 1px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  border-radius: 0;
}
.vol input[type="range"]::-moz-range-thumb { width: 5px; height: 11px; background: #1a1215; border: 1px solid #5a4048; border-radius: 0; }
.vol input[type="range"]:hover::-webkit-slider-thumb { border-color: var(--pink) #000 #000 var(--pink); }
.vol-val { min-width: 2.2ch; font-size: 10px; color: var(--ash); letter-spacing: 0.05em; }

/* ── the cursed hour (3:00–3:33) ── colours turn, blacks lift a little */
html.cursed { filter: invert(0.1) hue-rotate(165deg) saturate(1.35) contrast(1.08); }
html.cursed.cursed-flip { filter: invert(1) hue-rotate(180deg); }

/* group calls: one row per presence */
.people { display: grid; gap: 4px; margin-top: 2px; }
.cp { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px auto 70px 34px; align-items: center; gap: 6px; font-size: 11px; }
.cp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bone); }
.cp.me .cp-name { color: var(--pink); }
.cp.wait { opacity: 0.55; font-style: italic; }
.cp-tag { font-size: 9px; letter-spacing: 0.08em; color: var(--ash); white-space: nowrap; }
.cp-tag.bad { color: #ff4d6d; }
.cp-tag.ok { color: #7fe3ff; }
.cp canvas.meter { width: 52px; height: 8px; image-rendering: pixelated; border: 1px solid; border-color: #000 #5a4048 #5a4048 #000; }
.w95 .cp input[type="range"] { width: 70px; }
.cp-val { text-align: right; color: var(--ash); font-size: 10px; }
.cp-why { grid-column: 1 / -1; margin: -2px 0 2px; font-size: 10px; color: #ff8fa3; line-height: 1.4; }
.pick { margin-top: 8px; padding: 4px; border: 2px solid; border-color: #000 #5a4048 #5a4048 #000; max-height: 120px; overflow-y: auto; }
.pick[hidden] { display: none; }
.pick button { display: block; width: 100%; text-align: left; padding: 2px 6px; color: var(--bone); }
.pick button::before, .pick button::after { content: none; }
.pick button:hover, .pick button:focus-visible { background: #7a3e4f; color: #efe6cf; text-decoration: none; }
.pick .none { color: var(--ash); font-size: 11px; padding: 2px 6px; }

/* visually hidden, still read aloud */
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }

/* ── the jam window: floating, on the right, next to the call ── */
.jamwin { width: 420px; top: 12vh; left: auto; right: 3vw; transform: none; z-index: 55; }
.jamwin[hidden] { display: none; }
.jam-bar { cursor: var(--cur); /* the pixel arrow stays while a window is dragged */ }
.jam-body { padding: 10px 14px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.jam-body > * { min-width: 0; }
.jam-np-led, .jam-meter { display: block; image-rendering: pixelated; border: 2px solid; border-color: #000 #5a4048 #5a4048 #000; }
.jam-np-led { width: 100%; height: 40px; box-sizing: border-box; }
.jam-row { display: flex; gap: 10px; align-items: stretch; }
.jam-meter { width: 230px; height: 46px; flex: none; }
.jam-time { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.jam-t { color: #efe6cf; font-size: 13px; letter-spacing: 0.06em; }
.jam-by { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jamwin { position: fixed; }
.jam-player { position: absolute; left: 0; top: 0; width: 2px; height: 2px; overflow: hidden; opacity: 0; pointer-events: none; }
.jam-player iframe, .jam-player > div { display: block; width: 320px; height: 96px; border: 0; }
/* only when a source can't be driven from here (a bandcamp page with no stream) */
.jam-player.show { position: static; width: auto; height: auto; opacity: 1; pointer-events: auto; }
.jam-player.show iframe { width: 100%; height: 42px; }
/* youtube: its player in sight (youtube needs a visible one), the others stay hidden */
.jam-player.yt { position: static; width: auto; height: auto; opacity: 1; pointer-events: auto; border: 2px solid; border-color: #000 #5a4048 #5a4048 #000; background: #000; }
.jam-player.yt iframe, .jam-player.yt > div { width: 100%; height: 200px; }
/* youtube asking for a click (an ad, blocked autoplay): its player, at a size it accepts */
.jam-player.show-yt iframe, .jam-player.show-yt > div { width: 100%; height: 200px; }
.jam-src { color: #49d2ff; }
.jam-note { margin: 0; font-size: 10px; color: #7fe3ff; }
.jam-note:empty { display: none; }
.jam-ctl { display: flex; align-items: center; gap: 8px; }
.jam-ctl .w95btn { min-width: 64px; }
.jam-ctl .w95btn:disabled, .jam-add .w95btn:disabled { opacity: 0.4; }
.jam-vol { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.jam-vol input[type="range"] { width: 90px; }
.jam-add { display: flex; gap: 6px; }
.jam-add .w95btn { min-width: 0; padding: 3px 9px; }
.jam-add input { flex: 1; min-width: 0; font-size: 12px; }
.jam-err { margin: 0; min-height: 1.2em; font-size: 11px; color: #ff8fa3; }
.jam-err:empty { min-height: 0; }
.jam-queue { margin: 0; padding: 0; list-style: none; font-size: 11px; line-height: 1.6; color: var(--bone); display: grid; gap: 3px; }
.jam-qn { margin: 0; font-size: 10px; line-height: 1.6; }
.jam-by, .jam-foot, .jam-note, .jam-err { line-height: 1.6; }
.jam-queue li { display: flex; gap: 6px; align-items: center; min-width: 0; }
.jam-qt { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.jam-queue .jam-x { flex: none; }
.jam-x { color: #4a3a40; padding: 0 3px; font-size: 11px; }
.jam-x::before, .jam-x::after { content: none; }
.jam-x:hover { color: #ff4d6d; text-decoration: none; }
.jam-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.jam-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jam-modebtn { font-size: 10px; }

/* shared screens: a floating, resizable window */
.screenwin {
  top: 8vh;
  left: 8vw;
  transform: none;
  width: min(760px, 90vw);
  height: auto;
  resize: both;
  overflow: hidden;
  min-width: 260px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}
.screenwin video { flex: 1; min-height: 0; width: 100%; background: #000; object-fit: contain; display: block; }
.screen-ctl { display: flex; gap: 0; }
.screen-info { padding: 3px 6px; font-size: 10px; }
.cp-share { grid-column: 1 / -1; margin: -2px 0 2px; }
.cp-share button { font-size: 10px; color: #7fe3ff; }

/* zoomed in (ctrl +) or on a small screen: windows never leave the view, they scroll instead */
.w95 { max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; }
.screenwin { overflow: hidden; }
/* a shared screen keeps clear of the edges, even zoomed in */
.screenwin { top: clamp(8px, 8vh, 80px); left: clamp(8px, 8vw, 120px); max-height: calc(100vh - clamp(8px, 8vh, 80px) - 8px); }

/* voice changer */
.vx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.vx-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 7px;
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  color: var(--bone);
}
.vx-tile::before, .vx-tile::after { content: none; }
.vx-tile:hover { color: #efe6cf; text-decoration: none; }
.vx-tile:active { border-color: #000 #5a4048 #5a4048 #000; }
.vx-tile[aria-pressed="true"] { border-color: #000 var(--pink) var(--pink) #000; background: #2a1219; color: var(--pink); }
.vx-face { font-size: 13px; letter-spacing: 0.05em; }
.vx-name { font-size: 10px; letter-spacing: 0.1em; color: var(--ash); }
.vx-tile[aria-pressed="true"] .vx-name { color: var(--pink); }
.vx-ear { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11px; color: var(--bone); }
.vx-note { margin: 6px 0 0; font-size: 10px; }
.screen-foot { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 0; }
.screen-foot .screen-info { flex: 1; }
.w95 .screen-foot input[type="range"] { width: 90px; }

/* cameras in a call: a grid of tiles above the scope */
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px; margin-bottom: 8px; }
.cams[hidden] { display: none; }
.cam { position: relative; aspect-ratio: 16 / 9; background: #000; border: 2px solid; border-color: #000 #5a4048 #5a4048 #000; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam.mine video { transform: scaleX(-1); } /* like a mirror */
.cam-name { position: absolute; left: 4px; bottom: 3px; padding: 0 4px; font-size: 10px; color: #efe6cf; background: rgba(0, 0, 0, 0.6); }
.cam.mine .cam-name { color: var(--pink); }

/* bigger cameras: click → full width of the grid · ⤢ → own window · the call window resizes from its corner */
#callwin { resize: both; min-width: 380px; min-height: 200px; }
.cam { cursor: var(--cur-hand); }
.cam.big { grid-column: 1 / -1; }
.cam-pop {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 16px;
  color: #efe6cf;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
}
.cam-pop::before, .cam-pop::after { content: none; }
.cam:hover .cam-pop, .cam-pop:focus-visible { opacity: 1; }
.cam-pop:hover { color: var(--pink); text-decoration: none; }
.camwin { width: min(560px, 80vw); aspect-ratio: auto; }
.camwin video { aspect-ratio: 16 / 9; }

/* ── minimized windows: a taskbar at the bottom, one tab each ── */
.w95.minimized { display: none !important; }
/* title bars: the title takes the room, the buttons sit together on the right, no gaps */
.w95-title { justify-content: flex-start; gap: 0; }
.w95-title > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w95-title .w95-x { flex: none; margin: 0; }
.w95-min { line-height: 6px; }
#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  display: flex;
  gap: 4px;
  align-items: center;
  height: 30px;
  padding: 3px 6px;
  background: #1a1215;
  border-top: 2px solid #5a4048;
  box-shadow: inset 0 1px 0 #3a2a30, 0 -6px 18px rgba(0, 0, 0, 0.5);
  overflow-x: auto;
}
#taskbar[hidden] { display: none; }
.task {
  flex: 0 1 200px;
  min-width: 90px;
  height: 22px;
  padding: 0 8px;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  background: #1a1215;
  color: var(--bone);
  font-size: 11px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task::before { content: "▭ "; color: var(--pink); }
.task::after { content: none; }
.task:hover { color: #efe6cf; text-decoration: none; }
.task:active { border-color: #000 #5a4048 #5a4048 #000; }
/* the taskbar doesn't cover the message box */
body.has-taskbar .stage { padding-bottom: 56px; }

/* toasts: small win95 notices, bottom right (above the taskbar when it's there) */
#toasts { position: fixed; right: 14px; bottom: 14px; z-index: 96; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
body.has-taskbar #toasts { bottom: 44px; }
.toast {
  pointer-events: auto;
  width: 270px;
  max-width: calc(100vw - 28px);
  background: #1a1215;
  border: 2px solid;
  border-color: #5a4048 #000 #000 #5a4048;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.55);
  padding: 2px;
  animation: toastIn 0.3s steps(5);
}
.toast.out { animation: toastOut 0.25s steps(4) forwards; }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }
.toast-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 2px 2px 6px;
  background: linear-gradient(90deg, #7a3e4f, #2a161c);
  color: #efe6cf;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
}
.toast-body { padding: 9px 10px 6px; font-size: 12px; color: var(--bone); line-height: 1.5; overflow-wrap: anywhere; }
.toast-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 0 8px 8px; }
.toast-actions .w95btn { min-width: 0; padding: 2px 12px; }
