@font-face {
  font-family: "Poppins";
  src: url("font/Poppins-SemiBold.ttf") format("truetype");
  font-weight: 600;
}

:root {
  --bg: #ececec;
  --surface: #fff;
  --surface-hover: #eee;
  --surface-active: #111;
  --border: #dedede;
  --text: #333;
  --muted: #777;
  --toolbar-width: 58px;
  --tool-size: 40px;
  --radius: 8px;
  --icon-size: 21px;
  --transition: 0.15s ease;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.container {
  position: relative;
  width: 100%;
  height: 100vh;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  touch-action: none;
}

.toolbar {
  position: fixed;
  left: 18px;
  top: 50%;
  width: var(--toolbar-width);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateY(-50%);
  z-index: 10;
}

.toolGroup {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.redoGroup {
  padding-bottom: 0;
  border-bottom: none;
}

.tool {
  width: var(--tool-size);
  height: var(--tool-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.tool img,
.menuBtn img,
.pressToggle img,
.eyedropButton img {
  display: block;
  width: var(--icon-size);
  height: var(--icon-size);
  object-fit: contain;
  color: inherit;
}

.tool:hover {
  background: var(--surface-hover);
}

.tool.active {
  background: var(--surface-active);
  color: #fff;
}

.tool.active img,
.menuBtn:hover img,
.pressToggle.active img,
.eyedropButton:hover img {
  filter: invert(1);
}

.tool:focus,
.tool:focus-visible {
  outline: none;
}

.historyTools {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  border-radius: var(--radius);
}

.historyTools:hover {
  background: var(--surface-hover);
}

.historyTools .tool {
  background: transparent;
}

.stylePanel {
  position: fixed;
  right: 18px;
  top: 46%;
  width: 62px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(-50%);
  z-index: 10;
}

.setting {
  width: 62px;
  height: 250px;
  padding: 14px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ClrSetting {
  position: relative;
  width: 62px;
  height: 80px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settingTitle,
.settingClr {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.ClrButton,
.pressToggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111111;
  cursor: pointer;
}

.pressToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text);
}

.pressToggle img {
  width: 20px;
  height: 20px;
}

.pressToggle.active {
  background: var(--surface-active);
  color: #fff;
}

.ClrPanel {
  position: absolute;
  right: 94px;
  top: 0;
  width: 190px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 20;
}

.ClrPanel.active {
  display: flex;
}

.ClrPanelTitle {
  color: var(--text);
  font-size: 13px;
}

.ClrPanelLabel {
  color: var(--muted);
  font-size: 10px;
}

.ClrGrid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.ClrGrid button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  cursor: pointer;
}

.shadeRow {
  display: flex;
  gap: 5px;
}

.shadeRow button {
  flex: 1;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  cursor: pointer;
}

.hexRow {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.hexHash {
  padding-left: 8px;
  color: var(--muted);
  font-size: 11px;
}

.hexInput {
  width: 100%;
  height: 100%;
  padding: 0 4px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
}

.eyedropButton {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.eyedropButton img {
  width: 16px;
  height: 16px;
}

.widthSlider,
.opacitySlider {
  width: 3px;
  height: 200px;
  margin: 0 auto;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  background: transparent;
  cursor: pointer;
}

.widthSlider::-webkit-slider-runnable-track,
.opacitySlider::-webkit-slider-runnable-track {
  width: 3px;
  height: 200px;
  border-radius: 3px;
  background: var(--border);
}

.widthSlider::-webkit-slider-thumb,
.opacitySlider::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-left: -7px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.widthSlider::-moz-range-track,
.opacitySlider::-moz-range-track {
  width: 3px;
  height: 200px;
  border-radius: 3px;
  background: var(--border);
}

.widthSlider::-moz-range-thumb,
.opacitySlider::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.sliderValues {
  width: 100%;
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 14px;
}

.btm {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.pressureBtn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background var(--transition);
}

.pressureBtn img {
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.pressureBtn:hover {
  background: var(--surface-hover);
}

.pressureBtn.active {
  background: var(--surface-active);
}

.pressureBtn.active img {
  filter: invert(1);
}

.pressureBtn:focus,
.pressureBtn:focus-visible {
  outline: none;
}

.zoomControls {
  height: 40px;
  padding: 4px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
}

.zoomButton {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  cursor: pointer;
}

.zoomButton:hover {
  background: var(--surface-hover);
}

.zoomValue {
  width: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.menuBtn {
  position: fixed;
  left: 18px;
  top: 18px;
  width: 58px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 31;
  transition: background var(--transition);
}

.menuBtn img {
  width: 21px;
  height: 21px;
}

.menuBtn:hover {
  background: var(--surface-hover);
}

.menuBtn:active {
  transform: scale(0.96);
}

.menuBtn:focus,
.menuBtn:focus-visible {
  outline: none;
}

.menuPanel {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 274px;
  padding: 68px 8px 8px;
  display: none;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 30;
}

.menuPanel.active {
  display: flex;
}

.menuHeader {
  position: absolute;
  top: 20px;
  left: 78px;
  color: var(--text);
  font-size: 14px;
}

.menuItem {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.menuItem:hover {
  background: var(--surface-hover);
}

.menuItem:active {
  background: var(--border);
}

.menuItem:focus,
.menuItem:focus-visible {
  outline: none;
}

.menuDiv {
  width: 100%;
  height: 1px;
  margin: 5px 0;
  background: var(--border);
}

.minimap {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 180px;
  height: 120px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#minican {
  width: 100%;
  height: 100%;
  display: block;
}
