/* Diseñador de Tareas de Fútbol — estilos
 * Todo va dentro de .dtfb-root para no chocar con Astra ni con otros plugins.
 */
.dtfb-root {
  --ink: #0f1a16;
  --ink-2: #1a2925;
  --line: #dce4df;
  --paper: #ffffff;
  --paper-2: #f4f7f4;
  --text: #16241f;
  --muted: #6b7d75;
  --cono: #f2761f;      /* naranja cono: el acento de la herramienta */
  --lima: #bfe14a;      /* lima: acciones que abren algo nuevo */
  --tiza: #2f6fb0;
  --ok: #1f9d5b;
  --danger: #d33b3b;
  --r: 10px;
  /* altura máxima del campo: crece todo lo posible reservando el hueco de la
     barra superior y la de fases, y se ajusta con el factor --zoomlienzo */
  --zoomlienzo: 1;
  --lienzo: calc(min(86vh, calc(100vh - 145px)) * var(--zoomlienzo));
  --shadow: 0 1px 2px rgba(15,26,22,.06), 0 8px 24px rgba(15,26,22,.07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.dtfb-root *, .dtfb-root *::before, .dtfb-root *::after { box-sizing: border-box; }
.dtfb-root :where(button) { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; margin: 0; text-transform: none; letter-spacing: 0; box-shadow: none; }
.dtfb-root :where(button):hover { box-shadow: none; }
.dtfb-root input, .dtfb-root select { font: inherit; color: inherit; margin: 0; }
.dtfb-root h3, .dtfb-root h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.dtfb-root p { margin: 0; }
.dtfb-root ul { margin: 0; padding: 0; list-style: none; }

.dtfb-app {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ---------- cabecera ---------- */
.dtfb-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--ink); color: #eaf2ee;
}
.dtfb-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; }
.dtfb-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--cono); box-shadow: 0 0 0 3px rgba(242,118,31,.25); }
.dtfb-title {
  flex: 1 1 auto; min-width: 90px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #fff; border-radius: 8px; padding: 7px 11px; font-size: 14px; font-weight: 600;
}
.dtfb-title::placeholder { color: rgba(255,255,255,.45); font-weight: 400; }
.dtfb-title:focus { outline: 2px solid var(--cono); outline-offset: 1px; }
.dtfb-acts { display: flex; gap: 6px; flex: 0 0 auto; }

