/* Diseñador: usa la base del editor (colores, botones, paneles) y agrega su propia distribución:
   controles a la izquierda · vista previa y trucos a la derecha; en pantallas chicas se apilan. */
.d-layout {
  flex: 1; display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}
.controls { max-height: calc(100vh - 100px); position: sticky; top: 14px; }
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.small { font-size: .85rem; margin: 0 0 8px; }
.help { margin: 0; }

.sel { display: inline-flex; align-items: center; gap: 6px; }
.sel select { background: transparent; border: 0; padding: 0; }
.sel select option { background: var(--surface); }

.field { display: grid; gap: 4px; margin: 0 0 10px; font-size: .9rem; }
.field input[type=text], .field select, .trick input, .trick select, .trick textarea, .check select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%;
}
.check select { width: auto; }
.name input { font-family: var(--font-display); font-size: 1.05rem; }

details.sec { border-top: 1px solid var(--line); padding: 4px 0; }
details.sec summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; padding: 8px 0; list-style: none; display: flex; justify-content: space-between; }
details.sec summary::after { content: "▾"; color: var(--muted); }
details.sec:not([open]) summary::after { content: "▸"; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin: 4px 0 10px; font-size: .88rem; }
.row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--eye); }
.row output { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.row.color { grid-template-columns: 1fr auto; }
.row input[type=color] { width: 42px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.row .opt { display: flex; gap: 8px; align-items: center; }
.row select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }

.preview-card {
  display: grid; gap: 10px; justify-items: center; background: radial-gradient(circle at 50% 40%, #1d232b, #0b0d10 70%);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
}
#vista { width: min(100%, 440px); aspect-ratio: 440 / 380; }
.bar-preview { display: flex; gap: 10px; align-items: center; font-size: .8rem; flex-wrap: wrap; justify-content: center; }
.fake-bar { display: flex; align-items: center; gap: 6px; background: rgba(20, 24, 29, .85); border: 1px solid #2a313a; border-radius: 12px; padding: 2px 12px 2px 6px; color: #e9eef2; }
.fake-bar canvas { width: 32px; height: 28px; }
.fake-track { font-size: .78rem; opacity: .8; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.chips button { padding: 5px 10px; font-size: .85rem; }
.chips button.active { background: var(--eye); color: var(--eye-ink); border-color: var(--eye); }

.trick { display: grid; grid-template-columns: 1fr 1fr 80px auto; gap: 6px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line); }
.trick label { display: grid; gap: 2px; font-size: .78rem; color: var(--muted); }
.trick .phr { grid-column: 1 / -1; }
.trick textarea { resize: vertical; min-height: 36px; }

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--surface); border: 1px solid var(--eye); border-radius: 10px; padding: 8px 14px; transition: .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 820px) {
  .d-layout { grid-template-columns: minmax(0, 1fr); }
  .controls { position: static; max-height: none; order: 2; }
  .trick { grid-template-columns: 1fr 1fr; }
}

.how { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: .86rem; }
.how summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; }
.how ol { margin: 6px 0; padding-left: 18px; display: grid; gap: 4px; }
.how p { margin: 6px 0 2px; color: var(--muted); }
.how a { color: var(--eye); }

/* Armario */
.ward .tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ward .tabs button { padding: 4px 9px; font-size: .82rem; border-radius: 999px; }
.ward .tabs button.active { background: var(--eye); color: var(--eye-ink); border-color: var(--eye); }
.ward-target { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; margin-bottom: 6px; }
.ward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.ward-item { display: grid; gap: 2px; justify-items: center; padding: 4px; border-radius: 10px; background: #0b0d10; font-size: .72rem; white-space: normal; line-height: 1.15; }
.ward-item canvas { width: 64px; height: 55px; }
.ward-item span { color: #c9d1dc; text-align: center; }
.ward-item.active { border-color: var(--eye); box-shadow: 0 0 0 1px var(--eye) inset; }
.mine-actions, .mine-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.mine-list { flex-direction: column; }
.mine-list div { display: flex; gap: 6px; align-items: center; }
.mine-list span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mine-list button { padding: 2px 8px; }
.worn { margin-top: 10px; }
.panel-sub { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
.worn-item { border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; margin-bottom: 6px; }
.worn-item summary { cursor: pointer; padding: 4px 0; font-weight: 700; font-size: .9rem; }
.worn-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: .82rem; padding-bottom: 6px; }
.worn-opts select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.worn-opts input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; }

/* Taller de piezas */
.workshop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.ws-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: min(900px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.ws-head, .ws-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.ws-head { border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 1.1rem; }
.ws-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.ws-body { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 14px; padding: 14px; overflow: auto; }
.ws-group { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.ws-right { display: grid; justify-items: center; align-content: start; gap: 6px; }
.ws-canvas { width: min(100%, 420px); aspect-ratio: 1; border-radius: 12px; touch-action: none; cursor: crosshair; border: 1px solid var(--line); }
.ws-colors { align-items: center; }
.ws-colors .swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); padding: 0; font-size: .8rem; }
.ws-colors .swatch.active { border-color: var(--fg); transform: scale(1.1); }
.ws-colors input[type=color] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.ws-left .check { margin: 3px 0; font-size: .86rem; }
.ws-pixel { display: inline-block; margin-top: 6px; }
@media (max-width: 720px) { .ws-body { grid-template-columns: minmax(0, 1fr); } .ws-right { order: -1; } }
.when { border-top: 1px dashed var(--line); padding: 6px 0; font-size: .82rem; display: grid; gap: 6px; }
.when select, .when textarea, .when input[type=number] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; color: inherit; }
.when textarea { width: 100%; }
.when .chips { gap: 4px 10px; margin: 0; }
