@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;700&family=Newsreader:ital,wght@0,400;0,700;1,400;1,700&display=swap");
html,
body {
  margin: 0;
  padding: 0;
  position: fixed;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  font-family: "Manrope";
  background-color: #f9f9fa;
  overscroll-behavior: none;
}

#topNavbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 54px;
  background-color: #111827;
  display: flex;
  align-items: center;
  padding: 0 24px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  z-index: 1000;
  font-family: "Manrope";
  user-select: none;
}

.nav-brand {
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.15);
  margin: 0 15px;
}

#boardTitle {
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 400;
  margin: 0;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  outline: none;
  min-width: 100px;
  white-space: nowrap;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}

#boardTitle:hover {
  cursor: text;
  border-bottom: 2px solid rgba(59, 130, 246, 0.5);
}

#boardTitle:focus {
  color: #ffffff;
  border-bottom: 2px solid #3b82f6;
}

#whiteboard {
  display: block;
  cursor: crosshair;
  background-image: radial-gradient(#d1d1d6 1px, transparent 1px);
  background-size: 24px 24px;
  touch-action: none;
}

.controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 12px 24px;
  border-radius: 100px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0px 12px 35px rgba(0, 0, 0, 0.08);
  z-index: 1000;
}

.controls button {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  padding: 8px;
  font-size: 16px;
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.controls button:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: scale(1.1);
  color: #000;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: transparent;
  margin-right: 5px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  background: transparent;
  margin: 0;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

input[type="range"]::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #2c2c2e;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border: none;
  border-radius: 50%;
  background: #2c2c2e;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.25);
}

.text-tool-input {
  position: absolute;
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.3);
  outline: none;
  border-radius: 4px;
  padding: 2px;
  margin: 0;
  overflow: hidden;
  resize: none;
  z-index: 100;
  font-family: "Manrope", sans-serif;
  white-space: pre;
}

#eraserCursor {
  position: fixed;
  border: 1.5px solid rgba(255, 50, 50, 0.6);
  background-color: rgba(255, 50, 50, 0.15);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 9999;
  transition:
    width 0.1s,
    height 0.1s;
}

@media (max-width: 768px) {
  .controls {
    position: fixed;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    border-radius: 20px 20px 0 0;
    padding: 10px 15px;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .controls::-webkit-scrollbar {
    display: none;
  }
  .controls button {
    width: 34px;
    height: 34px;
    font-size: 14px;
    padding: 6px;
    flex-shrink: 0;
  }

  input[type="color"],
  input[type="range"] {
    flex-shrink: 0;
  }
}
