/* THE GOD TERMINAL — the ordinary-desktop costume (js/costume.js).
 * Deliberately off-palette: its own early-2000s tokens live on .cs, not :root. */

.cs {
  --cs-font: Tahoma, Verdana, 'Segoe UI', Geneva, sans-serif;
  --cs-teal: #0f8483;
  --cs-select: #316ac5;
  --cs-face: #ece9d8;
  --cs-frame: #0a3ed6;
  --cs-task-h: 2.75rem;
  overflow: hidden;
  background: #000; /* only seen around the screen while it switches on or off */
  font-family: var(--cs-font);
  font-size: 1rem;
  line-height: 1.3;
  color: #000;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  text-shadow: none;
}
.cs:focus { outline: none; }
/* Painted once after boot, invisibly, so the first switch-on doesn't stall (see prewarm()). */
.cs.is-warming { opacity: 0.01; pointer-events: none; }
.cs button { font-family: var(--cs-font); cursor: default; -webkit-tap-highlight-color: transparent; }
.cs-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.cs-art { display: block; width: 100%; height: 100%; overflow: visible; }

/* ───────── screen + wallpaper ───────── */
.cs-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform-origin: 50% 50%;
  /* Teal with a soft lamp-lit centre, a gentle diagonal sheen and fine paper grain. */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.05) 46%, transparent 62%),
    radial-gradient(120% 95% at 50% 38%, #24a8a5 0%, #128d8b 42%, #0a6a6b 82%, #075355 100%),
    var(--cs-teal);
}
.cs-desk { position: relative; flex: 1; min-height: 0; }

