* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #111;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

#top-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: #1c1c1c;
  border-bottom: 1px solid #333;
}

.bar-button {
  appearance: none;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #eee;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.bar-button:active {
  background: #3a3a3a;
}

.zoom-readout {
  margin-left: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #999;
  padding: 4px 8px;
}

#tool-group {
  display: flex;
  gap: 4px;
}

.tool-button {
  appearance: none;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #eee;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.tool-button.active {
  background: #2f5d8a;
  border-color: #5b9bd5;
  color: #fff;
}

.danger-button:not(:disabled):active {
  background: #6a2a2a;
}

.danger-button:disabled {
  opacity: 0.4;
  cursor: default;
}

#canvas-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.magnifier {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 20;
}

.magnifier[hidden] {
  display: none;
}
