/* TG-MI-1119: mobile icon dock + in-place text. Preview ?tgmi=p1119.
   Scoped to phones/tablets only. Desktop (>=1024px) is not restyled. */
@media (max-width: 1023px) {
#tees-studio.tgst-m.tgmi {
  --mi-ink: #16243E;
  --mi-red: #E6010B;
  --mi-line: #e7e8ec;
  --mi-soft: #f5f6f8;
  --mi-mute: #6b7280;
}

/* Bottom dock: labelled tiles, flexible height */
#tees-studio.tgst-m.tgmi .ts-tools {
  height: auto !important;
  min-height: 76px;
  max-height: 42vh;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom)) !important;
  gap: 8px !important;
  justify-content: flex-start !important;
  background: #fff !important;
  box-shadow: 0 -8px 24px rgba(22, 36, 62, .06);
}

#tees-studio.tgst-m.tgmi .ts-tools .ts-hint {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--mi-mute);
}

/* Add row: Upload / Text / AI / URL as equal tiles */
#tees-studio.tgst-m.tgmi .ts-tools .ts-add {
  display: flex !important;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  margin: 0;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-add > button,
#tees-studio.tgst-m.tgmi .ts-tools .ts-add .tgf-url {
  flex: 1 1 0;
  width: auto !important;
  min-width: 0 !important;
  min-height: 62px !important;
  height: 68px !important;
  padding: 6px 4px 5px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px;
  border: 1px solid var(--mi-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: var(--mi-ink) !important;
  box-shadow: none !important;
  font: 600 11px/1 Poppins, system-ui, sans-serif !important;
  letter-spacing: -.15px;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-add > button svg,
#tees-studio.tgst-m.tgmi .ts-tools .ts-add .tgf-url svg {
  width: 26px;
  height: 26px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-add > button .tgmi-lb,
#tees-studio.tgst-m.tgmi .ts-tools .ts-add .tgf-url .tgmi-lb {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Typo / image tabs: labelled Lucide tiles, scroll with a peek */
#tees-studio.tgst-m.tgmi .ts-tools .ts-tabs {
  display: flex !important;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px;
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-tabs::-webkit-scrollbar { display: none; }

#tees-studio.tgst-m.tgmi .ts-tools .ts-tab,
#tees-studio.tgst-m.tgmi .ts-tools .ts-tabs .ts-ok {
  flex: none;
  width: 54px !important;
  min-width: 54px !important;
  height: 62px !important;
  padding: 6px 2px 5px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px;
  border: 1px solid var(--mi-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: var(--mi-ink) !important;
  box-shadow: none !important;
  font: 600 9.5px/1 Poppins, system-ui, sans-serif !important;
  letter-spacing: -.15px;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-tab svg,
#tees-studio.tgst-m.tgmi .ts-tools .ts-ok svg {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-tab .tgmi-lb,
#tees-studio.tgst-m.tgmi .ts-tools .ts-ok .tgmi-lb {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-tab.is-on {
  background: var(--mi-ink) !important;
  border-color: var(--mi-ink) !important;
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(22, 36, 62, .22) !important;
}
#tees-studio.tgst-m.tgmi .ts-tools .ts-tabs .ts-ok {
  background: var(--mi-red) !important;
  border-color: var(--mi-red) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(230, 1, 11, .28) !important;
  margin-left: auto;
  position: sticky;
  right: 0;
}


/* URL belongs in the Add row only — hide the leftover full-width pill on typography */
#tees-studio.tgst-m.tgmi .ts-tools > .tgf-url { display: none !important; }
#tees-studio.tgst-m.tgmi .ts-tools .ts-add .tgf-url { display: flex !important; }

/* The old "type here" window: keep in DOM for core sync, never show it */
#tees-studio.tgst-m.tgmi .ts-tools .ts-tab[data-tab="edit"],
#tees-studio.tgst-m.tgmi .ts-tools .ts-txt,
#tees-studio.tgst-m.tgmi .ts-tools .ts-panel:has(> .ts-txt) {
  display: none !important;
}

/* Compact typography / filter sheet under the strip */
#tees-studio.tgst-m.tgmi .ts-tools .ts-panel {
  margin: 0;
  max-height: 18vh;
  overflow: auto;
}

/* In-place editor on the product */
#tees-studio.tgst-m.tgmi .tgmi-ed {
  position: fixed;
  z-index: 2147483100;
  margin: 0;
  padding: .08em .12em;
  border: 0;
  outline: 2px dashed #2f6bff;
  outline-offset: 3px;
  border-radius: 2px;
  background: transparent;
  white-space: pre;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
  max-width: none;
  box-sizing: content-box;
  caret-color: #E6010B;
}
#tees-studio.tgst-m.tgmi.tgmi-editing .ts-pa .ts-l.is-sel { opacity: 0 !important; }
#tees-studio.tgst-m.tgmi.tgmi-editing .tgst-dim { display: none !important; }
/* ST may still try to open its own overlay ~900ms later — never show a second one */
#tees-studio.tgst-m.tgmi.tgmi-editing .tgst-ed { display: none !important; }

/* Hidden probe used only to hold the iOS/Android keyboard on the same tap */
#tgmi-probe {
  position: fixed !important;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}
}