/* ───────── desktop icons ───────── */
.cs-icons {
  position: absolute;
  inset: 0;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.5rem 0.5rem max(0.6rem, env(safe-area-inset-left));
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 6.4rem);
  grid-auto-columns: 6.5rem;
  gap: 0.35rem 0.5rem;
  align-content: start;
  justify-content: start;
}
.cs-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 6.5rem;
  min-height: 5.5rem;
  padding: 0.3rem 0.15rem;
  border: 0;
  border-radius: 3px;
  background: none;
  color: #fff;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
}
.cs-icon:focus { outline: none; }
.cs-icon.is-pressed { transform: scale(1.07); }
.cs-icon-art {
  width: 3.25rem;
  height: 3.25rem;
  filter: drop-shadow(1px 2px 1.5px rgba(0, 0, 0, 0.45));
}
.cs-icon.is-selected .cs-icon-art .cs-art { filter: url(#cs-tint); }
.cs-icon-label {
  max-width: 100%;
  padding: 0.05rem 0.25rem 0.1rem;
  border: 1px dotted transparent;
  font-size: 0.875rem;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 1px 1px 1px #000, 0 0 3px rgba(0, 0, 0, 0.6);
  /* Long names are clipped to two lines until selected, as they always were. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-icon.is-selected .cs-icon-label {
  background: var(--cs-select);
  text-shadow: none;
  -webkit-line-clamp: 4;
}
.cs-icon:focus-visible .cs-icon-label { border-color: #fff; }
.cs-icon:hover:not(.is-selected) .cs-icon-art { filter: drop-shadow(1px 2px 1.5px rgba(0, 0, 0, 0.45)) brightness(1.08); }

.cs-marquee {
  position: absolute;
  border: 1px solid #4a8cf0;
  background: rgba(64, 128, 230, 0.28);
  pointer-events: none;
}

/* ───────── taskbar ───────── */
.cs-taskbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: stretch;
  height: calc(var(--cs-task-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, #3d7ef0 0%, #5d9cf6 4%, #2c69e3 9%, #2560db 30%, #2462d8 70%, #1f58cb 92%, #1747b0 100%);
  border-top: 1px solid #0e3fa8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 -1px 3px rgba(0, 0, 0, 0.25);
  z-index: 3;
}
.cs-start {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  padding: 0 1.4rem 0 0.6rem;
  border: 0;
  border-radius: 0 0.9rem 0.9rem 0;
  background: linear-gradient(180deg, #4fae4f 0%, #79d36f 6%, #46b043 14%, #3ba13a 50%, #33912f 85%, #2a7d27 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), inset -2px 0 3px rgba(0, 0, 0, 0.25), 2px 0 4px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: 'Trebuchet MS', 'Segoe UI', Tahoma, sans-serif;
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.55);
  transform-origin: 0 50%;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1), filter 120ms;
}
.cs-start:hover { filter: brightness(1.1); }
.cs-start.is-pressed, .cs-start.is-open {
  background: linear-gradient(180deg, #2b7f28 0%, #36962f 30%, #3aa236 70%, #42ac3d 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 2px 0 4px rgba(0, 0, 0, 0.35);
}
.cs-start.is-pressed { transform: scale(1.06); }
.cs-start-logo {
  width: 1.6rem;
  height: 1.6rem;
  filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5));
}

.cs-tasks {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  padding: 0 0.5rem;
  overflow: hidden;
}
.cs-task {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 1 11rem;
  min-width: 2.75rem;
  height: calc(var(--cs-task-h) - 0.6rem);
  padding: 0 0.6rem;
  border: 1px solid #1c4fbf;
  border-radius: 4px;
  background: linear-gradient(180deg, #5d9bf8, #3b7ff0 45%, #3375e8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.875rem;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.35);
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
}
.cs-task.is-active { background: linear-gradient(180deg, #1c4fbf, #2559c9); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35); }
.cs-task.is-pressed { transform: scale(1.06); }
.cs-task-icon { flex: none; width: 1.25rem; height: 1.25rem; }
.cs-task-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cs-tray {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: none;
  padding: 0 0.9rem 0 0.75rem;
  border-left: 1px solid #0d3a9a;
  background: linear-gradient(180deg, #13a1ef 0%, #18aaf3 8%, #0f94e8 50%, #0b84dd 92%, #0a72c9 100%);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.35);
}
.cs-tray-icon { width: 1.2rem; height: 1.2rem; filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.3)); }
.cs-clock {
  min-width: 4.6em;
  color: #fff;
  font-size: 0.875rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

/* ───────── Start menu ───────── */
.cs-menu {
  position: absolute;
  left: 0;
  bottom: calc(var(--cs-task-h) + env(safe-area-inset-bottom));
  z-index: 4;
  width: min(25rem, 100vw - 0.5rem);
  border: 1px solid #0b3cb6;
  border-radius: 0.55rem 0.55rem 0 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.45);
  transform-origin: 0 100%;
}
.cs-menu-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(180deg, #1a6fd8 0%, #3c8ff0 12%, #2a7ae6 40%, #1c63cf 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.cs-menu-head::after { content: none; }
.cs-menu-avatar {
  flex: none;
  width: 3.2rem;
  height: 3.2rem;
  padding: 0.25rem;
  border: 2px solid #fff;
  border-radius: 0.35rem;
  background: linear-gradient(160deg, #bfe3ff, #6fb0f2);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}
.cs-menu-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  font-size: 1.125rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.cs-menu-cols {
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, transparent, #f5a434 30%, #f5a434 70%, transparent) 1;
}
.cs-menu-left, .cs-menu-right { display: flex; flex-direction: column; padding: 0.35rem; }
.cs-menu-right { background: #d6e6fb; border-left: 1px solid #a9c8f0; }
.cs-menu-sep { width: 90%; margin: 0.2rem auto; border: 0; border-top: 1px solid #d3d3d3; }
.cs-menu-right .cs-menu-sep { border-top-color: #a9c8f0; }
.cs-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  padding: 0.2rem 0.45rem;
  border: 0;
  border-radius: 3px;
  background: none;
  color: #000;
  font-size: 0.875rem;
  text-align: left;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
  transform-origin: 20% 50%;
}
.cs-menu-right .cs-menu-item { color: #0a246a; }
.cs-menu-item b { font-weight: 400; }
.cs-menu-item.is-big b, .cs-menu-right .cs-menu-item b { font-weight: 700; }
.cs-menu-item small { display: block; color: #6d6d6d; font-size: 0.75rem; }
.cs-menu-item:hover, .cs-menu-item:focus-visible { background: var(--cs-select); color: #fff; outline: none; }
.cs-menu-item:hover small, .cs-menu-item:focus-visible small { color: #dce8ff; }
.cs-menu-item.is-pressed { transform: scale(1.04); }
.cs-menu-art { flex: none; width: 1.6rem; height: 1.6rem; }
.cs-menu-item.is-big .cs-menu-art { width: 2.2rem; height: 2.2rem; }
.cs-menu-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  background: linear-gradient(180deg, #2a7ae6 0%, #1c63cf 60%, #1856bd 100%);
}
.cs-menu-foot-btn, .cs-menu-exit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #fff;
  font-size: 0.875rem;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.45);
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1), background-color 120ms;
}
.cs-menu-foot-btn:hover, .cs-menu-foot-btn:focus-visible { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); outline: none; }
.cs-menu-exit {
  border-color: #0a3d14;
  background: linear-gradient(180deg, #1f3a26, #0b150e);
  color: #8dffb0;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(80, 255, 140, 0.7);
  box-shadow: 0 0 10px rgba(60, 255, 130, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.cs-menu-exit:hover, .cs-menu-exit:focus-visible {
  outline: none;
  background: linear-gradient(180deg, #24502f, #0d2214);
  box-shadow: 0 0 16px rgba(60, 255, 130, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.cs-menu-foot-btn.is-pressed, .cs-menu-exit.is-pressed { transform: scale(1.07); }

/* ───────── wallpaper right-click menu ───────── */
.cs-ctx {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  min-width: 14rem;
  padding: 0.2rem;
  border: 1px solid #aca899;
  background: #fff;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.35);
  transform-origin: 0 0;
}
.cs-ctx-item {
  display: block;
  width: 100%;
  min-height: 2rem;
  padding: 0.25rem 1.6rem;
  border: 0;
  background: none;
  color: #000;
  font-size: 0.875rem;
  text-align: left;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
  transform-origin: 15% 50%;
}
.cs-ctx-item:hover, .cs-ctx-item:focus-visible { background: var(--cs-select); color: #fff; outline: none; }
.cs-ctx-item.is-pressed { transform: scale(1.04); }
.cs-ctx .cs-menu-sep { width: auto; margin: 0.2rem 0.15rem; border-top-color: #aca899; }

/* ───────── dialogs ───────── */
/* Its own stacking layer: windows keep their order among themselves but stay under the
 * taskbar (3), Start menu / context menu (4) and tray balloon (5). */
.cs-windows { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cs-win {
  position: absolute;
  left: 0;
  top: 0;
  width: min(23rem, calc(100vw - 1rem));
  border: 3px solid var(--cs-frame);
  border-top: 0;
  border-radius: 0.5rem 0.5rem 0 0;
  background: var(--cs-face);
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}
.cs-win:not(.is-active) { --cs-frame: #7a96df; }
.cs-win-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  margin: 0 -3px;
  padding: 0 0.3rem 0 0.5rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: linear-gradient(180deg, #0a5ef7 0%, #3d8cff 8%, #0b5ff2 22%, #0656ea 60%, #0353e8 85%, #0447c9 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  touch-action: none;
}
.cs-win:not(.is-active) .cs-win-bar { background: linear-gradient(180deg, #7b9fe8, #9db8ef 10%, #7f9ee4 60%, #7593db); }
.cs-win.is-dragging .cs-win-bar { cursor: move; }
.cs-win-icon { flex: none; width: 1.15rem; height: 1.15rem; }
.cs-win-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  text-shadow: 1px 1px 1px #0f1a63;
}
.cs-win-x {
  position: relative;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid #fff;
  border-radius: 3px;
  background: linear-gradient(180deg, #f28b6c, #e2502d 45%, #c83a1b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1), filter 120ms;
}
.cs-win-x::before, .cs-win-x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 2.5px;
  border-radius: 1px;
  background: #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}
.cs-win-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cs-win-x:hover { filter: brightness(1.12); }
.cs-win-x.is-pressed { transform: scale(1.12); filter: brightness(0.9); }
.cs-win-body { padding: 1rem 1rem 0.9rem; }
.cs-win-msg { display: flex; align-items: flex-start; gap: 0.9rem; }
.cs-win-big { flex: none; width: 2.5rem; height: 2.5rem; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.25)); }
.cs-win-msg p { margin: 0.15rem 0 0; font-size: 0.9375rem; line-height: 1.4; }
.cs-win-btns { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem; }
.cs-btn {
  min-width: 5.5rem;
  min-height: 2rem;
  padding: 0.2rem 0.9rem;
  border: 1px solid #003c74;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff, #f3f2ec 60%, #d6d0c0);
  color: #000;
  font-size: 0.875rem;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1), box-shadow 120ms;
}
.cs-btn:hover { box-shadow: inset 0 0 0 2px #f8b636, inset 0 -2px 0 2px #e69a14; }
.cs-btn:focus-visible, .cs-btn:focus { outline: 1px dotted #000; outline-offset: -4px; box-shadow: inset 0 0 0 2px #98b8ea; }
.cs-btn.is-pressed { transform: scale(1.07); background: linear-gradient(180deg, #e4e0d2, #f2f0e8); }

/* ───────── tray balloon ───────── */
.cs-balloon {
  position: absolute;
  right: max(0.5rem, env(safe-area-inset-right));
  bottom: calc(var(--cs-task-h) + env(safe-area-inset-bottom) + 0.85rem);
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: min(21rem, calc(100vw - 1rem));
  padding: 0.7rem 0.6rem 0.75rem 0.75rem;
  border: 1px solid #000;
  border-radius: 0.55rem;
  background: #ffffe1;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.4);
  transform-origin: 85% 100%;
}
.cs-balloon::after {
  content: '';
  position: absolute;
  right: 4.5rem;
  bottom: -0.75rem;
  width: 1.1rem;
  height: 0.75rem;
  background: #000;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.cs-balloon::before {
  content: '';
  position: absolute;
  right: calc(4.5rem + 1px);
  bottom: calc(-0.75rem + 2px);
  z-index: 1;
  width: calc(1.1rem - 2px);
  height: 0.75rem;
  background: #ffffe1;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.cs-balloon-icon { flex: none; width: 1.5rem; height: 1.5rem; }
.cs-balloon-text { flex: 1; min-width: 0; }
.cs-balloon-text b { display: block; font-size: 0.9375rem; }
.cs-balloon-text p { margin: 0.25rem 0 0; font-size: 0.875rem; line-height: 1.35; }
.cs-balloon-x {
  position: relative;
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  margin: -0.2rem -0.1rem 0 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
}
.cs-balloon-x::before, .cs-balloon-x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60%;
  height: 1.5px;
  background: #333;
  transform: translate(-50%, -50%) rotate(45deg);
}
.cs-balloon-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cs-balloon-x:hover { border-color: #c8c8a8; background: #fff; }
.cs-balloon-x.is-pressed { transform: scale(1.15); }

/* ───────── the screen switch: glare over the screen, black around it ───────── */
.cs-switch {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.cs-beam {
  width: 100%;
  height: 100%;
  background: radial-gradient(75% 75% at 50% 50%, #ffffff 0%, #f0fffd 45%, #a6f0ea 100%);
  transform: scale(0, 0.004);
}

/* ───────── touch & small screens ───────── */
@media (pointer: coarse) {
  .cs { --cs-task-h: 3.25rem; }
  .cs-win-bar { height: 2.75rem; }
  .cs-win-x { width: 2.4rem; height: 2.2rem; }
  .cs-btn { min-height: 2.75rem; }
  .cs-ctx-item { min-height: 2.75rem; }
  .cs-balloon-x { width: 2.5rem; height: 2.5rem; margin: -0.5rem -0.4rem 0 0; }
}
@media (max-width: 599px) {
  .cs-icons { grid-template-rows: repeat(auto-fill, 6.6rem); }
  .cs-start { padding-right: 1.1rem; font-size: 1.2rem; }
  .cs-task { flex-basis: 2.75rem; padding: 0 0.5rem; justify-content: center; }
  .cs-task-label { display: none; }
  .cs-tray { gap: 0.45rem; padding: 0 0.7rem 0 0.6rem; }
  .cs-tray-icon:first-child { display: none; }
  .cs-menu-cols { grid-template-columns: 1fr 1fr; }
  .cs-menu-item { min-height: 2.75rem; }
  .cs-menu-foot { justify-content: space-between; }
}

/* App windows (Photos, Internet) registered via GT.costume.registerApp: a sized window whose body the app fills. */
.cs-win.cs-app { display: flex; flex-direction: column; max-width: none; }
.cs-win.cs-app .cs-app-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