.dtfb-b {
  background: linear-gradient(180deg, #ffffff 0%, #e4eae5 100%);
  border: 1px solid #c1cdc5; border-radius: 8px;
  padding: 7px 11px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(15,26,22,.12);
  transition: transform .06s ease, background .15s ease, box-shadow .1s ease;
}
.dtfb-b:hover { background: linear-gradient(180deg, #ffffff 0%, #dce4de 100%); }
.dtfb-b:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(15,26,22,.2); }
.dtfb-b--go {
  background: linear-gradient(180deg, #ff9152 0%, var(--cono) 100%); border-color: #d9640f; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 2px rgba(0,0,0,.18);
}
.dtfb-b--go:hover { background: linear-gradient(180deg, #ff9d63 0%, #f0700f 100%); }
.dtfb-b--danger {
  background: linear-gradient(180deg, #fff5f5 0%, #ffe3e3 100%); color: var(--danger); border-color: #eab6b6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 1px 2px rgba(15,26,22,.08);
}
.dtfb-b--sm { padding: 5px 9px; font-size: 12px; }
.dtfb-b.is-on {
  background: linear-gradient(180deg, #29a86b 0%, var(--ok) 100%); border-color: #16814f; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 2px rgba(0,0,0,.18);
}
.dtfb-top .dtfb-b {
  background: linear-gradient(180deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.06) 100%);
  border-color: rgba(255,255,255,.22); color: #eaf2ee;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 2px rgba(0,0,0,.22);
}
.dtfb-top .dtfb-b:hover { background: linear-gradient(180deg, rgba(255,255,255,.24) 0%, rgba(255,255,255,.1) 100%); }
.dtfb-top .dtfb-b--go { background: linear-gradient(180deg, #ff9152 0%, var(--cono) 100%); border-color: #d9640f; color: #fff; }
.dtfb-b--only-mobile { display: none; }
.dtfb-top .dtfb-b--limpiar { background: linear-gradient(180deg, #ff9152 0%, var(--cono) 100%); border-color: #d9640f; color: #fff; }
.dtfb-top .dtfb-b--nueva { background: linear-gradient(180deg, #d3ef82 0%, var(--lima) 100%); border-color: #9dbb47; color: #1b2c15; }
.dtfb-top .dtfb-b--limpiar:hover, .dtfb-top .dtfb-b--nueva:hover { filter: brightness(1.06); }

/* ---------- estructura ---------- */
.dtfb-main { display: grid; grid-template-columns: minmax(178px, 1fr) auto minmax(168px, 1fr); gap: 7px; padding: 7px; align-items: start; justify-content: center; }
.dtfb-stage { min-width: 0; }

.dtfb-pal, .dtfb-props {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  max-height: 74vh; overflow: auto; overscroll-behavior: contain;
}
.dtfb-tabs { display: flex; gap: 2px; padding: 6px; position: sticky; top: 0; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 2; flex-wrap: wrap; }
.dtfb-tab {
  flex: 1 1 auto; padding: 6px 4px; border-radius: 7px; font-size: 11.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.dtfb-tab.is-on { background: var(--ink); color: #fff; }
.dtfb-panes { padding: 8px; }

.dtfb-group { margin-bottom: 14px; }
.dtfb-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 7px; }
.dtfb-list { display: flex; flex-wrap: wrap; gap: 5px; }
.dtfb-opt {
  border: 1px solid #c1cdc5; border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(180deg, #ffffff 0%, #e4eae5 100%); display: inline-flex; align-items: center; gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(15,26,22,.1);
  transition: transform .06s ease, background .15s ease, box-shadow .1s ease;
}
.dtfb-opt:hover { background: linear-gradient(180deg, #ffffff 0%, #dce4de 100%); }
.dtfb-opt:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(15,26,22,.18); }
.dtfb-opt.is-on {
  background: linear-gradient(180deg, #16261f 0%, var(--ink) 100%); color: #fff; border-color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 2px rgba(0,0,0,.22);
}
.dtfb-opt--go {
  background: linear-gradient(180deg, #ff9152 0%, var(--cono) 100%); color: #fff; border-color: #d9640f;
  width: 100%; justify-content: center; margin-top: 6px;
}
.dtfb-opt--go:hover { background: linear-gradient(180deg, #ff9d63 0%, #f0700f 100%); }
.dtfb-opt--surf i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }

.dtfb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.dtfb-grid--pat { grid-template-columns: repeat(5, 1fr); }
.dtfb-grid--arr { grid-template-columns: repeat(2, 1fr); }
.dtfb-item {
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2);
  padding: 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dtfb-item svg { width: 100%; height: 38px; display: block; background: #46825c; border-radius: 6px; }
.dtfb-grid--arr .dtfb-item svg, .dtfb-grid--pat .dtfb-item svg { height: 34px; }
.dtfb-item span { font-size: 10px; line-height: 1.15; color: var(--muted); font-weight: 600; text-align: center; }
.dtfb-item.is-on { border-color: var(--cono); box-shadow: 0 0 0 2px rgba(242,118,31,.25); }

.dtfb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.dtfb-lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.dtfb-row select, .dtfb-in {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; background: var(--paper); max-width: 140px;
}
.dtfb-row input[type=range] { width: 130px; accent-color: var(--cono); }
.dtfb-row--col { flex-direction: column; align-items: stretch; gap: 4px; }
.dtfb-ta { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 13px; line-height: 1.4; background: var(--paper); resize: vertical; min-height: 76px; }
.dtfb-ta:focus { outline: 2px solid var(--cono); }
.dtfb-tip .dtfb-b { margin-top: 4px; }
.dtfb-sw { display: flex; flex-wrap: wrap; gap: 4px; }
.dtfb-pair { display: inline-flex; gap: 4px; }
.dtfb-pair .dtfb-b { min-width: 34px; font-size: 15px; line-height: 1; padding: 6px 0; text-align: center; }
.dtfb-chip { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(0,0,0,.22); padding: 0; }
.dtfb-chip.is-on { box-shadow: 0 0 0 2px var(--ink); }
.dtfb-chip--custom { position: relative; overflow: hidden; background: conic-gradient(#e11d2e,#ffd400,#22c55e,#1f4fd8,#e11d2e); }
.dtfb-chip--custom input { position: absolute; inset: -6px; opacity: 0; width: 200%; height: 200%; cursor: pointer; }
.dtfb-sw2 { position: relative; display: inline-block; width: 40px; height: 22px; }
.dtfb-sw2 input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.dtfb-sw2 span { position: absolute; inset: 0; background: #cdd7d1; border-radius: 999px; transition: background .15s; }
.dtfb-sw2 span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.dtfb-sw2 input:checked + span { background: var(--ok); }
.dtfb-sw2 input:checked + span::after { transform: translateX(18px); }
.dtfb-tip { font-size: 11.5px; color: var(--muted); margin-top: 7px; line-height: 1.4; }

/* ---------- campo ---------- */
.dtfb-stage { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* El lienzo mantiene la proporción 3:2 pero no pasa de una altura máxima, para que
   la barra de fases y el botón de animar queden siempre a la vista sin desplazar. */
.dtfb-canvas-wrap {
  position: relative; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
  background: #2f6b45; width: min(100%, calc(var(--lienzo) * 1.5)); margin: 0 auto; max-width: 100%;
}
.dtfb-canvas { display: block; width: 100%; height: auto; touch-action: none; -webkit-user-select: none; user-select: none; }
.dtfb-stage.is-placing .dtfb-canvas { cursor: crosshair; }
.dtfb-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%) translateY(6px);
  background: rgba(15,26,22,.86); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; opacity: 0; transition: .18s; pointer-events: none;
}
.dtfb-hint.is-on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; cursor: pointer; }
.dtfb-hint b { color: var(--cono); }

.dtfb-scenes { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 8px; }
.dtfb-scene-list { display: flex; gap: 4px; flex-wrap: wrap; }
.dtfb-scene {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid #c1cdc5;
  background: linear-gradient(180deg, #ffffff 0%, #e4eae5 100%); font-weight: 700; font-size: 12.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(15,26,22,.1);
}
.dtfb-scene:hover { background: linear-gradient(180deg, #ffffff 0%, #dce4de 100%); }
.dtfb-scene.is-on {
  background: linear-gradient(180deg, #16261f 0%, var(--ink) 100%); color: #fff; border-color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 2px rgba(0,0,0,.22);
}
.dtfb-scene-acts { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.dtfb-vel { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dtfb-vel select { border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font-size: 12px;
  background: var(--paper); text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 600; }

/* ---------- propiedades ---------- */
.dtfb-props { padding: 8px; }
.dtfb-props-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 13px; }
.dtfb-props-acts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.dtfb-x { font-size: 20px; line-height: 1; color: var(--muted); padding: 0 4px; }
.dtfb-empty { color: var(--muted); font-size: 12.5px; }
.dtfb-empty strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }

/* ---------- ficha de texto ---------- */
.dtfb-doc { background: var(--paper); border-top: 1px solid var(--line); padding: 14px; }
.dtfb-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dtfb-doc-head h3 { font-size: 14px; }
.dtfb-doc-acts { display: flex; gap: 5px; flex-wrap: wrap; }
.dtfb-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.dtfb-f { display: flex; flex-direction: column; gap: 3px; }
.dtfb-f span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dtfb-f input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: var(--paper-2); width: 100%; }
.dtfb-f input:focus, .dtfb-in:focus, .dtfb-row select:focus { outline: 2px solid var(--cono); outline-offset: 0; }

.dtfb-editor-bar { display: flex; flex-wrap: wrap; gap: 3px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; padding: 5px; background: var(--paper-2); }
.dtfb-eb {
  padding: 5px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text);
  border: 1px solid #c1cdc5; background: linear-gradient(180deg, #ffffff 0%, #e4eae5 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 1px rgba(15,26,22,.08);
}
.dtfb-eb:hover { background: linear-gradient(180deg, #ffffff 0%, #dce4de 100%); }
.dtfb-eb:active { transform: translateY(1px); }
.dtfb-editor {
  border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); padding: 14px 16px;
  min-height: 180px; background: var(--paper); font-size: 15px; line-height: 1.65; outline: none;
}
.dtfb-editor:empty::before { content: attr(data-ph); color: #9aaaa2; }
.dtfb-editor:focus { border-color: var(--cono); }
.dtfb-editor h2 { font-size: 19px; margin: 14px 0 6px; }
.dtfb-editor h3 { font-size: 16px; margin: 12px 0 4px; }
.dtfb-editor ul, .dtfb-editor ol { padding-left: 22px; margin: 6px 0; list-style: revert; }
.dtfb-editor li { list-style: inherit; }

/* ---------- logos ---------- */
.dtfb-logos { display: flex; flex-direction: column; gap: 6px; }
.dtfb-logo { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 6px; background: var(--paper-2); }
.dtfb-logo img { width: 46px; height: 46px; object-fit: contain; background: #46825c; border-radius: 6px; flex: 0 0 auto; }
.dtfb-logo-b { display: flex; gap: 4px; flex-wrap: wrap; }
.dtfb-logo.is-sel { border-color: var(--cono); box-shadow: 0 0 0 2px rgba(242,118,31,.22); }
.dtfb-opt input[type=file] { display: none; }

/* ---------- avisos y modal ---------- */
.dtfb-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 999999;
}
.dtfb-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.dtfb-modal { position: fixed; inset: 0; background: rgba(11,20,17,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 999998; }
.dtfb-modal[hidden] { display: none; }
.dtfb-modal-in { background: var(--paper); border-radius: 14px; padding: 18px; width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; position: relative; }
.dtfb-modal-in h3 { font-size: 17px; margin-bottom: 4px; }
.dtfb-modal-in h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 16px 0 7px; }
.dtfb-modal-in .dtfb-x { position: absolute; top: 10px; right: 12px; }
.dtfb-modal-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.dtfb-modal-acts .dtfb-b { cursor: pointer; }
.dtfb-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.dtfb-campos select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: var(--paper-2); width: 100%; }
.dtfb-camz, .dtfb-camzf, .dtfb-camg { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 62px; text-align: right; }
.dtfb-lib { margin-top: 10px; }
.dtfb-lib li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dtfb-lib strong { display: block; font-size: 13.5px; }
.dtfb-lib em { font-size: 11.5px; color: var(--muted); font-style: normal; }

/* ---------- móvil ---------- */
@media (max-width: 980px) {
  .dtfb-main { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .dtfb-root { --lienzo: 200vh; }
  .dtfb-stage { order: 1; }
  .dtfb-props { order: 2; max-height: none; }
  .dtfb-props:not(.is-on) { display: none; }
  .dtfb-pal { order: 3; max-height: 46vh; }
  .dtfb-b--only-mobile { display: inline-block; }
  .dtfb-brand span:not(.dtfb-dot) { display: none; }
  .dtfb-brand { font-size: 0; }
  .dtfb-doc { display: none; }
  .dtfb-doc.is-open { display: block; }
  .dtfb-grid { grid-template-columns: repeat(4, 1fr); }
  .dtfb-item svg { height: 42px; }
  .dtfb-tab { font-size: 11px; padding: 8px 4px; }
  .dtfb-chip { width: 26px; height: 26px; }
  .dtfb-scene { width: 34px; height: 34px; }
  .dtfb-b { padding: 8px 11px; }
}
@media (max-width: 520px) {
  .dtfb-grid { grid-template-columns: repeat(3, 1fr); }
  .dtfb-grid--pat { grid-template-columns: repeat(5, 1fr); }
  .dtfb-grid--arr { grid-template-columns: repeat(2, 1fr); }
  .dtfb-title { font-size: 13px; }
  .dtfb-acts .dtfb-b { padding: 8px 9px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .dtfb-root *, .dtfb-root *::before { transition: none !important; }
}

/* ---------- ampliar o reducir la zona de trabajo ---------- */
.dtfb-tam { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.dtfb-tam .dtfb-b { min-width: 30px; padding: 4px 0; text-align: center; font-size: 15px; line-height: 1; }
.dtfb-tam span { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 40px; text-align: center; }

/* ---------- pantalla completa ---------- */
.dtfb-app.dtfb-full {
  position: fixed; inset: 0; z-index: 999990; border-radius: 0; border: 0;
  overflow: auto; background: var(--paper-2);
  --lienzo: calc(100vh - 118px);
}
.dtfb-app.dtfb-full .dtfb-doc { display: none; }
.dtfb-app.dtfb-full .dtfb-pal, .dtfb-app.dtfb-full .dtfb-props { max-height: calc(100vh - 130px); }

/* fase con parada para leer */
.dtfb-scene.tiene-pausa { position: relative; }
.dtfb-scene.tiene-pausa::after {
  content: ""; position: absolute; right: 3px; bottom: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--cono);
  box-shadow: 0 0 0 1.5px var(--paper);
}

/* distintivo de edición junto a la marca */
.dtfb-ed { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: var(--cono); color: #fff; padding: 2px 6px; border-radius: 5px; margin-left: 2px; }
