html, body {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  margin: 0;
  background: white;
  overflow: hidden;
  font-family: sans-serif;
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

#toolbar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;   /* 🔥 THIS is what enables scrolling */
  width: 160px;

  z-index: 1000;

  display: flex;
  flex-direction: column;

  padding: 10px;
  border-right: 1px solid #ddd;

  overflow-y: auto;
  overflow-x: hidden;
  
  scroll-behavior: smooth;

  background: rgba(245, 245, 245, 0.95);
  backdrop-filter: blur(4px);
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);

  transition: transform 0.2s ease;
}

#toolbar button {
  padding: 14px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;

  background: white;
  cursor: pointer;

  min-height: 44px; /* ✅ mobile touch target */
}

#toolbar button:hover {
  background: #e9f3ff;
}

#board {
  position: fixed;
  top: 0;
  left: 0;        /* ✅ no offset */
  width: 100vw;   /* ✅ full width */
  height: 100vh;  /* ✅ full height  older iPads */
  height: 100dvh;  /* KEY FIX */  
}

#toolbar.collapsed {
  transform: translateX(-160px);
}

.toolbar-toggle {
  position: fixed;
  left: 10px;
  top: 10px;
  z-index: 9999;

  width: 40px;
  height: 40px;

  border: none;
  background: #f5f5f5;
  border: 1px solid #ddd;
  cursor: pointer;
}

.tool-control {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.tool-block {
  display: flex;
  flex-direction: column;
  gap: 6px;

  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;

  background: white;
}

.tool-title {
  font-size: 13px;
  font-weight: bold;
  color: #333;
}

.tool-info {
  font-size: 11px;
  color: #777;
  line-height: 1.2;
}

.tool-section {
  display: flex;
  flex-direction: column;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  margin-bottom: 10px;
  overflow: visible; /* important */
}

.section-header {
  padding: 10px;
  font-weight: bold;
  font-size: 13px;
  background: #f0f0f0;
}

.section-content {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 10px;
}

canvas {
  display: block;
  touch-action: none;
  user-select: none;
}