html,
body,
svg {
  padding: 0;
  margin: 0;
  font-family:
    Liberation sans,
    sans-serif;
}

:root {
  --board-shell-offset: 10px;
  --board-control-size: 40px;
  --board-control-gap: 10px;
  --board-toolbar-safe-area: calc(
    var(--board-shell-offset) +
    var(--board-control-size) +
    var(--board-control-gap)
  );
  --board-hud-gap: 6px;
  --board-hud-max-width: calc(
    100vw -
    var(--board-toolbar-safe-area) -
    var(--board-shell-offset)
  );
  --board-control-radius: 2px;
  --board-control-border: #d9dde3;
  --board-control-border-strong: #b8c0cc;
  --board-control-bg: #ffffff;
  --board-control-bg-active: #f2f7f5;
  --board-control-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  --board-control-shadow-active:
    0 0 0 1px rgba(171, 198, 198, 0.38), 0 2px 6px rgba(16, 24, 40, 0.1);
  --board-accent: #abc6c6;
  --board-accent-strong: #8fb4a8;
}

#turnstile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}

.turnstile-overlay-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

#canvas {
  transform-origin: 0 0;
}

.board-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 45;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

#loadingMessage.hidden {
  opacity: 0;
  visibility: hidden;
}

.board-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: min(320px, calc(100vw - 48px));
  max-width: 100%;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--board-control-border);
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.12);
  color: #111827;
}

.board-loading-spinner,
.board-status-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid var(--board-control-border-strong);
  border-top-color: var(--board-accent);
  box-sizing: border-box;
}

.board-loading-spinner {
  animation: board-status-spin 0.8s linear infinite;
}

.board-loading-copy {
  min-width: 0;
}

.board-loading-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

@media (max-width: 640px) {
  .board-loading {
    padding: 16px 12px 16px calc(var(--board-toolbar-safe-area) + 12px);
  }

  .board-loading-card {
    min-width: 0;
    max-width: min(260px, calc(100vw - var(--board-toolbar-safe-area) - 24px));
    gap: 9px;
    padding: 13px 14px;
  }

  .board-loading-spinner {
    width: 12px;
    height: 12px;
  }

  .board-loading-title {
    font-size: 13px;
  }
}

.board-hud {
  position: fixed;
  top: var(--board-shell-offset);
  right: var(--board-shell-offset);
  z-index: 35;
  display: grid;
  gap: var(--board-hud-gap);
  justify-items: end;
  max-width: var(--board-hud-max-width);
}

.board-hud > * {
  max-width: 100%;
}

#menu .tool,
.board-presence-toggle,
.board-status-card {
  border: 1px solid var(--board-control-border);
  border-radius: var(--board-control-radius);
  background: var(--board-control-bg);
  box-shadow: var(--board-control-shadow);
  color: #111827;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.board-status-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--board-control-size);
  width: fit-content;
  max-width: min(220px, var(--board-hud-max-width));
  padding: 0 9px;
  pointer-events: none;
}

.board-status-card[hidden] {
  display: none;
}

.board-status-copy {
  min-width: 0;
  overflow: hidden;
  max-width: 100%;
}

.board-status-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.board-status-detail {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.25;
  color: #4b5563;
  overflow-wrap: anywhere;
}

.board-status-detail-hidden {
  display: none;
}

.board-status-buffering .board-status-icon {
  animation: board-status-spin 0.8s linear infinite;
}

.board-status-buffering .board-status-title {
  color: #111827;
}

.board-status-reconnecting {
  border-color: var(--board-control-border-strong);
}

.board-status-reconnecting .board-status-icon {
  animation: board-status-spin 0.8s linear infinite;
  border-top-color: var(--board-accent-strong);
}

.board-status-paused {
  border-color: #d7c2bc;
  background: #fffaf8;
}

.board-status-paused .board-status-icon {
  border-color: #d7c2bc;
  border-top-color: #c23b22;
}

.board-status-paused .board-status-title {
  color: #7c2d12;
}

