:root {
  --fondo: #0b1419; --vidrio: rgba(11, 20, 25, .78); --vidrio2: rgba(11, 20, 25, .62); --linea: rgba(255, 255, 255, .12);
  --texto: #e8eef1; --suave: #9fb0b8; --acento: #14d5cf; --rojo: #d6312b; --ambar: #f2a33a;
  --r: 12px; --sombra: 0 8px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--texto);
  font: 14px/1.4 'Outfit', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
#lienzo { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button, select, input { font: inherit; color: inherit; }

/* ---------- CONFIDENCIAL ---------- */
.marca-agua { position: fixed; inset: -50%; z-index: 2; pointer-events: none; transform: rotate(-24deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='200'%3E%3Ctext x='0' y='120' font-family='Arial,Helvetica,sans-serif' font-size='54' font-weight='700' letter-spacing='6' fill='rgba(214,49,43,0.09)' stroke='rgba(255,255,255,0.05)' stroke-width='1'%3ECONFIDENCIAL%3C/text%3E%3C/svg%3E");
  background-repeat: repeat; }
.sello { position: fixed; z-index: 6; top: 14px; right: 74px; pointer-events: none; transform: rotate(-7deg);
  color: #fff; background: rgba(214, 49, 43, .88); border: 3px double rgba(255, 255, 255, .9); border-radius: 6px;
  padding: 6px 14px 5px; font: 800 22px/1 Arial, Helvetica, sans-serif; letter-spacing: .14em; text-align: center; box-shadow: var(--sombra); }
.sello small { display: block; font: 600 10px/1.3 'Outfit', sans-serif; letter-spacing: .08em; margin-top: 3px; text-transform: uppercase; opacity: .95; }

/* ---------- cabecera ---------- */
.cabecera { position: fixed; z-index: 5; top: 12px; left: 12px; max-width: min(560px, calc(100% - 400px)); padding: 12px 16px 12px;
  background: var(--vidrio); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra); }
