* {
  box-sizing: border-box;
}

:root {
  --grid-step: 5px;
  --map-scale: 1;
  --map-offset-x: 0px;
  --map-offset-y: 0px;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --bottom-overlay-height: 420px;
  --bottom-overlay-opacity: 0.72;
  --bottom-overlay-fade: 35%;
  --bottom-overlay-rgb: 5, 6, 7;
  --crt-opacity: 0.18;
  --crt-scale: 1;
  --crt-z: 12;
  --vignette-opacity: 0.48;
  --vignette-left-size: 18%;
  --vignette-right-size: 18%;
  --vignette-y-size: 10%;
  --vignette-z: 13;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #111315;
  overflow: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
}

.hero {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 1920px;
  height: 950px;
  flex: 0 0 auto;
  overflow: hidden;
  transform: translate(-50%, -50%);
  background: #111315;
  isolation: isolate;
}

.scan-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(10, 11, 12, 0.28), rgba(22, 24, 26, 0.06) 35%, rgba(8, 9, 10, 0.32)),
    #111315;
}

.scan-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 48%, rgba(70, 76, 80, 0.12), transparent 58%);
  mix-blend-mode: screen;
  opacity: 0.28;
}

.world-map {
  position: absolute;
  left: 960px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.world-map,
.network-overlay {
  left: calc(960px + var(--map-offset-x) + var(--parallax-x));
  top: calc(50% + var(--map-offset-y) + var(--parallax-y));
  z-index: 7;
  width: 1920px;
  height: 930px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--map-scale));
}

.network-overlay {
  position: absolute;
  z-index: 8;
  overflow: visible;
  pointer-events: none;
  shape-rendering: crispEdges;
}

.nav-art,
.copy-art {
  position: absolute;
  left: 50%;
  width: 1920px;
  max-width: none;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.nav-art {
  z-index: 30;
  top: 0;
}

.copy-art {
  z-index: 30;
  bottom: 0;
}

.bottom-gradient-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  height: var(--bottom-overlay-height);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(var(--bottom-overlay-rgb), 0) 0%,
    rgba(var(--bottom-overlay-rgb), calc(var(--bottom-overlay-opacity) * 0.45)) var(--bottom-overlay-fade),
    rgba(var(--bottom-overlay-rgb), var(--bottom-overlay-opacity)) 100%
  );
}

.hero:not(.has-art-overlay) .nav-art,
.hero:not(.has-art-overlay) .copy-art {
  display: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 11, 12, 0.1) 0, transparent 17%),
    linear-gradient(90deg, rgba(8, 9, 10, 0.18), transparent 16%, transparent 84%, rgba(8, 9, 10, 0.18));
}

.post-effect {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.crt-effect {
  z-index: var(--crt-z);
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAGCAYAAAD37n+BAAAALElEQVQYV2NkYGD4/x9IMAIxAxoDmzhIHfU0gCxFB9S1AacfsFmNJQzAoQIAH84j/OCkeYUAAAAASUVORK5CYII=");
  background-size: calc(12px * var(--crt-scale)) calc(6px * var(--crt-scale));
  image-rendering: pixelated;
  opacity: var(--crt-opacity);
  mix-blend-mode: screen;
}

.vignette-effect {
  z-index: var(--vignette-z);
  opacity: var(--vignette-opacity);
  background:
    linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.98) 3%, transparent var(--vignette-left-size), transparent 100%),
    linear-gradient(270deg, #000 0%, rgba(0, 0, 0, 0.98) 3%, transparent var(--vignette-right-size), transparent 100%),
    linear-gradient(180deg, #000 0%, transparent var(--vignette-y-size), transparent calc(100% - var(--vignette-y-size)), #000 100%),
    radial-gradient(ellipse at 50% 46%, transparent 0%, transparent 62%, rgba(0, 0, 0, 0.28) 84%, rgba(0, 0, 0, 0.72) 100%);
  mix-blend-mode: multiply;
}

.hero.has-crt-mask .crt-effect,
.hero.has-vignette .vignette-effect {
  display: block;
}

.effect-order-block {
  margin: 8px 0 10px;
}

.effect-order-title {
  margin-bottom: 6px;
  color: #bdbdbd;
  font-size: 11px;
  font-weight: 600;
}

.effect-order-list {
  display: grid;
  gap: 5px;
}

.effect-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: #dedede;
  background: #363636;
  font: inherit;
  cursor: grab;
}

.effect-order-item::after {
  content: "drag";
  color: #8e8e8e;
  font-size: 10px;
}

.effect-order-item.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.director-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 292px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  color: #e7e7e7;
  background: #2c2c2c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.director-sticky-top {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2c2c2c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.director-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 8px;
}

.director-kicker {
  margin: 0 0 2px;
  color: #8e8e8e;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
}