@keyframes board-status-spin {
  to {
    transform: rotate(360deg);
  }
}

.board-presence {
  position: relative;
  pointer-events: auto;
  width: fit-content;
}

.board-presence-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--board-control-size);
  min-width: var(--board-control-size);
  min-height: var(--board-control-size);
  padding: 0;
  overflow: visible;
  font: inherit;
  cursor: pointer;
}

#menu .tool:active,
#menu .tool.curTool,
.board-presence-toggle:hover,
.board-presence-toggle:focus-visible,
.board-presence-toggle-open {
  border-color: var(--board-accent);
  background: var(--board-control-bg-active);
  box-shadow: var(--board-control-shadow-active);
}

.board-presence-toggle:focus-visible {
  outline: none;
}

.board-presence-icon {
  display: block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  opacity: 0.92;
}

.board-presence-toggle .tool-name {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid var(--board-control-border-strong);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.board-presence-toggle .tool-name[hidden] {
  display: none;
}

.board-presence-toggle .tool-name[data-badge-size="single"] {
  width: 16px;
  padding: 0;
  font-size: 10px;
}

.board-presence-toggle .tool-name[data-badge-size="double"] {
  min-width: 18px;
}

.board-presence-toggle .tool-name[data-badge-size="capped"] {
  min-width: 22px;
}

.connected-users-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(220px, var(--board-hud-max-width));
  max-height: min(320px, calc(100vh - 72px));
  background: #ffffff;
  border: 1px solid var(--board-control-border);
  border-radius: var(--board-control-radius);
  box-shadow: 0 6px 14px rgba(16, 24, 40, 0.12);
  z-index: 50;
  overflow: auto;
}

.connected-users-panel-hidden {
  display: none;
}

.connected-users-panel[data-empty="true"] {
  display: none;
}

.connected-users-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.connected-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-top: 1px solid #e5e7eb;
  cursor: default;
}

.connected-user-row:first-child {
  border-top: 0;
}

.connected-user-name {
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #111111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connected-user-row-self .connected-user-name {
  font-weight: 700;
}

.connected-user-main {
  min-width: 0;
}

.connected-user-main-link {
  color: inherit;
  text-decoration: none;
  outline: none;
}

.connected-user-meta {
  font-size: 10px;
  line-height: 1.2;
  color: #444444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connected-user-color {
  --pulse-ms: 0.75s;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #111111;
  box-sizing: border-box;
  justify-self: center;
}

.connected-user-color.active {
  animation: connected-user-pulse var(--pulse-ms) ease-out 2;
}

.connected-user-row-jumpable {
  cursor: pointer;
}

.connected-user-row-jumpable:hover,
.connected-user-row-jumpable:focus-within {
  background: var(--board-control-bg-active);
  outline: none;
}

.connected-user-report {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--board-control-border);
  border-radius: 2px;
  background: #ffffff;
  color: #111111;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.connected-user-report[disabled] {
  opacity: 0.45;
  cursor: default;
}

.connected-user-report-latched {
  opacity: 1;
  background: #f3f4f6;
  border-color: var(--board-control-border-strong);
  color: #111111;
}

@keyframes connected-user-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(17, 17, 17, 0.45);
    transform: scale(1);
  }

  65% {
    box-shadow: 0 0 0 7px rgba(17, 17, 17, 0);
    transform: scale(1.35);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(17, 17, 17, 0);
    transform: scale(1);
  }
}

/* Hide scrollbar for Chrome, Safari and Opera */
#menu::-webkit-scrollbar {
  display: none;
}

#menu {
  -ms-overflow-style: none;
  scrollbar-width: none;
  font-size: 16px;
  border-radius: 0;
  overflow-y: scroll;
  position: fixed;
  margin-bottom: 30px;
  left: 0;
  top: 0;
  color: black;
  max-height: 100%;
  transition-duration: 1s;
  cursor: default;
  padding: 10px;
}