.marca { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.marca-logo { font-weight: 700; letter-spacing: .06em; font-size: 15px; color: #fff; }
.marca-logo b { color: var(--acento); font-weight: 700; }
.marca-sep { width: 1px; height: 14px; background: var(--linea); }
.marca-sub { color: var(--suave); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.cabecera h1 { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 600; }
.cabecera .meta { margin: 6px 0 0; color: var(--suave); font-size: 12.5px; }
.cabecera .meta b { color: var(--texto); font-weight: 600; }
.lic-sello { display: inline-block; transform: rotate(-3deg); color: #fff; background: rgba(214, 49, 43, .92); border: 2px double rgba(255, 255, 255, .9); border-radius: 4px;
  padding: 1px 8px 0; font: 800 12px/1.5 Arial, Helvetica, sans-serif; letter-spacing: .14em; margin: 0 2px; }

/* ---------- panel ---------- */
.boton-panel { position: fixed; z-index: 7; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--linea);
  background: var(--vidrio); backdrop-filter: blur(10px); cursor: pointer; font-size: 18px; }
.panel { position: fixed; z-index: 5; top: 80px; right: 12px; bottom: calc(var(--atr-h, 30px) + 128px); width: 340px; overflow: auto; padding: 4px 14px 12px;
  background: var(--vidrio); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra);
  scrollbar-width: thin; }
.panel.oculto { display: none; }
.panel section { padding: 8px 0; border-bottom: 1px solid var(--linea); }
.panel section:last-of-type { border-bottom: 0; }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--acento); margin-bottom: 7px; font-weight: 600; }
.botones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.b { border: 1px solid var(--linea); background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; min-height: 32px; }
.b:hover { background: rgba(255, 255, 255, .12); }
.b.on, .b.acento { border-color: var(--acento); background: rgba(20, 213, 207, .16); }
.b.mia { font-size: 12px; }
.fila { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
select { background: rgba(255, 255, 255, .06); border: 1px solid var(--linea); border-radius: 8px; padding: 5px 8px; min-height: 32px; }
select option { background: #13222a; }
input[type=range] { width: 100%; accent-color: var(--acento); }
.etq { color: var(--suave); font-size: 12.5px; }
.pildora { font-size: 11.5px; color: var(--suave); border: 1px solid var(--linea); border-radius: 99px; padding: 2px 8px; }
.capas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.capas .capa { font-size: 12px; min-width: 0; }
.capas .capa span:last-child { line-height: 1.2; }
details summary { cursor: pointer; list-style: none; margin-bottom: 0; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: ' ▾'; }
details[open] summary { margin-bottom: 7px; }
.capa { display: grid; grid-template-columns: 16px 12px 1fr; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.capa .sw { width: 12px; height: 12px; border-radius: 3px; }
.actividad { font-size: 12.5px; color: var(--suave); max-height: 220px; overflow: auto; }
.actividad div { padding: 3px 0; border-bottom: 1px dashed var(--linea); }
.actividad b { color: var(--texto); font-weight: 500; }
.actividad .crit { color: #ff8a80; }
.nota { font-size: 11px; line-height: 1.3; color: var(--suave); margin: 6px 0 0; }

/* ---------- ficha y rótulos ---------- */
.ficha { position: fixed; z-index: 6; left: 12px; bottom: calc(var(--atr-h, 30px) + 128px); width: min(380px, calc(100% - 24px)); padding: 12px 14px;
  background: var(--vidrio); backdrop-filter: blur(10px); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra); font-size: 13px; }
.ficha h3 { margin: 0 24px 4px 0; font-size: 15px; }
.ficha .cat { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; margin-bottom: 6px; color: #0b1419; font-weight: 600; }
.ficha p { margin: 4px 0; color: var(--suave); }
.ficha-cerrar { position: absolute; top: 6px; right: 8px; background: none; border: 0; font-size: 20px; cursor: pointer; }
#rotulos { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.rotulo { position: absolute; transform: translate(-50%, calc(-100% - 8px)); white-space: nowrap; font-size: 12px; padding: 3px 8px; border-radius: 6px;
  background: rgba(11, 20, 25, .86); border: 1px solid rgba(20, 213, 207, .6); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.rotulo::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 1px; height: 7px; background: rgba(20, 213, 207, .8); }
.rotulo.sel { border-color: var(--ambar); }
.leyenda-recorrido { position: fixed; z-index: 6; left: 50%; bottom: calc(var(--atr-h, 30px) + 128px); transform: translateX(-50%); max-width: min(640px, calc(100% - 24px));
  background: var(--vidrio); backdrop-filter: blur(10px); border: 1px solid var(--acento); border-radius: var(--r); padding: 10px 16px; font-size: 14px; text-align: center; }

/* ---------- línea de tiempo ---------- */
.tiempo { position: fixed; z-index: 5; left: 12px; right: 12px; bottom: calc(var(--atr-h, 30px) + 8px); padding: 10px 14px 8px; background: var(--vidrio);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra); }
.tiempo-fila { display: flex; gap: 12px; align-items: center; }
.tiempo-centro { flex: 1; min-width: 0; }
.reproducir { width: 44px; height: 44px; border-radius: 50%; font-size: 16px; flex: none; border-color: var(--acento); }
.fases { display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.fases div { cursor: pointer; font-size: 9.5px; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; color: rgba(255, 255, 255, .92); border-right: 1px solid rgba(0, 0, 0, .25); }
.fases div.act { outline: 2px solid #fff; outline-offset: -2px; }
.tiempo-texto { font-size: 13px; line-height: 1.35; color: var(--suave); margin-top: 2px; max-height: 2.7em; overflow: hidden; overflow-wrap: normal; word-break: normal; hyphens: none; }
.tiempo-texto b { color: var(--texto); font-weight: 600; }

/* ---------- atribuciones (siempre visibles) ---------- */
.atribuciones { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; min-height: 30px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 12px;
  padding: 4px 12px; background: rgba(11, 20, 25, .82); font-size: 11px; color: #c9d4d9; }
.atribuciones img { height: 18px; vertical-align: middle; }
.atribuciones a { color: #c9d4d9; }
.atribuciones .izq { margin-right: auto; color: var(--suave); }
.atribuciones .datos { white-space: normal; }
.atribuciones .terreno-atr { color: #c9d4d9; }

/* ---------- carga ---------- */
.carga { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #13262e, #0b1419 70%); transition: opacity .6s; }
.carga.fuera { opacity: 0; pointer-events: none; }
.carga-caja { display: grid; gap: 14px; justify-items: center; color: var(--suave); }
.carga .marca-logo { font-size: 26px; }
.giro { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--acento); animation: g 1s linear infinite; }
@keyframes g { to { transform: rotate(360deg); } }

/* ---------- móvil ---------- */
@media (max-width: 760px) {
  /* móvil: cabecera compacta (una línea de título + sello y expediente), rótulos pequeños, marca de agua más espaciada */
  .cabecera { max-width: calc(100% - 24px); right: 64px; top: 8px; left: 8px; padding: 7px 10px; }
  .marca { margin-bottom: 2px; } .marca-logo { font-size: 12.5px; }
  .cabecera h1 { font-size: 12.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .cabecera .meta { font-size: 10.5px; margin-top: 3px; }
  .marca-sub { display: none; }
  .cabecera .meta .sep { display: inline; } .cabecera .meta .exp { display: inline; } .cabecera .meta br, .cabecera .meta .org { display: none; }
  .lic-sello { font-size: 9.5px; padding: 0 5px; letter-spacing: .1em; }
  .sello { display: none; }   /* en móvil el sello va dentro de la cabecera, junto al licitador: no tapa la escena */
  .boton-panel { top: 8px; right: 8px; width: 40px; height: 40px; }
  .marca-agua { background-size: 640px 260px; opacity: .9; }
  .rotulo { white-space: normal; max-width: 128px; text-align: center; font-size: 10px; padding: 2px 6px; line-height: 1.2; }
  .panel { top: auto; left: 8px; right: 8px; bottom: calc(var(--atr-h, 30px) + 96px); width: auto; max-height: 52vh; }
  .tiempo { left: 8px; right: 8px; padding: 7px 10px 5px; }
  .reproducir { width: 38px; height: 38px; }
  .tiempo-texto { font-size: 12px; }
  .ficha { bottom: calc(var(--atr-h, 30px) + 96px); left: 8px; }
  .leyenda-recorrido { bottom: calc(var(--atr-h, 30px) + 100px); font-size: 13px; }
  .atribuciones { justify-content: flex-start; font-size: 9.5px; padding: 3px 8px; gap: 2px 8px; }
  .atribuciones .izq { display: none; }
  .atribuciones img { height: 14px; }
}
@media (prefers-reduced-motion: reduce) { .giro { animation: none; } }