.director-header h1 {
  margin: 0;
  color: #f3f3f3;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
}

.performance-monitor {
  display: flex;
  justify-content: space-between;
  padding: 0 10px 8px;
  color: #9c9c9c;
  font-size: 11px;
}

.state-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 10px 8px;
}

.state-button {
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: #cfcfcf;
  background: #373737;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.state-button:hover,
.state-button.is-active {
  color: #fff;
  background: #464646;
}

.resource-monitor {
  margin: 0 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #262626;
}

.resource-monitor-head {
  display: flex;
  justify-content: space-between;
  padding: 6px 7px 5px;
  color: #d8d8d8;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.resource-monitor-head span:last-child {
  color: #9c9c9c;
  font-weight: 400;
}

.resource-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 4px 8px;
  padding: 7px;
  color: #969696;
  font-size: 10px;
  line-height: 1.1;
}

.resource-grid strong {
  min-width: 34px;
  color: #ededed;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.director-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 10px 10px;
}

.director-section-toggle {
  width: 100%;
  border: 0;
  padding: 0 0 8px;
  color: #d8d8d8;
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: default;
}

.director-group {
  margin: 0 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
}

.director-group:last-child {
  margin-bottom: 0;
}

.director-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 6px 8px;
  color: #d8d8d8;
  font-size: 12px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.director-group summary::-webkit-details-marker {
  display: none;
}

.director-group summary::after {
  content: "+";
  color: #8f8f8f;
  font-size: 13px;
  font-weight: 400;
}

.director-group[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 8px;
}

.director-group[open] summary::after {
  content: "-";
}

.director-group > :not(summary) {
  margin-left: 8px;
  margin-right: 8px;
}

.director-group > :last-child {
  margin-bottom: 8px;
}

.control-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0 0 10px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.has-number-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #bdbdbd;
}

.number-field-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.native-range-output {
  width: 58px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 0 6px;
  color: #ededed;
  background: #3b3b3b;
  font: inherit;
  text-align: right;
}

.number-scrubber {
  width: 12px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background:
    linear-gradient(90deg, transparent 3px, rgba(255, 255, 255, 0.24) 3px, rgba(255, 255, 255, 0.24) 4px, transparent 4px),
    linear-gradient(90deg, transparent 7px, rgba(255, 255, 255, 0.18) 7px, rgba(255, 255, 255, 0.18) 8px, transparent 8px),
    #363636;
  cursor: ew-resize;
}

.number-scrubber:hover,
.number-scrubber.is-dragging {
  background-color: #474747;
}

.control-group input[type="range"] {
  width: 100%;
  height: 14px;
  margin: 0;
  appearance: none;
  background: transparent;
}

.control-group input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: #555;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  width: 6px;
  height: 10px;
  margin-top: -4px;
  appearance: none;
  border-radius: 2px;
  background: #f2f2f2;
  transition: width 120ms ease, height 120ms ease, margin 120ms ease;
}

.control-group input[type="range"]:hover::-webkit-slider-thumb,
.control-group input[type="range"]:focus::-webkit-slider-thumb {
  width: 10px;
  height: 14px;
  margin-top: -6px;
}

.curve-editor {
  margin: 0 0 12px;
}

.curve-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 7px;
  color: #bdbdbd;
}

.curve-editor-head span:last-child {
  color: #8f8f8f;
  font-size: 10px;
  text-align: right;
}

.curve-editor-plot {
  display: block;
  width: 100%;
  height: 132px;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: #252525;
  touch-action: none;
}

.curve-grid-line {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}

.curve-axis {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.curve-handle-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.curve-path {
  fill: none;
  stroke: #f2f2f2;
  stroke-width: 3;
  stroke-linecap: round;
}

.curve-endpoint {
  fill: #9a9a9a;
}

.curve-handle {
  fill: #16d7ee;
  stroke: #f2f2f2;
  stroke-width: 2;
  cursor: grab;
}

.curve-handle:hover,
.curve-handle:focus {
  fill: #ff3d1f;
  outline: none;
}

.curve-handle.is-dragging {
  cursor: grabbing;
  fill: #ff3d1f;
}

.director-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px 34px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #bdbdbd;
}

.color-control span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-control input[type="color"] {
  width: 34px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 2px;
  background: #3b3b3b;
  cursor: pointer;
}

.color-control input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #f2f2f2;
}

.color-control:not(:has(input[type="checkbox"])) {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 10px;
  color: #bdbdbd;
  cursor: pointer;
}

.checkbox-label input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #f2f2f2;
}

.action-button,
.icon-action-button {
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: #ececec;
  background: #3b3b3b;
  font: inherit;
  cursor: pointer;
}

.icon-action-button {
  width: 28px;
  flex: 0 0 auto;
}

.action-button:hover,
.icon-action-button:hover {
  background: #464646;
}