#menu.closed {
  border-radius: 3px;
  left: 10px;
  top: 10px;
  background-color: rgba(100, 200, 255, 0.7);
  width: 6vw;
  height: 2em;
  transition-duration: 1s;
}

#menu h2 {
  /*Menu title ("Menu")*/
  display: none;
  font-size: 4vh;
  text-align: center;
  letter-spacing: 0.5vw;
  text-shadow: 0px 0px 5px white;
  color: black;
  padding: 0;
  margin: 0;
}

#menu .tools {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

#settings {
  margin: calc(var(--board-control-gap) * 2) 0 20px;
}

#menu .tool {
  position: relative;
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Opera and Firefox */
  pointer-events: auto;
  white-space: nowrap;
  list-style-position: inside;
  text-decoration: none;
  cursor: pointer;
  height: var(--board-control-size);
  line-height: var(--board-control-size);
  max-width: var(--board-control-size);
  transition-duration: 0.2s;
  overflow: hidden;
  width: max-content;
}

#menu .tool + .tool {
  margin-top: var(--board-control-gap);
}

#menu .tool:hover {
  max-width: 100%;
}

@media (hover: none), (pointer: coarse) {
  #menu .tool:hover {
    max-width: var(--board-control-size);
  }

  #menu .tool:focus {
    max-width: 100%;
  }

  #menu {
    pointer-events: auto;
  }

  #menu:focus-within {
    pointer-events: none;
  }
}

#menu .oneTouch:active {
  border-radius: var(--board-control-radius);
  background-color: var(--board-control-bg-active);
}

#menu .tool:active {
  transition-duration: 0.12s;
}

#menu .tool.curTool {
  transition-duration: 0.16s;
}

#menu .tool.disabledTool {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: not-allowed;
}

#menu .tool.disabledTool.curTool {
  box-shadow: none;
  background: inherit;
}

#menu .tool-icon {
  display: inline-block;
  text-align: center;
  width: 35px;
  height: 35px;
  margin: 2.5px;
  font-family: mono, monospace;
  overflow: hidden;
}

#menu img.tool-icon {
  pointer-events: none;
}

#menu .tool-icon > * {
  display: block;
  margin: auto;
}

#menu .tool-name {
  text-align: center;
  font-size: 15px;
  margin-right: 12px;
  margin-left: 12px;
  margin-bottom: 2.5px;
  display: inline-block;
  vertical-align: text-bottom;
}
#menu .tool-name.slider {
  display: inline-block;
  width: 150px;
  height: 30px;
  font-size: 12px;
  line-height: 15px;
  vertical-align: top;
  padding: 6px;
}

#menu .tool.hasSecondary .tool-icon {
  margin-top: 0px;
  margin-left: 0px;
}

#menu .tool .tool-icon.secondaryIcon {
  display: none;
}

#menu .tool.hasSecondary .tool-icon.secondaryIcon {
  display: block;
  position: absolute;
  bottom: 0px;
  left: 26px;
  width: 12px;
  height: 12px;
}

input {
  font-size: 16px;
}

#chooseColor {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  color: black;
  display: block;
  margin: 0;
  padding: 0;
}

.colorPresets {
  margin-right: 20px;
  vertical-align: top;
  display: inline-block;
}

.colorPresetButton {
  width: 30px;
  height: 30px;
  border: 1px solid black;
  border-radius: 3px;
  display: inline-block;
  margin-right: 6px;
  padding: 0;
  vertical-align: middle;
}

.rangeChooser {
  display: block;
  border: 0;
  width: 100%;
  margin: 0;
  background: transparent;
}

line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

text {
  font-family: "Arial", "Helvetica", sans-serif;
  user-select: none;
  -moz-user-select: none;
}

circle.opcursor {
  pointer-events: none;
  transition: 0.1s;
}

#cursor-me {
  transition: 0s;
}

@media (forced-colors: active) {
  #chooseColor {
    color: transparent;
  }
  label.tool-name[for="chooseColor"] {
    line-height: 10px;
  }
}
