/* Layer Studio panel — token fallbacks so it works even if the design-system
 * variables aren't present (defensive, like the panel JS). */
.ly-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 96vw);
  background: var(--surface-2, #0e0e12);
  border-left: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 9000;
  display: flex; flex-direction: column;
  color: var(--t1, #f2f2f5);
}
.ly-panel.open { transform: translateX(0); }
.ly-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.ly-title { font-weight: 700; font-size: 14px; }
.ly-sub { font-weight: 500; font-size: 11px; color: var(--accent); margin-left: 6px; }
.ly-x { background: none; border: none; color: var(--t2, #b4b4bd); font-size: 24px; line-height: 1; cursor: pointer; }
.ly-x:hover { color: var(--t1, #fff); }
.ly-body { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

.ly-src { display: flex; gap: 8px; }
.ly-input {
  background: var(--surface-1, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
  border-radius: 8px; color: var(--t1, #f2f2f5);
  padding: 7px 10px; font-size: 13px; flex: 1; min-width: 0;
}
/* Keep the native selected-text line clear of vertical padding. */
.ly-panel select.ly-input { padding-block: 0; }
.ly-ta { width: 100%; resize: vertical; font-family: inherit; }

.ly-btn {
  background: var(--surface-1, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
  border-radius: 8px; color: var(--t1, #f2f2f5);
  padding: 7px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.ly-btn:hover { background: var(--surface-2, rgba(255, 255, 255, 0.1)); }
.ly-btn-sm { padding: 4px 10px; font-size: 12px; }
.ly-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ly-btn-primary:hover { filter: brightness(1.08); }

.ly-stage-wrap { display: flex; justify-content: center; }
.ly-stage {
  width: 100%; min-height: 200px;
  background: repeating-conic-gradient(#1a1a20 0 25%, #141418 0 50%) 50% / 22px 22px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 10px;
}
.ly-empty, .ly-hint { color: var(--t3, #8a8a93); font-size: 12px; text-align: center; }
.ly-holder { position: relative; max-width: 100%; }
.ly-bg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.ly-ov {
  position: absolute; cursor: grab; user-select: none; white-space: nowrap;
  font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  padding: 1px 2px; border: 1px dashed transparent; touch-action: none;
}
.ly-ov:hover { border-color: var(--accent); }

.ly-row-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--t2, #b4b4bd); }
.ly-list { display: flex; flex-direction: column; gap: 6px; }
.ly-lrow { display: flex; gap: 6px; align-items: center; }
.ly-l-text { flex: 1; }
.ly-l-size { width: 64px; flex: none; }
.ly-l-color { width: 34px; height: 32px; padding: 0; border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1)); border-radius: 8px; background: none; cursor: pointer; }
.ly-del { background: none; border: none; color: var(--t3, #8a8a93); font-size: 20px; cursor: pointer; }
.ly-del:hover { color: var(--danger); }

.ly-variants summary { font-size: 12px; color: var(--t2, #b4b4bd); cursor: pointer; margin-bottom: 8px; }
.ly-variants { display: flex; flex-direction: column; }
.ly-variants > *:not(summary) { margin-bottom: 8px; }

.ly-actions { display: flex; gap: 8px; }
.ly-actions .ly-btn { flex: 1; }

.ly-out { min-height: 10px; }
.ly-result { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ly-result img { max-width: 100%; border-radius: 8px; border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1)); }
.ly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.ly-cell { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.ly-cell img { width: 100%; border-radius: 6px; border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1)); }
.ly-cell a { color: var(--accent); text-decoration: none; }
.ly-cell-err { color: var(--danger); padding: 8px; border: 1px solid var(--danger); border-radius: 6px; }
.ly-err { color: var(--danger); font-size: 12px; }
/* Named documents: bounded controls; visual pixels come from server preview. */
.ly-document-actions { display:flex; gap:6px; flex-wrap:wrap; }
.ly-body { min-height:0; flex:1; }
.ly-body > *, .ly-head { flex-shrink:0; }
#ly-editor { border:0; padding:0; margin:0; display:flex; flex-direction:column; gap:12px; min-width:0; }
#ly-editor label { display:flex; flex-direction:column; gap:4px; font-size:12px; }
.ly-panel button { cursor:pointer; border:1px solid var(--glass-border,#555); border-radius:6px; padding:6px 9px; color:inherit; background:var(--surface-1,#222); }
.ly-panel button:disabled { opacity:.45; cursor:default; }
#ly-status { font-size:12px; white-space:normal; overflow-wrap:anywhere; }
#ly-saved-list { display:flex; flex-direction:column; gap:5px; max-height:180px; overflow:auto; }
#ly-saved-list[hidden] { display:none; }
.ly-lrow { flex-wrap:wrap; border:1px solid var(--glass-border,#555); border-radius:6px; padding:6px; }
.ly-lrow input[type=number] { width:64px; }
.ly-lrow span { overflow-wrap:anywhere; max-width:100%; }
.ly-ov { font-size:0; padding:0; border:1px dashed #a0a0a0; background:transparent; box-sizing:border-box; }
.ly-src { flex-wrap:wrap; }
@media(max-width:480px) {
  .ly-body { padding:10px; }
  .ly-panel { width:98vw; }
  .ly-panel select.ly-input { min-height:44px; }
}

/* Palette controls remain scoped to this explicit one-layer action. */
#ly-pal-controls { border:0; padding:0; margin:0; min-width:0; display:grid; gap:10px; }
#ly-pal-controls label { display:grid; gap:5px; min-width:0; font-size:12px; }
#ly-pal-controls .ly-input { width:100%; max-width:100%; min-width:0; box-sizing:border-box; }
#ly-pal-controls button { max-width:100%; white-space:normal; overflow-wrap:anywhere; justify-self:start; }
#ly-pal-controls p { margin:0; }
