.ink-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.ink-layer[data-tool] { pointer-events: auto; }
.ink-layer[data-tool=laser] { cursor: crosshair; }

.ink-stroke, .laser-trail path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ink-stroke {
  stroke: var(--stroke-color, #233e81);
  stroke-width: 2.1px;
}

.ink-shared, .ink-shared *, .ink-lasers, .ink-lasers * { pointer-events: none; }
.laser-glow {
  stroke: #ff1f46;
  stroke-width: 8px;
  filter: blur(2.6px);
  opacity: .64;
}
.laser-core { stroke: #ff2343; stroke-width: 4.5px; }
.laser-center { stroke: #fff4ee; stroke-width: 1.35px; }
.laser-trail.fading { animation: ink-laser-fade 850ms ease-out forwards; }

@keyframes ink-laser-fade {
  0%, 17% { opacity: 1; }
  100% { opacity: 0; }
}

#ink-controls .ink-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

#ink-controls button, .ink-palette summary {
  min-height: 38px;
  padding: 3px 9px;
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  font: 600 15px Arial, sans-serif;
}

#ink-controls [data-mode][aria-pressed=true] {
  background: var(--ink);
  color: var(--sheet);
}

.ink-palette { position: relative; }
.ink-palette summary {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ink-palette summary::-webkit-details-marker { display: none; }
.ink-color-dot, .ink-swatch::before {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  background: var(--swatch-color);
}

.ink-colors {
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: calc(100% + 5px);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--sheet);
  box-shadow: 0 3px 12px #00264922;
}

#ink-controls .ink-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.ink-swatch::before { content: ''; }
#ink-controls .ink-swatch[aria-pressed=true] {
  border-color: var(--ink);
  background: #e9e4d9;
}

@media screen and (max-width:640px) and (orientation:portrait) {
  #ink-controls .ink-tools { gap: 2px; }
  #ink-controls button, .ink-palette summary {
    min-height: 34px;
    padding: 2px 6px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .laser-trail.fading { animation: none; }
}

@media print {
  .ink-lasers { display: none !important; }
}
