/* Texture Maker. #tmk-scoped — tool-theme.css loads after this and wins a plain class rule. */

#tmk { display: block; }

#tmk .tmk-grid {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) minmax(200px, 240px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  #tmk .tmk-grid { grid-template-columns: minmax(0, 1fr); }
}

#tmk .tmk-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#tmk .tmk-field { display: block; min-width: 0; }
#tmk .tmk-label {
  display: block; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; opacity: .72; margin-bottom: 7px;
}
#tmk .tmk-sub { font-weight: 600; letter-spacing: 0; text-transform: none; opacity: .72; }

/* Library ------------------------------------------------------------------ */
#tmk .tmk-search { width: 100%; box-sizing: border-box; padding: 8px 11px; font-size: 13px; border-radius: 9px; }
#tmk .tmk-tabs { display: flex; gap: 5px; margin-top: 8px; }
#tmk .tmk-tab {
  flex: 1 1 0; padding: 6px 4px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 700;
}
#tmk .tmk-tab.tmk-on { outline: 2px solid currentColor; outline-offset: -2px; }

#tmk .tmk-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 460px; overflow-y: auto;
  padding-right: 3px;
}
#tmk .tmk-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 6px 9px; border-radius: 9px; cursor: pointer; text-align: left;
}
#tmk .tmk-item.tmk-on { outline: 2px solid currentColor; outline-offset: -2px; }
#tmk .tmk-thumb {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 3px;
  /* One texture pixel is one image pixel; smoothing turns a 16×16 sprite into a smudge. */
  image-rendering: pixelated;
  background: rgba(127, 127, 127, .18);
}
#tmk .tmk-itemname { flex: 1 1 auto; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tmk .tmk-itemkind { font-size: 10px; opacity: .55; text-transform: uppercase; letter-spacing: .05em; flex: 0 0 auto; }
#tmk .tmk-item.tmk-edited .tmk-itemname::after { content: " •"; opacity: .9; }
#tmk .tmk-empty { margin: 8px 0 0; font-size: 13px; opacity: .7; }

/* Canvas ------------------------------------------------------------------- */
#tmk .tmk-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 12px; border-radius: 14px;
  background: rgba(127, 127, 127, .12);
}
#tmk .tmk-stage canvas {
  display: block; max-width: 100%; height: auto;
  image-rendering: pixelated;
  border-radius: 4px;
  touch-action: none;             /* or a drag on a phone scrolls the page instead of drawing */
  /* The transparency checkerboard, so an erased pixel is visibly empty rather than black. */
  background-color: #6e6e6e;
  background-image:
    linear-gradient(45deg, rgba(0, 0, 0, .22) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, .22) 75%),
    linear-gradient(45deg, rgba(0, 0, 0, .22) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, .22) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

#tmk .tmk-under {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12.5px;
}
#tmk .tmk-coord {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; opacity: .75; min-width: 9ch;
}
#tmk .tmk-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
#tmk .tmk-zoom { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 130px; min-width: 0; }
#tmk .tmk-zoom input[type="range"] { flex: 1 1 auto; min-width: 0; margin: 0; box-sizing: border-box; }

/* Tools -------------------------------------------------------------------- */
#tmk .tmk-toolset { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#tmk .tmk-tool {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 11px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 700;
}
#tmk .tmk-tool.tmk-on { outline: 2px solid currentColor; outline-offset: -2px; }
#tmk .tmk-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px; opacity: .5;
}

#tmk .tmk-colour { display: flex; align-items: center; gap: 8px; }
#tmk .tmk-colour input[type="color"] {
  width: 44px; height: 34px; padding: 2px; border-radius: 8px; cursor: pointer; flex: 0 0 auto;
}
#tmk .tmk-hex {
  flex: 1 1 auto; min-width: 0; box-sizing: border-box;
  padding: 7px 9px; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; text-transform: uppercase;
}
#tmk .tmk-swatches {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 9px;
}
#tmk .tmk-swatch {
  aspect-ratio: 1 / 1; border-radius: 6px; cursor: pointer; padding: 0;
  border: 1px solid rgba(127, 127, 127, .4);
}

#tmk .tmk-actions { display: flex; flex-wrap: wrap; gap: 7px; }
#tmk .tmk-btn { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; }
#tmk .tmk-primary { width: 100%; box-sizing: border-box; padding: 11px 15px; font-size: 14px; }
#tmk .tmk-note { margin: 0; min-height: 1.2em; font-size: 13px; line-height: 1.55; opacity: .85; }
#tmk .tmk-hint { margin: 9px 0 0; font-size: 12px; line-height: 1.55; opacity: .7; }

#tmk .tmk-help { margin-top: 26px; font-size: 14.5px; line-height: 1.65; max-width: 72ch; }
#tmk .tmk-help p { margin: 0; }

#tmk [hidden] { display: none !important; }
