* {
  margin: 0;
  padding: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.canvas-container {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

#canvas {
  position: absolute;
  inset: 0;
  background-color: #353536;
}

.canvas-drawing {
  width: 100vw;
  height: 100dvh;
  cursor: url('../icons/pencil.ico'), default;
}

.canvas-erasing {
  cursor: url('../icons/eraser.ico'), default;
}

.navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 999;
  width: 100%;
  height: auto;
  background: var(--color-bg);
}

.buttons {
  position: fixed;
  z-index: 1000;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 0.25rem;
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 0.7rem 0.4rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid color-mix(in srgb, var(--color-fg) 20%, transparent);
  border-radius: 1rem 1rem 0 0;
  background: color-mix(in srgb, var(--color-bg) 94%, transparent);
  backdrop-filter: blur(8px);
  list-style-type: none;
}

.buttons > li {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.button {
  width: auto;
  min-width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 5px;
  background-color: black;
  color: white;
}

.buttons .button {
  min-width: 0;
  margin: 0;
}

.buttons #clearBtn,
.buttons #eraserBtn,
.buttons #colorPicker {
  display: inline-flex;
  flex: 0 0 3rem;
  align-items: center;
  justify-content: center;
  width: 3rem;
  min-width: 3rem;
  max-width: 3rem;
  height: 3rem;
  padding: 0.45rem;
  border: 1px solid color-mix(in srgb, var(--color-fg) 45%, transparent);
  border-radius: 0.7rem;
  background-color: var(--color-bgl);
  color: var(--color-fg);
  box-shadow: 0 1px 3px rgb(0 0 0 / 15%);
}

.buttons #clearBtn,
.buttons #eraserBtn {
  cursor: pointer;
}

.buttons #clearBtn:hover,
.buttons #eraserBtn:hover {
  border-color: var(--color-s);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-s) 18%, transparent);
}

.buttons #colorPicker {
  cursor: pointer;
}

.buttons #colorPicker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.buttons #colorPicker::-webkit-color-swatch {
  border: 1px solid color-mix(in srgb, var(--color-fg) 35%, transparent);
  border-radius: 0.35rem;
}

.buttons #colorPicker::-moz-color-swatch {
  border: 1px solid color-mix(in srgb, var(--color-fg) 35%, transparent);
  border-radius: 0.35rem;
}

.buttons #lineWidthPicker {
  width: 100%;
  max-width: 100%;
  padding: 0;
}

.buttons #saveToGalleryBtn {
  width: 100%;
  max-width: none;
  height: 3rem;
  padding: 0.25rem;
  font-size: clamp(0.65rem, 2.4vw, 0.85rem);
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.buttonImage {
  width: 25px;
  height: 25px;
}

.drawboard-status {
  position: fixed;
  z-index: 20;
  top: 130px;
  right: 1rem;
  display: none;
  max-width: min(90vw, 360px);
  padding: 0.6rem 0.8rem;
  border: 1px solid #1ac9b8;
  border-radius: 0.6rem;
  background: rgb(0 0 0 / 85%);
  color: #fff;
}

.pressed {
  border-color: #1ac9b8;
  background-color: rgb(72 72 72 / 50%);
}

.canvas-container + footer {
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 900px) {
  .navbar__container {
    background: unset;
  }

  .drawboard-status {
    top: 90px;
    right: 0.8rem;
    left: 0.8rem;
    max-width: unset;
  }
}

@media (max-width: 500px) {
  .canvas-container + footer {
    right: auto;
    bottom: calc(70px + 0.5rem + env(safe-area-inset-bottom, 0px));
    left: 0.5rem;
    width: max-content;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.35rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  }
}
