:root {
  color-scheme: light;
  font: 100%/1.35 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: white;
  color: #262824;
}
* { box-sizing: border-box; }
html, body, main {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: white;
  touch-action: none;
  cursor: crosshair;
}
.controls {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid #deded9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 7px #2928200b;
  touch-action: none;
}
button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: none;
}
button svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#tool { background: #2e312e; color: white; min-width: 114px; }
#tool .swap-icon { width: 13px; height: 13px; opacity: .7; }
#tool .eraser-icon, #tool.erasing .pen-icon { display: none; }
#tool.erasing .eraser-icon { display: block; }
#tool.erasing { background: #eaeae6; color: #343631; }
#size[aria-expanded="true"] { background: #eeeee9; }
#size-picker {
  position: absolute;
  top: calc(100% + 8px);
  right: -1px;
  width: min(244px, calc(100vw - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding: 12px;
  border: 1px solid #deded9;
  border-radius: 16px;
  background: white;
  box-shadow: 0 4px 16px #29282012;
}
#size-picker[hidden] { display: none; }
#size-title {
  margin: 0 0 8px 2px;
  font-size: .875rem;
  font-weight: 600;
}
#size-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.size-choice {
  display: grid;
  grid-template-rows: 26px auto;
  justify-items: center;
  align-content: center;
  gap: 3px;
  height: 60px;
  padding: 2px;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.size-choice[aria-pressed="true"] { background: #eeeee9; border-color: #777a71; }
.size-dot {
  width: var(--dot-size);
  height: var(--dot-size);
  max-width: 25px;
  max-height: 25px;
  border-radius: 50%;
  background: currentColor;
}
button:focus-visible { outline: 2px solid #426ab4; outline-offset: 2px; }
button:active { opacity: .75; }
@media (hover: hover) {
  #clear:hover, #size:hover, .size-choice:hover { background: #f2f2ef; }
}
@media (max-width: 400px) {
  .controls { gap: 1px; }
  .controls > button { gap: 5px; padding-inline: 8px; }
}
#eraser-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border: 1px solid #6669;
  border-radius: 50%;
  pointer-events: none;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
