/* PixelGrid Studio: nur was über das gemeinsame Gerüst hinausgeht */
.t-stage > #cv {
  max-width: none; max-height: none; touch-action: none; cursor: crosshair;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 14px 44px rgba(0, 0, 0, 0.1);
}
body[data-tool='move'] #cv { cursor: default; }
body[data-tool='frag'] #cv { cursor: cell; }

/* Werkzeugleiste: schwebend links in der Bühne, mobil unten */
.pg-tools {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
  background: var(--t-bg); border: 1px solid var(--t-line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 28px rgba(0, 0, 0, 0.08);
}
.pg-tool {
  appearance: none; border: 0; background: none; width: 40px; height: 40px; border-radius: 10px; padding: 0;
  display: grid; place-items: center; cursor: pointer; color: var(--t-fg); position: relative;
}
.pg-tool svg { width: 20px; height: 20px; display: block; }
.pg-tool:hover { background: var(--t-fill); }
.pg-tool.is-on { background: var(--t-fg); color: var(--t-bg); }
.pg-tool .pg-k { position: absolute; right: 4px; bottom: 3px; font: 500 8px/1 var(--t-mono); opacity: 0.45; }
.pg-tool::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--t-fg); color: var(--t-bg); font-size: 12px; line-height: 1; padding: 6px 9px; border-radius: 7px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
.pg-tool:hover::after { opacity: 1; }
.pg-sep { height: 1px; background: var(--t-line); margin: 3px 6px; }

.pg-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 4; max-width: calc(100% - 24px);
  background: var(--t-bg); border: 1px solid var(--t-line); border-radius: 999px; padding: 5px 13px;
  font-size: 12px; line-height: 16px; color: var(--t-fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.pg-hint:empty { display: none; }
.pg-empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  font-size: 14px; color: var(--t-fg-2); text-align: center; max-width: 260px; line-height: 20px;
}

/* Panel */
.pg-body { display: grid; gap: 10px; min-width: 0; }
.pg-field { display: grid; gap: 6px; }
.pg-colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pg-dot {
  appearance: none; width: 26px; height: 26px; border-radius: 50%; padding: 0; cursor: pointer; position: relative;
  border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.pg-dot.is-on { outline: 2px solid var(--t-fg); outline-offset: 2px; }
.pg-dot-custom { background: conic-gradient(#ff4f1f, #f2c500, #3ddc84, #2b9bff, #2b4bff, #ff6fa8, #ff4f1f); overflow: hidden; display: block; }
.pg-dot-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

.pg-patterns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pg-pat {
  appearance: none; border: 1px solid var(--t-line); border-radius: 10px; background: none; padding: 9px; cursor: pointer;
  display: grid; gap: 4px; justify-items: center; font-size: 10px; line-height: 12px; color: var(--t-fg-2); min-width: 0;
}
.pg-pat span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-pat svg { width: 100%; aspect-ratio: 1; display: block; color: var(--t-fg); }
.pg-pat:hover { border-color: var(--t-fg-3); }
.pg-pat.is-on { border-color: var(--t-fg); box-shadow: inset 0 0 0 1px var(--t-fg); color: var(--t-fg); }

.pg-layers { display: grid; gap: 1px; max-height: 300px; overflow-y: auto; margin: 0 -6px; }
.pg-layer {
  display: grid; grid-template-columns: 24px 28px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 9px; cursor: pointer;
}
.pg-layer:hover { background: var(--t-fill); }
.pg-layer.is-on { background: var(--t-fill-2); }
.pg-layer.is-hidden .pg-lthumb, .pg-layer.is-hidden .pg-ltext { opacity: 0.4; }
.pg-eye {
  appearance: none; border: 0; background: none; width: 24px; height: 24px; padding: 0; border-radius: 6px;
  display: grid; place-items: center; cursor: pointer; color: var(--t-fg-2);
}
.pg-eye:hover { color: var(--t-fg); background: var(--t-fill); }
.pg-eye svg { width: 16px; height: 16px; }
.pg-lthumb {
  width: 28px; height: 28px; border-radius: 6px; background: var(--t-fill) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--t-line); display: grid; place-items: center; color: var(--t-fg);
}
.pg-lthumb svg { width: 16px; height: 16px; }
.pg-ltext { display: grid; min-width: 0; }
.pg-lname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-lmeta { font-size: 11px; line-height: 14px; color: var(--t-fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-sel { display: grid; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--t-line); }
.pg-acts { display: grid; grid-template-columns: 32px 32px 1fr 1fr; gap: 6px; }
.pg-acts .t-btn { justify-content: center; padding: 0 10px; }
.pg-acts .t-btn.is-icon { padding: 0; }

.pg-lib { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pg-ph {
  appearance: none; aspect-ratio: 1; border-radius: 8px; border: 0; padding: 0; cursor: pointer; position: relative;
  background: var(--t-fill) center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--t-line);
}
.pg-ph-add { display: grid; place-items: center; font-size: 20px; color: var(--t-fg-2); }
.pg-ph .pg-x {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; padding: 0;
  background: var(--t-fg); color: var(--t-bg); font-size: 11px; line-height: 18px; cursor: pointer; display: none;
}
.pg-ph:hover .pg-x { display: block; }

@media (max-width: 820px) {
  .pg-tools { left: 50%; top: auto; bottom: 10px; transform: translateX(-50%); flex-direction: row; }
  .pg-tool { width: 38px; height: 38px; }
  .pg-tool .pg-k, .pg-tool::after { display: none; }
  .pg-sep { width: 1px; height: auto; margin: 6px 3px; }
  .pg-hint { top: 8px; font-size: 11px; }
}
.pg-sel[hidden] { display: none; }
@media (max-width: 820px) { .t-stage-info { display: none; } }
@media (max-width: 600px) { .pg-hint { display: none; } }
