/* The full simulator's touchscreen mode keeps delivery controls within reach. */
.laser-touch-focus, .laser-touch-toolbar { display: none; }
.laser-panel .change-control-method { width: auto; flex: 0 0 auto; }
body.touchscreen .laser-touch-focus:not([hidden]) {
  position: absolute;
  z-index: 2;
  left: 10px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  width: 64px;
  padding: 12px 5px;
  border: 1px solid #555d54;
  border-radius: 14px;
  background: #161c19ed;
  color: #e4e7df;
  user-select: none;
  -webkit-user-select: none;
}
body.touchscreen .laser-touch-focus-label { font-size: 12px; font-weight: 600; }
body.touchscreen .laser-touch-focus-track {
  position: relative;
  width: 50px;
  height: clamp(96px, 18dvh, 150px);
  touch-action: none;
  cursor: ns-resize;
  border-radius: 9px;
}
body.touchscreen .laser-touch-focus-track::before {
  content: '';
  position: absolute;
  inset: 0 21px;
  background: #080b09;
  box-shadow: inset 0 1px 4px #000, 0 0 0 1px #5a6257;
  border-radius: 8px;
}
body.touchscreen .laser-touch-focus-midpoint {
  position: absolute;
  top: 50%;
  left: 5px;
  right: 5px;
  border-top: 2px solid #a9bfa3;
}
body.touchscreen .laser-touch-focus-thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 44px;
  height: 28px;
  border: 1px solid #b7c0b3;
  border-radius: 10px;
  background: linear-gradient(#8b9688, #3a4437);
  box-shadow: 0 3px 8px #0008, inset 0 1px 2px #e6ebdf80;
  transform: translateY(-50%);
  pointer-events: none;
}
body.touchscreen .laser-touch-focus-thumb::after { content: ''; position: absolute; inset: 12px 10px; border-top: 2px solid #dce4d5; }
body.touchscreen .laser-touch-focus.is-sharp { border-color: #b0d19b; }
body.touchscreen .laser-touch-focus-track:is(:focus-visible, .is-adjusting) { outline: 2px solid #c5ddbb; outline-offset: 4px; }
body.touchscreen #laserCanvas { cursor: grab; }
body.touchscreen #laserCanvas.is-dragging { cursor: grabbing; }
body.touchscreen .laser-touch-toolbar:not([hidden]) {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: #dedfd6;
  background: #171d19;
  font-size: 12px;
}
body.touchscreen .laser-touch-toolbar > span { flex: 1; min-width: 110px; }
body.touchscreen .laser-panel .laser-touch-toolbar button { min-height: 44px; color: #e3e9df; background: #293328; border-color: #5a6758; font-size: 12px; }
body.touchscreen .laser-panel .laser-touch-toolbar button[aria-pressed="true"] { color: #fff; background: #506a44; }
body.touchscreen .laser-panel :is(button, select) { min-height: 44px; font-size: 12px; }
body.touchscreen .laser-panel :is(.laser-pattern-grid button, .laser-eye-toggle button, .laser-navigation-controls button, .laser-secondary-actions button, .laser-guidance #laserGuide) { min-height: 44px; }
body.touchscreen .laser-panel input[type="range"] { min-height: 44px; touch-action: pan-y; }
body.touchscreen .laser-panel :is(#laserFire, #laserMobileFire) { min-height: 52px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.touchscreen .laser-panel :is(kbd, .laser-key-hint) { display: none; }
body.touchscreen .laser-panel .laser-header-tools { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
body.touchscreen .laser-panel .laser-pattern-options { flex-wrap: wrap; }
body.touchscreen .laser-panel .laser-pattern-options select { min-width: 72px; }
body.touchscreen .laser-panel .laser-pattern-grid button { padding: 4px; }
body.touchscreen .laser-panel .laser-pattern-grid svg { height: 23px; }
body.touchscreen .laser-help { max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
body.touchscreen .laser-panel .laser-help-start { min-height: 48px; }
body.touchscreen .laser-panel :is(#laserDuration, #laserTestSpot, #laserArcOptions select) { min-height: 44px; }
body.touchscreen .laser-delivery .laser-section-heading { flex-wrap: wrap; }

@media (min-width: 760px) {
  body.touchscreen.laser-active .sim-root { height: 100dvh; max-height: 100dvh; padding: 8px; gap: 8px; }
  body.touchscreen.laser-active .laser-panel:not([hidden]) { display: flex; flex-direction: column; height: auto; padding: 0; max-width: none; }
  body.touchscreen .laser-header { flex: none; padding: 8px 10px; margin-bottom: 8px; gap: 10px; }
  body.touchscreen .laser-header h1 { font-size: 18px; }
  body.touchscreen .laser-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(300px, 36vw, 480px); grid-template-rows: minmax(0, 1fr); gap: 10px; }
  body.touchscreen .laser-examination { min-height: 0; }
  body.touchscreen .laser-view-wrap { min-height: 0; container-type: size; }
  body.touchscreen .laser-panel .laser-view-field { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); max-width: 100%; max-height: 100%; }
  body.touchscreen .laser-view-heading { flex: none; flex-wrap: wrap; gap: 4px; padding: 8px; }
  body.touchscreen .laser-console { min-height: 0; padding: 10px; gap: 10px; }
  body.touchscreen .laser-console-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  body.touchscreen .laser-overview { width: 60%; }
  body.touchscreen .laser-console .laser-delivery { margin-top: auto; padding-top: 8px; }
  body.touchscreen .laser-guidance { padding: 8px; gap: 5px; font-size: 11px; }
  body.touchscreen .laser-fire-row { gap: 8px; grid-template-columns: minmax(110px, 0.9fr) minmax(0, 1fr); }
}
@media (min-width: 1180px) {
  body.touchscreen .laser-console { padding: clamp(12px, 1vw, 16px); }
  body.touchscreen .laser-panel :is(button, select),
  body.touchscreen .laser-navigation-controls label,
  body.touchscreen .laser-settings > label,
  body.touchscreen .laser-setting-row { font-size: var(--tablet-control-font); }
  body.touchscreen .laser-header h1 { font-size: 20px; }
  body.touchscreen .laser-guidance { padding: 10px 12px; font-size: 12px; }
}
@media (max-width: 759px) {
  body.touchscreen.laser-active { height: auto; overflow-y: auto; }
  body.touchscreen.laser-active .sim-root { height: auto; max-height: none; padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
  body.touchscreen .laser-panel { height: auto; overflow: visible; padding: 0; }
  body.touchscreen .laser-layout { display: block; }
  body.touchscreen .laser-panel .laser-view-field { width: min(100%, 560px); height: auto; }
  body.touchscreen .laser-view-wrap { min-height: 300px; container-type: normal; }
  body.touchscreen .laser-panel .laser-ready-controls,
  body.touchscreen .laser-fire-row { display: none; }
  body.touchscreen .laser-panel .laser-mobile-firebar { display: block; position: fixed; z-index: 45; bottom: 0; left: 0; right: 0; padding: 10px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: var(--surface-1); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px #0005; }
  body.touchscreen .laser-mobile-firebar > div { display: flex; align-items: center; gap: 9px; }
  body.touchscreen .laser-mobile-firebar #laserMobileFire { flex: 1; color: #fff; background: var(--accent); }
  body.touchscreen .laser-mobile-firebar p { margin: 0 0 8px; font-size: 12px; }
}
