/* Grid sheet (sheet.js) and its toolbar (toolbar.js). */

.sheet {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #eef2f7;
  /* All gestures are handled in sheet.js: the pen must never scroll, the palm never zoom. */
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  contain: strict;
  outline: none;
}
.sheet.tool-pen { cursor: crosshair; }
.sheet.tool-eraser { cursor: none; }
.sheet.is-readonly, .sheet.is-readonly.tool-pen, .sheet.is-readonly.tool-eraser { cursor: grab; }
.sheet.is-panning { cursor: grabbing; }

.sheet canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
}

/* Task header: lives on the paper. Sizes are in em, the font size follows the zoom (set by sheet.js),
   so the text is re-laid out sharply instead of being scaled as a bitmap. 1em = 18 logical units. */
.sheet-header {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
  color: #1b2a41;
  line-height: 1.45;
}
.sheet-header-inner {
  padding: 1.1em 1.6em 0.7em 3.1em;
}
.sheet-header-inner > :first-child { margin-top: 0; }
.sheet-header-inner > :last-child { margin-bottom: 0; }

/* ---------- toolbar ---------- */
.sheet-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(31, 58, 104, 0.08), 0 4px 16px rgba(31, 58, 104, 0.08);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overflow-y: auto;
  scrollbar-width: none;
}
.sheet-toolbar::-webkit-scrollbar { display: none; }

.tb-btn {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: #1f3a68;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, box-shadow 0.12s, color 0.12s;
}
.tb-btn svg { width: 24px; height: 24px; display: block; }
@media (hover: hover) { .tb-btn:hover:not(:disabled) { background: #eef2f7; } }
.tb-btn:active:not(:disabled) { background: #e2e8f1; }
.tb-btn:focus-visible { outline: 2px solid #6b8bc4; outline-offset: 1px; }
.tb-btn:disabled { color: #b7c1d0; cursor: default; }
.tb-btn.is-active { background: #1f3a68; color: #fff; }

.tb-color .dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s;
}
.tb-color.is-active { background: transparent; box-shadow: inset 0 0 0 3px #2e9e5b; }
.tb-color.is-active .dot { transform: scale(1.08); }

.tb-sep { flex: none; width: 28px; height: 1px; background: #dfe5ee; margin: 4px 0; }

.tb-zoom {
  width: 52px;
  height: 36px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1f3a68;
}

.tb-finger { color: #8090a8; }
.tb-finger.is-active { background: #e7f5ed; color: #2e9e5b; box-shadow: inset 0 0 0 2px #2e9e5b; }
.tb-finger svg { width: 22px; height: 22px; }
.tb-finger-label { font-size: 9.5px; line-height: 1; margin-top: -2px; font-weight: 600; letter-spacing: 0.01em; }
.tb-finger .tb-stack { display: grid; place-items: center; gap: 2px; }

/* Landscape phones and low windows: horizontal scroll is not needed, the bar scrolls vertically. */
@media (max-height: 640px) {
  .tb-btn { width: 44px; height: 44px; }
  .sheet-toolbar { gap: 2px; padding: 6px 4px; }
}
